diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index e8cfcd4788..35ec32e544 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -1,5 +1,5 @@ # GitHub action to build LAMMPS on Windows with Visual C++ -name: "Native Windows Compilation" +name: "Native Windows Compilation and Unit Tests" on: push: @@ -17,13 +17,21 @@ jobs: with: fetch-depth: 2 + - name: Select Python version + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Building LAMMPS via CMake shell: bash run: | + python3 -m pip install numpy cmake -C cmake/presets/windows.cmake \ + -D PKG_PYTHON=on \ -S cmake -B build \ -D BUILD_SHARED_LIBS=on \ - -D LAMMPS_EXCEPTIONS=on + -D LAMMPS_EXCEPTIONS=on \ + -D ENABLE_TESTING=on cmake --build build --config Release - name: Run LAMMPS executable @@ -31,3 +39,8 @@ jobs: run: | ./build/Release/lmp.exe -h ./build/Release/lmp.exe -in bench/in.lj + + - name: Run Unit Tests + working-directory: build + shell: bash + run: ctest -V -C Release diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b5f8db93d2..cc3843b4ef 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -19,6 +19,9 @@ set(SOVERSION 0) get_filename_component(LAMMPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE) get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE) +# collect all executables and shared libs in the top level build folder +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(LAMMPS_SOURCE_DIR ${LAMMPS_DIR}/src) set(LAMMPS_LIB_SOURCE_DIR ${LAMMPS_DIR}/lib) @@ -281,35 +284,19 @@ if(BUILD_MPI) # We use a non-standard procedure to cross-compile with MPI on Windows if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) include(MPI4WIN) - target_link_libraries(lammps PUBLIC MPI::MPI_CXX) else() find_package(MPI REQUIRED) - target_link_libraries(lammps PUBLIC MPI::MPI_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) endif() endif() + target_link_libraries(lammps PUBLIC MPI::MPI_CXX) else() - file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.cpp) - add_library(mpi_stubs STATIC ${MPI_SOURCES}) - set_target_properties(mpi_stubs PROPERTIES OUTPUT_NAME lammps_mpi_stubs${LAMMPS_MACHINE}) - target_include_directories(mpi_stubs PUBLIC $) - if(BUILD_SHARED_LIBS) - target_link_libraries(lammps PRIVATE mpi_stubs) - if(MSVC) - target_link_libraries(lmp PRIVATE mpi_stubs) - target_include_directories(lmp INTERFACE $) - target_compile_definitions(lmp INTERFACE $) - endif() - target_include_directories(lammps INTERFACE $) - target_compile_definitions(lammps INTERFACE $) - else() - target_include_directories(lammps INTERFACE $) - target_compile_definitions(lammps INTERFACE $) - target_link_libraries(lammps PUBLIC mpi_stubs) - endif() - add_library(MPI::MPI_CXX ALIAS mpi_stubs) + target_sources(lammps PRIVATE ${LAMMPS_SOURCE_DIR}/STUBS/mpi.cpp) + add_library(mpi_stubs INTERFACE) + target_include_directories(mpi_stubs INTERFACE $) + target_link_libraries(lammps PUBLIC mpi_stubs) endif() set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)") @@ -373,11 +360,13 @@ if(BUILD_OMP) ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. # Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe. - target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=4) + set(LAMMPS_OMP_COMPAT_LEVEL 4) else() - target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=3) + set(LAMMPS_OMP_COMPAT_LEVEL 3) endif() + target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=${LAMMPS_OMP_COMPAT_LEVEL}) target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX) + target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE) @@ -591,11 +580,10 @@ if(PKG_ATC) if(LAMMPS_SIZES STREQUAL "BIGBIG") message(FATAL_ERROR "The ATC Package is not compatible with -DLAMMPS_BIGBIG") endif() - target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES}) if(BUILD_MPI) - target_link_libraries(atc PRIVATE MPI::MPI_CXX) + target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES} MPI::MPI_CXX) else() - target_link_libraries(atc PRIVATE mpi_stubs) + target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES} mpi_stubs) endif() target_include_directories(atc PRIVATE ${LAMMPS_SOURCE_DIR}) target_compile_definitions(atc PRIVATE -DLAMMPS_${LAMMPS_SIZES}) @@ -691,6 +679,7 @@ endif() set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) +set_target_properties(lammps PROPERTIES PREFIX "lib") target_include_directories(lammps PUBLIC $) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps) foreach(_HEADER ${LAMMPS_CXX_HEADERS}) @@ -710,6 +699,9 @@ foreach(_DEF ${LAMMPS_DEFINES}) endforeach() if(BUILD_SHARED_LIBS) install(TARGETS lammps EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if(NOT BUILD_MPI) + install(TARGETS mpi_stubs EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(EXPORT LAMMPS_Targets FILE LAMMPS_Targets.cmake NAMESPACE LAMMPS:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS) @@ -749,7 +741,7 @@ install( if(BUILD_SHARED_LIBS) if(CMAKE_VERSION VERSION_LESS 3.12) # adjust so we find Python 3 versions before Python 2 on old systems with old CMake - set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5) + set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) find_package(PythonInterp) # Deprecated since version 3.12 if(PYTHONINTERP_FOUND) set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) diff --git a/cmake/CMakeSettings.json b/cmake/CMakeSettings.json index ee4b3c46d5..9320341ec4 100644 --- a/cmake/CMakeSettings.json +++ b/cmake/CMakeSettings.json @@ -6,7 +6,7 @@ "configurationType": "Debug", "buildRoot": "${workspaceRoot}\\build\\${name}", "installRoot": "${workspaceRoot}\\install\\${name}", - "cmakeCommandArgs": "-S ${workspaceRoot}\\cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DENABLE_TESTING=on", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], @@ -25,6 +25,54 @@ "name": "LAMMPS_EXCEPTIONS", "value": "True", "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" + } + ] + }, + { + "name": "x64-Release-MSVC", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" } ] }, @@ -34,11 +82,16 @@ "configurationType": "Debug", "buildRoot": "${workspaceRoot}\\build\\${name}", "installRoot": "${workspaceRoot}\\install\\${name}", - "cmakeCommandArgs": "-S ${workspaceRoot}\\cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DENABLE_TESTING=on", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "clang_cl_x64" ], "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, { "name": "BUILD_TOOLS", "value": "True", @@ -48,6 +101,16 @@ "name": "LAMMPS_EXCEPTIONS", "value": "True", "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" } ] }, @@ -57,7 +120,7 @@ "configurationType": "Debug", "buildRoot": "${workspaceRoot}\\build\\${name}", "installRoot": "${workspaceRoot}\\install\\${name}", - "cmakeCommandArgs": "-S ${workspaceRoot}\\cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DENABLE_TESTING=on -DCMAKE_CXX_COMPILER=icx -DCMAKE_C_COMPILER=icx -DBUILD_MPI=off", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_CXX_COMPILER=icx -DCMAKE_C_COMPILER=icx", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], @@ -76,6 +139,21 @@ "name": "LAMMPS_EXCEPTIONS", "value": "True", "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_MPI", + "value": "False", + "type": "BOOL" } ] }, @@ -85,7 +163,7 @@ "configurationType": "Debug", "buildRoot": "${workspaceRoot}\\build\\${name}", "installRoot": "${workspaceRoot}\\install\\${name}", - "cmakeCommandArgs": "-S ${workspaceRoot}\\cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DENABLE_TESTING=off -DCMAKE_CXX_COMPILER=icl -DCMAKE_C_COMPILER=icl -DCMAKE_Fortran_COMPILER=ifort -DBUILD_MPI=off", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_CXX_COMPILER=icl -DCMAKE_C_COMPILER=icl -DCMAKE_Fortran_COMPILER=ifort", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], @@ -104,8 +182,23 @@ "name": "LAMMPS_EXCEPTIONS", "value": "True", "type": "BOOL" + }, + { + "name": "PKG_PYTHON", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "False", + "type": "BOOL" + }, + { + "name": "BUILD_MPI", + "value": "False", + "type": "BOOL" } ] } ] -} \ No newline at end of file +} diff --git a/cmake/Modules/FindCythonize.cmake b/cmake/Modules/FindCythonize.cmake index 9a37904ea7..2a4cc753e8 100644 --- a/cmake/Modules/FindCythonize.cmake +++ b/cmake/Modules/FindCythonize.cmake @@ -8,18 +8,19 @@ #============================================================================= if(CMAKE_VERSION VERSION_LESS 3.12) + set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12 if(PYTHONINTERP_FOUND) - set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) endif() else() - find_package(Python3 3.6 COMPONENTS Interpreter QUIET) + find_package(Python 3.6 COMPONENTS Interpreter QUIET) endif() # Use the Cython executable that lives next to the Python executable # if it is a local installation. -if(Python3_EXECUTABLE) - get_filename_component(_python_path ${Python3_EXECUTABLE} PATH) +if(Python_EXECUTABLE) + get_filename_component(_python_path ${Python_EXECUTABLE} PATH) find_program(Cythonize_EXECUTABLE NAMES cythonize3 cythonize cythonize.bat HINTS ${_python_path}) diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake index 3a8e63b213..23ca81a5f2 100644 --- a/cmake/Modules/OpenCLLoader.cmake +++ b/cmake/Modules/OpenCLLoader.cmake @@ -1,50 +1,11 @@ message(STATUS "Downloading and building OpenCL loader library") -set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.09.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball") -set(OPENCL_LOADER_MD5 "3b3882627964bd02e5c3b02065daac3c" CACHE STRING "MD5 checksum of OpenCL loader tarball") +set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2022.01.04.tar.gz" CACHE STRING "URL for OpenCL loader tarball") +set(OPENCL_LOADER_MD5 "8d3a801e87a2c6653bf0e27707063914" CACHE STRING "MD5 checksum of OpenCL loader tarball") mark_as_advanced(OPENCL_LOADER_URL) mark_as_advanced(OPENCL_LOADER_MD5) -include(ExternalProject) -ExternalProject_Add(opencl_loader - URL ${OPENCL_LOADER_URL} - URL_MD5 ${OPENCL_LOADER_MD5} - SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src" - BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build" - CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_INSTALL_PREFIX= - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - BUILD_BYPRODUCTS /libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX} - LOG_DOWNLOAD ON - LOG_CONFIGURE ON - LOG_BUILD ON - INSTALL_COMMAND "" - TEST_COMMAND "") - -ExternalProject_Get_Property(opencl_loader SOURCE_DIR) -set(OPENCL_LOADER_INCLUDE_DIR ${SOURCE_DIR}/inc) - -# workaround for CMake 3.10 on ubuntu 18.04 -file(MAKE_DIRECTORY ${OPENCL_LOADER_INCLUDE_DIR}) - -ExternalProject_Get_Property(opencl_loader BINARY_DIR) -set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX}") - -find_package(Threads QUIET) -if(NOT WIN32) - set(OPENCL_LOADER_DEP_LIBS "Threads::Threads;${CMAKE_DL_LIBS}") -else() - set(OPENCL_LOADER_DEP_LIBS "cfgmgr32;runtimeobject") -endif() - -add_library(OpenCL::OpenCL UNKNOWN IMPORTED) -add_dependencies(OpenCL::OpenCL opencl_loader) - -set_target_properties(OpenCL::OpenCL PROPERTIES - IMPORTED_LOCATION ${OPENCL_LOADER_LIBRARY_PATH} - INTERFACE_INCLUDE_DIRECTORIES ${OPENCL_LOADER_INCLUDE_DIR} - INTERFACE_LINK_LIBRARIES "${OPENCL_LOADER_DEP_LIBS}") - +set(INSTALL_LIBOPENCL OFF CACHE BOOL "" FORCE) +include(ExternalCMakeProject) +ExternalCMakeProject(opencl_loader ${OPENCL_LOADER_URL} ${OPENCL_LOADER_MD5} opencl-loader . "") +add_library(OpenCL::OpenCL ALIAS OpenCL) diff --git a/cmake/Modules/Packages/COMPRESS.cmake b/cmake/Modules/Packages/COMPRESS.cmake index 887dfb88a6..bdcf1aa3f8 100644 --- a/cmake/Modules/Packages/COMPRESS.cmake +++ b/cmake/Modules/Packages/COMPRESS.cmake @@ -1,10 +1,11 @@ find_package(ZLIB REQUIRED) target_link_libraries(lammps PRIVATE ZLIB::ZLIB) -find_package(PkgConfig REQUIRED) -pkg_check_modules(Zstd IMPORTED_TARGET libzstd>=1.4) - -if(Zstd_FOUND) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(Zstd IMPORTED_TARGET libzstd>=1.4) + if(Zstd_FOUND) target_compile_definitions(lammps PRIVATE -DLAMMPS_ZSTD) target_link_libraries(lammps PRIVATE PkgConfig::Zstd) + endif() endif() diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 048c0ed473..fe15917f47 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -422,13 +422,12 @@ RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES) RegisterFixStyle(${GPU_SOURCES_DIR}/fix_gpu.h) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) - -if(NOT BUILD_MPI) - # mpistubs is aliased to MPI::MPI_CXX, but older versions of cmake won't work forward the include path - target_link_libraries(gpu PRIVATE mpi_stubs) -else() +if(BUILD_MPI) target_link_libraries(gpu PRIVATE MPI::MPI_CXX) +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_sources(lammps PRIVATE ${GPU_SOURCES}) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 25211268e9..4e35e6dcc0 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -11,8 +11,14 @@ if(Kokkos_ENABLE_CUDA) endif() # Adding OpenMP compiler flags without the checks done for # BUILD_OMP can result in compile failures. Enforce consistency. -if(Kokkos_ENABLE_OPENMP AND NOT BUILD_OMP) - message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP") +if(Kokkos_ENABLE_OPENMP) + if(NOT BUILD_OMP) + message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP") + else() + if(LAMMPS_OMP_COMPAT_LEVEL LESS 4) + message(FATAL_ERROR "Compiler must support OpenMP 4.0 or later with Kokkos_ENABLE_OPENMP") + endif() + endif() endif() ######################################################################## @@ -27,6 +33,8 @@ if(DOWNLOAD_KOKKOS) endforeach() message(STATUS "KOKKOS download requested - we will build our own") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_INSTALL_PREFIX=") + # build KOKKOS downloaded libraries as static libraries but with PIC, if needed + list(APPEND KOKKOS_LIB_BUILD_ARGS "-DBUILD_SHARED_LIBS=OFF") if(CMAKE_REQUEST_PIC) list(APPEND KOKKOS_LIB_BUILD_ARGS ${CMAKE_REQUEST_PIC}) endif() @@ -47,18 +55,22 @@ if(DOWNLOAD_KOKKOS) URL ${KOKKOS_URL} URL_MD5 ${KOKKOS_MD5} CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS} - BUILD_BYPRODUCTS /lib/libkokkoscore.a + BUILD_BYPRODUCTS /lib/libkokkoscore.a /lib/libkokkoscontainers.a ) ExternalProject_get_property(kokkos_build INSTALL_DIR) file(MAKE_DIRECTORY ${INSTALL_DIR}/include) - add_library(LAMMPS::KOKKOS UNKNOWN IMPORTED) - set_target_properties(LAMMPS::KOKKOS PROPERTIES + add_library(LAMMPS::KOKKOSCORE UNKNOWN IMPORTED) + add_library(LAMMPS::KOKKOSCONTAINERS UNKNOWN IMPORTED) + set_target_properties(LAMMPS::KOKKOSCORE PROPERTIES IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscore.a" INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include" INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) - target_link_libraries(lammps PRIVATE LAMMPS::KOKKOS) - target_link_libraries(lmp PRIVATE LAMMPS::KOKKOS) - add_dependencies(LAMMPS::KOKKOS kokkos_build) + set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES + IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a") + target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS) + target_link_libraries(lmp PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS) + add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) + add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) find_package(Kokkos 3.5.00 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) @@ -66,8 +78,17 @@ elseif(EXTERNAL_KOKKOS) else() set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) + # build KOKKOS internal libraries as static libraries but with PIC, if needed + if(BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS_WAS_ON YES) + set(BUILD_SHARED_LIBS OFF) + endif() + if(CMAKE_REQUEST_PIC) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + endif() add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) + set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src ${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src @@ -75,6 +96,9 @@ else() target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS}) target_link_libraries(lammps PRIVATE kokkos) target_link_libraries(lmp PRIVATE kokkos) + if(BUILD_SHARED_LIBS_WAS_ON) + set(BUILD_SHARED_LIBS ON) + endif() endif() target_compile_definitions(lammps PUBLIC $) @@ -109,6 +133,12 @@ if(PKG_KSPACE) endif() endif() + +if(PKG_PHONON) + list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/dynamical_matrix_kokkos.cpp) + list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/third_order_kokkos.cpp) +endif() + set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}") # detects styles which have KOKKOS version diff --git a/cmake/Modules/Packages/ML-HDNNP.cmake b/cmake/Modules/Packages/ML-HDNNP.cmake index e27b3a1410..5a4c287fa2 100644 --- a/cmake/Modules/Packages/ML-HDNNP.cmake +++ b/cmake/Modules/Packages/ML-HDNNP.cmake @@ -46,12 +46,10 @@ if(DOWNLOAD_N2P2) if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING) get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES) set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}") - set(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER}) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES) set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}") - set(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER}) endif() endif() @@ -64,8 +62,8 @@ if(DOWNLOAD_N2P2) string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE) set(N2P2_BUILD_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}} ${N2P2_CXX_STD}") set(N2P2_BUILD_OPTIONS INTERFACES=LAMMPS COMP=${N2P2_COMP} "PROJECT_OPTIONS=${N2P2_PROJECT_OPTIONS}" "PROJECT_DEBUG=" - "PROJECT_CC=${CMAKE_CXX_COMPILER}" "PROJECT_MPICC=${MPI_CXX_COMPILER}" "PROJECT_CFLAGS=${N2P2_BUILD_FLAGS}" - "PROJECT_AR=${N2P2_AR}") + "PROJECT_CC=${CMAKE_CXX_COMPILER}" "PROJECT_MPICC=${CMAKE_CXX_COMPILER}" "PROJECT_CFLAGS=${N2P2_BUILD_FLAGS}" + "PROJECT_AR=${N2P2_AR}" "APP_CORE=nnp-convert" "APP_TRAIN=nnp-train" "APP=nnp-convert") # echo final flag for debugging message(STATUS "N2P2 BUILD OPTIONS: ${N2P2_BUILD_OPTIONS}") diff --git a/cmake/Modules/Packages/PYTHON.cmake b/cmake/Modules/Packages/PYTHON.cmake index 7be25a6b05..c94db88073 100644 --- a/cmake/Modules/Packages/PYTHON.cmake +++ b/cmake/Modules/Packages/PYTHON.cmake @@ -3,7 +3,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12) target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS}) target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES}) else() - find_package(Python REQUIRED COMPONENTS Development) + find_package(Python REQUIRED COMPONENTS Interpreter Development) target_link_libraries(lammps PRIVATE Python::Python) endif() target_compile_definitions(lammps PRIVATE -DLMP_PYTHON) diff --git a/cmake/Modules/generate_lmpgitversion.cmake b/cmake/Modules/generate_lmpgitversion.cmake index b19716d74b..f066269723 100644 --- a/cmake/Modules/generate_lmpgitversion.cmake +++ b/cmake/Modules/generate_lmpgitversion.cmake @@ -24,10 +24,10 @@ if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git) OUTPUT_STRIP_TRAILING_WHITESPACE) endif() -set(temp "${temp}const bool LAMMPS_NS::LAMMPS::has_git_info = ${temp_git_info};\n") -set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_commit[] = \"${temp_git_commit}\";\n") -set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_branch[] = \"${temp_git_branch}\";\n") -set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_descriptor[] = \"${temp_git_describe}\";\n") +set(temp "${temp}bool LAMMPS_NS::LAMMPS::has_git_info() { return ${temp_git_info}; }\n") +set(temp "${temp}const char *LAMMPS_NS::LAMMPS::git_commit() { return \"${temp_git_commit}\"; }\n") +set(temp "${temp}const char *LAMMPS_NS::LAMMPS::git_branch() { return \"${temp_git_branch}\"; }\n") +set(temp "${temp}const char *LAMMPS_NS::LAMMPS::git_descriptor() { return \"${temp_git_describe}\"; }\n") set(temp "${temp}#endif\n\n") message(STATUS "Generating lmpgitversion.h...") diff --git a/cmake/iwyu/iwyu-extra-map.imp b/cmake/iwyu/iwyu-extra-map.imp index 8eae74cbfa..7167142662 100644 --- a/cmake/iwyu/iwyu-extra-map.imp +++ b/cmake/iwyu/iwyu-extra-map.imp @@ -20,9 +20,14 @@ { include: [ "@\"kspace_.*.h\"", public, "\"style_kspace.h\"", public ] }, { include: [ "@\"nbin_.*.h\"", public, "\"style_nbin.h\"", public ] }, { include: [ "@\"npair_.*.h\"", public, "\"style_npair.h\"", public ] }, - { include: [ "@\"nstenci_.*.h\"", public, "\"style_nstencil.h\"", public ] }, + { include: [ "@\"nstencil_.*.h\"", public, "\"style_nstencil.h\"", public ] }, { include: [ "@\"ntopo_.*.h\"", public, "\"style_ntopo.h\"", public ] }, + { include: [ "\"fmt/core.h\"", private, "\"fmt/format.h\"", public ] }, { include: [ "", public, "", public ] }, + { include: [ "\"float.h\"", public, "", public ] }, { include: [ "", public, "", public ] }, + { include: [ "\"limits.h\"", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", private, "", public ] }, { include: [ "", private, "", public ] }, ] diff --git a/cmake/presets/gcc.cmake b/cmake/presets/gcc.cmake index c2dbacf674..cb626ea019 100644 --- a/cmake/presets/gcc.cmake +++ b/cmake/presets/gcc.cmake @@ -3,19 +3,19 @@ set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE) set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Og -g" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) set(MPI_CXX "g++" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) set(MPI_C "gcc" CACHE STRING "" FORCE) set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS_DEBUG "-Wall -g" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS_DEBUG "-Wall -Og -g" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) set(MPI_Fortran "gfortran" CACHE STRING "" FORCE) set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -g -std=f2003" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Og -g -std=f2003" CACHE STRING "" FORCE) set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE) set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE) unset(HAVE_OMP_H_INCLUDE CACHE) diff --git a/doc/lammps.1 b/doc/lammps.1 index 58086b1fae..574d20bf51 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "1" "7 January 2022" "2022-1-7" +.TH LAMMPS "1" "17 February 2022" "2022-2-17" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index c708228be7..8995ffdcc4 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -47,7 +47,7 @@ An alphabetic list of all general LAMMPS commands. * :doc:`displace_atoms ` * :doc:`dump ` * :doc:`dump_modify ` - * :doc:`dynamical_matrix ` + * :doc:`dynamical_matrix (k) ` * :doc:`echo ` * :doc:`fix ` * :doc:`fix_modify ` @@ -117,7 +117,7 @@ An alphabetic list of all general LAMMPS commands. * :doc:`thermo ` * :doc:`thermo_modify ` * :doc:`thermo_style ` - * :doc:`third_order ` + * :doc:`third_order (k) ` * :doc:`timer ` * :doc:`timestep ` * :doc:`uncompute ` diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index b7b5089aed..8e707ee154 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -129,6 +129,7 @@ OPT. * :doc:`npt/sphere (o) ` * :doc:`npt/uef ` * :doc:`numdiff ` + * :doc:`numdiff/virial ` * :doc:`nve (giko) ` * :doc:`nve/asphere (gi) ` * :doc:`nve/asphere/noforce ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 9ac4fc851c..7d8c5c31e8 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -119,10 +119,12 @@ OPT. * :doc:`granular ` * :doc:`gw ` * :doc:`gw/zbl ` + * :doc:`harmonic/cut (o) ` * :doc:`hbond/dreiding/lj (o) ` * :doc:`hbond/dreiding/morse (o) ` * :doc:`hdnnp ` * :doc:`ilp/graphene/hbn ` + * :doc:`ilp/tmd ` * :doc:`kolmogorov/crespi/full ` * :doc:`kolmogorov/crespi/z ` * :doc:`lcbop ` @@ -240,6 +242,7 @@ OPT. * :doc:`reaxff (ko) ` * :doc:`rebo (io) ` * :doc:`resquared (go) ` + * :doc:`saip/metal ` * :doc:`sdpd/taitwater/isothermal ` * :doc:`smd/hertz ` * :doc:`smd/tlsph ` diff --git a/doc/src/Developer.rst b/doc/src/Developer.rst index fd4a44a8a0..4d82f93625 100644 --- a/doc/src/Developer.rst +++ b/doc/src/Developer.rst @@ -11,6 +11,7 @@ of time and requests from the LAMMPS user community. :maxdepth: 1 Developer_org + Developer_cxx_vs_c_style Developer_parallel Developer_flow Developer_write diff --git a/doc/src/Developer_cxx_vs_c_style.rst b/doc/src/Developer_cxx_vs_c_style.rst new file mode 100644 index 0000000000..438e57abc7 --- /dev/null +++ b/doc/src/Developer_cxx_vs_c_style.rst @@ -0,0 +1,384 @@ +Code design +----------- + +This section discusses some of the code design choices in LAMMPS and +overall strategy in order to assist developers to write new code that +will fit well with the remaining code. Please see the section on +:doc:`Requirements for contributed code ` for more +specific recommendations and guidelines. While that section is +organized more in the form of a checklist for code contributors, the +focus here is on overall code design strategy, choices made between +possible alternatives, and to discuss of some relevant C++ programming +language constructs. + +Historically, the basic design philosophy of the LAMMPS C++ code was +that of a "C with classes" style. The was motivated by the desire to +make it easier to modify LAMMPS for people without significant training +in C++ programming and by trying to use data structures and code constructs +that somewhat resemble the previous implementation(s) in Fortran. +A contributing factor for this choice also was that at the time the +implementation of C++ compilers was not always very mature and some of +the advanced features contained bugs or were not functioning exactly +as the standard required; plus there was some disagreement between +compiler vendors about how to interpret the C++ standard documents. + +However, C++ compilers have advanced a lot since then and with the +transition to requiring the C++11 standard in 2020 as the minimum C++ language +standard for LAMMPS, the decision was made to also replace some of the +C-style constructs with equivalent C++ functionality, either from the +C++ standard library or as custom classes or function, in order to +improve readability of the code and to increase code reuse through +abstraction of commonly used functionality. + +.. note:: + + Please note that as of spring 2022 there is still a sizable chunk of + legacy code in LAMMPS that has not yet been refactored to reflect these + style conventions in full. LAMMPS has a large code base and many + different contributors and there also is a hierarchy of precedence + in which the code is adapted. Highest priority has the code in the + ``src`` folder, followed by code in packages in order of their popularity + and complexity (simpler code is adapted sooner), followed by code + in the ``lib`` folder. Source code that is downloaded during compilation + is not subject to the conventions discussed here. + +Object oriented code +^^^^^^^^^^^^^^^^^^^^ + +LAMMPS is designed to be an object oriented code, that is each +simulation is represented by an instance of the LAMMPS class. When +running in parallel, of course, each MPI process will create such an +instance. This can be seen in the ``main.cpp`` file where the core +steps of running a LAMMPS simulation are the following 3 lines of code: + +.. code-block:: C++ + + LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm); + lammps->input->file(); + delete lammps; + +The first line creates a LAMMPS class instance and passes the command +line arguments and the global communicator to its constructor. The +second line tells the LAMMPS instance to process the input (either from +standard input or the provided input file) until the end. And the third +line deletes that instance again. The remainder of the main.cpp file +are for error handling, MPI configuration and other special features. + +In the constructor of the LAMMPS class instance the basic LAMMPS class hierarchy +is created as shown in :ref:`class-topology`. While processing the input further +class instances are created, or deleted, or replaced and specific member functions +of specific classes are called to trigger actions like creating atoms, computing +forces, computing properties, propagating the system, or writing output. + +Compositing and Inheritance +=========================== + +LAMMPS makes extensive use of the object oriented programming (OOP) +principles of *compositing* and *inheritance*. Classes like the +``LAMMPS`` class are a **composite** containing pointers to instances of +other classes like ``Atom``, ``Comm``, ``Force``, ``Neighbor``, +``Modify``, and so on. Each of these classes implement certain +functionality by storing and manipulating data related to the simulation +and providing member functions that trigger certain actions. Some of +those classes like ``Force`` are a composite again containing instances +of classes describing the force interactions or ``Modify`` containing +and calling fixes and computes. In most cases (e.g. ``AtomVec``, ``Comm``, +``Pair``, or ``Bond``) there is only one instance of those member classes +allowed, but in a few cases (e.g. ``Region``, ``Fix``, ``Compute``, or +``Dump``) there can be multiple instances and the parent class is +maintaining a list of the pointers of instantiated classes instead +of a single pointer. + +Changing behavior or adjusting how LAMMPS handles a simulation is +implemented via **inheritance** where different variants of the +functionality are realized by creating *derived* classes that can share +common functionality in their base class and provide a consistent +interface where the derived classes replace (dummy or pure) functions in +the base class. The higher level classes can then call those methods of +the instantiated classes without having to know which specific derived +class variant was instantiated. In the LAMMPS documentation those +derived classes are usually referred to a "styles", e.g. pair styles, +fix styles, atom styles and so on. + +This is the origin of the flexibility of LAMMPS and facilitates for +example to compute forces for very different non-bonded potential +functions by having different pair styles (implemented as different +classes derived from the ``Pair`` class) where the evaluation of the +potential function is confined to the implementation of the individual +classes. Whenever a new :doc:`pair_style` or :doc:`bond_style` or +:doc:`comm_style` or similar command is processed in the LAMMPS input +any existing class instance is deleted and a new instance created in +it place. + +Classes derived from ``Fix`` or ``Compute`` represent a different facet +of LAMMPS' flexibility as there can be multiple instances of them an +their member functions will be called at different phases of the time +integration process (as explained in `Developer_flow`). This way +multiple manipulations of the entire or parts of the system can be +programmed (with fix styles) or different computations can be performed +and accessed and further processed or output through a common interface +(with compute styles). + +Further code sharing is possible by creating derived classes from the +derived classes (for instance to implement an accelerated version of a +pair style) where then only a subset of the methods are replaced with +the accelerated versions. + +Polymorphism +============ + +Polymorphism and dynamic dispatch are another OOP feature that play an +important part of how LAMMPS selects which code to execute. In a nutshell, +this is a mechanism where the decision of which member function to call +from a class is determined at runtime and not when the code is compiled. +To enable it, the function has to be declared as ``virtual`` and all +corresponding functions in derived classes should be using the ``override`` +property. Below is a brief example. + +.. code-block:: c++ + + class Base { + public: + virtual ~Base() = default; + void call(); + void normal(); + virtual void poly(); + }; + + void Base::call() { + normal(); + poly(); + } + + class Derived : public Base { + public: + ~Derived() override = default; + void normal(); + void poly() override; + }; + + // [....] + + Base *base1 = new Base(); + Base *base2 = new Derived(); + + base1->call(); + base2->call(); + +The difference in behavior of the ``normal()`` and the ``poly()`` member +functions is in which of the two member functions is called when +executing `base1->call()` and `base2->call()`. Without polymorphism, a +function within the base class will call only member functions within +the same scope, that is ``Base::call()`` will always call +``Base::normal()``. But for the `base2->call()` the call for the +virtual member function will be dispatched to ``Derived::poly()`` +instead. This mechanism allows to always call functions within the +scope of the class type that was used to create the class instance, even +if they are assigned to a pointer using the type of a base class. This +is the desired behavior, and thanks to dynamic dispatch, LAMMPS can even +use styles that are loaded at runtime from a shared object file with the +:doc:`plugin command `. + +A special case of virtual functions are so-called pure functions. These +are virtual functions that are initialized to 0 in the class declaration +(see example below). + +.. code-block:: c++ + + class Base { + public: + virtual void pure() = 0; + }; + +This has the effect that it will no longer be possible to create an +instance of the base class and that derived classes **must** implement +these functions. Many of the functions listed with the various class +styles in the section :doc:`Modify` are such pure functions. The +motivation for this is to define the interface or API of the functions +but defer the implementation to the derived classes. + +However, there are downsides to this. For example, calls to virtual +functions from within a constructor, will not be in the scope of the +derived class and thus it is good practice to either avoid calling them +or to provide an explicit scope like in ``Base::poly()``. Furthermore, +any destructors in classes containing virtual functions should be +declared virtual, too, so they are processed in the expected order +before types are removed from dynamic dispatch. + +.. admonition:: Important Notes + + In order to be able to detect incompatibilities and to avoid unexpected + behavior already at compile time, it is crucial that all member functions + that are intended to replace a virtual or pure function use the ``override`` + property keyword. For the same reason it should be avoided to use overloads + or default arguments for virtual functions as they lead to confusion over + which function is supposed to override which and which arguments need to be + declared. + +Style Factories +=============== + +In order to create class instances of the different styles, LAMMPS often +uses a programming pattern called `Factory`. Those are functions that create +an instance of a specific derived class, say ``PairLJCut`` and return a pointer +to the type of the common base class of that style, ``Pair`` in this case. +To associate the factory function with the style keyword, an ``std::map`` +class is used in which function pointers are indexed by their keyword +(for example "lj/cut" for ``PairLJCut`` and "morse" ``PairMorse``). +A couple of typedefs help to keep the code readable and a template function +is used to implement the actual factory functions for the individual classes. + +I/O and output formatting +^^^^^^^^^^^^^^^^^^^^^^^^^ + +C-style stdio versus C++ style iostreams +======================================== + +LAMMPS chooses to use the "stdio" library of the standard C library for +reading from and writing to files and console instead of C++ +"iostreams". This is mainly motivated by the better performance, better +control over formatting, and less effort to achieve specific formatting. + +Since mixing "stdio" and "iostreams" can lead to unexpected behavior using +the latter is strongly discouraged. Also output to the screen should not +use the predefined ``stdout`` FILE pointer, but rather the ``screen`` and +``logfile`` FILE pointers managed by the LAMMPS class. Furthermore, output +should only be done by MPI rank 0 (``comm->me == 0``) and output that is +send to both ``screen`` and ``logfile`` should use the +:cpp:func:`utils::logmesg() convenience function `. + +We also discourage the use for stringstreams as the bundled {fmt} library +and the customized tokenizer classes can provide the same functionality +in a cleaner way with better performance. This will also help to retain +a consistent programming style despite the many different contributors. + +Formatting with the {fmt} library +=================================== + +The LAMMPS source code includes a copy of the `{fmt} library +`_ which is preferred over formatting with the +"printf()" family of functions. The primary reason is that it allows a +typesafe default format for any type of supported data. This is +particularly useful for formatting integers of a given size (32-bit or +64-bit) which may require different format strings depending on compile +time settings or compilers/operating systems. Furthermore, {fmt} gives +better performance, has more functionality, a familiar formatting syntax +that has similarities to ``format()`` in Python, and provides a facility +that can be used to integrate format strings and a variable number of +arguments into custom functions in a much simpler way that the varargs +mechanism of the C library. Finally, {fmt} has been included into the +C++20 language standard, so changes to adopt it are future proof. + +Formatted strings are frequently created by calling the +``fmt::format()`` function which will return a string as ``std::string`` +class instance. In contrast to the ``%`` placeholder in ``printf()``, +the {fmt} library uses ``{}`` to embed format descriptors. In the +simplest case, no additional characters are needed as {fmt} will choose +the default format based on the data type of the argument. Alternatively +The ``fmt::print()`` function may be used instead of ``printf()`` or +``fprintf()``. In addition, several LAMMPS output functions, that +originally accepted a single string as arguments have been overloaded to +accept a format string with optional arguments as well (e.g. +``Error::all()``, ``Error::one()``, ``utils::logmesg()``). + +Summary of the {fmt} format syntax +================================== + +The syntax of the format string is "{[][:]}", +where either the argument id or the format spec (separated by a colon +':') is optional. The argument id is usually a number starting from 0 +that is the index to the arguments following the format string. By +default these are assigned in order (i.e. 0, 1, 2, 3, 4 etc.). The most +common case for using argument id would be to use the same argument in +multiple places in the format string without having to provide it as an +argument multiple times. In LAMMPS the argument id is rarely used. + +More common is the use of the format specifier, which starts with a +colon. This may optionally be followed by a fill character (default is +' '). If provided, the fill character **must** be followed by an +alignment character ('<', '^', '>' for left, centered, or right +alignment (default)). The alignment character may be used without a fill +character. The next important format parameter would be the minimum +width, which may be followed by a dot '.' and a precision for floating +point numbers. The final character in the format string would be an +indicator for the "presentation", i.e. 'd' for decimal presentation of +integers, 'x' for hexadecimal, 'o' for octal, 'c' for character +etc. This mostly follows the "printf()" scheme but without requiring an +additional length parameter to distinguish between different integer +widths. The {fmt} library will detect those and adapt the formatting +accordingly. For floating point numbers there are correspondingly, 'g' +for generic presentation, 'e' for exponential presentation, and 'f' for +fixed point presentation. + +Thus "{:8}" would represent *any* type argument using at least 8 +characters; "{:<8}" would do this as left aligned, "{:^8}" as centered, +"{:>8}" as right aligned. If a specific presentation is selected, the +argument type must be compatible or else the {fmt} formatting code will +throw an exception. Some format string examples are given below: + +.. code-block:: C + + auto mesg = fmt::format(" CPU time: {:4d}:{:02d}:{:02d}\n", cpuh, cpum, cpus); + mesg = fmt::format("{:<8s}| {:<10.5g} | {:<10.5g} | {:<10.5g} |{:6.1f} |{:6.2f}\n", + label, time_min, time, time_max, time_sq, tmp); + utils::logmesg(lmp,"{:>6} = max # of 1-2 neighbors\n",maxall); + utils::logmesg(lmp,"Lattice spacing in x,y,z = {:.8} {:.8} {:.8}\n", + xlattice,ylattice,zlattice); + +which will create the following output lines: + +.. parsed-literal:: + + CPU time: 0:02:16 + Pair | 2.0133 | 2.0133 | 2.0133 | 0.0 | 84.21 + 4 = max # of 1-2 neighbors + Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962 + +A special feature of the {fmt} library is that format parameters like +the width or the precision may be also provided as arguments. In that +case a nested format is used where a pair of curly braces (with an +optional argument id) "{}" are used instead of the value, for example +"{:{}d}" will consume two integer arguments, the first will be the value +shown and the second the minimum width. + +For more details and examples, please consult the `{fmt} syntax +documentation `_ website. + + +Memory management +^^^^^^^^^^^^^^^^^ + +Dynamical allocation of data and objects should be done with either the +C++ commands "new" and "delete/delete[]" or using member functions of +the ``Memory`` class, most commonly, ``Memory::create()``, +``Memory::grow()``, and ``Memory::destroy()``. The use of ``malloc()``, +``calloc()``, ``realloc()`` and ``free()`` directly is strongly +discouraged. To simplify adapting legacy code into the LAMMPS code base +the member functions ``Memory::smalloc()``, ``Memory::srealloc()``, and +``Memory::sfree()`` are available. + +Using those custom memory allocation functions is motivated by the +following considerations: + +- memory allocation failures on *any* MPI rank during a parallel run + will trigger an immediate abort of the entire parallel calculation + instead of stalling it +- a failing "new" will trigger an exception which is also captured by + LAMMPS and triggers a global abort +- allocation of multi-dimensional arrays will be done in a C compatible + fashion but so that the storage of the actual data is stored in one + large consecutive block and thus when MPI communication is needed, + only this storage needs to be communicated (similar to Fortran arrays) +- the "destroy()" and "sfree()" functions may safely be called on NULL + pointers +- the "destroy()" functions will nullify the pointer variables making + "use after free" errors easy to detect +- it is possible to use a larger than default memory alignment (not on + all operating systems, since the allocated storage pointers must be + compatible with ``free()`` for technical reasons) + +In the practical implementation of code this means that any pointer variables +that are class members should be initialized to a ``nullptr`` value in their +respective constructors. That way it would be safe to call ``Memory::destroy()`` +or ``delete[]`` on them before *any* allocation outside the constructor. +This helps to prevent memory leaks. diff --git a/doc/src/Developer_notes.rst b/doc/src/Developer_notes.rst index ab2e3826f2..a15354bb9a 100644 --- a/doc/src/Developer_notes.rst +++ b/doc/src/Developer_notes.rst @@ -7,6 +7,61 @@ typically document what a variable stores, what a small section of code does, or what a function does and its input/outputs. The topics on this page are intended to document code functionality at a higher level. +Reading and parsing of text and text files +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +It is frequently required for a class in LAMMPS to read in additional +data from a file, most commonly potential parameters from a potential +file for manybody potentials. LAMMPS provides several custom classes +and convenience functions to simplify the process. This offers the +following benefits: + +- better code reuse and fewer lines of code needed to implement reading + and parsing data from a file +- better detection of format errors, incompatible data, and better error messages +- exit with an error message instead of silently converting only part of the + text to a number or returning a 0 on unrecognized text and thus reading incorrect values +- re-entrant code through avoiding global static variables (as used by ``strtok()``) +- transparent support for translating unsupported UTF-8 characters to their ASCII equivalents + (the text to value conversion functions **only** accept ASCII characters) + +In most cases (e.g. potential files) the same data is needed on all MPI +ranks. Then it is best to do the reading and parsing only on MPI rank +0, and communicate the data later with one or more ``MPI_Bcast()`` +calls. For reading generic text and potential parameter files the +custom classes :cpp:class:`TextFileReader ` +and :cpp:class:`PotentialFileReader ` +are available. Those classes allow to read the file as individual lines +for which they can return a tokenizer class (see below) for parsing the +line, or they can return blocks of numbers as a vector directly. The +documentation on `File reader classes `_ contains +an example for a typical case. + +When reading per-atom data, the data in the file usually needs include +an atom ID so it can be associated with a particular atom. In that case +the data can be read in multi-line chunks and broadcast to all MPI ranks +with :cpp:func:`utils::read_lines_from_file() +`. Those chunks are then +split into lines, parsed, and applied only to atoms the MPI rank +"owns". + +For splitting a string (incrementally) into words and optionally +converting those to numbers, the :cpp:class:`Tokenizer +` and :cpp:class:`ValueTokenizer +` can be used. Those provide a superset of +the functionality of ``strtok()`` from the C-library and the latter also +includes conversion to different types. Any errors while processing the +string in those classes will result in an exception, which can be caught +and the error processed as needed. Unlike the C-library functions +``atoi()``, ``atof()``, ``strtol()``, or ``strtod()`` the conversion +will check if the converted text is a valid integer of floating point +number and will not silently return an unexpected or incorrect value. +For example, ``atoi()`` will return 12 when converting "12.5" while the +ValueTokenizer class will throw an :cpp:class:`InvalidIntegerException +` if +:cpp:func:`ValueTokenizer::next_int() +` is called on the same string. + Fix contributions to instantaneous energy, virial, and cumulative energy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/src/Developer_org.rst b/doc/src/Developer_org.rst index b5acdf5631..ce36d9a590 100644 --- a/doc/src/Developer_org.rst +++ b/doc/src/Developer_org.rst @@ -225,7 +225,7 @@ follows: commands in an input script. - The Force class computes various forces between atoms. The Pair - parent class is for non-bonded or pair-wise forces, which in LAMMPS + parent class is for non-bonded or pairwise forces, which in LAMMPS also includes many-body forces such as the Tersoff 3-body potential if those are computed by walking pairwise neighbor lists. The Bond, Angle, Dihedral, Improper parent classes are styles for bonded diff --git a/doc/src/Developer_utils.rst b/doc/src/Developer_utils.rst index a9969b7543..a9df85c899 100644 --- a/doc/src/Developer_utils.rst +++ b/doc/src/Developer_utils.rst @@ -21,18 +21,21 @@ In that case, the functions will stop with an error message, indicating the name of the problematic file, if possible unless the *error* argument is a NULL pointer. -The :cpp:func:`fgets_trunc` function will work similar for ``fgets()`` -but it will read in a whole line (i.e. until the end of line or end -of file), but store only as many characters as will fit into the buffer -including a final newline character and the terminating NULL byte. -If the line in the file is longer it will thus be truncated in the buffer. -This function is used by :cpp:func:`read_lines_from_file` to read individual -lines but make certain they follow the size constraints. +The :cpp:func:`utils::fgets_trunc() ` +function will work similar for ``fgets()`` but it will read in a whole +line (i.e. until the end of line or end of file), but store only as many +characters as will fit into the buffer including a final newline +character and the terminating NULL byte. If the line in the file is +longer it will thus be truncated in the buffer. This function is used +by :cpp:func:`utils::read_lines_from_file() +` to read individual lines but +make certain they follow the size constraints. -The :cpp:func:`read_lines_from_file` function will read the requested -number of lines of a maximum length into a buffer and will return 0 -if successful or 1 if not. It also guarantees that all lines are -terminated with a newline character and the entire buffer with a +The :cpp:func:`utils::read_lines_from_file() +` function will read the +requested number of lines of a maximum length into a buffer and will +return 0 if successful or 1 if not. It also guarantees that all lines +are terminated with a newline character and the entire buffer with a NULL character. ---------- @@ -62,7 +65,7 @@ silently returning the result of a partial conversion or zero in cases where the string is not a valid number. This behavior improves detecting typos or issues when processing input files. -Similarly the :cpp:func:`logical() ` function +Similarly the :cpp:func:`utils::logical() ` function will convert a string into a boolean and will only accept certain words. The *do_abort* flag should be set to ``true`` in case this function @@ -70,8 +73,8 @@ is called only on a single MPI rank, as that will then trigger the a call to ``Error::one()`` for errors instead of ``Error::all()`` and avoids a "hanging" calculation when run in parallel. -Please also see :cpp:func:`is_integer() ` -and :cpp:func:`is_double() ` for testing +Please also see :cpp:func:`utils::is_integer() ` +and :cpp:func:`utils::is_double() ` for testing strings for compliance without conversion. ---------- @@ -205,6 +208,9 @@ Convenience functions .. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg) :project: progguide +.. doxygenfunction:: flush_buffers(LAMMPS *lmp) + :project: progguide + .. doxygenfunction:: getsyserror :project: progguide @@ -337,11 +343,11 @@ This code example should produce the following output: .. doxygenclass:: LAMMPS_NS::InvalidIntegerException :project: progguide - :members: what + :members: .. doxygenclass:: LAMMPS_NS::InvalidFloatException :project: progguide - :members: what + :members: ---------- @@ -390,21 +396,26 @@ A typical code segment would look like this: ---------- +.. file-reader-classes: + File reader classes ------------------- The purpose of the file reader classes is to simplify the recurring task of reading and parsing files. They can use the -:cpp:class:`LAMMPS_NS::ValueTokenizer` class to process the read in -text. The :cpp:class:`LAMMPS_NS::TextFileReader` is a more general -version while :cpp:class:`LAMMPS_NS::PotentialFileReader` is specialized -to implement the behavior expected for looking up and reading/parsing -files with potential parameters in LAMMPS. The potential file reader -class requires a LAMMPS instance, requires to be run on MPI rank 0 only, -will use the :cpp:func:`LAMMPS_NS::utils::get_potential_file_path` -function to look up and open the file, and will call the -:cpp:class:`LAMMPS_NS::Error` class in case of failures to read or to -convert numbers, so that LAMMPS will be aborted. +:cpp:class:`ValueTokenizer ` class to process +the read in text. The :cpp:class:`TextFileReader +` is a more general version while +:cpp:class:`PotentialFileReader ` is +specialized to implement the behavior expected for looking up and +reading/parsing files with potential parameters in LAMMPS. The +potential file reader class requires a LAMMPS instance, requires to be +run on MPI rank 0 only, will use the +:cpp:func:`utils::get_potential_file_path +` function to look up and +open the file, and will call the :cpp:class:`LAMMPS_NS::Error` class in +case of failures to read or to convert numbers, so that LAMMPS will be +aborted. .. code-block:: C++ :caption: Use of PotentialFileReader class in pair style coul/streitz @@ -479,10 +490,10 @@ provided, as that is used to determine whether a new page of memory must be used. The :cpp:class:`MyPage ` class offers two ways to -reserve a chunk: 1) with :cpp:func:`get() ` the -chunk size needs to be known in advance, 2) with :cpp:func:`vget() +reserve a chunk: 1) with :cpp:func:`MyPage::get() ` the +chunk size needs to be known in advance, 2) with :cpp:func:`MyPage::vget() ` a pointer to the next chunk is returned, but -its size is registered later with :cpp:func:`vgot() +its size is registered later with :cpp:func:`MyPage::vgot() `. .. code-block:: C++ @@ -585,4 +596,3 @@ the communication buffers. .. doxygenunion:: LAMMPS_NS::ubuf :project: progguide - diff --git a/doc/src/Errors_messages.rst b/doc/src/Errors_messages.rst index c06f4c86e3..4e216828d3 100644 --- a/doc/src/Errors_messages.rst +++ b/doc/src/Errors_messages.rst @@ -1941,6 +1941,9 @@ Doc page with :doc:`WARNING messages ` *Compute ID for fix numdiff does not exist* Self-explanatory. +*Compute ID for fix numdiff/virial does not exist* + Self-explanatory. + *Compute ID for fix store/state does not exist* Self-explanatory. @@ -3796,6 +3799,10 @@ Doc page with :doc:`WARNING messages ` Self-explanatory. Efficient loop over all atoms for numerical difference requires consecutive atom IDs. +*Fix numdiff/virial must use group all* + Virial contributions computed by this fix are + computed on all atoms. + *Fix nve/asphere requires extended particles* This fix can only be used for particles with a shape setting. diff --git a/doc/src/Errors_warnings.rst b/doc/src/Errors_warnings.rst index d7a97c1507..2d588a1b77 100644 --- a/doc/src/Errors_warnings.rst +++ b/doc/src/Errors_warnings.rst @@ -416,7 +416,7 @@ This will most likely cause errors in kinetic fluctuations. not defined for the specified atom style. *Molecule has bond topology but no special bond settings* - This means the bonded atoms will not be excluded in pair-wise + This means the bonded atoms will not be excluded in pairwise interactions. *Molecule template for create_atoms has multiple molecules* diff --git a/doc/src/Howto_pylammps.rst b/doc/src/Howto_pylammps.rst index e6d3d7b91d..6c788e2365 100644 --- a/doc/src/Howto_pylammps.rst +++ b/doc/src/Howto_pylammps.rst @@ -545,6 +545,6 @@ Feedback and Contributing ------------------------- If you find this Python interface useful, please feel free to provide feedback -and ideas on how to improve it to Richard Berger (richard.berger@temple.edu). We also +and ideas on how to improve it to Richard Berger (richard.berger@outlook.com). We also want to encourage people to write tutorial style IPython notebooks showcasing LAMMPS usage and maybe their latest research results. diff --git a/doc/src/Intro_authors.rst b/doc/src/Intro_authors.rst index fc609e12cf..a0902ccda1 100644 --- a/doc/src/Intro_authors.rst +++ b/doc/src/Intro_authors.rst @@ -8,7 +8,7 @@ University: * Aidan Thompson, athomps at sandia.gov * Stan Moore, stamoor at sandia.gov * Axel Kohlmeyer, akohlmey at gmail.com -* Richard Berger, richard.berger at temple.edu +* Richard Berger, richard.berger at outlook.com .. _sjp: http://www.cs.sandia.gov/~sjplimp .. _lws: https://www.lammps.org diff --git a/doc/src/Library_utility.rst b/doc/src/Library_utility.rst index 32fac6bcc8..da64e3b8f0 100644 --- a/doc/src/Library_utility.rst +++ b/doc/src/Library_utility.rst @@ -13,6 +13,7 @@ functions. They do not directly call the LAMMPS library. - :cpp:func:`lammps_fix_external_set_virial_peratom` - :cpp:func:`lammps_fix_external_set_vector_length` - :cpp:func:`lammps_fix_external_set_vector` +- :cpp:func:`lammps_flush_buffers` - :cpp:func:`lammps_free` - :cpp:func:`lammps_is_running` - :cpp:func:`lammps_force_timeout` @@ -72,6 +73,11 @@ where such memory buffers were allocated that require the use of ----------------------- +.. doxygenfunction:: lammps_flush_buffers + :project: progguide + +----------------------- + .. doxygenfunction:: lammps_free :project: progguide diff --git a/doc/src/Modify_style.rst b/doc/src/Modify_style.rst index 50e7afb370..382db3b0ea 100644 --- a/doc/src/Modify_style.rst +++ b/doc/src/Modify_style.rst @@ -305,6 +305,40 @@ you are uncertain, please ask. FILE pointers and only be done on MPI rank 0. Use the :cpp:func:`utils::logmesg` convenience function where possible. +- Usage of C++11 `virtual`, `override`, `final` keywords: Please follow the + `C++ Core Guideline C.128 `_. + That means, you should only use `virtual` to declare a new virtual + function, `override` to indicate you are overriding an existing virtual + function, and `final` to prevent any further overriding. + +- Trivial destructors: Prefer not writing destructors when they are empty and `default`. + + .. code-block:: c++ + + // don't write destructors for A or B like this + class A : protected Pointers { + public: + A(); + ~A() override {} + }; + + class B : protected Pointers { + public: + B(); + ~B() override = default; + }; + + // instead, let the compiler create the implicit default destructor by not writing it + class A : protected Pointers { + public: + A(); + }; + + class B : protected Pointers { + public: + B(); + }; + - Header files, especially those defining a "style", should only use the absolute minimum number of include files and **must not** contain any ``using`` statements. Typically that would be only the header for diff --git a/doc/src/Run_output.rst b/doc/src/Run_output.rst index 8adfd4b293..a988be94ad 100644 --- a/doc/src/Run_output.rst +++ b/doc/src/Run_output.rst @@ -106,7 +106,7 @@ individual ranks. Here is an example output for this section: ---------- The third section above lists the number of owned atoms (Nlocal), -ghost atoms (Nghost), and pair-wise neighbors stored per processor. +ghost atoms (Nghost), and pairwise neighbors stored per processor. The max and min values give the spread of these values across processors with a 10-bin histogram showing the distribution. The total number of histogram counts is equal to the number of processors. @@ -114,7 +114,7 @@ number of histogram counts is equal to the number of processors. ---------- The last section gives aggregate statistics (across all processors) -for pair-wise neighbors and special neighbors that LAMMPS keeps track +for pairwise neighbors and special neighbors that LAMMPS keeps track of (see the :doc:`special_bonds ` command). The number of times neighbor lists were rebuilt is tallied, as is the number of potentially *dangerous* rebuilds. If atom movement triggered neighbor diff --git a/doc/src/Speed_kokkos.rst b/doc/src/Speed_kokkos.rst index 14c2ec680e..8b9b2e99af 100644 --- a/doc/src/Speed_kokkos.rst +++ b/doc/src/Speed_kokkos.rst @@ -214,7 +214,7 @@ threads/task as Nt. The product of these two values should be N, i.e. The default for the :doc:`package kokkos ` command when running on KNL is to use "half" neighbor lists and set the Newton flag to "on" for both pairwise and bonded interactions. This will typically - be best for many-body potentials. For simpler pair-wise potentials, it + be best for many-body potentials. For simpler pairwise potentials, it may be faster to use a "full" neighbor list with Newton flag to "off". Use the "-pk kokkos" :doc:`command-line switch ` to change the default :doc:`package kokkos ` options. See its page for diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 0d8ffa3f45..f24659b278 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -277,17 +277,34 @@ at ens-lyon.fr, alain.dequidt at uca.fr eam database tool ----------------------------- -The tools/eam_database directory contains a Fortran program that will -generate EAM alloy setfl potential files for any combination of 16 -elements: Cu, Ag, Au, Ni, Pd, Pt, Al, Pb, Fe, Mo, Ta, W, Mg, Co, Ti, -Zr. The files can then be used with the :doc:`pair_style eam/alloy ` command. +The tools/eam_database directory contains a Fortran and a Python program +that will generate EAM alloy setfl potential files for any combination +of the 17 elements: Cu, Ag, Au, Ni, Pd, Pt, Al, Pb, Fe, Mo, Ta, W, Mg, +Co, Ti, Zr, Cr. The files can then be used with the :doc:`pair_style +eam/alloy ` command. -The tool is authored by Xiaowang Zhou (Sandia), xzhou at sandia.gov, -and is based on his paper: +The Fortran version of the tool was authored by Xiaowang Zhou (Sandia), +xzhou at sandia.gov, with updates from Lucas Hale (NIST) lucas.hale at +nist.gov and is based on his paper: X. W. Zhou, R. A. Johnson, and H. N. G. Wadley, Phys. Rev. B, 69, 144113 (2004). +The parameters for Cr were taken from: + +Lin Z B, Johnson R A and Zhigilei L V, Phys. Rev. B 77 214108 (2008). + +The Python version of the tool was authored by Germain Clavier +(TU Eindhoven) g.m.g.c.clavier at tue.nl or germain.clavier at gmail.com + +.. note:: + + The parameters in the database are only optimized for individual + elements. The mixed parameters for interactions between different + elements generated by this tool are derived from simple mixing rules + and are thus inferior to parameterizations that are specifically + optimized for specific mixtures and combinations of elements. + ---------- .. _eamgn: diff --git a/doc/src/balance.rst b/doc/src/balance.rst index 5063a502bb..1d24e467d8 100644 --- a/doc/src/balance.rst +++ b/doc/src/balance.rst @@ -383,7 +383,7 @@ multiple groups, its weight is the product of the weight factors. This weight style is useful in combination with pair style :doc:`hybrid `, e.g. when combining a more costly many-body -potential with a fast pair-wise potential. It is also useful when +potential with a fast pairwise potential. It is also useful when using :doc:`run_style respa ` where some portions of the system have many bonded interactions and others none. It assumes that the computational cost for each group remains constant over time. diff --git a/doc/src/compute_pressure.rst b/doc/src/compute_pressure.rst index 6d76713b41..ab57786c05 100644 --- a/doc/src/compute_pressure.rst +++ b/doc/src/compute_pressure.rst @@ -141,7 +141,7 @@ Related commands """""""""""""""" :doc:`compute temp `, :doc:`compute stress/atom `, -:doc:`thermo_style `, +:doc:`thermo_style `, :doc:`fix numdiff/virial `, Default """"""" diff --git a/doc/src/compute_pressure_cylinder.rst b/doc/src/compute_pressure_cylinder.rst index a008254540..9913ef159b 100644 --- a/doc/src/compute_pressure_cylinder.rst +++ b/doc/src/compute_pressure_cylinder.rst @@ -61,7 +61,7 @@ Restrictions This compute currently calculates the pressure tensor contributions for pair styles only (i.e. no bond, angle, dihedral, etc. contributions and in the presence of bonded interactions, the result will be incorrect -due to exclusions for special bonds) and requires pair-wise force +due to exclusions for special bonds) and requires pairwise force calculations not available for most many-body pair styles. K-space calculations are also excluded. Note that this pressure compute outputs the configurational terms only; the kinetic contribution is not included diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index ffb5fdcb55..2f47707d65 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -17,13 +17,14 @@ Syntax * one or more keyword/value pairs may be appended * these keywords apply to various dump styles -* keyword = *append* or *at* or *buffer* or *delay* or *element* or *every* or *every/time* or *fileper* or *first* or *flush* or *format* or *header* or *image* or *label* or *maxfiles* or *nfile* or *pad* or *pbc* or *precision* or *region* or *refresh* or *scale* or *sfactor* or *sort* or *tfactor* or *thermo* or *thresh* or *time* or *units* or *unwrap* +* keyword = *append* or *at* or *balance* or *buffer* or *delay* or *element* or *every* or *every/time* or *fileper* or *first* or *flush* or *format* or *header* or *image* or *label* or *maxfiles* or *nfile* or *pad* or *pbc* or *precision* or *region* or *refresh* or *scale* or *sfactor* or *sort* or *tfactor* or *thermo* or *thresh* or *time* or *units* or *unwrap* .. parsed-literal:: *append* arg = *yes* or *no* *at* arg = N N = index of frame written upon first dump + *balance* arg = *yes* or *no* *buffer* arg = *yes* or *no* *delay* arg = Dstep Dstep = delay output until this timestep @@ -668,6 +669,14 @@ keywords are set to non-default values (i.e. the number of dump file pieces is not equal to the number of procs), then sorting cannot be performed. +In a parallel run, the per-processor dump file pieces can have +significant imbalance in number of lines of per-atom info. The *balance* +keyword determines whether the number of lines in each processor +snapshot are balanced to be nearly the same. A balance value of *no* +means no balancing will be done, while *yes* means balancing will be +performed. This balancing preserves dump sorting order. For a serial +run, this option is ignored since the output is already balanced. + .. note:: Unless it is required by the dump style, sorting dump file @@ -833,6 +842,7 @@ Default The option defaults are * append = no +* balance = no * buffer = yes for dump styles *atom*, *custom*, *loca*, and *xyz* * element = "C" for every atom type * every = whatever it was set to via the :doc:`dump ` command diff --git a/doc/src/dynamical_matrix.rst b/doc/src/dynamical_matrix.rst index 37b9e5b4a5..93e4c2a1aa 100644 --- a/doc/src/dynamical_matrix.rst +++ b/doc/src/dynamical_matrix.rst @@ -1,8 +1,11 @@ .. index:: dynamical_matrix +.. index:: dynamical_matrix/kk dynamical_matrix command ======================== +Accelerator Variants: dynamical_matrix/kk + Syntax """""" @@ -56,6 +59,12 @@ If the style eskm is selected, the dynamical matrix will be in units of inverse squared femtoseconds. These units will then conveniently leave frequencies in THz. +---------- + +.. include:: accel_styles.rst + +---------- + Restrictions """""""""""" diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 2f3287fc36..deabf59a73 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -271,7 +271,8 @@ accelerated styles exist. * :doc:`npt/eff ` - NPT for nuclei and electrons in the electron force field model * :doc:`npt/sphere ` - NPT for spherical particles * :doc:`npt/uef ` - NPT style time integration with diagonal flow -* :doc:`numdiff ` - compute derivatives of per-atom data from finite differences +* :doc:`numdiff ` - numerically approximate atomic forces using finite energy differences +* :doc:`numdiff/virial ` - numerically approximate virial stress tensor using finite energy differences * :doc:`nve ` - constant NVE time integration * :doc:`nve/asphere ` - NVE for aspherical particles * :doc:`nve/asphere/noforce ` - NVE for aspherical particles without forces diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index 9ff28b6ac3..82bcf3d69d 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -20,13 +20,13 @@ Syntax .. parsed-literal:: - keyword = *pH*, *pKa*, *pKb*, *pIp*, *pIm*, *pKs*, *acid_type*, *base_type*, *lunit_nm*, *temp*, *tempfixid*, *nevery*, *nmc*, *xrd*, *seed*, *tag*, *group*, *onlysalt*, *pmcmoves* + keyword = *pH*, *pKa*, *pKb*, *pIp*, *pIm*, *pKs*, *acid_type*, *base_type*, *lunit_nm*, *temp*, *tempfixid*, *nevery*, *nmc*, *rxd*, *seed*, *tag*, *group*, *onlysalt*, *pmcmoves* *pH* value = pH of the solution (can be specified as an equal-style variable) - *pKa* value = acid dissociation constant - *pKb* value = base dissociation constant - *pIp* value = chemical potential of free cations - *pIm* value = chemical potential of free anions - *pKs* value = solution self-dissociation constant + *pKa* value = acid dissociation constant (in the -log10 representation) + *pKb* value = base dissociation constant (in the -log10 representation) + *pIp* value = activity (effective concentration) of free cations (in the -log10 representation) + *pIm* value = activity (effective concentration) of free anions (in the -log10 representation) + *pKs* value = solvent self-dissociation constant (in the -log10 representation) *acid_type* = atom type of acid groups *base_type* = atom type of base groups *lunit_nm* value = unit length used by LAMMPS (# in the units of nanometers) @@ -34,7 +34,7 @@ Syntax *tempfixid* value = fix ID of temperature thermostat *nevery* value = invoke this fix every nevery steps *nmc* value = number of charge regulation MC moves to attempt every nevery steps - *xrd* value = cutoff distance for acid/base reaction + *rxd* value = cutoff distance for acid/base reaction *seed* value = random # seed (positive integer) *tag* value = yes or no (yes: The code assign unique tags to inserted ions; no: The tag of all inserted ions is "0") *group* value = group-ID, inserted ions are assigned to group group-ID. Can be used multiple times to assign inserted ions to multiple groups. @@ -47,7 +47,7 @@ Examples """""""" .. code-block:: LAMMPS - fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT + fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5.0 pKb 6.0 pH 7.0 pIp 3.0 pIm 3.0 nevery 200 nmc 200 seed 123 tempfixid fT fix chareg all charge/regulation 1 2 pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0 @@ -92,7 +92,11 @@ where the fix attempts to charge :math:`\mathrm{A}` (discharge :math:`\mathrm{A}^-`) to :math:`\mathrm{A}^-` (:math:`\mathrm{A}`) and insert (delete) a proton (atom type 2). Besides, the fix implements self-ionization reaction of water :math:`\emptyset \rightleftharpoons -\mathrm{H}^++\mathrm{OH}^-`. However, this approach is highly +\mathrm{H}^++\mathrm{OH}^-`. + + + +However, this approach is highly inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of both protons and hydroxyl ions is low, resulting in a relatively low acceptance rate of MC moves. @@ -102,24 +106,31 @@ reactions, which can be easily achieved via .. code-block:: LAMMPS - fix acid_reaction all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0 + fix acid_reaction2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0 -where particles of atom type 4 and 5 are the salt cations and anions, -both at chemical potential pI=2.0, see :ref:`(Curk1) ` and +where particles of atom type 4 and 5 are the salt cations and anions, both at activity (effective concentration) of :math:`10^{-2}` mol/l, see :ref:`(Curk1) ` and :ref:`(Landsgesell) ` for more details. - - Similarly, we could have simultaneously added a base ionization reaction - (:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`) +We could have simultaneously added a base ionization reaction (:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`) .. code-block:: LAMMPS - fix base_reaction all charge/regulation 2 3 base_type 6 pH 7.0 pKb 6.0 pIp 7.0 pIm 7.0 + fix acid_base_reaction all charge/regulation 2 3 acid_type 1 base_type 6 pH 7.0 pKa 5.0 pKb 6.0 pIp 7.0 pIm 7.0 where the fix will attempt to charge :math:`\mathrm{B}` (discharge :math:`\mathrm{B}^+`) to :math:`\mathrm{B}^+` (:math:`\mathrm{B}`) and -insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. If -neither the acid or the base type is specified, for example, +insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. + + +Dissociated ions and salt ions can be combined into a single particle type, which reduces the number of necessary MC moves and increases sampling performance, see :ref:`(Curk1) `. The :math:`\mathrm{H}^+` and monovalent salt cation (:math:`\mathrm{S}^+`) are combined into a single particle type, :math:`\mathrm{X}^+ = \{\mathrm{H}^+, \mathrm{S}^+\}`. In this case "pIp" refers to the effective concentration of the combined cation type :math:`\mathrm{X}^+` and its value is determined by :math:`10^{-\mathrm{pIp}} = 10^{-\mathrm{pH}} + 10^{-\mathrm{pSp}}`, where :math:`10^{-\mathrm{pSp}}` is the effective concentration of salt cations. For example, at pH=7 and pSp=6 we would find pIp~5.958 and the command that performs reactions with combined ions could read, + +.. code-block:: LAMMPS + + fix acid_reaction_combined all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 5.0 pIp 5.958 pIm 5.958 + + + +If neither the acid or the base type is specified, for example, .. code-block:: LAMMPS @@ -127,11 +138,11 @@ neither the acid or the base type is specified, for example, the fix simply inserts or deletes an ion pair of a free cation (atom type 4) and a free anion (atom type 5) as done in a conventional -grand-canonical MC simulation. +grand-canonical MC simulation. Multivalent ions can be inserted (deleted) by using the *onlysalt* keyword. The fix is compatible with LAMMPS sub-packages such as *molecule* or -*rigid*. That said, the acid and base particles can be part of larger +*rigid*. The acid and base particles can be part of larger molecules or rigid bodies. Free ions that are inserted to or deleted from the system must be defined as single particles (no bonded interactions allowed) and cannot be part of larger molecules or rigid @@ -153,14 +164,14 @@ Langevin thermostat: fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp -The chemical potential units (e.g. pH) are in the standard log10 +The units of pH, pKa, pKb, pIp, pIm are considered to be in the standard -log10 representation assuming reference concentration :math:`\rho_0 = -\mathrm{mol}/\mathrm{l}`. Therefore, to perform the internal unit -conversion, the length (in nanometers) of the LAMMPS unit length must be -specified via *lunit_nm* (default is set to the Bjerrum length in water -at room temperature *lunit_nm* = 0.71nm). For example, in the dilute -ideal solution limit, the concentration of free ions will be -:math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. +\mathrm{mol}/\mathrm{l}`. For example, in the dilute +ideal solution limit, the concentration of free cations will be +:math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. To perform the internal unit +conversion, the the value of the LAMMPS unit length must be +specified in nanometers via *lunit_nm*. The default value is set to the Bjerrum length in water +at room temperature (0.71 nm), *lunit_nm* = 0.71. The temperature used in MC acceptance probability is set by *temp*. This temperature should be the same as the temperature set by the molecular @@ -171,10 +182,10 @@ thermostat fix-ID is *fT*. The inserted particles attain a random velocity corresponding to the specified temperature. Using *tempfixid* overrides any fixed temperature set by *temp*. -The *xrd* keyword can be used to restrict the inserted/deleted +The *rxd* keyword can be used to restrict the inserted/deleted counterions to a specific radial distance from an acid or base particle that is currently participating in a reaction. This can be used to -simulate more realist reaction dynamics. If *xrd* = 0 or *xrd* > *L* / +simulate more realist reaction dynamics. If *rxd* = 0 or *rxd* > *L* / 2, where *L* is the smallest box dimension, the radial restriction is automatically turned off and free ion can be inserted or deleted anywhere in the simulation box. @@ -258,18 +269,18 @@ Default pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs = 14.0; acid_type = -1; base_type = -1; lunit_nm = 0.71; temp = 1.0; nevery = -100; nmc = 100; xrd = 0; seed = 0; tag = no; onlysalt = no, pmcmoves = +100; nmc = 100; rxd = 0; seed = 0; tag = no; onlysalt = no, pmcmoves = [1/3, 1/3, 1/3], group-ID = all ---------- .. _Curk1: -**(Curk1)** T. Curk, J. Yuan, and E. Luijten, "Coarse-grained simulation of charge regulation using LAMMPS", preprint (2021). +**(Curk1)** T. Curk, J. Yuan, and E. Luijten, "Accelerated simulation method for charge regulation effects", JCP 156 (2022). .. _Curk2: -**(Curk2)** T. Curk and E. Luijten, "Charge-regulation effects in nanoparticle self-assembly", PRL (2021) +**(Curk2)** T. Curk and E. Luijten, "Charge-regulation effects in nanoparticle self-assembly", PRL 126 (2021) .. _Landsgesell: diff --git a/doc/src/fix_numdiff.rst b/doc/src/fix_numdiff.rst index b0686f471f..b5fdfb12e6 100644 --- a/doc/src/fix_numdiff.rst +++ b/doc/src/fix_numdiff.rst @@ -13,16 +13,15 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * numdiff = style name of this fix command * Nevery = calculate force by finite difference every this many timesteps -* delta = finite difference displacement length (distance units) +* delta = size of atom displacements (distance units) Examples """""""" .. code-block:: LAMMPS - fix 1 all numdiff 1 0.0001 fix 1 all numdiff 10 1e-6 - fix 1 all numdiff 100 0.01 + fix 1 movegroup numdiff 100 0.01 Description """"""""""" @@ -67,16 +66,17 @@ by two times *delta*. The cost of each energy evaluation is essentially the cost of an MD timestep. Thus invoking this fix once for a 3d system has a cost - of 6N timesteps, where N is the total number of atoms in the system - (assuming all atoms are included in the group). So this fix can be - very expensive to use for large systems. + of 6N timesteps, where N is the total number of atoms in the system. + So this fix can be very expensive to use for large systems. + One expedient alternative is to define the fix for a group containing + only a few atoms. ---------- The *Nevery* argument specifies on what timesteps the force will be used calculated by finite difference. -The *delta* argument specifies the positional displacement each +The *delta* argument specifies the size of the displacement each atom will undergo. ---------- @@ -93,7 +93,12 @@ This fix produces a per-atom array which can be accessed by various the force on each atom as calculated by finite difference. The per-atom values can only be accessed on timesteps that are multiples of *Nevery* since that is when the finite difference forces are -calculated. +calculated. See the examples in *examples/numdiff* directory +to see how this fix can be used to directly compare with +the analytic forces computed by LAMMPS. + +The array values calculated by this compute +will be in force :doc:`units `. No parameter of this fix can be used with the *start/stop* keywords of the :doc:`run ` command. This fix is invoked during :doc:`energy @@ -108,7 +113,7 @@ was built with that package. See the :doc:`Build package ` page Related commands """""""""""""""" -:doc:`dynamical_matrix `, +:doc:`dynamical_matrix `, :doc:`fix numdiff/virial `, Default """"""" diff --git a/doc/src/fix_numdiff_virial.rst b/doc/src/fix_numdiff_virial.rst new file mode 100644 index 0000000000..647a0e592a --- /dev/null +++ b/doc/src/fix_numdiff_virial.rst @@ -0,0 +1,115 @@ +.. index:: fix numdiff/virial + +fix numdiff/virial command +========================== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID numdiff/virial Nevery delta + +* ID, group-ID are documented in :doc:`fix ` command +* numdiff/virial = style name of this fix command +* Nevery = calculate virial by finite difference every this many timesteps +* delta = magnitude of strain fields (dimensionless) + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all numdiff/stress 10 1e-6 + +Description +""""""""""" + +Calculate the virial stress tensor through a finite difference calculation of +energy versus strain. These values can be compared to the analytic virial +tensor computed by pair styles, bond styles, etc. This can be useful for +debugging or other purposes. The specified group must be "all". + +This fix applies linear strain fields of magnitude *delta* to all the +atoms relative to a point at the center of the box. The +strain fields are in six different directions, corresponding to the +six Cartesian components of the stress tensor defined by LAMMPS. +For each direction it applies the strain field in both the positive +and negative senses, and the new energy of the entire system +is calculated after each. The difference in these two energies +divided by two times *delta*, approximates the corresponding +component of the virial stress tensor, after applying +a suitable unit conversion. + +.. note:: + + It is important to choose a suitable value for delta, the magnitude of + strains that are used to generate finite difference + approximations to the exact virial stress. For typical systems, a value in + the range of 1 part in 1e5 to 1e6 will be sufficient. + However, the best value will depend on a multitude of factors + including the stiffness of the interatomic potential, the thermodynamic + state of the material being probed, and so on. The only way to be sure + that you have made a good choice is to do a sensitivity study on a + representative atomic configuration, sweeping over a wide range of + values of delta. If delta is too small, the output values will vary + erratically due to truncation effects. If delta is increased beyond a + certain point, the output values will start to vary smoothly with + delta, due to growing contributions from higher order derivatives. In + between these two limits, the numerical virial values should be largely + independent of delta. + +---------- + +The *Nevery* argument specifies on what timesteps the force will +be used calculated by finite difference. + +The *delta* argument specifies the size of the displacement each +atom will undergo. + +---------- + +Restart, fix_modify, output, run start/stop, minimize info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +No information about this fix is written to :doc:`binary restart files +`. None of the :doc:`fix_modify ` options are +relevant to this fix. + +This fix produces a global vector which can be accessed by various +:doc:`output commands `, which stores the components of +the virial stress tensor as calculated by finite difference. The +global vector can only be accessed on timesteps that are multiples +of *Nevery* since that is when the finite difference virial is +calculated. See the examples in *examples/numdiff* directory +to see how this fix can be used to directly compare with +the analytic virial stress tensor computed by LAMMPS. + +The order of the virial stress tensor components is *xx*, *yy*, *zz*, +*yz*, *xz*, and *xy*, consistent with Voigt notation. Note that +the vector produced by :doc:`compute pressure ` +uses a different ordering, with *yz* and *xy* swapped. + +The vector values calculated by this compute are +"intensive". The vector values will be in pressure +:doc:`units `. + +No parameter of this fix can be used with the *start/stop* keywords of +the :doc:`run ` command. This fix is invoked during :doc:`energy +minimization `. + +Restrictions +"""""""""""" + +This fix 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 numdiff `, :doc:`compute pressure ` + +Default +""""""" + +none diff --git a/doc/src/fix_nvt_sllod.rst b/doc/src/fix_nvt_sllod.rst index 4bb4478991..04e60057a1 100644 --- a/doc/src/fix_nvt_sllod.rst +++ b/doc/src/fix_nvt_sllod.rst @@ -66,7 +66,10 @@ equivalent to Newton's equations of motion for shear flow by :ref:`(Evans and Morriss) `. They were later shown to generate the desired velocity gradient and the correct production of work by stresses for all forms of homogeneous flow by :ref:`(Daivis and Todd) -`. As implemented in LAMMPS, they are coupled to a +`. +The LAMMPS implementation corresponds to the p-SLLOD variant +of SLLOD. :ref:`(Edwards) `. +The equations of motion are coupled to a Nose/Hoover chain thermostat in a velocity Verlet formulation, closely following the implementation used for the :doc:`fix nvt ` command. @@ -180,6 +183,10 @@ Same as :doc:`fix nvt `, except tchain = 1. **(Daivis and Todd)** Daivis and Todd, J Chem Phys, 124, 194103 (2006). +.. _Edwards: + +**(Edwards)** Edwards, Baig, and Keffer, J Chem Phys 124, 194104 (2006). + .. _Daivis-sllod: **(Daivis and Todd)** Daivis and Todd, Nonequilibrium Molecular Dynamics (book), diff --git a/doc/src/fix_viscosity.rst b/doc/src/fix_viscosity.rst index e077af19f4..204e435d6e 100644 --- a/doc/src/fix_viscosity.rst +++ b/doc/src/fix_viscosity.rst @@ -108,10 +108,11 @@ fluid, in appropriate units. See the :ref:`Muller-Plathe paper An alternative method for calculating a viscosity is to run a NEMD simulation, as described on the :doc:`Howto nemd ` doc page. -NEMD simulations deform the simulation box via the :doc:`fix deform ` command. Thus they cannot be run on a charged -system using a :doc:`PPPM solver ` since PPPM does not -currently support non-orthogonal boxes. Using fix viscosity keeps the -box orthogonal; thus it does not suffer from this limitation. +NEMD simulations deform the simulation box via the :doc:`fix deform ` command. + +Some features or combination of settings in LAMMPS do not support +non-orthogonal boxes. Using fix viscosity keeps the box orthogonal; +thus it does not suffer from these limitations. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/package.rst b/doc/src/package.rst index 2cf772ea5a..437601dc60 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -460,7 +460,7 @@ using *neigh/thread* *on*, a full neighbor list must also be used. Using is turned on by default only when there are 16K atoms or less owned by an MPI rank and when using a full neighbor list. Not all KOKKOS-enabled potentials support this keyword yet, and only thread over atoms. Many -simple pair-wise potentials such as Lennard-Jones do support threading +simple pairwise potentials such as Lennard-Jones do support threading over both atoms and neighbors. The *newton* keyword sets the Newton flags for pairwise and bonded diff --git a/doc/src/pair_charmm.rst b/doc/src/pair_charmm.rst index d45ef58060..e1469ae323 100644 --- a/doc/src/pair_charmm.rst +++ b/doc/src/pair_charmm.rst @@ -119,7 +119,7 @@ name are the older, original LAMMPS implementations. They compute the LJ and Coulombic interactions with an energy switching function (esw, shown in the formula below as S(r)), which ramps the energy smoothly to zero between the inner and outer cutoff. This can cause -irregularities in pair-wise forces (due to the discontinuous second +irregularities in pairwise forces (due to the discontinuous second derivative of energy at the boundaries of the switching region), which in some cases can result in detectable artifacts in an MD simulation. diff --git a/doc/src/pair_dpd.rst b/doc/src/pair_dpd.rst index 8a8b35e50a..8c61c789a6 100644 --- a/doc/src/pair_dpd.rst +++ b/doc/src/pair_dpd.rst @@ -50,7 +50,7 @@ Style *dpd* computes a force field for dissipative particle dynamics Style *dpd/tstat* invokes a DPD thermostat on pairwise interactions, which is equivalent to the non-conservative portion of the DPD force -field. This pair-wise thermostat can be used in conjunction with any +field. This pairwise thermostat can be used in conjunction with any :doc:`pair style `, and in leiu of per-particle thermostats like :doc:`fix langevin ` or ensemble thermostats like Nose Hoover as implemented by :doc:`fix nvt `. To use diff --git a/doc/src/pair_harmonic_cut.rst b/doc/src/pair_harmonic_cut.rst new file mode 100644 index 0000000000..877d2d97ff --- /dev/null +++ b/doc/src/pair_harmonic_cut.rst @@ -0,0 +1,90 @@ +.. index:: pair_style harmonic/cut +.. index:: pair_style harmonic/cut/omp + +pair_style harmonic/cut command +=============================== + +Accelerator Variants: *harmonic/cut/omp* + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style style + +* style = *harmonic/cut* + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style harmonic/cut 2.5 + pair_coeff * * 0.2 2.0 + pair_coeff 1 1 0.5 2.5 + +Description +""""""""""" + +Style *harmonic/cut* computes pairwise repulsive-only harmonic interactions with the formula + +.. math:: + + E = k (r_c - r)^2 \qquad r < r_c + +:math:`r_c` is the cutoff. + +The following coefficients must be defined for each pair of atoms +types via the :doc:`pair_coeff ` command as in the examples +above, or in the data file or restart files read by the +:doc:`read_data ` or :doc:`read_restart ` +commands: + +* :math:`k` (energy units) +* :math:`r_c` (distance units) + +---------- + +.. include:: accel_styles.rst + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +For atom type pairs I,J and I != J, the :math:`k` and :math:`r_c` +coefficients can be mixed. The default mix value is *geometric*. +See the "pair_modify" command for details. + +Since the potential is zero at and beyond the cutoff parameter by +construction, there is no need to support support the :doc:`pair_modify +` shift or tail options for the energy and pressure of the +pair interaction. + +These pair styles write their information to :doc:`binary restart files `, +so pair_style and pair_coeff commands do not need to be specified in an input script +that reads a restart file. + +These pair styles can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. They do not support the +*inner*, *middle*, *outer* keywords. + +---------- + +Restrictions +"""""""""""" + +The *harmonic/cut* pair style is only enabled if LAMMPS was +built with the EXTRA-PAIR package. +See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff ` + +Default +""""""" + +none diff --git a/doc/src/pair_ilp_graphene_hbn.rst b/doc/src/pair_ilp_graphene_hbn.rst index c188b4011e..04b8a4ddde 100644 --- a/doc/src/pair_ilp_graphene_hbn.rst +++ b/doc/src/pair_ilp_graphene_hbn.rst @@ -159,6 +159,8 @@ Related commands :doc:`pair_none `, :doc:`pair_style hybrid/overlay `, :doc:`pair_style drip `, +:doc:`pair_style ilp_tmd `, +:doc:`pair_style saip_metal `, :doc:`pair_style pair_kolmogorov_crespi_z `, :doc:`pair_style pair_kolmogorov_crespi_full `, :doc:`pair_style pair_lebedeva_z `, diff --git a/doc/src/pair_ilp_tmd.rst b/doc/src/pair_ilp_tmd.rst new file mode 100644 index 0000000000..1ee619ec91 --- /dev/null +++ b/doc/src/pair_ilp_tmd.rst @@ -0,0 +1,157 @@ +.. index:: pair_style ilp/tmd + +pair_style ilp/tmd command +=================================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style [hybrid/overlay ...] ilp/tmd cutoff tap_flag + +* cutoff = global cutoff (distance units) +* tap_flag = 0/1 to turn off/on the taper function + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style hybrid/overlay ilp/tmd 16.0 1 + pair_coeff * * ilp/tmd TMD.ILP Mo S S + + pair_style hybrid/overlay sw/mod sw/mod ilp/tmd 16.0 + pair_coeff * * sw/mod 1 tmd.sw.mod Mo S S NULL NULL NULL + pair_coeff * * sw/mod 2 tmd.sw.mod NULL NULL NULL Mo S S + pair_coeff * * ilp/tmd TMD.ILP Mo S S Mo S S + +Description +""""""""""" + +The *ilp/tmd* style computes the registry-dependent interlayer +potential (ILP) potential for transition metal dichalcogenides (TMD) +as described in :ref:`(Ouyang7) `. + +.. math:: + + E = & \frac{1}{2} \sum_i \sum_{j \neq i} V_{ij} \\ + V_{ij} = & {\rm Tap}(r_{ij})\left \{ e^{-\alpha (r_{ij}/\beta -1)} + \left [ \epsilon + f(\rho_{ij}) + f(\rho_{ji})\right ] - + \frac{1}{1+e^{-d\left [ \left ( r_{ij}/\left (s_R \cdot r^{eff} \right ) \right )-1 \right ]}} + \cdot \frac{C_6}{r^6_{ij}} \right \}\\ + \rho_{ij}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_i)^2 \\ + \rho_{ji}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_j)^2 \\ + f(\rho) = & C e^{ -( \rho / \delta )^2 } \\ + {\rm Tap}(r_{ij}) = & 20\left ( \frac{r_{ij}}{R_{cut}} \right )^7 - + 70\left ( \frac{r_{ij}}{R_{cut}} \right )^6 + + 84\left ( \frac{r_{ij}}{R_{cut}} \right )^5 - + 35\left ( \frac{r_{ij}}{R_{cut}} \right )^4 + 1 + +Where :math:`\mathrm{Tap}(r_{ij})` is the taper function which provides +a continuous cutoff (up to third derivative) for interatomic separations +larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn `. + +It is important to include all the pairs to build the neighbor list for +calculating the normals. + +.. note:: + + Since each MX2 (M = Mo, W and X = S, Se Te) layer contains two + sub-layers of X atoms and one sub-layer of M atoms, the definition of the + normal vectors used for graphene and h-BN is no longer valid for TMDs. + In :ref:`(Ouyang7) `, a new definition is proposed, where for + each atom `i`, its six nearest neighboring atoms belonging to the same + sub-layer are chosen to define the normal vector `{\bf n}_i`. + +The parameter file (e.g. TMD.ILP), is intended for use with *metal* +:doc:`units `, with energies in meV. Two additional parameters, +*S*, and *rcut* are included in the parameter file. *S* is designed to +facilitate scaling of energies. *rcut* is designed to build the neighbor +list for calculating the normals for each atom pair. + +.. note:: + + The parameters presented in the parameter file (e.g. TMD.ILP), + are fitted with taper function by setting the cutoff equal to 16.0 + Angstrom. Using different cutoff or taper function should be careful. + These parameters provide a good description in both short- and long-range + interaction regimes. This feature is essential for simulations in high pressure + regime (i.e., the interlayer distance is smaller than the equilibrium + distance). The benchmark tests and comparison of these parameters can + be found in :ref:`(Ouyang7) `. + +This potential must be used in combination with hybrid/overlay. +Other interactions can be set to zero using pair_style *none*\ . + +This pair style tallies a breakdown of the total interlayer potential +energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 2. +The 2 values correspond to the following sub-categories: + +1. *E_vdW* = vdW (attractive) energy +2. *E_Rep* = Repulsive energy + +To print these quantities to the log file (with descriptive column +headings) the following commands could be included in an input script: + +.. code-block:: LAMMPS + + compute 0 all pair ilp/tmd + variable Evdw equal c_0[1] + variable Erep equal c_0[2] + thermo_style custom step temp epair v_Erep v_Evdw + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This pair style does not support the pair_modify mix, shift, table, and +tail options. + +This pair style does not write their information to binary restart +files, since it is stored in potential files. Thus, you need to +re-specify the pair_style and pair_coeff commands in an input script +that reads a restart file. + +Restrictions +"""""""""""" + +This pair style is part of the INTERLAYER package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` page for more info. + +This pair style requires the newton setting to be *on* for pair +interactions. + +The TMD.ILP potential file provided with LAMMPS (see the potentials +directory) are parameterized for *metal* units. You can use this +potential with any LAMMPS units, but you would need to create your +BNCH.ILP potential file with coefficients listed in the appropriate +units, if your simulation does not use *metal* units. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, +:doc:`pair_none `, +:doc:`pair_style hybrid/overlay `, +:doc:`pair_style drip `, +:doc:`pair_style saip_metal `, +:doc:`pair_style ilp_graphene_hbn `, +:doc:`pair_style pair_kolmogorov_crespi_z `, +:doc:`pair_style pair_kolmogorov_crespi_full `, +:doc:`pair_style pair_lebedeva_z `, +:doc:`pair_style pair_coul_shield `. + +Default +""""""" + +tap_flag = 1 + + +---------- + +.. _Ouyang7: + +**(Ouyang7)** W. Ouyang, et al., J. Chem. Theory Comput. 17, 7237 (2021). diff --git a/doc/src/pair_python.rst b/doc/src/pair_python.rst index 35e07dbd11..65e1cd1611 100644 --- a/doc/src/pair_python.rst +++ b/doc/src/pair_python.rst @@ -164,7 +164,7 @@ Following the *LJCutMelt* example, here are the two functions: .. note:: The evaluation of scripted python code will slow down the - computation pair-wise interactions quite significantly. However, this + computation pairwise interactions quite significantly. However, this can be largely worked around through using the python pair style not for the actual simulation, but to generate tabulated potentials on the fly using the :doc:`pair_write ` command. Please see below diff --git a/doc/src/pair_saip_metal.rst b/doc/src/pair_saip_metal.rst new file mode 100644 index 0000000000..19e85d9416 --- /dev/null +++ b/doc/src/pair_saip_metal.rst @@ -0,0 +1,156 @@ +.. index:: pair_style saip/metal + +pair_style saip/metal command +=================================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style [hybrid/overlay ...] saip/metal cutoff tap_flag + +* cutoff = global cutoff (distance units) +* tap_flag = 0/1 to turn off/on the taper function + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style hybrid/overlay saip/metal 16.0 1 + pair_coeff * * saip/metal CHAu.ILP Au C H + + pair_style hybrid/overlay eam rebo saip/metal 16.0 + pair_coeff 1 1 eam Au_u3.eam Au NULL NULL + pair_coeff * * rebo CH.rebo NULL C H + pair_coeff * * saip/metal CHAu.ILP Au C H + +Description +""""""""""" + +The *saip/metal* style computes the registry-dependent interlayer +potential (ILP) potential for hetero-junctions formed with hexagonal +2D materials and metal surfaces, as described in :ref:`(Ouyang6) `. + +.. math:: + + E = & \frac{1}{2} \sum_i \sum_{j \neq i} V_{ij} \\ + V_{ij} = & {\rm Tap}(r_{ij})\left \{ e^{-\alpha (r_{ij}/\beta -1)} + \left [ \epsilon + f(\rho_{ij}) + f(\rho_{ji})\right ] - + \frac{1}{1+e^{-d\left [ \left ( r_{ij}/\left (s_R \cdot r^{eff} \right ) \right )-1 \right ]}} + \cdot \frac{C_6}{r^6_{ij}} \right \}\\ + \rho_{ij}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_i)^2 \\ + \rho_{ji}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_j)^2 \\ + f(\rho) = & C e^{ -( \rho / \delta )^2 } \\ + {\rm Tap}(r_{ij}) = & 20\left ( \frac{r_{ij}}{R_{cut}} \right )^7 - + 70\left ( \frac{r_{ij}}{R_{cut}} \right )^6 + + 84\left ( \frac{r_{ij}}{R_{cut}} \right )^5 - + 35\left ( \frac{r_{ij}}{R_{cut}} \right )^4 + 1 + +Where :math:`\mathrm{Tap}(r_{ij})` is the taper function which provides +a continuous cutoff (up to third derivative) for interatomic separations +larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn `. + +It is important to include all the pairs to build the neighbor list for +calculating the normals. + +.. note:: + + To account for the isotropic nature of the isolated gold atom + electron cloud, their corresponding normal vectors (`{\bf n}_i`) are + assumed to lie along the interatomic vector `{\bf r}_ij`. Notably, this + assumption is suitable for many bulk material surfaces, for + example, for systems possessing s-type valence orbitals or + metallic surfaces, whose valence electrons are mostly + delocalized, such that their Pauli repulsion with the electrons + of adjacent surfaces are isotropic. Caution should be used in + the case of very small gold contacts, for example, nano-clusters, + where edge effects may become relevant. + +The parameter file (e.g. CHAu.ILP), is intended for use with *metal* +:doc:`units `, with energies in meV. Two additional parameters, +*S*, and *rcut* are included in the parameter file. *S* is designed to +facilitate scaling of energies. *rcut* is designed to build the neighbor +list for calculating the normals for each atom pair. + +.. note:: + + The parameters presented in the parameter file (e.g. BNCH.ILP), + are fitted with taper function by setting the cutoff equal to 16.0 + Angstrom. Using different cutoff or taper function should be careful. + +This potential must be used in combination with hybrid/overlay. +Other interactions can be set to zero using pair_style *none*\ . + +This pair style tallies a breakdown of the total interlayer potential +energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 2. +The 2 values correspond to the following sub-categories: + +1. *E_vdW* = vdW (attractive) energy +2. *E_Rep* = Repulsive energy + +To print these quantities to the log file (with descriptive column +headings) the following commands could be included in an input script: + +.. code-block:: LAMMPS + + compute 0 all pair saip/metal + variable Evdw equal c_0[1] + variable Erep equal c_0[2] + thermo_style custom step temp epair v_Erep v_Evdw + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This pair style does not support the pair_modify mix, shift, table, and +tail options. + +This pair style does not write their information to binary restart +files, since it is stored in potential files. Thus, you need to +re-specify the pair_style and pair_coeff commands in an input script +that reads a restart file. + +Restrictions +"""""""""""" + +This pair style is part of the INTERLAYER package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` page for more info. + +This pair style requires the newton setting to be *on* for pair +interactions. + +The CHAu.ILP potential file provided with LAMMPS (see the potentials +directory) are parameterized for *metal* units. You can use this +potential with any LAMMPS units, but you would need to create your +BNCH.ILP potential file with coefficients listed in the appropriate +units, if your simulation does not use *metal* units. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, +:doc:`pair_none `, +:doc:`pair_style hybrid/overlay `, +:doc:`pair_style drip `, +:doc:`pair_style ilp_tmd `, +:doc:`pair_style ilp_graphene_hbn `, +:doc:`pair_style pair_kolmogorov_crespi_z `, +:doc:`pair_style pair_kolmogorov_crespi_full `, +:doc:`pair_style pair_lebedeva_z `, +:doc:`pair_style pair_coul_shield `. + +Default +""""""" + +tap_flag = 1 + + +---------- + +.. _Ouyang6: + +**(Ouyang6)** W. Ouyang, O. Hod, and R. Guerra, J. Chem. Theory Comput. 17, 7215 (2021). diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 4bb3c90a8d..f2afe959f3 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -154,10 +154,10 @@ accelerated styles exist. * :doc:`coul/wolf/cs ` - Coulomb via Wolf potential with core/shell adjustments * :doc:`dpd ` - dissipative particle dynamics (DPD) * :doc:`dpd/ext ` - generalized force field for DPD -* :doc:`dpd/ext/tstat ` - pair-wise DPD thermostatting with generalized force field +* :doc:`dpd/ext/tstat ` - pairwise DPD thermostatting with generalized force field * :doc:`dpd/fdt ` - DPD for constant temperature and pressure * :doc:`dpd/fdt/energy ` - DPD for constant energy and enthalpy -* :doc:`dpd/tstat ` - pair-wise DPD thermostatting +* :doc:`dpd/tstat ` - pairwise DPD thermostatting * :doc:`dsmc ` - Direct Simulation Monte Carlo (DSMC) * :doc:`e3b ` - Explicit-three body (E3B) water model * :doc:`drip ` - Dihedral-angle-corrected registry-dependent interlayer potential (DRIP) @@ -183,10 +183,12 @@ accelerated styles exist. * :doc:`gran/hooke/history ` - granular potential without history effects * :doc:`gw ` - Gao-Weber potential * :doc:`gw/zbl ` - Gao-Weber potential with a repulsive ZBL core +* :doc:`harmonic/cut ` - repulsive-only harmonic potential * :doc:`hbond/dreiding/lj ` - DREIDING hydrogen bonding LJ potential * :doc:`hbond/dreiding/morse ` - DREIDING hydrogen bonding Morse potential * :doc:`hdnnp ` - High-dimensional neural network potential * :doc:`ilp/graphene/hbn ` - registry-dependent interlayer potential (ILP) +* :doc:`ilp/tmd ` - interlayer potential (ILP) potential for transition metal dichalcogenides (TMD) * :doc:`kim ` - interface to potentials provided by KIM project * :doc:`kolmogorov/crespi/full ` - Kolmogorov-Crespi (KC) potential with no simplifications * :doc:`kolmogorov/crespi/z ` - Kolmogorov-Crespi (KC) potential with normals along z-axis @@ -304,6 +306,7 @@ accelerated styles exist. * :doc:`reaxff ` - ReaxFF potential * :doc:`rebo ` - second generation REBO potential of Brenner * :doc:`resquared ` - Everaers RE-Squared ellipsoidal potential +* :doc:`saip/metal ` - interlayer potential for hetero-junctions formed with hexagonal 2D materials and metal surfaces * :doc:`sdpd/taitwater/isothermal ` - smoothed dissipative particle dynamics for water at isothermal conditions * :doc:`smd/hertz ` - * :doc:`smd/tlsph ` - diff --git a/doc/src/pair_sw.rst b/doc/src/pair_sw.rst index d71999b2d4..0a6b284b96 100644 --- a/doc/src/pair_sw.rst +++ b/doc/src/pair_sw.rst @@ -29,8 +29,8 @@ Syntax .. parsed-literal:: *maxdelcs* value = delta1 delta2 (optional) - delta1 = The minimum thershold for cosine of three-body angle - delta2 = The maximum threshold for cosine of three-body angle + delta1 = The minimum thershold for the variation of cosine of three-body angle + delta2 = The maximum threshold for the variation of cosine of three-body angle Examples """""""" @@ -69,7 +69,7 @@ and K of atom I within a cutoff distance :math:`a `\sigma`. The *sw/mod* style is designed for simulations of materials when distinguishing three-body angles are necessary, such as borophene -and transition metal dichalcogenide, which cannot be described +and transition metal dichalcogenides, which cannot be described by the original code for the Stillinger-Weber potential. For instance, there are several types of angles around each Mo atom in `MoS_2`, and some unnecessary angle types should be excluded in the three-body interaction. @@ -99,7 +99,7 @@ This smoothly turns off the energy and force contributions for :math:`\left| \de It is suggested that :math:`\delta 1` and :math:`\delta_2` to be the value around :math:`0.5 \left| \cos \theta_1 - \cos \theta_2 \right|`, with :math:`\theta_1` and :math:`\theta_2` as the different types of angles around an atom. -For borophene and transition metal dichalcogenide, :math:`\delta_1 = 0.25` and :math:`\delta_2 = 0.35`. +For borophene and transition metal dichalcogenides, :math:`\delta_1 = 0.25` and :math:`\delta_2 = 0.35`. This value enables the cut-off function to exclude unnecessary angles in the three-body SW terms. .. note:: @@ -202,7 +202,7 @@ elements are the same. Thus the two-body parameters for Si interacting with C, comes from the SiCC entry. The three-body parameters can in principle be specific to the three elements of the configuration. In the literature, however, the three-body parameters -are usually defined by simple formulas involving two sets of pair-wise +are usually defined by simple formulas involving two sets of pairwise parameters, corresponding to the ij and ik pairs, where i is the center atom. The user must ensure that the correct combining rule is used to calculate the values of the three-body parameters for diff --git a/doc/src/pair_write.rst b/doc/src/pair_write.rst index 1d88137255..b62383cb7b 100644 --- a/doc/src/pair_write.rst +++ b/doc/src/pair_write.rst @@ -76,8 +76,10 @@ must be set before this command can be invoked. Due to how the pairwise force is computed, an inner value > 0.0 must be specified even if the potential has a finite value at r = 0.0. -For EAM potentials, the pair_write command only tabulates the -pairwise portion of the potential, not the embedding portion. +The *pair_write* command can only be used for pairwise additive +interactions for which a `Pair::single()` function can be and has +been implemented. This excludes for example manybody potentials +or TIP4P coulomb styles. Related commands """""""""""""""" diff --git a/doc/src/run_style.rst b/doc/src/run_style.rst index b4d1c22113..fd63c82b90 100644 --- a/doc/src/run_style.rst +++ b/doc/src/run_style.rst @@ -89,7 +89,7 @@ in its 3d FFTs. In this scenario, splitting your P total processors into 2 subsets of processors, P1 in the first partition and P2 in the second partition, can enable your simulation to run faster. This is because the long-range forces in PPPM can be calculated at the same -time as pair-wise and bonded forces are being calculated, and the FFTs +time as pairwise and bonded forces are being calculated, and the FFTs can actually speed up when running on fewer processors. To use this style, you must define 2 partitions where P1 is a multiple diff --git a/doc/src/third_order.rst b/doc/src/third_order.rst index f020511aad..b163844365 100644 --- a/doc/src/third_order.rst +++ b/doc/src/third_order.rst @@ -1,8 +1,11 @@ .. index:: third_order +.. index:: third_order/kk third_order command =================== +Accelerator Variants: third_order/kk + Syntax """""" @@ -49,6 +52,12 @@ If the style eskm is selected, the tensor will be using energy units of 10 J/mol These units conform to eskm style from the dynamical_matrix command, which will simplify operations using dynamical matrices with third order tensors. +---------- + +.. include:: accel_styles.rst + +---------- + Restrictions """""""""""" diff --git a/doc/utils/check-styles.py b/doc/utils/check-styles.py index 2ad75aeeda..4294f5a5bc 100755 --- a/doc/utils/check-styles.py +++ b/doc/utils/check-styles.py @@ -259,7 +259,7 @@ skip_pair = ('meam/c','lj/sf','reax/c') counter = 0 -counter += check_style('Commands_all.rst', doc_dir, ":doc:`(.+) <.+>`",command,'Command',suffix=False) +counter += check_style('Commands_all.rst', doc_dir, ":doc:`(.+) <.+>`",command,'Command',suffix=True) counter += check_style('Commands_compute.rst', doc_dir, ":doc:`(.+) `",compute,'Compute',suffix=True) counter += check_style('compute.rst', doc_dir, ":doc:`(.+) ` -",compute,'Compute',suffix=False) counter += check_style('Commands_fix.rst', doc_dir, ":doc:`(.+) `",fix,'Fix',skip=skip_fix,suffix=True) diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index fe1e40e8ba..18ae834078 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -52,8 +52,8 @@ aij aimd airebo Aj -ajs ajaramil +ajs akohlmey Aktulga al @@ -119,10 +119,10 @@ Appl Apu arallel arccos -arge Archlinux arcsin arg +arge args argv arrhenius @@ -149,9 +149,9 @@ atc AtC ATC athermal +athomps atime atimestep -athomps atm atomeye atomfile @@ -194,8 +194,8 @@ Baczewski Bagchi Bagi Bagnold +Baig Bajaj -Bkappa Bal balancer Balankura @@ -214,8 +214,8 @@ barostatting Barostatting Barrat Barros -Bartelt Bartels +Bartelt barycenter barye Bashford @@ -257,7 +257,6 @@ bigint Bij bilayer bilayers -biquadratic binsize binstyle binutils @@ -266,6 +265,7 @@ biomolecule Biomolecules Biophys Biosym +biquadratic bisectioning bispectrum Bispectrum @@ -276,6 +276,7 @@ bitrate bitrates Bitzek Bjerrum +Bkappa Blaise blanchedalmond blocksize @@ -314,14 +315,14 @@ Botu Bouguet Bourne boxcolor -boxlo boxhi -boxxlo +boxlo boxxhi -boxylo +boxxlo boxyhi -boxzlo +boxylo boxzhi +boxzlo bp bpclermont bpls @@ -421,13 +422,14 @@ Chaudhuri checkbox checkmark checkqeq +checksum chemistries Chemnitz Cheng Chenoweth chiral -ChiralIDs chiralIDs +ChiralIDs chirality Cho ChooseOffset @@ -498,12 +500,12 @@ cond conda Conda Condens -Connor conf config configfile configurational conformational +Connor ConstMatrix Contrib cooperativity @@ -560,14 +562,14 @@ cstring cstyle csvr ctrl -Ctypes ctypes +Ctypes cuda Cuda CUDA +cuFFT CuH Cui -cuFFT Cummins Curk Cusentino @@ -629,11 +631,11 @@ de dE De deallocated -decorrelation debye Debye Decius decompositions +decorrelation decrementing deeppink deepskyblue @@ -642,8 +644,8 @@ defn deformable del delaystep -DeleteIDs deleteIDs +DeleteIDs delflag Dellago delocalization @@ -668,6 +670,7 @@ Derlet Deserno Destree destructor +destructors detils Devanathan devel @@ -689,7 +692,7 @@ diagonalizers diagonalizing Diallo diblock -dichalcogenide +dichalcogenides Dickel diel Dietz @@ -702,8 +705,8 @@ Dihedrals dihydride Dij dimdim -dimensioned dimensionality +dimensioned dimgray dipolar dir @@ -728,10 +731,10 @@ dmg dmi dnf DNi -Dobson Dobnikar -Dodds +Dobson docenv +Dodds dodgerblue dof doi @@ -739,10 +742,10 @@ Donadio Donev dotc Doty +downarrow doxygen doxygenclass doxygenfunction -downarrow Doye Doyl dpd @@ -811,8 +814,8 @@ eco ecoul ecp Ecut -EdgeIDs edgeIDs +EdgeIDs edihed edim edip @@ -824,8 +827,8 @@ ee Eebt ees eFF -efield effm +efield eflag eflux eg @@ -834,10 +837,10 @@ ehex eHEX Ei eigen +eigendecomposition eigensolve eigensolver eigensolvers -eigendecomposition eigenvalue eigenvalues eigenvector @@ -912,15 +915,15 @@ equilibrated equilibrates equilibrating equilibration -Equilibria equilibria +Equilibria equilization equipartitioning -Ercolessi -Erdmann eradius erate erc +Ercolessi +Erdmann erf erfc Erhart @@ -930,10 +933,10 @@ erotate errno Ertas ervel -Espanol -Eshelby eshelby +Eshelby eskm +Espanol esph estretch esu @@ -948,20 +951,20 @@ etol etot etotal etube -Eulerian eulerian +Eulerian eulerimplicit Europhys ev eV +eval +evals evalue Evanseck evdwl -evector evec evecs -eval -evals +evector Everaers Evgeny evirials @@ -990,13 +993,13 @@ fbMC Fc fcc fcm -Fd fd +Fd fdotr fdt +fe Fehlberg Fellinger -fe femtosecond femtoseconds fene @@ -1010,6 +1013,7 @@ fexternal Fexternal ffield ffl +fflush ffmpeg FFmpeg ffplay @@ -1030,11 +1034,14 @@ filename Filename filenames Filenames -Fily fileper filesystem +filesystems +Fily Fincham Finchham +fingerprintconstants +fingerprintsperelement Finnis Fiorin fixID @@ -1073,8 +1080,8 @@ forestgreen formatarg formulae Forschungszentrum -Fortran fortran +Fortran Fosado fourier fp @@ -1096,6 +1103,7 @@ fstyle fsw ftm ftol +fuer fugacity Fumi func @@ -1103,7 +1111,6 @@ funcs functionalities functionals funroll -fuer fx fy fz @@ -1138,12 +1145,13 @@ Geier gencode georg Georg +germain Germann Germano gerolf Gerolf -getrusage Gershgorin +getrusage getter gettimeofday gewald @@ -1220,8 +1228,8 @@ gsmooth gstyle GTL Gubbins -Guericke Guenole +Guericke gui Gumbsch Gunsteren @@ -1297,7 +1305,6 @@ histogrammed histogramming hma hmaktulga -hplanck hoc Hochbruck Hofling @@ -1314,6 +1321,7 @@ howto Howto Hoy Hoyt +hplanck Hs hstyle html @@ -1344,8 +1352,8 @@ hyperspherical hysteretic hz IAP -Ibanez iatom +Ibanez ibar ibm icc @@ -1436,8 +1444,8 @@ ipi ipp Ippolito IPv -IPython ipython +IPython Isele isenthalpic ish @@ -1453,8 +1461,8 @@ isotropically isovolume Isralewitz iter -iters iteratively +iters Ith Itsets itype @@ -1569,6 +1577,7 @@ ke KE Keblinski Keefe +Keffer keflag Keir Kelchner @@ -1596,8 +1605,8 @@ KMP kmu Knizhnik knl -Kofke kofke +Kofke Kohlmeyer Kohn kokkos @@ -1649,15 +1658,15 @@ Lackmann Ladd lagrangian lambdai -lamda LambdaLanczos +lamda lammps Lammps LAMMPS lammpsplot lammpsplugin -Lampis Lamoureux +Lampis Lanczos Lande Landron @@ -1670,8 +1679,8 @@ larentzos Larentzos Laroche lars -LATBOLTZ latboltz +LATBOLTZ latencies Latour latourr @@ -1808,6 +1817,7 @@ lsfftw ltbbmalloc Lua lubricateU +lucas lucy Luding Luijten @@ -1826,13 +1836,13 @@ Lyulin lz lzma Maaravi -MACHDYN machdyn +MACHDYN Mackay Mackrodt +MacOS Macromolecules macroparticle -MacOS Madura Magda Magdeburg @@ -1916,8 +1926,8 @@ mc McLachlan md mdf -MDI mdi +MDI mdpd mDPD meam @@ -1941,8 +1951,8 @@ Mei Melchor Meloni Melrose -Mem mem +Mem memalign MEMALIGN membered @@ -1956,10 +1966,10 @@ Merz meshless meso mesocnt -MESODPD mesodpd -MESONT +MESODPD mesont +MESONT mesoparticle mesoscale mesoscopic @@ -1994,8 +2004,8 @@ Militzer Minary mincap Mindlin -minhbonds mingw +minhbonds minima minimizations minimizer @@ -2094,6 +2104,7 @@ Muccioli mui Mukherjee Mulders +Müller mult multi multibody @@ -2122,7 +2133,6 @@ muVT mux muy muz -Müller mv mV Mvapich @@ -2142,9 +2152,9 @@ nabla Nagaosa Nakano nall +namedtuple namespace namespaces -namedtuple nan NaN Nandor @@ -2160,8 +2170,8 @@ nanometer nanometers nanoparticle nanoparticles -Nanotube nanotube +Nanotube nanotubes Narulkar nasa @@ -2197,8 +2207,8 @@ ncount nd ndescriptors ndihedrals -ndihedraltypes Ndihedraltype +ndihedraltypes Ndirango ndof Ndof @@ -2210,9 +2220,9 @@ Neel Neelov Negre nelem -nelems Nelement Nelements +nelems nemd netcdf netstat @@ -2246,8 +2256,8 @@ Nicklas Niklasson Nikolskiy nimpropers -nimpropertypes Nimpropertype +nimpropertypes Ninteger NiO Nissila @@ -2261,8 +2271,8 @@ nktv nl nlayers nlen -Nlines nlines +Nlines nlo nlocal Nlocal @@ -2270,16 +2280,16 @@ Nlog nlp nm Nm -Nmax nmax +Nmax nmc -Nmin nmin +Nmin Nmols nn nnodes -Nocedal nO +Nocedal nocite nocoeff nodeless @@ -2332,11 +2342,11 @@ Nrho Nroff nrow nrun +ns Ns Nsample Nskip Nspecies -ns nsq Nstart nstats @@ -2345,9 +2355,9 @@ Nsteplast Nstop nsub Nswap +nt Nt Ntable -nt ntheta nthreads ntimestep @@ -2390,11 +2400,11 @@ ocl octahedral octants Ohara +O'Hearn ohenrich ok Okabe Okamoto -O'Hearn O'Keefe OKeefe oldlace @@ -2452,8 +2462,8 @@ overdamped overlayed Ovito oxdna -oxrna oxDNA +oxrna oxRNA packings padua @@ -2502,7 +2512,6 @@ pc pchain Pchain pcmoves -pmcmoves Pdamp pdb pdf @@ -2561,13 +2570,16 @@ Pieniazek Pieter pIm pimd -pIp Piola +pIp Pisarev Pishevar Pitera pj pjintve +pKa +pKb +pKs planeforce Plathe Plimpton @@ -2576,10 +2588,8 @@ ploop PloS plt plumedfile -pKa -pKb -pKs pmb +pmcmoves Pmolrotate Pmoltrans pN @@ -2601,8 +2611,8 @@ polydisperse polydispersity polyelectrolyte polyhedra -polymorphism Polym +polymorphism popen Popov popstore @@ -2618,11 +2628,12 @@ Potapkin potin Pourtois powderblue +PowerShell ppn pppm -prd Prakash Praprotnik +prd pre Pre prec @@ -2639,14 +2650,15 @@ Priya proc Proc procs -Prony progguide +Prony ps Ps pscreen pscrozi pseudodynamics pseudopotential +pSp Pstart Pstop pstyle @@ -2670,8 +2682,8 @@ px Px pxx Pxx -Pxy pxy +Pxy pxz py Py @@ -2688,13 +2700,13 @@ Pyy pyz pz Pz -Pzz pzz +Pzz qbmsst qcore qdist -qE qe +qE qeff qelectron qeq @@ -2770,15 +2782,15 @@ RDideal rdx reacter Readline -realTypeMap -real_t README +real_t realtime +realTypeMap reamin reax -REAXFF -ReaxFF reaxff +ReaxFF +REAXFF rebo recurse recursing @@ -2806,8 +2818,8 @@ Rensselaer reparameterizing repo representable -Reproducibility reproducibility +Reproducibility repuls reqid rescale @@ -2925,13 +2937,14 @@ Runge runtime Rutuparna rx +rxd rxnave rxnsum ry -rz Ryckaert Rycroft Rydbergs +rz Rz Sabry saddlebrown @@ -2941,6 +2954,7 @@ safezone Safran Sagui Saidi +saip Salanne Salles sandia @@ -2964,9 +2978,9 @@ Schimansky Schiotz Schlitter Schmid -Schratt Schoen Schotte +Schratt Schulten Schunk Schuring @@ -3004,6 +3018,7 @@ Setmask setpoint setvel sfftw +sfree Sg Shan Shanno @@ -3021,8 +3036,8 @@ Shiga Shinoda Shiomi shlib -SHM shm +SHM shockvel shrinkexceed Shugaev @@ -3141,10 +3156,10 @@ stepwise Stesmans Stillinger stk -Stockmayer -Stoddard stochastically stochasticity +Stockmayer +Stoddard stoichiometric stoichiometry Stokesian @@ -3163,6 +3178,7 @@ Streiz strerror strided strietz +stringstreams strmatch strncmp strstr @@ -3204,8 +3220,8 @@ Swiler Swinburne Swol Swope -Sx sx +Sx sy Sy symplectic @@ -3214,8 +3230,8 @@ sys sysdim Syst systemd -Sz sz +Sz Tabbernor tabinner Tadmor @@ -3262,9 +3278,9 @@ tfmc tfMC tgnpt tgnvt +th Thakkar Thaokar -th thb thei Theodorou @@ -3322,11 +3338,11 @@ Tmin tmp tN Tobias +Toennies Tohoku tokenizer tokyo tol -Toennies tomic toolchain topologies @@ -3398,10 +3414,12 @@ twojmax Tx txt Tyagi +typeargs +typedefs typeI typeJ typeN -typeargs +typesafe Tz Tzou ub @@ -3419,8 +3437,8 @@ uk ul ulb Uleft -uloop Ulomek +uloop ulsph Ultrafast uMech @@ -3485,6 +3503,7 @@ Valuev Vanden Vandenbrande Vanduyfhuys +varargs varavg Varshalovich Varshney @@ -3578,10 +3597,10 @@ vzcm vzi Waals Wadley -Waroquier wallstyle walltime Waltham +Waroquier wavepacket wB Wbody @@ -3599,12 +3618,12 @@ whitesmoke whitespace Wi Wicaksono -Widom widom +Widom Wijk Wikipedia -Wildcard wildcard +Wildcard wildcards Winkler Wirnsberger @@ -3618,12 +3637,12 @@ Worley Wriggers Wuppertal Wurtzite -Wysocki www wx Wx wy Wy +Wysocki wz Wz xa @@ -3671,10 +3690,10 @@ xyz xz xzhou yaff -yaml -Yanxon YAFF Yamada +yaml +Yanxon Yaser Yazdani Ybar @@ -3705,14 +3724,15 @@ Yuya yx yy yz +Zagaceta Zannoni Zavattieri zbl ZBL Zc zcm -Zeeman zeeman +Zeeman Zemer Zepeda zflag @@ -3726,29 +3746,23 @@ zi Zi ziegenhain Ziegenhain +zincblende Zj zlim zlo +Zm zmax zmin zmq zN zs zst +Zstandard +zstd +Zstd zsu zu zx zy Zybin zz -Zm -PowerShell -filesystems -fingerprintconstants -fingerprintsperelement -Zagaceta -zincblende -Zstandard -Zstd -zstd -checksum diff --git a/examples/PACKAGES/cgdna/examples/test.sh b/examples/PACKAGES/cgdna/examples/test.sh index 795be9ef88..152047b94b 100755 --- a/examples/PACKAGES/cgdna/examples/test.sh +++ b/examples/PACKAGES/cgdna/examples/test.sh @@ -1,20 +1,24 @@ #! /bin/bash -DATE='2Jul21' -LMPDIR=/Users/ohenrich/Work/code/lammps +DATE='14Dec21' +TOL=1e-8 +LMPDIR=/Users/ohenrich/Work/code/lammps SRCDIR=$LMPDIR/src EXDIR=$LMPDIR/examples/PACKAGES/cgdna/examples if [ $# -eq 1 ] && [ $1 = run ]; then - echo '# Compiling executable in' $SRCDIR + echo '# Compiling executable in' $SRCDIR | tee -a $EXDIR/test.log cd $SRCDIR - make clean-all - make -j8 mpi + make clean-all | tee -a $EXDIR/test.log + make purge | tee -a $EXDIR/test.log + make pu | tee -a $EXDIR/test.log + make ps | tee -a $EXDIR/test.log + make -j8 mpi | tee -a $EXDIR/test.log ###################################################### - echo '# Running oxDNA duplex1 test' + echo '# Running oxDNA duplex1 test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA/duplex1 mkdir test cd test @@ -24,20 +28,32 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex1 > /dev/null mv log.lammps log.$DATE.duplex1.g++.1 - grep etot log.$DATE.duplex1.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex1.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex1 > /dev/null mv log.lammps log.$DATE.duplex1.g++.4 - grep etot log.$DATE.duplex1.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex1.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxDNA duplex2 test' + echo '# Running oxDNA duplex2 test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA/duplex2 mkdir test cd test @@ -47,20 +63,32 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex2 > /dev/null mv log.lammps log.$DATE.duplex2.g++.1 - grep etot log.$DATE.duplex2.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex2.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex2 > /dev/null mv log.lammps log.$DATE.duplex2.g++.4 - grep etot log.$DATE.duplex2.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex2.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxDNA2 duplex1 test' + echo '# Running oxDNA2 duplex1 test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA2/duplex1 mkdir test cd test @@ -70,20 +98,32 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex1 > /dev/null mv log.lammps log.$DATE.duplex1.g++.1 - grep etot log.$DATE.duplex1.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex1.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex1 > /dev/null mv log.lammps log.$DATE.duplex1.g++.4 - grep etot log.$DATE.duplex1.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex1.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxDNA2 duplex2 test' + echo '# Running oxDNA2 duplex2 test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA2/duplex2 mkdir test cd test @@ -93,20 +133,32 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex2 > /dev/null mv log.lammps log.$DATE.duplex2.g++.1 - grep etot log.$DATE.duplex2.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex2.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex2 > /dev/null mv log.lammps log.$DATE.duplex2.g++.4 - grep etot log.$DATE.duplex2.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex2.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxDNA2 duplex3 test' + echo '# Running oxDNA2 duplex3 test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA2/duplex3 mkdir test cd test @@ -116,20 +168,32 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex3 > /dev/null mv log.lammps log.$DATE.duplex3.g++.1 - grep etot log.$DATE.duplex3.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex3.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex3 > /dev/null mv log.lammps log.$DATE.duplex3.g++.4 - grep etot log.$DATE.duplex3.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex3.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxDNA2 unique_bp test' + echo '# Running oxDNA2 unique_bp test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA2/unique_bp mkdir test cd test @@ -141,32 +205,56 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex4.4type > /dev/null mv log.lammps log.$DATE.duplex4.4type.g++.1 - grep etot log.$DATE.duplex4.4type.g++.1 > e_test.dat - grep etot ../log*4type*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex4.4type.g++.1 > e_test.4type.1.dat + grep etot ../log*4type*1 > e_old.4type.1.dat + ndiff -relerr $TOL e_test.4type.1.dat e_old.4type.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task 4 types passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task 4 types unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex4.4type > /dev/null mv log.lammps log.$DATE.duplex4.4type.g++.4 - grep etot log.$DATE.duplex4.4type.g++.4 > e_test.dat - grep etot ../log*4type*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex4.4type.g++.4 > e_test.4type.4.dat + grep etot ../log*4type*4 > e_old.4type.4.dat + ndiff -relerr $TOL e_test.4type.4.dat e_old.4type.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks 4 types passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks 4 types unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 1 ./lmp_mpi < in.duplex4.8type > /dev/null mv log.lammps log.$DATE.duplex4.8type.g++.1 - grep etot log.$DATE.duplex4.8type.g++.1 > e_test.dat - grep etot ../log*8type*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex4.8type.g++.1 > e_test.8type.1.dat + grep etot ../log*8type*1 > e_old.8type.1.dat + ndiff -relerr $TOL e_test.8type.1.dat e_old.8type.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task 8 types passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task 8 types unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex4.8type > /dev/null mv log.lammps log.$DATE.duplex4.8type.g++.4 - grep etot log.$DATE.duplex4.8type.g++.4 > e_test.dat - grep etot ../log*8type*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex4.8type.g++.4 > e_test.8type.4.dat + grep etot ../log*8type*4 > e_old.8type.4.dat + ndiff -relerr $TOL e_test.8type.4.dat e_old.8type.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks 8 types passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks 8 types unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxDNA2 dsring test' + echo '# Running oxDNA2 dsring test' | tee -a $EXDIR/test.log cd $EXDIR/oxDNA2/dsring mkdir test cd test @@ -176,20 +264,32 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.dsring > /dev/null mv log.lammps log.$DATE.dsring.g++.1 - grep etot log.$DATE.dsring.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.dsring.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.dsring > /dev/null mv log.lammps log.$DATE.dsring.g++.4 - grep etot log.$DATE.dsring.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.dsring.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### ###################################################### - echo '# Running oxRNA2 duplex2 test' + echo '# Running oxRNA2 duplex2 test' | tee -a $EXDIR/test.log cd $EXDIR/oxRNA2/duplex2 mkdir test cd test @@ -199,18 +299,30 @@ if [ $# -eq 1 ] && [ $1 = run ]; then mpirun -np 1 ./lmp_mpi < in.duplex2 > /dev/null mv log.lammps log.$DATE.duplex2.g++.1 - grep etot log.$DATE.duplex2.g++.1 > e_test.dat - grep etot ../log*1 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex2.g++.1 > e_test.1.dat + grep etot ../log*1 > e_old.1.dat + ndiff -relerr $TOL e_test.1.dat e_old.1.dat + if [ $? -eq 0 ]; + then + echo "# 1 MPI-task passed" | tee -a $EXDIR/test.log + else + echo "# 1 MPI-task unsuccessful" | tee -a $EXDIR/test.log + fi mpirun -np 4 ./lmp_mpi < in.duplex2 > /dev/null mv log.lammps log.$DATE.duplex2.g++.4 - grep etot log.$DATE.duplex2.g++.4 > e_test.dat - grep etot ../log*4 > e_old.dat - ndiff -relerr 1e-8 e_test.dat e_old.dat + grep etot log.$DATE.duplex2.g++.4 > e_test.4.dat + grep etot ../log*4 > e_old.4.dat + ndiff -relerr $TOL e_test.4.dat e_old.4.dat + if [ $? -eq 0 ]; + then + echo "# 4 MPI-tasks passed" | tee -a $EXDIR/test.log + else + echo "# 4 MPI-tasks unsuccessful" | tee -a $EXDIR/test.log + fi ###################################################### - echo '# Done' + echo '# Done' | tee -a $EXDIR/test.log elif [ $# -eq 1 ] && [ $1 = clean ]; then echo '# Deleting test directories' @@ -222,6 +334,7 @@ elif [ $# -eq 1 ] && [ $1 = clean ]; then rm -rf $EXDIR/oxDNA2/unique_bp/test rm -rf $EXDIR/oxDNA2/dsring/test rm -rf $EXDIR/oxRNA2/duplex2/test + rm -rf $EXDIR/test.log echo '# Done' else diff --git a/examples/PACKAGES/electron_stopping/Si.Si.elstop b/examples/PACKAGES/electron_stopping/Si.Si.elstop index 51618149ff..1a6952e571 100644 --- a/examples/PACKAGES/electron_stopping/Si.Si.elstop +++ b/examples/PACKAGES/electron_stopping/Si.Si.elstop @@ -1,8 +1,8 @@ -# Electronic stopping for Si in Si -# Uses metal units +# Electronic stopping for Si in Si UNITS: metal DATE: 2019-02-19 CONTRIBUTOR: Risto Toijala risto.toijala@helsinki.fi # Kinetic energy in eV, stopping power in eV/A # For other atom types, add columns. +# atom type 1 # energy Si in Si 3918.2 6.541 15672.9 13.091 diff --git a/examples/PACKAGES/gle/qt-300k.A b/examples/PACKAGES/gle/qt-300k.A index 073100ad9d..31ada37b05 100644 --- a/examples/PACKAGES/gle/qt-300k.A +++ b/examples/PACKAGES/gle/qt-300k.A @@ -1,3 +1,5 @@ +# DATE: 2014-11-24 UNITS: real CONTRIBUTOR: Michele Ceriotti michele.ceriotti@gmail.com + 3.904138445158e-4 4.681059722010e-2 3.079778738058e-2 4.428079381336e-2 5.057825203477e-2 2.591193419597e-2 1.513907125942e-2 -4.789343294190e-2 2.037551040972e-2 6.597801861779e-2 -8.528273506602e-3 -2.230839572773e-3 6.593086307870e-3 -6.653653981891e-2 -2.905096373618e-2 -6.597801861779e-2 2.086885297843e-2 1.145471984072e-2 3.111465343867e-2 1.101562087523e-2 -3.264959166486e-2 diff --git a/examples/PACKAGES/gle/qt-300k.C b/examples/PACKAGES/gle/qt-300k.C index 50d68df251..d6239ca8dc 100644 --- a/examples/PACKAGES/gle/qt-300k.C +++ b/examples/PACKAGES/gle/qt-300k.C @@ -1,3 +1,5 @@ +# DATE: 2014-11-24 UNITS: real CONTRIBUTOR: Michele Ceriotti michele.ceriotti@gmail.com + 2.999985914100e+2 5.937593337000e+0 2.144376751500e+2 5.883055908000e+1 -1.119803766000e+2 -6.793381764000e+1 1.379789732400e+1 5.937593337000e+0 3.781851303000e+2 -5.794518522000e+1 -2.178772681500e+2 -1.649310659100e+2 -6.557113452000e+1 3.833830743000e+1 2.144376751500e+2 -5.794518522000e+1 7.325759985000e+2 2.188507713000e+2 -3.704586531000e+2 -3.385193865000e+1 -4.827706758000e+0 diff --git a/examples/PACKAGES/gle/smart.A b/examples/PACKAGES/gle/smart.A index a63bd881c8..8abbdea76a 100644 --- a/examples/PACKAGES/gle/smart.A +++ b/examples/PACKAGES/gle/smart.A @@ -1,3 +1,5 @@ +# DATE: 2014-11-24 UNITS: real CONTRIBUTOR: Michele Ceriotti michele.ceriotti@gmail.com + 4.247358737218e-3 3.231404593065e-2 -9.715629522215e-3 8.199488441225e-3 7.288427565896e-3 -3.634229949055e-3 -3.294395982200e-3 4.887738278128e-2 5.978602802893e-1 -2.079222967202e-1 1.088740438247e-1 4.666954324786e-2 -1.334147134493e-2 -3.914996645811e-2 4.015863091190e-2 2.079222967202e-1 1.645970119444e-1 8.351952991453e-2 5.114740085468e-2 1.217862237677e-2 -4.506711205974e-2 diff --git a/examples/PACKAGES/interlayer/ilp_graphene_hbn/BNCH.ILP b/examples/PACKAGES/interlayer/ilp_graphene_hbn/BNCH.ILP new file mode 120000 index 0000000000..d999bd5e31 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_graphene_hbn/BNCH.ILP @@ -0,0 +1 @@ +../../../../potentials/BNCH.ILP \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/ilp_graphene_hbn/CH.rebo b/examples/PACKAGES/interlayer/ilp_graphene_hbn/CH.rebo new file mode 120000 index 0000000000..c5a6a40100 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_graphene_hbn/CH.rebo @@ -0,0 +1 @@ +../../../../potentials/CH.rebo \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/ilp_tmds/MoS2.ILP b/examples/PACKAGES/interlayer/ilp_tmds/MoS2.ILP new file mode 120000 index 0000000000..75dd894eef --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_tmds/MoS2.ILP @@ -0,0 +1 @@ +../../../../potentials/MoS2.ILP \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/ilp_tmds/bilayer_MoS2_AAprime_stacking.data b/examples/PACKAGES/interlayer/ilp_tmds/bilayer_MoS2_AAprime_stacking.data new file mode 100644 index 0000000000..928dc0ed8c --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_tmds/bilayer_MoS2_AAprime_stacking.data @@ -0,0 +1,1549 @@ + Bilayer MoS2 + + 1536 atoms + + 6 atom types + + 0.0000000000000000 51.1523200000000177 xlo xhi + 0.0000000000000000 44.2992085825108320 ylo yhi + -100.0000000000000000 100.0000000000000000 zlo zhi + 25.5761600000000088 0.0000000000000000 0.0000000000000000 xy xz yz + + Atoms + + 1 1 2 -0.42 0.000000000000000 0.000000000000000 -1.596930000000000 + 2 1 3 -0.42 0.000000000000000 0.000000000000000 1.596930000000000 + 3 1 1 0.84 0.000000000000000 1.845800357604618 0.000000000000000 + 4 1 2 -0.42 1.598510000000001 2.768700536406927 -1.596930000000000 + 5 1 3 -0.42 1.598510000000001 2.768700536406927 1.596930000000000 + 6 1 1 0.84 1.598510000000001 4.614500894011545 0.000000000000000 + 7 1 2 -0.42 3.197020000000001 5.537401072813854 -1.596930000000000 + 8 1 3 -0.42 3.197020000000001 5.537401072813854 1.596930000000000 + 9 1 1 0.84 3.197020000000001 7.383201430418472 0.000000000000000 + 10 1 2 -0.42 4.795530000000002 8.306101609220781 -1.596930000000000 + 11 1 3 -0.42 4.795530000000002 8.306101609220781 1.596930000000000 + 12 1 1 0.84 4.795530000000002 10.151901966825399 0.000000000000000 + 13 1 2 -0.42 6.394040000000002 11.074802145627708 -1.596930000000000 + 14 1 3 -0.42 6.394040000000002 11.074802145627708 1.596930000000000 + 15 1 1 0.84 6.394040000000002 12.920602503232326 0.000000000000000 + 16 1 2 -0.42 7.992550000000003 13.843502682034635 -1.596930000000000 + 17 1 3 -0.42 7.992550000000003 13.843502682034635 1.596930000000000 + 18 1 1 0.84 7.992550000000003 15.689303039639253 0.000000000000000 + 19 1 2 -0.42 9.591060000000003 16.612203218441562 -1.596930000000000 + 20 1 3 -0.42 9.591060000000003 16.612203218441562 1.596930000000000 + 21 1 1 0.84 9.591060000000003 18.458003576046180 0.000000000000000 + 22 1 2 -0.42 11.189570000000004 19.380903754848489 -1.596930000000000 + 23 1 3 -0.42 11.189570000000004 19.380903754848489 1.596930000000000 + 24 1 1 0.84 11.189570000000004 21.226704112453107 0.000000000000000 + 25 1 2 -0.42 12.788080000000004 22.149604291255416 -1.596930000000000 + 26 1 3 -0.42 12.788080000000004 22.149604291255416 1.596930000000000 + 27 1 1 0.84 12.788080000000004 23.995404648860034 0.000000000000000 + 28 1 2 -0.42 14.386590000000005 24.918304827662343 -1.596930000000000 + 29 1 3 -0.42 14.386590000000005 24.918304827662343 1.596930000000000 + 30 1 1 0.84 14.386590000000005 26.764105185266961 0.000000000000000 + 31 1 2 -0.42 15.985100000000006 27.687005364069270 -1.596930000000000 + 32 1 3 -0.42 15.985100000000006 27.687005364069270 1.596930000000000 + 33 1 1 0.84 15.985100000000006 29.532805721673888 0.000000000000000 + 34 1 2 -0.42 17.583610000000006 30.455705900476197 -1.596930000000000 + 35 1 3 -0.42 17.583610000000006 30.455705900476197 1.596930000000000 + 36 1 1 0.84 17.583610000000006 32.301506258080815 0.000000000000000 + 37 1 2 -0.42 19.182120000000007 33.224406436883124 -1.596930000000000 + 38 1 3 -0.42 19.182120000000007 33.224406436883124 1.596930000000000 + 39 1 1 0.84 19.182120000000007 35.070206794487742 0.000000000000000 + 40 1 2 -0.42 20.780630000000007 35.993106973290051 -1.596930000000000 + 41 1 3 -0.42 20.780630000000007 35.993106973290051 1.596930000000000 + 42 1 1 0.84 20.780630000000007 37.838907330894669 0.000000000000000 + 43 1 2 -0.42 22.379140000000008 38.761807509696978 -1.596930000000000 + 44 1 3 -0.42 22.379140000000008 38.761807509696978 1.596930000000000 + 45 1 1 0.84 22.379140000000008 40.607607867301596 0.000000000000000 + 46 1 2 -0.42 23.977650000000008 41.530508046103905 -1.596930000000000 + 47 1 3 -0.42 23.977650000000008 41.530508046103905 1.596930000000000 + 48 1 1 0.84 23.977650000000008 43.376308403708523 0.000000000000000 + 49 1 2 -0.42 3.197020000000001 0.000000000000000 -1.596930000000000 + 50 1 3 -0.42 3.197020000000001 0.000000000000000 1.596930000000000 + 51 1 1 0.84 3.197020000000001 1.845800357604618 0.000000000000000 + 52 1 2 -0.42 4.795530000000002 2.768700536406927 -1.596930000000000 + 53 1 3 -0.42 4.795530000000002 2.768700536406927 1.596930000000000 + 54 1 1 0.84 4.795530000000002 4.614500894011545 0.000000000000000 + 55 1 2 -0.42 6.394040000000002 5.537401072813854 -1.596930000000000 + 56 1 3 -0.42 6.394040000000002 5.537401072813854 1.596930000000000 + 57 1 1 0.84 6.394040000000002 7.383201430418472 0.000000000000000 + 58 1 2 -0.42 7.992550000000003 8.306101609220781 -1.596930000000000 + 59 1 3 -0.42 7.992550000000003 8.306101609220781 1.596930000000000 + 60 1 1 0.84 7.992550000000003 10.151901966825399 0.000000000000000 + 61 1 2 -0.42 9.591060000000003 11.074802145627708 -1.596930000000000 + 62 1 3 -0.42 9.591060000000003 11.074802145627708 1.596930000000000 + 63 1 1 0.84 9.591060000000003 12.920602503232326 0.000000000000000 + 64 1 2 -0.42 11.189570000000004 13.843502682034635 -1.596930000000000 + 65 1 3 -0.42 11.189570000000004 13.843502682034635 1.596930000000000 + 66 1 1 0.84 11.189570000000004 15.689303039639253 0.000000000000000 + 67 1 2 -0.42 12.788080000000004 16.612203218441562 -1.596930000000000 + 68 1 3 -0.42 12.788080000000004 16.612203218441562 1.596930000000000 + 69 1 1 0.84 12.788080000000004 18.458003576046180 0.000000000000000 + 70 1 2 -0.42 14.386590000000005 19.380903754848489 -1.596930000000000 + 71 1 3 -0.42 14.386590000000005 19.380903754848489 1.596930000000000 + 72 1 1 0.84 14.386590000000005 21.226704112453107 0.000000000000000 + 73 1 2 -0.42 15.985100000000006 22.149604291255416 -1.596930000000000 + 74 1 3 -0.42 15.985100000000006 22.149604291255416 1.596930000000000 + 75 1 1 0.84 15.985100000000006 23.995404648860034 0.000000000000000 + 76 1 2 -0.42 17.583610000000006 24.918304827662343 -1.596930000000000 + 77 1 3 -0.42 17.583610000000006 24.918304827662343 1.596930000000000 + 78 1 1 0.84 17.583610000000006 26.764105185266961 0.000000000000000 + 79 1 2 -0.42 19.182120000000007 27.687005364069270 -1.596930000000000 + 80 1 3 -0.42 19.182120000000007 27.687005364069270 1.596930000000000 + 81 1 1 0.84 19.182120000000007 29.532805721673888 0.000000000000000 + 82 1 2 -0.42 20.780630000000007 30.455705900476197 -1.596930000000000 + 83 1 3 -0.42 20.780630000000007 30.455705900476197 1.596930000000000 + 84 1 1 0.84 20.780630000000007 32.301506258080815 0.000000000000000 + 85 1 2 -0.42 22.379140000000008 33.224406436883124 -1.596930000000000 + 86 1 3 -0.42 22.379140000000008 33.224406436883124 1.596930000000000 + 87 1 1 0.84 22.379140000000008 35.070206794487742 0.000000000000000 + 88 1 2 -0.42 23.977650000000008 35.993106973290051 -1.596930000000000 + 89 1 3 -0.42 23.977650000000008 35.993106973290051 1.596930000000000 + 90 1 1 0.84 23.977650000000008 37.838907330894669 0.000000000000000 + 91 1 2 -0.42 25.576160000000009 38.761807509696978 -1.596930000000000 + 92 1 3 -0.42 25.576160000000009 38.761807509696978 1.596930000000000 + 93 1 1 0.84 25.576160000000009 40.607607867301596 0.000000000000000 + 94 1 2 -0.42 27.174670000000009 41.530508046103905 -1.596930000000000 + 95 1 3 -0.42 27.174670000000009 41.530508046103905 1.596930000000000 + 96 1 1 0.84 27.174670000000009 43.376308403708523 0.000000000000000 + 97 1 2 -0.42 6.394040000000002 0.000000000000000 -1.596930000000000 + 98 1 3 -0.42 6.394040000000002 0.000000000000000 1.596930000000000 + 99 1 1 0.84 6.394040000000002 1.845800357604618 0.000000000000000 + 100 1 2 -0.42 7.992550000000003 2.768700536406927 -1.596930000000000 + 101 1 3 -0.42 7.992550000000003 2.768700536406927 1.596930000000000 + 102 1 1 0.84 7.992550000000003 4.614500894011545 0.000000000000000 + 103 1 2 -0.42 9.591060000000003 5.537401072813854 -1.596930000000000 + 104 1 3 -0.42 9.591060000000003 5.537401072813854 1.596930000000000 + 105 1 1 0.84 9.591060000000003 7.383201430418472 0.000000000000000 + 106 1 2 -0.42 11.189570000000004 8.306101609220781 -1.596930000000000 + 107 1 3 -0.42 11.189570000000004 8.306101609220781 1.596930000000000 + 108 1 1 0.84 11.189570000000004 10.151901966825399 0.000000000000000 + 109 1 2 -0.42 12.788080000000004 11.074802145627708 -1.596930000000000 + 110 1 3 -0.42 12.788080000000004 11.074802145627708 1.596930000000000 + 111 1 1 0.84 12.788080000000004 12.920602503232326 0.000000000000000 + 112 1 2 -0.42 14.386590000000005 13.843502682034635 -1.596930000000000 + 113 1 3 -0.42 14.386590000000005 13.843502682034635 1.596930000000000 + 114 1 1 0.84 14.386590000000005 15.689303039639253 0.000000000000000 + 115 1 2 -0.42 15.985100000000006 16.612203218441562 -1.596930000000000 + 116 1 3 -0.42 15.985100000000006 16.612203218441562 1.596930000000000 + 117 1 1 0.84 15.985100000000006 18.458003576046180 0.000000000000000 + 118 1 2 -0.42 17.583610000000006 19.380903754848489 -1.596930000000000 + 119 1 3 -0.42 17.583610000000006 19.380903754848489 1.596930000000000 + 120 1 1 0.84 17.583610000000006 21.226704112453107 0.000000000000000 + 121 1 2 -0.42 19.182120000000007 22.149604291255416 -1.596930000000000 + 122 1 3 -0.42 19.182120000000007 22.149604291255416 1.596930000000000 + 123 1 1 0.84 19.182120000000007 23.995404648860034 0.000000000000000 + 124 1 2 -0.42 20.780630000000007 24.918304827662343 -1.596930000000000 + 125 1 3 -0.42 20.780630000000007 24.918304827662343 1.596930000000000 + 126 1 1 0.84 20.780630000000007 26.764105185266961 0.000000000000000 + 127 1 2 -0.42 22.379140000000008 27.687005364069270 -1.596930000000000 + 128 1 3 -0.42 22.379140000000008 27.687005364069270 1.596930000000000 + 129 1 1 0.84 22.379140000000008 29.532805721673888 0.000000000000000 + 130 1 2 -0.42 23.977650000000008 30.455705900476197 -1.596930000000000 + 131 1 3 -0.42 23.977650000000008 30.455705900476197 1.596930000000000 + 132 1 1 0.84 23.977650000000008 32.301506258080815 0.000000000000000 + 133 1 2 -0.42 25.576160000000009 33.224406436883124 -1.596930000000000 + 134 1 3 -0.42 25.576160000000009 33.224406436883124 1.596930000000000 + 135 1 1 0.84 25.576160000000009 35.070206794487742 0.000000000000000 + 136 1 2 -0.42 27.174670000000009 35.993106973290051 -1.596930000000000 + 137 1 3 -0.42 27.174670000000009 35.993106973290051 1.596930000000000 + 138 1 1 0.84 27.174670000000009 37.838907330894669 0.000000000000000 + 139 1 2 -0.42 28.773180000000010 38.761807509696978 -1.596930000000000 + 140 1 3 -0.42 28.773180000000010 38.761807509696978 1.596930000000000 + 141 1 1 0.84 28.773180000000010 40.607607867301596 0.000000000000000 + 142 1 2 -0.42 30.371690000000011 41.530508046103905 -1.596930000000000 + 143 1 3 -0.42 30.371690000000011 41.530508046103905 1.596930000000000 + 144 1 1 0.84 30.371690000000011 43.376308403708523 0.000000000000000 + 145 1 2 -0.42 9.591060000000003 0.000000000000000 -1.596930000000000 + 146 1 3 -0.42 9.591060000000003 0.000000000000000 1.596930000000000 + 147 1 1 0.84 9.591060000000003 1.845800357604618 0.000000000000000 + 148 1 2 -0.42 11.189570000000004 2.768700536406927 -1.596930000000000 + 149 1 3 -0.42 11.189570000000004 2.768700536406927 1.596930000000000 + 150 1 1 0.84 11.189570000000004 4.614500894011545 0.000000000000000 + 151 1 2 -0.42 12.788080000000004 5.537401072813854 -1.596930000000000 + 152 1 3 -0.42 12.788080000000004 5.537401072813854 1.596930000000000 + 153 1 1 0.84 12.788080000000004 7.383201430418472 0.000000000000000 + 154 1 2 -0.42 14.386590000000005 8.306101609220781 -1.596930000000000 + 155 1 3 -0.42 14.386590000000005 8.306101609220781 1.596930000000000 + 156 1 1 0.84 14.386590000000005 10.151901966825399 0.000000000000000 + 157 1 2 -0.42 15.985100000000006 11.074802145627708 -1.596930000000000 + 158 1 3 -0.42 15.985100000000006 11.074802145627708 1.596930000000000 + 159 1 1 0.84 15.985100000000006 12.920602503232326 0.000000000000000 + 160 1 2 -0.42 17.583610000000006 13.843502682034635 -1.596930000000000 + 161 1 3 -0.42 17.583610000000006 13.843502682034635 1.596930000000000 + 162 1 1 0.84 17.583610000000006 15.689303039639253 0.000000000000000 + 163 1 2 -0.42 19.182120000000007 16.612203218441562 -1.596930000000000 + 164 1 3 -0.42 19.182120000000007 16.612203218441562 1.596930000000000 + 165 1 1 0.84 19.182120000000007 18.458003576046180 0.000000000000000 + 166 1 2 -0.42 20.780630000000007 19.380903754848489 -1.596930000000000 + 167 1 3 -0.42 20.780630000000007 19.380903754848489 1.596930000000000 + 168 1 1 0.84 20.780630000000007 21.226704112453107 0.000000000000000 + 169 1 2 -0.42 22.379140000000008 22.149604291255416 -1.596930000000000 + 170 1 3 -0.42 22.379140000000008 22.149604291255416 1.596930000000000 + 171 1 1 0.84 22.379140000000008 23.995404648860034 0.000000000000000 + 172 1 2 -0.42 23.977650000000008 24.918304827662343 -1.596930000000000 + 173 1 3 -0.42 23.977650000000008 24.918304827662343 1.596930000000000 + 174 1 1 0.84 23.977650000000008 26.764105185266961 0.000000000000000 + 175 1 2 -0.42 25.576160000000009 27.687005364069270 -1.596930000000000 + 176 1 3 -0.42 25.576160000000009 27.687005364069270 1.596930000000000 + 177 1 1 0.84 25.576160000000009 29.532805721673888 0.000000000000000 + 178 1 2 -0.42 27.174670000000009 30.455705900476197 -1.596930000000000 + 179 1 3 -0.42 27.174670000000009 30.455705900476197 1.596930000000000 + 180 1 1 0.84 27.174670000000009 32.301506258080815 0.000000000000000 + 181 1 2 -0.42 28.773180000000010 33.224406436883124 -1.596930000000000 + 182 1 3 -0.42 28.773180000000010 33.224406436883124 1.596930000000000 + 183 1 1 0.84 28.773180000000010 35.070206794487742 0.000000000000000 + 184 1 2 -0.42 30.371690000000011 35.993106973290051 -1.596930000000000 + 185 1 3 -0.42 30.371690000000011 35.993106973290051 1.596930000000000 + 186 1 1 0.84 30.371690000000011 37.838907330894669 0.000000000000000 + 187 1 2 -0.42 31.970200000000011 38.761807509696978 -1.596930000000000 + 188 1 3 -0.42 31.970200000000011 38.761807509696978 1.596930000000000 + 189 1 1 0.84 31.970200000000011 40.607607867301596 0.000000000000000 + 190 1 2 -0.42 33.568710000000012 41.530508046103905 -1.596930000000000 + 191 1 3 -0.42 33.568710000000012 41.530508046103905 1.596930000000000 + 192 1 1 0.84 33.568710000000012 43.376308403708523 0.000000000000000 + 193 1 2 -0.42 12.788080000000004 0.000000000000000 -1.596930000000000 + 194 1 3 -0.42 12.788080000000004 0.000000000000000 1.596930000000000 + 195 1 1 0.84 12.788080000000004 1.845800357604618 0.000000000000000 + 196 1 2 -0.42 14.386590000000005 2.768700536406927 -1.596930000000000 + 197 1 3 -0.42 14.386590000000005 2.768700536406927 1.596930000000000 + 198 1 1 0.84 14.386590000000005 4.614500894011545 0.000000000000000 + 199 1 2 -0.42 15.985100000000006 5.537401072813854 -1.596930000000000 + 200 1 3 -0.42 15.985100000000006 5.537401072813854 1.596930000000000 + 201 1 1 0.84 15.985100000000006 7.383201430418472 0.000000000000000 + 202 1 2 -0.42 17.583610000000006 8.306101609220781 -1.596930000000000 + 203 1 3 -0.42 17.583610000000006 8.306101609220781 1.596930000000000 + 204 1 1 0.84 17.583610000000006 10.151901966825399 0.000000000000000 + 205 1 2 -0.42 19.182120000000007 11.074802145627708 -1.596930000000000 + 206 1 3 -0.42 19.182120000000007 11.074802145627708 1.596930000000000 + 207 1 1 0.84 19.182120000000007 12.920602503232326 0.000000000000000 + 208 1 2 -0.42 20.780630000000007 13.843502682034635 -1.596930000000000 + 209 1 3 -0.42 20.780630000000007 13.843502682034635 1.596930000000000 + 210 1 1 0.84 20.780630000000007 15.689303039639253 0.000000000000000 + 211 1 2 -0.42 22.379140000000008 16.612203218441562 -1.596930000000000 + 212 1 3 -0.42 22.379140000000008 16.612203218441562 1.596930000000000 + 213 1 1 0.84 22.379140000000008 18.458003576046180 0.000000000000000 + 214 1 2 -0.42 23.977650000000008 19.380903754848489 -1.596930000000000 + 215 1 3 -0.42 23.977650000000008 19.380903754848489 1.596930000000000 + 216 1 1 0.84 23.977650000000008 21.226704112453107 0.000000000000000 + 217 1 2 -0.42 25.576160000000009 22.149604291255416 -1.596930000000000 + 218 1 3 -0.42 25.576160000000009 22.149604291255416 1.596930000000000 + 219 1 1 0.84 25.576160000000009 23.995404648860034 0.000000000000000 + 220 1 2 -0.42 27.174670000000009 24.918304827662343 -1.596930000000000 + 221 1 3 -0.42 27.174670000000009 24.918304827662343 1.596930000000000 + 222 1 1 0.84 27.174670000000009 26.764105185266961 0.000000000000000 + 223 1 2 -0.42 28.773180000000010 27.687005364069270 -1.596930000000000 + 224 1 3 -0.42 28.773180000000010 27.687005364069270 1.596930000000000 + 225 1 1 0.84 28.773180000000010 29.532805721673888 0.000000000000000 + 226 1 2 -0.42 30.371690000000011 30.455705900476197 -1.596930000000000 + 227 1 3 -0.42 30.371690000000011 30.455705900476197 1.596930000000000 + 228 1 1 0.84 30.371690000000011 32.301506258080815 0.000000000000000 + 229 1 2 -0.42 31.970200000000011 33.224406436883124 -1.596930000000000 + 230 1 3 -0.42 31.970200000000011 33.224406436883124 1.596930000000000 + 231 1 1 0.84 31.970200000000011 35.070206794487742 0.000000000000000 + 232 1 2 -0.42 33.568710000000012 35.993106973290051 -1.596930000000000 + 233 1 3 -0.42 33.568710000000012 35.993106973290051 1.596930000000000 + 234 1 1 0.84 33.568710000000012 37.838907330894669 0.000000000000000 + 235 1 2 -0.42 35.167220000000012 38.761807509696978 -1.596930000000000 + 236 1 3 -0.42 35.167220000000012 38.761807509696978 1.596930000000000 + 237 1 1 0.84 35.167220000000012 40.607607867301596 0.000000000000000 + 238 1 2 -0.42 36.765730000000013 41.530508046103905 -1.596930000000000 + 239 1 3 -0.42 36.765730000000013 41.530508046103905 1.596930000000000 + 240 1 1 0.84 36.765730000000013 43.376308403708523 0.000000000000000 + 241 1 2 -0.42 15.985100000000006 0.000000000000000 -1.596930000000000 + 242 1 3 -0.42 15.985100000000006 0.000000000000000 1.596930000000000 + 243 1 1 0.84 15.985100000000006 1.845800357604618 0.000000000000000 + 244 1 2 -0.42 17.583610000000006 2.768700536406927 -1.596930000000000 + 245 1 3 -0.42 17.583610000000006 2.768700536406927 1.596930000000000 + 246 1 1 0.84 17.583610000000006 4.614500894011545 0.000000000000000 + 247 1 2 -0.42 19.182120000000007 5.537401072813854 -1.596930000000000 + 248 1 3 -0.42 19.182120000000007 5.537401072813854 1.596930000000000 + 249 1 1 0.84 19.182120000000007 7.383201430418472 0.000000000000000 + 250 1 2 -0.42 20.780630000000007 8.306101609220781 -1.596930000000000 + 251 1 3 -0.42 20.780630000000007 8.306101609220781 1.596930000000000 + 252 1 1 0.84 20.780630000000007 10.151901966825399 0.000000000000000 + 253 1 2 -0.42 22.379140000000008 11.074802145627708 -1.596930000000000 + 254 1 3 -0.42 22.379140000000008 11.074802145627708 1.596930000000000 + 255 1 1 0.84 22.379140000000008 12.920602503232326 0.000000000000000 + 256 1 2 -0.42 23.977650000000008 13.843502682034635 -1.596930000000000 + 257 1 3 -0.42 23.977650000000008 13.843502682034635 1.596930000000000 + 258 1 1 0.84 23.977650000000008 15.689303039639253 0.000000000000000 + 259 1 2 -0.42 25.576160000000009 16.612203218441562 -1.596930000000000 + 260 1 3 -0.42 25.576160000000009 16.612203218441562 1.596930000000000 + 261 1 1 0.84 25.576160000000009 18.458003576046180 0.000000000000000 + 262 1 2 -0.42 27.174670000000009 19.380903754848489 -1.596930000000000 + 263 1 3 -0.42 27.174670000000009 19.380903754848489 1.596930000000000 + 264 1 1 0.84 27.174670000000009 21.226704112453107 0.000000000000000 + 265 1 2 -0.42 28.773180000000010 22.149604291255416 -1.596930000000000 + 266 1 3 -0.42 28.773180000000010 22.149604291255416 1.596930000000000 + 267 1 1 0.84 28.773180000000010 23.995404648860034 0.000000000000000 + 268 1 2 -0.42 30.371690000000011 24.918304827662343 -1.596930000000000 + 269 1 3 -0.42 30.371690000000011 24.918304827662343 1.596930000000000 + 270 1 1 0.84 30.371690000000011 26.764105185266961 0.000000000000000 + 271 1 2 -0.42 31.970200000000011 27.687005364069270 -1.596930000000000 + 272 1 3 -0.42 31.970200000000011 27.687005364069270 1.596930000000000 + 273 1 1 0.84 31.970200000000011 29.532805721673888 0.000000000000000 + 274 1 2 -0.42 33.568710000000012 30.455705900476197 -1.596930000000000 + 275 1 3 -0.42 33.568710000000012 30.455705900476197 1.596930000000000 + 276 1 1 0.84 33.568710000000012 32.301506258080815 0.000000000000000 + 277 1 2 -0.42 35.167220000000012 33.224406436883124 -1.596930000000000 + 278 1 3 -0.42 35.167220000000012 33.224406436883124 1.596930000000000 + 279 1 1 0.84 35.167220000000012 35.070206794487742 0.000000000000000 + 280 1 2 -0.42 36.765730000000013 35.993106973290051 -1.596930000000000 + 281 1 3 -0.42 36.765730000000013 35.993106973290051 1.596930000000000 + 282 1 1 0.84 36.765730000000013 37.838907330894669 0.000000000000000 + 283 1 2 -0.42 38.364240000000013 38.761807509696978 -1.596930000000000 + 284 1 3 -0.42 38.364240000000013 38.761807509696978 1.596930000000000 + 285 1 1 0.84 38.364240000000013 40.607607867301596 0.000000000000000 + 286 1 2 -0.42 39.962750000000014 41.530508046103905 -1.596930000000000 + 287 1 3 -0.42 39.962750000000014 41.530508046103905 1.596930000000000 + 288 1 1 0.84 39.962750000000014 43.376308403708523 0.000000000000000 + 289 1 2 -0.42 19.182120000000007 0.000000000000000 -1.596930000000000 + 290 1 3 -0.42 19.182120000000007 0.000000000000000 1.596930000000000 + 291 1 1 0.84 19.182120000000007 1.845800357604618 0.000000000000000 + 292 1 2 -0.42 20.780630000000007 2.768700536406927 -1.596930000000000 + 293 1 3 -0.42 20.780630000000007 2.768700536406927 1.596930000000000 + 294 1 1 0.84 20.780630000000007 4.614500894011545 0.000000000000000 + 295 1 2 -0.42 22.379140000000008 5.537401072813854 -1.596930000000000 + 296 1 3 -0.42 22.379140000000008 5.537401072813854 1.596930000000000 + 297 1 1 0.84 22.379140000000008 7.383201430418472 0.000000000000000 + 298 1 2 -0.42 23.977650000000008 8.306101609220781 -1.596930000000000 + 299 1 3 -0.42 23.977650000000008 8.306101609220781 1.596930000000000 + 300 1 1 0.84 23.977650000000008 10.151901966825399 0.000000000000000 + 301 1 2 -0.42 25.576160000000009 11.074802145627708 -1.596930000000000 + 302 1 3 -0.42 25.576160000000009 11.074802145627708 1.596930000000000 + 303 1 1 0.84 25.576160000000009 12.920602503232326 0.000000000000000 + 304 1 2 -0.42 27.174670000000009 13.843502682034635 -1.596930000000000 + 305 1 3 -0.42 27.174670000000009 13.843502682034635 1.596930000000000 + 306 1 1 0.84 27.174670000000009 15.689303039639253 0.000000000000000 + 307 1 2 -0.42 28.773180000000010 16.612203218441562 -1.596930000000000 + 308 1 3 -0.42 28.773180000000010 16.612203218441562 1.596930000000000 + 309 1 1 0.84 28.773180000000010 18.458003576046180 0.000000000000000 + 310 1 2 -0.42 30.371690000000011 19.380903754848489 -1.596930000000000 + 311 1 3 -0.42 30.371690000000011 19.380903754848489 1.596930000000000 + 312 1 1 0.84 30.371690000000011 21.226704112453107 0.000000000000000 + 313 1 2 -0.42 31.970200000000011 22.149604291255416 -1.596930000000000 + 314 1 3 -0.42 31.970200000000011 22.149604291255416 1.596930000000000 + 315 1 1 0.84 31.970200000000011 23.995404648860034 0.000000000000000 + 316 1 2 -0.42 33.568710000000012 24.918304827662343 -1.596930000000000 + 317 1 3 -0.42 33.568710000000012 24.918304827662343 1.596930000000000 + 318 1 1 0.84 33.568710000000012 26.764105185266961 0.000000000000000 + 319 1 2 -0.42 35.167220000000012 27.687005364069270 -1.596930000000000 + 320 1 3 -0.42 35.167220000000012 27.687005364069270 1.596930000000000 + 321 1 1 0.84 35.167220000000012 29.532805721673888 0.000000000000000 + 322 1 2 -0.42 36.765730000000013 30.455705900476197 -1.596930000000000 + 323 1 3 -0.42 36.765730000000013 30.455705900476197 1.596930000000000 + 324 1 1 0.84 36.765730000000013 32.301506258080815 0.000000000000000 + 325 1 2 -0.42 38.364240000000013 33.224406436883124 -1.596930000000000 + 326 1 3 -0.42 38.364240000000013 33.224406436883124 1.596930000000000 + 327 1 1 0.84 38.364240000000013 35.070206794487742 0.000000000000000 + 328 1 2 -0.42 39.962750000000014 35.993106973290051 -1.596930000000000 + 329 1 3 -0.42 39.962750000000014 35.993106973290051 1.596930000000000 + 330 1 1 0.84 39.962750000000014 37.838907330894669 0.000000000000000 + 331 1 2 -0.42 41.561260000000014 38.761807509696978 -1.596930000000000 + 332 1 3 -0.42 41.561260000000014 38.761807509696978 1.596930000000000 + 333 1 1 0.84 41.561260000000014 40.607607867301596 0.000000000000000 + 334 1 2 -0.42 43.159770000000015 41.530508046103905 -1.596930000000000 + 335 1 3 -0.42 43.159770000000015 41.530508046103905 1.596930000000000 + 336 1 1 0.84 43.159770000000015 43.376308403708523 0.000000000000000 + 337 1 2 -0.42 22.379140000000008 0.000000000000000 -1.596930000000000 + 338 1 3 -0.42 22.379140000000008 0.000000000000000 1.596930000000000 + 339 1 1 0.84 22.379140000000008 1.845800357604618 0.000000000000000 + 340 1 2 -0.42 23.977650000000008 2.768700536406927 -1.596930000000000 + 341 1 3 -0.42 23.977650000000008 2.768700536406927 1.596930000000000 + 342 1 1 0.84 23.977650000000008 4.614500894011545 0.000000000000000 + 343 1 2 -0.42 25.576160000000009 5.537401072813854 -1.596930000000000 + 344 1 3 -0.42 25.576160000000009 5.537401072813854 1.596930000000000 + 345 1 1 0.84 25.576160000000009 7.383201430418472 0.000000000000000 + 346 1 2 -0.42 27.174670000000009 8.306101609220781 -1.596930000000000 + 347 1 3 -0.42 27.174670000000009 8.306101609220781 1.596930000000000 + 348 1 1 0.84 27.174670000000009 10.151901966825399 0.000000000000000 + 349 1 2 -0.42 28.773180000000010 11.074802145627708 -1.596930000000000 + 350 1 3 -0.42 28.773180000000010 11.074802145627708 1.596930000000000 + 351 1 1 0.84 28.773180000000010 12.920602503232326 0.000000000000000 + 352 1 2 -0.42 30.371690000000011 13.843502682034635 -1.596930000000000 + 353 1 3 -0.42 30.371690000000011 13.843502682034635 1.596930000000000 + 354 1 1 0.84 30.371690000000011 15.689303039639253 0.000000000000000 + 355 1 2 -0.42 31.970200000000011 16.612203218441562 -1.596930000000000 + 356 1 3 -0.42 31.970200000000011 16.612203218441562 1.596930000000000 + 357 1 1 0.84 31.970200000000011 18.458003576046180 0.000000000000000 + 358 1 2 -0.42 33.568710000000012 19.380903754848489 -1.596930000000000 + 359 1 3 -0.42 33.568710000000012 19.380903754848489 1.596930000000000 + 360 1 1 0.84 33.568710000000012 21.226704112453107 0.000000000000000 + 361 1 2 -0.42 35.167220000000012 22.149604291255416 -1.596930000000000 + 362 1 3 -0.42 35.167220000000012 22.149604291255416 1.596930000000000 + 363 1 1 0.84 35.167220000000012 23.995404648860034 0.000000000000000 + 364 1 2 -0.42 36.765730000000013 24.918304827662343 -1.596930000000000 + 365 1 3 -0.42 36.765730000000013 24.918304827662343 1.596930000000000 + 366 1 1 0.84 36.765730000000013 26.764105185266961 0.000000000000000 + 367 1 2 -0.42 38.364240000000013 27.687005364069270 -1.596930000000000 + 368 1 3 -0.42 38.364240000000013 27.687005364069270 1.596930000000000 + 369 1 1 0.84 38.364240000000013 29.532805721673888 0.000000000000000 + 370 1 2 -0.42 39.962750000000014 30.455705900476197 -1.596930000000000 + 371 1 3 -0.42 39.962750000000014 30.455705900476197 1.596930000000000 + 372 1 1 0.84 39.962750000000014 32.301506258080815 0.000000000000000 + 373 1 2 -0.42 41.561260000000014 33.224406436883124 -1.596930000000000 + 374 1 3 -0.42 41.561260000000014 33.224406436883124 1.596930000000000 + 375 1 1 0.84 41.561260000000014 35.070206794487742 0.000000000000000 + 376 1 2 -0.42 43.159770000000015 35.993106973290051 -1.596930000000000 + 377 1 3 -0.42 43.159770000000015 35.993106973290051 1.596930000000000 + 378 1 1 0.84 43.159770000000015 37.838907330894669 0.000000000000000 + 379 1 2 -0.42 44.758280000000015 38.761807509696978 -1.596930000000000 + 380 1 3 -0.42 44.758280000000015 38.761807509696978 1.596930000000000 + 381 1 1 0.84 44.758280000000015 40.607607867301596 0.000000000000000 + 382 1 2 -0.42 46.356790000000016 41.530508046103905 -1.596930000000000 + 383 1 3 -0.42 46.356790000000016 41.530508046103905 1.596930000000000 + 384 1 1 0.84 46.356790000000016 43.376308403708523 0.000000000000000 + 385 1 2 -0.42 25.576160000000009 0.000000000000000 -1.596930000000000 + 386 1 3 -0.42 25.576160000000009 0.000000000000000 1.596930000000000 + 387 1 1 0.84 25.576160000000009 1.845800357604618 0.000000000000000 + 388 1 2 -0.42 27.174670000000009 2.768700536406927 -1.596930000000000 + 389 1 3 -0.42 27.174670000000009 2.768700536406927 1.596930000000000 + 390 1 1 0.84 27.174670000000009 4.614500894011545 0.000000000000000 + 391 1 2 -0.42 28.773180000000010 5.537401072813854 -1.596930000000000 + 392 1 3 -0.42 28.773180000000010 5.537401072813854 1.596930000000000 + 393 1 1 0.84 28.773180000000010 7.383201430418472 0.000000000000000 + 394 1 2 -0.42 30.371690000000011 8.306101609220781 -1.596930000000000 + 395 1 3 -0.42 30.371690000000011 8.306101609220781 1.596930000000000 + 396 1 1 0.84 30.371690000000011 10.151901966825399 0.000000000000000 + 397 1 2 -0.42 31.970200000000011 11.074802145627708 -1.596930000000000 + 398 1 3 -0.42 31.970200000000011 11.074802145627708 1.596930000000000 + 399 1 1 0.84 31.970200000000011 12.920602503232326 0.000000000000000 + 400 1 2 -0.42 33.568710000000012 13.843502682034635 -1.596930000000000 + 401 1 3 -0.42 33.568710000000012 13.843502682034635 1.596930000000000 + 402 1 1 0.84 33.568710000000012 15.689303039639253 0.000000000000000 + 403 1 2 -0.42 35.167220000000012 16.612203218441562 -1.596930000000000 + 404 1 3 -0.42 35.167220000000012 16.612203218441562 1.596930000000000 + 405 1 1 0.84 35.167220000000012 18.458003576046180 0.000000000000000 + 406 1 2 -0.42 36.765730000000013 19.380903754848489 -1.596930000000000 + 407 1 3 -0.42 36.765730000000013 19.380903754848489 1.596930000000000 + 408 1 1 0.84 36.765730000000013 21.226704112453107 0.000000000000000 + 409 1 2 -0.42 38.364240000000013 22.149604291255416 -1.596930000000000 + 410 1 3 -0.42 38.364240000000013 22.149604291255416 1.596930000000000 + 411 1 1 0.84 38.364240000000013 23.995404648860034 0.000000000000000 + 412 1 2 -0.42 39.962750000000014 24.918304827662343 -1.596930000000000 + 413 1 3 -0.42 39.962750000000014 24.918304827662343 1.596930000000000 + 414 1 1 0.84 39.962750000000014 26.764105185266961 0.000000000000000 + 415 1 2 -0.42 41.561260000000014 27.687005364069270 -1.596930000000000 + 416 1 3 -0.42 41.561260000000014 27.687005364069270 1.596930000000000 + 417 1 1 0.84 41.561260000000014 29.532805721673888 0.000000000000000 + 418 1 2 -0.42 43.159770000000015 30.455705900476197 -1.596930000000000 + 419 1 3 -0.42 43.159770000000015 30.455705900476197 1.596930000000000 + 420 1 1 0.84 43.159770000000015 32.301506258080815 0.000000000000000 + 421 1 2 -0.42 44.758280000000015 33.224406436883124 -1.596930000000000 + 422 1 3 -0.42 44.758280000000015 33.224406436883124 1.596930000000000 + 423 1 1 0.84 44.758280000000015 35.070206794487742 0.000000000000000 + 424 1 2 -0.42 46.356790000000016 35.993106973290051 -1.596930000000000 + 425 1 3 -0.42 46.356790000000016 35.993106973290051 1.596930000000000 + 426 1 1 0.84 46.356790000000016 37.838907330894669 0.000000000000000 + 427 1 2 -0.42 47.955300000000017 38.761807509696978 -1.596930000000000 + 428 1 3 -0.42 47.955300000000017 38.761807509696978 1.596930000000000 + 429 1 1 0.84 47.955300000000017 40.607607867301596 0.000000000000000 + 430 1 2 -0.42 49.553810000000017 41.530508046103905 -1.596930000000000 + 431 1 3 -0.42 49.553810000000017 41.530508046103905 1.596930000000000 + 432 1 1 0.84 49.553810000000017 43.376308403708523 0.000000000000000 + 433 1 2 -0.42 28.773180000000010 0.000000000000000 -1.596930000000000 + 434 1 3 -0.42 28.773180000000010 0.000000000000000 1.596930000000000 + 435 1 1 0.84 28.773180000000010 1.845800357604618 0.000000000000000 + 436 1 2 -0.42 30.371690000000011 2.768700536406927 -1.596930000000000 + 437 1 3 -0.42 30.371690000000011 2.768700536406927 1.596930000000000 + 438 1 1 0.84 30.371690000000011 4.614500894011545 0.000000000000000 + 439 1 2 -0.42 31.970200000000011 5.537401072813854 -1.596930000000000 + 440 1 3 -0.42 31.970200000000011 5.537401072813854 1.596930000000000 + 441 1 1 0.84 31.970200000000011 7.383201430418472 0.000000000000000 + 442 1 2 -0.42 33.568710000000012 8.306101609220781 -1.596930000000000 + 443 1 3 -0.42 33.568710000000012 8.306101609220781 1.596930000000000 + 444 1 1 0.84 33.568710000000012 10.151901966825399 0.000000000000000 + 445 1 2 -0.42 35.167220000000012 11.074802145627708 -1.596930000000000 + 446 1 3 -0.42 35.167220000000012 11.074802145627708 1.596930000000000 + 447 1 1 0.84 35.167220000000012 12.920602503232326 0.000000000000000 + 448 1 2 -0.42 36.765730000000013 13.843502682034635 -1.596930000000000 + 449 1 3 -0.42 36.765730000000013 13.843502682034635 1.596930000000000 + 450 1 1 0.84 36.765730000000013 15.689303039639253 0.000000000000000 + 451 1 2 -0.42 38.364240000000013 16.612203218441562 -1.596930000000000 + 452 1 3 -0.42 38.364240000000013 16.612203218441562 1.596930000000000 + 453 1 1 0.84 38.364240000000013 18.458003576046180 0.000000000000000 + 454 1 2 -0.42 39.962750000000014 19.380903754848489 -1.596930000000000 + 455 1 3 -0.42 39.962750000000014 19.380903754848489 1.596930000000000 + 456 1 1 0.84 39.962750000000014 21.226704112453107 0.000000000000000 + 457 1 2 -0.42 41.561260000000014 22.149604291255416 -1.596930000000000 + 458 1 3 -0.42 41.561260000000014 22.149604291255416 1.596930000000000 + 459 1 1 0.84 41.561260000000014 23.995404648860034 0.000000000000000 + 460 1 2 -0.42 43.159770000000015 24.918304827662343 -1.596930000000000 + 461 1 3 -0.42 43.159770000000015 24.918304827662343 1.596930000000000 + 462 1 1 0.84 43.159770000000015 26.764105185266961 0.000000000000000 + 463 1 2 -0.42 44.758280000000015 27.687005364069270 -1.596930000000000 + 464 1 3 -0.42 44.758280000000015 27.687005364069270 1.596930000000000 + 465 1 1 0.84 44.758280000000015 29.532805721673888 0.000000000000000 + 466 1 2 -0.42 46.356790000000016 30.455705900476197 -1.596930000000000 + 467 1 3 -0.42 46.356790000000016 30.455705900476197 1.596930000000000 + 468 1 1 0.84 46.356790000000016 32.301506258080815 0.000000000000000 + 469 1 2 -0.42 47.955300000000017 33.224406436883124 -1.596930000000000 + 470 1 3 -0.42 47.955300000000017 33.224406436883124 1.596930000000000 + 471 1 1 0.84 47.955300000000017 35.070206794487742 0.000000000000000 + 472 1 2 -0.42 49.553810000000017 35.993106973290051 -1.596930000000000 + 473 1 3 -0.42 49.553810000000017 35.993106973290051 1.596930000000000 + 474 1 1 0.84 49.553810000000017 37.838907330894669 0.000000000000000 + 475 1 2 -0.42 51.152320000000018 38.761807509696978 -1.596930000000000 + 476 1 3 -0.42 51.152320000000018 38.761807509696978 1.596930000000000 + 477 1 1 0.84 51.152320000000018 40.607607867301596 0.000000000000000 + 478 1 2 -0.42 52.750830000000018 41.530508046103905 -1.596930000000000 + 479 1 3 -0.42 52.750830000000018 41.530508046103905 1.596930000000000 + 480 1 1 0.84 52.750830000000018 43.376308403708523 0.000000000000000 + 481 1 2 -0.42 31.970200000000011 0.000000000000000 -1.596930000000000 + 482 1 3 -0.42 31.970200000000011 0.000000000000000 1.596930000000000 + 483 1 1 0.84 31.970200000000011 1.845800357604618 0.000000000000000 + 484 1 2 -0.42 33.568710000000012 2.768700536406927 -1.596930000000000 + 485 1 3 -0.42 33.568710000000012 2.768700536406927 1.596930000000000 + 486 1 1 0.84 33.568710000000012 4.614500894011545 0.000000000000000 + 487 1 2 -0.42 35.167220000000012 5.537401072813854 -1.596930000000000 + 488 1 3 -0.42 35.167220000000012 5.537401072813854 1.596930000000000 + 489 1 1 0.84 35.167220000000012 7.383201430418472 0.000000000000000 + 490 1 2 -0.42 36.765730000000013 8.306101609220781 -1.596930000000000 + 491 1 3 -0.42 36.765730000000013 8.306101609220781 1.596930000000000 + 492 1 1 0.84 36.765730000000013 10.151901966825399 0.000000000000000 + 493 1 2 -0.42 38.364240000000013 11.074802145627708 -1.596930000000000 + 494 1 3 -0.42 38.364240000000013 11.074802145627708 1.596930000000000 + 495 1 1 0.84 38.364240000000013 12.920602503232326 0.000000000000000 + 496 1 2 -0.42 39.962750000000014 13.843502682034635 -1.596930000000000 + 497 1 3 -0.42 39.962750000000014 13.843502682034635 1.596930000000000 + 498 1 1 0.84 39.962750000000014 15.689303039639253 0.000000000000000 + 499 1 2 -0.42 41.561260000000014 16.612203218441562 -1.596930000000000 + 500 1 3 -0.42 41.561260000000014 16.612203218441562 1.596930000000000 + 501 1 1 0.84 41.561260000000014 18.458003576046180 0.000000000000000 + 502 1 2 -0.42 43.159770000000015 19.380903754848489 -1.596930000000000 + 503 1 3 -0.42 43.159770000000015 19.380903754848489 1.596930000000000 + 504 1 1 0.84 43.159770000000015 21.226704112453107 0.000000000000000 + 505 1 2 -0.42 44.758280000000015 22.149604291255416 -1.596930000000000 + 506 1 3 -0.42 44.758280000000015 22.149604291255416 1.596930000000000 + 507 1 1 0.84 44.758280000000015 23.995404648860034 0.000000000000000 + 508 1 2 -0.42 46.356790000000016 24.918304827662343 -1.596930000000000 + 509 1 3 -0.42 46.356790000000016 24.918304827662343 1.596930000000000 + 510 1 1 0.84 46.356790000000016 26.764105185266961 0.000000000000000 + 511 1 2 -0.42 47.955300000000017 27.687005364069270 -1.596930000000000 + 512 1 3 -0.42 47.955300000000017 27.687005364069270 1.596930000000000 + 513 1 1 0.84 47.955300000000017 29.532805721673888 0.000000000000000 + 514 1 2 -0.42 49.553810000000017 30.455705900476197 -1.596930000000000 + 515 1 3 -0.42 49.553810000000017 30.455705900476197 1.596930000000000 + 516 1 1 0.84 49.553810000000017 32.301506258080815 0.000000000000000 + 517 1 2 -0.42 51.152320000000018 33.224406436883124 -1.596930000000000 + 518 1 3 -0.42 51.152320000000018 33.224406436883124 1.596930000000000 + 519 1 1 0.84 51.152320000000018 35.070206794487742 0.000000000000000 + 520 1 2 -0.42 52.750830000000018 35.993106973290051 -1.596930000000000 + 521 1 3 -0.42 52.750830000000018 35.993106973290051 1.596930000000000 + 522 1 1 0.84 52.750830000000018 37.838907330894669 0.000000000000000 + 523 1 2 -0.42 54.349340000000019 38.761807509696978 -1.596930000000000 + 524 1 3 -0.42 54.349340000000019 38.761807509696978 1.596930000000000 + 525 1 1 0.84 54.349340000000019 40.607607867301596 0.000000000000000 + 526 1 2 -0.42 55.947850000000019 41.530508046103905 -1.596930000000000 + 527 1 3 -0.42 55.947850000000019 41.530508046103905 1.596930000000000 + 528 1 1 0.84 55.947850000000019 43.376308403708523 0.000000000000000 + 529 1 2 -0.42 35.167220000000012 0.000000000000000 -1.596930000000000 + 530 1 3 -0.42 35.167220000000012 0.000000000000000 1.596930000000000 + 531 1 1 0.84 35.167220000000012 1.845800357604618 0.000000000000000 + 532 1 2 -0.42 36.765730000000013 2.768700536406927 -1.596930000000000 + 533 1 3 -0.42 36.765730000000013 2.768700536406927 1.596930000000000 + 534 1 1 0.84 36.765730000000013 4.614500894011545 0.000000000000000 + 535 1 2 -0.42 38.364240000000013 5.537401072813854 -1.596930000000000 + 536 1 3 -0.42 38.364240000000013 5.537401072813854 1.596930000000000 + 537 1 1 0.84 38.364240000000013 7.383201430418472 0.000000000000000 + 538 1 2 -0.42 39.962750000000014 8.306101609220781 -1.596930000000000 + 539 1 3 -0.42 39.962750000000014 8.306101609220781 1.596930000000000 + 540 1 1 0.84 39.962750000000014 10.151901966825399 0.000000000000000 + 541 1 2 -0.42 41.561260000000014 11.074802145627708 -1.596930000000000 + 542 1 3 -0.42 41.561260000000014 11.074802145627708 1.596930000000000 + 543 1 1 0.84 41.561260000000014 12.920602503232326 0.000000000000000 + 544 1 2 -0.42 43.159770000000015 13.843502682034635 -1.596930000000000 + 545 1 3 -0.42 43.159770000000015 13.843502682034635 1.596930000000000 + 546 1 1 0.84 43.159770000000015 15.689303039639253 0.000000000000000 + 547 1 2 -0.42 44.758280000000015 16.612203218441562 -1.596930000000000 + 548 1 3 -0.42 44.758280000000015 16.612203218441562 1.596930000000000 + 549 1 1 0.84 44.758280000000015 18.458003576046180 0.000000000000000 + 550 1 2 -0.42 46.356790000000016 19.380903754848489 -1.596930000000000 + 551 1 3 -0.42 46.356790000000016 19.380903754848489 1.596930000000000 + 552 1 1 0.84 46.356790000000016 21.226704112453107 0.000000000000000 + 553 1 2 -0.42 47.955300000000017 22.149604291255416 -1.596930000000000 + 554 1 3 -0.42 47.955300000000017 22.149604291255416 1.596930000000000 + 555 1 1 0.84 47.955300000000017 23.995404648860034 0.000000000000000 + 556 1 2 -0.42 49.553810000000017 24.918304827662343 -1.596930000000000 + 557 1 3 -0.42 49.553810000000017 24.918304827662343 1.596930000000000 + 558 1 1 0.84 49.553810000000017 26.764105185266961 0.000000000000000 + 559 1 2 -0.42 51.152320000000018 27.687005364069270 -1.596930000000000 + 560 1 3 -0.42 51.152320000000018 27.687005364069270 1.596930000000000 + 561 1 1 0.84 51.152320000000018 29.532805721673888 0.000000000000000 + 562 1 2 -0.42 52.750830000000018 30.455705900476197 -1.596930000000000 + 563 1 3 -0.42 52.750830000000018 30.455705900476197 1.596930000000000 + 564 1 1 0.84 52.750830000000018 32.301506258080815 0.000000000000000 + 565 1 2 -0.42 54.349340000000019 33.224406436883124 -1.596930000000000 + 566 1 3 -0.42 54.349340000000019 33.224406436883124 1.596930000000000 + 567 1 1 0.84 54.349340000000019 35.070206794487742 0.000000000000000 + 568 1 2 -0.42 55.947850000000019 35.993106973290051 -1.596930000000000 + 569 1 3 -0.42 55.947850000000019 35.993106973290051 1.596930000000000 + 570 1 1 0.84 55.947850000000019 37.838907330894669 0.000000000000000 + 571 1 2 -0.42 57.546360000000020 38.761807509696978 -1.596930000000000 + 572 1 3 -0.42 57.546360000000020 38.761807509696978 1.596930000000000 + 573 1 1 0.84 57.546360000000020 40.607607867301596 0.000000000000000 + 574 1 2 -0.42 59.144870000000020 41.530508046103905 -1.596930000000000 + 575 1 3 -0.42 59.144870000000020 41.530508046103905 1.596930000000000 + 576 1 1 0.84 59.144870000000020 43.376308403708523 0.000000000000000 + 577 1 2 -0.42 38.364240000000013 0.000000000000000 -1.596930000000000 + 578 1 3 -0.42 38.364240000000013 0.000000000000000 1.596930000000000 + 579 1 1 0.84 38.364240000000013 1.845800357604618 0.000000000000000 + 580 1 2 -0.42 39.962750000000014 2.768700536406927 -1.596930000000000 + 581 1 3 -0.42 39.962750000000014 2.768700536406927 1.596930000000000 + 582 1 1 0.84 39.962750000000014 4.614500894011545 0.000000000000000 + 583 1 2 -0.42 41.561260000000014 5.537401072813854 -1.596930000000000 + 584 1 3 -0.42 41.561260000000014 5.537401072813854 1.596930000000000 + 585 1 1 0.84 41.561260000000014 7.383201430418472 0.000000000000000 + 586 1 2 -0.42 43.159770000000015 8.306101609220781 -1.596930000000000 + 587 1 3 -0.42 43.159770000000015 8.306101609220781 1.596930000000000 + 588 1 1 0.84 43.159770000000015 10.151901966825399 0.000000000000000 + 589 1 2 -0.42 44.758280000000015 11.074802145627708 -1.596930000000000 + 590 1 3 -0.42 44.758280000000015 11.074802145627708 1.596930000000000 + 591 1 1 0.84 44.758280000000015 12.920602503232326 0.000000000000000 + 592 1 2 -0.42 46.356790000000016 13.843502682034635 -1.596930000000000 + 593 1 3 -0.42 46.356790000000016 13.843502682034635 1.596930000000000 + 594 1 1 0.84 46.356790000000016 15.689303039639253 0.000000000000000 + 595 1 2 -0.42 47.955300000000017 16.612203218441562 -1.596930000000000 + 596 1 3 -0.42 47.955300000000017 16.612203218441562 1.596930000000000 + 597 1 1 0.84 47.955300000000017 18.458003576046180 0.000000000000000 + 598 1 2 -0.42 49.553810000000017 19.380903754848489 -1.596930000000000 + 599 1 3 -0.42 49.553810000000017 19.380903754848489 1.596930000000000 + 600 1 1 0.84 49.553810000000017 21.226704112453107 0.000000000000000 + 601 1 2 -0.42 51.152320000000018 22.149604291255416 -1.596930000000000 + 602 1 3 -0.42 51.152320000000018 22.149604291255416 1.596930000000000 + 603 1 1 0.84 51.152320000000018 23.995404648860034 0.000000000000000 + 604 1 2 -0.42 52.750830000000018 24.918304827662343 -1.596930000000000 + 605 1 3 -0.42 52.750830000000018 24.918304827662343 1.596930000000000 + 606 1 1 0.84 52.750830000000018 26.764105185266961 0.000000000000000 + 607 1 2 -0.42 54.349340000000019 27.687005364069270 -1.596930000000000 + 608 1 3 -0.42 54.349340000000019 27.687005364069270 1.596930000000000 + 609 1 1 0.84 54.349340000000019 29.532805721673888 0.000000000000000 + 610 1 2 -0.42 55.947850000000019 30.455705900476197 -1.596930000000000 + 611 1 3 -0.42 55.947850000000019 30.455705900476197 1.596930000000000 + 612 1 1 0.84 55.947850000000019 32.301506258080815 0.000000000000000 + 613 1 2 -0.42 57.546360000000020 33.224406436883124 -1.596930000000000 + 614 1 3 -0.42 57.546360000000020 33.224406436883124 1.596930000000000 + 615 1 1 0.84 57.546360000000020 35.070206794487742 0.000000000000000 + 616 1 2 -0.42 59.144870000000020 35.993106973290051 -1.596930000000000 + 617 1 3 -0.42 59.144870000000020 35.993106973290051 1.596930000000000 + 618 1 1 0.84 59.144870000000020 37.838907330894669 0.000000000000000 + 619 1 2 -0.42 60.743380000000021 38.761807509696978 -1.596930000000000 + 620 1 3 -0.42 60.743380000000021 38.761807509696978 1.596930000000000 + 621 1 1 0.84 60.743380000000021 40.607607867301596 0.000000000000000 + 622 1 2 -0.42 62.341890000000022 41.530508046103905 -1.596930000000000 + 623 1 3 -0.42 62.341890000000022 41.530508046103905 1.596930000000000 + 624 1 1 0.84 62.341890000000022 43.376308403708523 0.000000000000000 + 625 1 2 -0.42 41.561260000000014 0.000000000000000 -1.596930000000000 + 626 1 3 -0.42 41.561260000000014 0.000000000000000 1.596930000000000 + 627 1 1 0.84 41.561260000000014 1.845800357604618 0.000000000000000 + 628 1 2 -0.42 43.159770000000015 2.768700536406927 -1.596930000000000 + 629 1 3 -0.42 43.159770000000015 2.768700536406927 1.596930000000000 + 630 1 1 0.84 43.159770000000015 4.614500894011545 0.000000000000000 + 631 1 2 -0.42 44.758280000000015 5.537401072813854 -1.596930000000000 + 632 1 3 -0.42 44.758280000000015 5.537401072813854 1.596930000000000 + 633 1 1 0.84 44.758280000000015 7.383201430418472 0.000000000000000 + 634 1 2 -0.42 46.356790000000016 8.306101609220781 -1.596930000000000 + 635 1 3 -0.42 46.356790000000016 8.306101609220781 1.596930000000000 + 636 1 1 0.84 46.356790000000016 10.151901966825399 0.000000000000000 + 637 1 2 -0.42 47.955300000000017 11.074802145627708 -1.596930000000000 + 638 1 3 -0.42 47.955300000000017 11.074802145627708 1.596930000000000 + 639 1 1 0.84 47.955300000000017 12.920602503232326 0.000000000000000 + 640 1 2 -0.42 49.553810000000017 13.843502682034635 -1.596930000000000 + 641 1 3 -0.42 49.553810000000017 13.843502682034635 1.596930000000000 + 642 1 1 0.84 49.553810000000017 15.689303039639253 0.000000000000000 + 643 1 2 -0.42 51.152320000000018 16.612203218441562 -1.596930000000000 + 644 1 3 -0.42 51.152320000000018 16.612203218441562 1.596930000000000 + 645 1 1 0.84 51.152320000000018 18.458003576046180 0.000000000000000 + 646 1 2 -0.42 52.750830000000018 19.380903754848489 -1.596930000000000 + 647 1 3 -0.42 52.750830000000018 19.380903754848489 1.596930000000000 + 648 1 1 0.84 52.750830000000018 21.226704112453107 0.000000000000000 + 649 1 2 -0.42 54.349340000000019 22.149604291255416 -1.596930000000000 + 650 1 3 -0.42 54.349340000000019 22.149604291255416 1.596930000000000 + 651 1 1 0.84 54.349340000000019 23.995404648860034 0.000000000000000 + 652 1 2 -0.42 55.947850000000019 24.918304827662343 -1.596930000000000 + 653 1 3 -0.42 55.947850000000019 24.918304827662343 1.596930000000000 + 654 1 1 0.84 55.947850000000019 26.764105185266961 0.000000000000000 + 655 1 2 -0.42 57.546360000000020 27.687005364069270 -1.596930000000000 + 656 1 3 -0.42 57.546360000000020 27.687005364069270 1.596930000000000 + 657 1 1 0.84 57.546360000000020 29.532805721673888 0.000000000000000 + 658 1 2 -0.42 59.144870000000020 30.455705900476197 -1.596930000000000 + 659 1 3 -0.42 59.144870000000020 30.455705900476197 1.596930000000000 + 660 1 1 0.84 59.144870000000020 32.301506258080815 0.000000000000000 + 661 1 2 -0.42 60.743380000000021 33.224406436883124 -1.596930000000000 + 662 1 3 -0.42 60.743380000000021 33.224406436883124 1.596930000000000 + 663 1 1 0.84 60.743380000000021 35.070206794487742 0.000000000000000 + 664 1 2 -0.42 62.341890000000022 35.993106973290051 -1.596930000000000 + 665 1 3 -0.42 62.341890000000022 35.993106973290051 1.596930000000000 + 666 1 1 0.84 62.341890000000022 37.838907330894669 0.000000000000000 + 667 1 2 -0.42 63.940400000000022 38.761807509696978 -1.596930000000000 + 668 1 3 -0.42 63.940400000000022 38.761807509696978 1.596930000000000 + 669 1 1 0.84 63.940400000000022 40.607607867301596 0.000000000000000 + 670 1 2 -0.42 65.538910000000023 41.530508046103905 -1.596930000000000 + 671 1 3 -0.42 65.538910000000023 41.530508046103905 1.596930000000000 + 672 1 1 0.84 65.538910000000023 43.376308403708523 0.000000000000000 + 673 1 2 -0.42 44.758280000000015 0.000000000000000 -1.596930000000000 + 674 1 3 -0.42 44.758280000000015 0.000000000000000 1.596930000000000 + 675 1 1 0.84 44.758280000000015 1.845800357604618 0.000000000000000 + 676 1 2 -0.42 46.356790000000016 2.768700536406927 -1.596930000000000 + 677 1 3 -0.42 46.356790000000016 2.768700536406927 1.596930000000000 + 678 1 1 0.84 46.356790000000016 4.614500894011545 0.000000000000000 + 679 1 2 -0.42 47.955300000000017 5.537401072813854 -1.596930000000000 + 680 1 3 -0.42 47.955300000000017 5.537401072813854 1.596930000000000 + 681 1 1 0.84 47.955300000000017 7.383201430418472 0.000000000000000 + 682 1 2 -0.42 49.553810000000017 8.306101609220781 -1.596930000000000 + 683 1 3 -0.42 49.553810000000017 8.306101609220781 1.596930000000000 + 684 1 1 0.84 49.553810000000017 10.151901966825399 0.000000000000000 + 685 1 2 -0.42 51.152320000000018 11.074802145627708 -1.596930000000000 + 686 1 3 -0.42 51.152320000000018 11.074802145627708 1.596930000000000 + 687 1 1 0.84 51.152320000000018 12.920602503232326 0.000000000000000 + 688 1 2 -0.42 52.750830000000018 13.843502682034635 -1.596930000000000 + 689 1 3 -0.42 52.750830000000018 13.843502682034635 1.596930000000000 + 690 1 1 0.84 52.750830000000018 15.689303039639253 0.000000000000000 + 691 1 2 -0.42 54.349340000000019 16.612203218441562 -1.596930000000000 + 692 1 3 -0.42 54.349340000000019 16.612203218441562 1.596930000000000 + 693 1 1 0.84 54.349340000000019 18.458003576046180 0.000000000000000 + 694 1 2 -0.42 55.947850000000019 19.380903754848489 -1.596930000000000 + 695 1 3 -0.42 55.947850000000019 19.380903754848489 1.596930000000000 + 696 1 1 0.84 55.947850000000019 21.226704112453107 0.000000000000000 + 697 1 2 -0.42 57.546360000000020 22.149604291255416 -1.596930000000000 + 698 1 3 -0.42 57.546360000000020 22.149604291255416 1.596930000000000 + 699 1 1 0.84 57.546360000000020 23.995404648860034 0.000000000000000 + 700 1 2 -0.42 59.144870000000020 24.918304827662343 -1.596930000000000 + 701 1 3 -0.42 59.144870000000020 24.918304827662343 1.596930000000000 + 702 1 1 0.84 59.144870000000020 26.764105185266961 0.000000000000000 + 703 1 2 -0.42 60.743380000000021 27.687005364069270 -1.596930000000000 + 704 1 3 -0.42 60.743380000000021 27.687005364069270 1.596930000000000 + 705 1 1 0.84 60.743380000000021 29.532805721673888 0.000000000000000 + 706 1 2 -0.42 62.341890000000022 30.455705900476197 -1.596930000000000 + 707 1 3 -0.42 62.341890000000022 30.455705900476197 1.596930000000000 + 708 1 1 0.84 62.341890000000022 32.301506258080815 0.000000000000000 + 709 1 2 -0.42 63.940400000000022 33.224406436883124 -1.596930000000000 + 710 1 3 -0.42 63.940400000000022 33.224406436883124 1.596930000000000 + 711 1 1 0.84 63.940400000000022 35.070206794487742 0.000000000000000 + 712 1 2 -0.42 65.538910000000023 35.993106973290051 -1.596930000000000 + 713 1 3 -0.42 65.538910000000023 35.993106973290051 1.596930000000000 + 714 1 1 0.84 65.538910000000023 37.838907330894669 0.000000000000000 + 715 1 2 -0.42 67.137420000000023 38.761807509696978 -1.596930000000000 + 716 1 3 -0.42 67.137420000000023 38.761807509696978 1.596930000000000 + 717 1 1 0.84 67.137420000000023 40.607607867301596 0.000000000000000 + 718 1 2 -0.42 68.735930000000024 41.530508046103905 -1.596930000000000 + 719 1 3 -0.42 68.735930000000024 41.530508046103905 1.596930000000000 + 720 1 1 0.84 68.735930000000024 43.376308403708523 0.000000000000000 + 721 1 2 -0.42 47.955300000000017 0.000000000000000 -1.596930000000000 + 722 1 3 -0.42 47.955300000000017 0.000000000000000 1.596930000000000 + 723 1 1 0.84 47.955300000000017 1.845800357604618 0.000000000000000 + 724 1 2 -0.42 49.553810000000017 2.768700536406927 -1.596930000000000 + 725 1 3 -0.42 49.553810000000017 2.768700536406927 1.596930000000000 + 726 1 1 0.84 49.553810000000017 4.614500894011545 0.000000000000000 + 727 1 2 -0.42 51.152320000000018 5.537401072813854 -1.596930000000000 + 728 1 3 -0.42 51.152320000000018 5.537401072813854 1.596930000000000 + 729 1 1 0.84 51.152320000000018 7.383201430418472 0.000000000000000 + 730 1 2 -0.42 52.750830000000018 8.306101609220781 -1.596930000000000 + 731 1 3 -0.42 52.750830000000018 8.306101609220781 1.596930000000000 + 732 1 1 0.84 52.750830000000018 10.151901966825399 0.000000000000000 + 733 1 2 -0.42 54.349340000000019 11.074802145627708 -1.596930000000000 + 734 1 3 -0.42 54.349340000000019 11.074802145627708 1.596930000000000 + 735 1 1 0.84 54.349340000000019 12.920602503232326 0.000000000000000 + 736 1 2 -0.42 55.947850000000019 13.843502682034635 -1.596930000000000 + 737 1 3 -0.42 55.947850000000019 13.843502682034635 1.596930000000000 + 738 1 1 0.84 55.947850000000019 15.689303039639253 0.000000000000000 + 739 1 2 -0.42 57.546360000000020 16.612203218441562 -1.596930000000000 + 740 1 3 -0.42 57.546360000000020 16.612203218441562 1.596930000000000 + 741 1 1 0.84 57.546360000000020 18.458003576046180 0.000000000000000 + 742 1 2 -0.42 59.144870000000020 19.380903754848489 -1.596930000000000 + 743 1 3 -0.42 59.144870000000020 19.380903754848489 1.596930000000000 + 744 1 1 0.84 59.144870000000020 21.226704112453107 0.000000000000000 + 745 1 2 -0.42 60.743380000000021 22.149604291255416 -1.596930000000000 + 746 1 3 -0.42 60.743380000000021 22.149604291255416 1.596930000000000 + 747 1 1 0.84 60.743380000000021 23.995404648860034 0.000000000000000 + 748 1 2 -0.42 62.341890000000022 24.918304827662343 -1.596930000000000 + 749 1 3 -0.42 62.341890000000022 24.918304827662343 1.596930000000000 + 750 1 1 0.84 62.341890000000022 26.764105185266961 0.000000000000000 + 751 1 2 -0.42 63.940400000000022 27.687005364069270 -1.596930000000000 + 752 1 3 -0.42 63.940400000000022 27.687005364069270 1.596930000000000 + 753 1 1 0.84 63.940400000000022 29.532805721673888 0.000000000000000 + 754 1 2 -0.42 65.538910000000023 30.455705900476197 -1.596930000000000 + 755 1 3 -0.42 65.538910000000023 30.455705900476197 1.596930000000000 + 756 1 1 0.84 65.538910000000023 32.301506258080815 0.000000000000000 + 757 1 2 -0.42 67.137420000000023 33.224406436883124 -1.596930000000000 + 758 1 3 -0.42 67.137420000000023 33.224406436883124 1.596930000000000 + 759 1 1 0.84 67.137420000000023 35.070206794487742 0.000000000000000 + 760 1 2 -0.42 68.735930000000024 35.993106973290051 -1.596930000000000 + 761 1 3 -0.42 68.735930000000024 35.993106973290051 1.596930000000000 + 762 1 1 0.84 68.735930000000024 37.838907330894669 0.000000000000000 + 763 1 2 -0.42 70.334440000000024 38.761807509696978 -1.596930000000000 + 764 1 3 -0.42 70.334440000000024 38.761807509696978 1.596930000000000 + 765 1 1 0.84 70.334440000000024 40.607607867301596 0.000000000000000 + 766 1 2 -0.42 71.932950000000025 41.530508046103905 -1.596930000000000 + 767 1 3 -0.42 71.932950000000025 41.530508046103905 1.596930000000000 + 768 1 1 0.84 71.932950000000025 43.376308403708523 0.000000000000000 + 769 2 4 0.84 0.000000000000000 0.000000000000000 6.210000000000000 + 770 2 5 -0.42 0.000000000000000 1.845800357604618 4.613070000000000 + 771 2 6 -0.42 0.000000000000000 1.845800357604618 7.806930000000000 + 772 2 4 0.84 1.598510000000001 2.768700536406927 6.210000000000000 + 773 2 5 -0.42 1.598510000000001 4.614500894011545 4.613070000000000 + 774 2 6 -0.42 1.598510000000001 4.614500894011545 7.806930000000000 + 775 2 4 0.84 3.197020000000001 5.537401072813854 6.210000000000000 + 776 2 5 -0.42 3.197020000000001 7.383201430418472 4.613070000000000 + 777 2 6 -0.42 3.197020000000001 7.383201430418472 7.806930000000000 + 778 2 4 0.84 4.795530000000002 8.306101609220781 6.210000000000000 + 779 2 5 -0.42 4.795530000000002 10.151901966825399 4.613070000000000 + 780 2 6 -0.42 4.795530000000002 10.151901966825399 7.806930000000000 + 781 2 4 0.84 6.394040000000002 11.074802145627708 6.210000000000000 + 782 2 5 -0.42 6.394040000000002 12.920602503232326 4.613070000000000 + 783 2 6 -0.42 6.394040000000002 12.920602503232326 7.806930000000000 + 784 2 4 0.84 7.992550000000003 13.843502682034635 6.210000000000000 + 785 2 5 -0.42 7.992550000000003 15.689303039639253 4.613070000000000 + 786 2 6 -0.42 7.992550000000003 15.689303039639253 7.806930000000000 + 787 2 4 0.84 9.591060000000003 16.612203218441562 6.210000000000000 + 788 2 5 -0.42 9.591060000000003 18.458003576046180 4.613070000000000 + 789 2 6 -0.42 9.591060000000003 18.458003576046180 7.806930000000000 + 790 2 4 0.84 11.189570000000004 19.380903754848489 6.210000000000000 + 791 2 5 -0.42 11.189570000000004 21.226704112453107 4.613070000000000 + 792 2 6 -0.42 11.189570000000004 21.226704112453107 7.806930000000000 + 793 2 4 0.84 12.788080000000004 22.149604291255416 6.210000000000000 + 794 2 5 -0.42 12.788080000000004 23.995404648860034 4.613070000000000 + 795 2 6 -0.42 12.788080000000004 23.995404648860034 7.806930000000000 + 796 2 4 0.84 14.386590000000005 24.918304827662343 6.210000000000000 + 797 2 5 -0.42 14.386590000000005 26.764105185266961 4.613070000000000 + 798 2 6 -0.42 14.386590000000005 26.764105185266961 7.806930000000000 + 799 2 4 0.84 15.985100000000006 27.687005364069270 6.210000000000000 + 800 2 5 -0.42 15.985100000000006 29.532805721673888 4.613070000000000 + 801 2 6 -0.42 15.985100000000006 29.532805721673888 7.806930000000000 + 802 2 4 0.84 17.583610000000006 30.455705900476197 6.210000000000000 + 803 2 5 -0.42 17.583610000000006 32.301506258080815 4.613070000000000 + 804 2 6 -0.42 17.583610000000006 32.301506258080815 7.806930000000000 + 805 2 4 0.84 19.182120000000007 33.224406436883124 6.210000000000000 + 806 2 5 -0.42 19.182120000000007 35.070206794487742 4.613070000000000 + 807 2 6 -0.42 19.182120000000007 35.070206794487742 7.806930000000000 + 808 2 4 0.84 20.780630000000007 35.993106973290051 6.210000000000000 + 809 2 5 -0.42 20.780630000000007 37.838907330894669 4.613070000000000 + 810 2 6 -0.42 20.780630000000007 37.838907330894669 7.806930000000000 + 811 2 4 0.84 22.379140000000008 38.761807509696978 6.210000000000000 + 812 2 5 -0.42 22.379140000000008 40.607607867301596 4.613070000000000 + 813 2 6 -0.42 22.379140000000008 40.607607867301596 7.806930000000000 + 814 2 4 0.84 23.977650000000008 41.530508046103905 6.210000000000000 + 815 2 5 -0.42 23.977650000000008 43.376308403708523 4.613070000000000 + 816 2 6 -0.42 23.977650000000008 43.376308403708523 7.806930000000000 + 817 2 4 0.84 3.197020000000001 0.000000000000000 6.210000000000000 + 818 2 5 -0.42 3.197020000000001 1.845800357604618 4.613070000000000 + 819 2 6 -0.42 3.197020000000001 1.845800357604618 7.806930000000000 + 820 2 4 0.84 4.795530000000002 2.768700536406927 6.210000000000000 + 821 2 5 -0.42 4.795530000000002 4.614500894011545 4.613070000000000 + 822 2 6 -0.42 4.795530000000002 4.614500894011545 7.806930000000000 + 823 2 4 0.84 6.394040000000002 5.537401072813854 6.210000000000000 + 824 2 5 -0.42 6.394040000000002 7.383201430418472 4.613070000000000 + 825 2 6 -0.42 6.394040000000002 7.383201430418472 7.806930000000000 + 826 2 4 0.84 7.992550000000003 8.306101609220781 6.210000000000000 + 827 2 5 -0.42 7.992550000000003 10.151901966825399 4.613070000000000 + 828 2 6 -0.42 7.992550000000003 10.151901966825399 7.806930000000000 + 829 2 4 0.84 9.591060000000003 11.074802145627708 6.210000000000000 + 830 2 5 -0.42 9.591060000000003 12.920602503232326 4.613070000000000 + 831 2 6 -0.42 9.591060000000003 12.920602503232326 7.806930000000000 + 832 2 4 0.84 11.189570000000004 13.843502682034635 6.210000000000000 + 833 2 5 -0.42 11.189570000000004 15.689303039639253 4.613070000000000 + 834 2 6 -0.42 11.189570000000004 15.689303039639253 7.806930000000000 + 835 2 4 0.84 12.788080000000004 16.612203218441562 6.210000000000000 + 836 2 5 -0.42 12.788080000000004 18.458003576046180 4.613070000000000 + 837 2 6 -0.42 12.788080000000004 18.458003576046180 7.806930000000000 + 838 2 4 0.84 14.386590000000005 19.380903754848489 6.210000000000000 + 839 2 5 -0.42 14.386590000000005 21.226704112453107 4.613070000000000 + 840 2 6 -0.42 14.386590000000005 21.226704112453107 7.806930000000000 + 841 2 4 0.84 15.985100000000006 22.149604291255416 6.210000000000000 + 842 2 5 -0.42 15.985100000000006 23.995404648860034 4.613070000000000 + 843 2 6 -0.42 15.985100000000006 23.995404648860034 7.806930000000000 + 844 2 4 0.84 17.583610000000006 24.918304827662343 6.210000000000000 + 845 2 5 -0.42 17.583610000000006 26.764105185266961 4.613070000000000 + 846 2 6 -0.42 17.583610000000006 26.764105185266961 7.806930000000000 + 847 2 4 0.84 19.182120000000007 27.687005364069270 6.210000000000000 + 848 2 5 -0.42 19.182120000000007 29.532805721673888 4.613070000000000 + 849 2 6 -0.42 19.182120000000007 29.532805721673888 7.806930000000000 + 850 2 4 0.84 20.780630000000007 30.455705900476197 6.210000000000000 + 851 2 5 -0.42 20.780630000000007 32.301506258080815 4.613070000000000 + 852 2 6 -0.42 20.780630000000007 32.301506258080815 7.806930000000000 + 853 2 4 0.84 22.379140000000008 33.224406436883124 6.210000000000000 + 854 2 5 -0.42 22.379140000000008 35.070206794487742 4.613070000000000 + 855 2 6 -0.42 22.379140000000008 35.070206794487742 7.806930000000000 + 856 2 4 0.84 23.977650000000008 35.993106973290051 6.210000000000000 + 857 2 5 -0.42 23.977650000000008 37.838907330894669 4.613070000000000 + 858 2 6 -0.42 23.977650000000008 37.838907330894669 7.806930000000000 + 859 2 4 0.84 25.576160000000009 38.761807509696978 6.210000000000000 + 860 2 5 -0.42 25.576160000000009 40.607607867301596 4.613070000000000 + 861 2 6 -0.42 25.576160000000009 40.607607867301596 7.806930000000000 + 862 2 4 0.84 27.174670000000009 41.530508046103905 6.210000000000000 + 863 2 5 -0.42 27.174670000000009 43.376308403708523 4.613070000000000 + 864 2 6 -0.42 27.174670000000009 43.376308403708523 7.806930000000000 + 865 2 4 0.84 6.394040000000002 0.000000000000000 6.210000000000000 + 866 2 5 -0.42 6.394040000000002 1.845800357604618 4.613070000000000 + 867 2 6 -0.42 6.394040000000002 1.845800357604618 7.806930000000000 + 868 2 4 0.84 7.992550000000003 2.768700536406927 6.210000000000000 + 869 2 5 -0.42 7.992550000000003 4.614500894011545 4.613070000000000 + 870 2 6 -0.42 7.992550000000003 4.614500894011545 7.806930000000000 + 871 2 4 0.84 9.591060000000003 5.537401072813854 6.210000000000000 + 872 2 5 -0.42 9.591060000000003 7.383201430418472 4.613070000000000 + 873 2 6 -0.42 9.591060000000003 7.383201430418472 7.806930000000000 + 874 2 4 0.84 11.189570000000004 8.306101609220781 6.210000000000000 + 875 2 5 -0.42 11.189570000000004 10.151901966825399 4.613070000000000 + 876 2 6 -0.42 11.189570000000004 10.151901966825399 7.806930000000000 + 877 2 4 0.84 12.788080000000004 11.074802145627708 6.210000000000000 + 878 2 5 -0.42 12.788080000000004 12.920602503232326 4.613070000000000 + 879 2 6 -0.42 12.788080000000004 12.920602503232326 7.806930000000000 + 880 2 4 0.84 14.386590000000005 13.843502682034635 6.210000000000000 + 881 2 5 -0.42 14.386590000000005 15.689303039639253 4.613070000000000 + 882 2 6 -0.42 14.386590000000005 15.689303039639253 7.806930000000000 + 883 2 4 0.84 15.985100000000006 16.612203218441562 6.210000000000000 + 884 2 5 -0.42 15.985100000000006 18.458003576046180 4.613070000000000 + 885 2 6 -0.42 15.985100000000006 18.458003576046180 7.806930000000000 + 886 2 4 0.84 17.583610000000006 19.380903754848489 6.210000000000000 + 887 2 5 -0.42 17.583610000000006 21.226704112453107 4.613070000000000 + 888 2 6 -0.42 17.583610000000006 21.226704112453107 7.806930000000000 + 889 2 4 0.84 19.182120000000007 22.149604291255416 6.210000000000000 + 890 2 5 -0.42 19.182120000000007 23.995404648860034 4.613070000000000 + 891 2 6 -0.42 19.182120000000007 23.995404648860034 7.806930000000000 + 892 2 4 0.84 20.780630000000007 24.918304827662343 6.210000000000000 + 893 2 5 -0.42 20.780630000000007 26.764105185266961 4.613070000000000 + 894 2 6 -0.42 20.780630000000007 26.764105185266961 7.806930000000000 + 895 2 4 0.84 22.379140000000008 27.687005364069270 6.210000000000000 + 896 2 5 -0.42 22.379140000000008 29.532805721673888 4.613070000000000 + 897 2 6 -0.42 22.379140000000008 29.532805721673888 7.806930000000000 + 898 2 4 0.84 23.977650000000008 30.455705900476197 6.210000000000000 + 899 2 5 -0.42 23.977650000000008 32.301506258080815 4.613070000000000 + 900 2 6 -0.42 23.977650000000008 32.301506258080815 7.806930000000000 + 901 2 4 0.84 25.576160000000009 33.224406436883124 6.210000000000000 + 902 2 5 -0.42 25.576160000000009 35.070206794487742 4.613070000000000 + 903 2 6 -0.42 25.576160000000009 35.070206794487742 7.806930000000000 + 904 2 4 0.84 27.174670000000009 35.993106973290051 6.210000000000000 + 905 2 5 -0.42 27.174670000000009 37.838907330894669 4.613070000000000 + 906 2 6 -0.42 27.174670000000009 37.838907330894669 7.806930000000000 + 907 2 4 0.84 28.773180000000010 38.761807509696978 6.210000000000000 + 908 2 5 -0.42 28.773180000000010 40.607607867301596 4.613070000000000 + 909 2 6 -0.42 28.773180000000010 40.607607867301596 7.806930000000000 + 910 2 4 0.84 30.371690000000011 41.530508046103905 6.210000000000000 + 911 2 5 -0.42 30.371690000000011 43.376308403708523 4.613070000000000 + 912 2 6 -0.42 30.371690000000011 43.376308403708523 7.806930000000000 + 913 2 4 0.84 9.591060000000003 0.000000000000000 6.210000000000000 + 914 2 5 -0.42 9.591060000000003 1.845800357604618 4.613070000000000 + 915 2 6 -0.42 9.591060000000003 1.845800357604618 7.806930000000000 + 916 2 4 0.84 11.189570000000004 2.768700536406927 6.210000000000000 + 917 2 5 -0.42 11.189570000000004 4.614500894011545 4.613070000000000 + 918 2 6 -0.42 11.189570000000004 4.614500894011545 7.806930000000000 + 919 2 4 0.84 12.788080000000004 5.537401072813854 6.210000000000000 + 920 2 5 -0.42 12.788080000000004 7.383201430418472 4.613070000000000 + 921 2 6 -0.42 12.788080000000004 7.383201430418472 7.806930000000000 + 922 2 4 0.84 14.386590000000005 8.306101609220781 6.210000000000000 + 923 2 5 -0.42 14.386590000000005 10.151901966825399 4.613070000000000 + 924 2 6 -0.42 14.386590000000005 10.151901966825399 7.806930000000000 + 925 2 4 0.84 15.985100000000006 11.074802145627708 6.210000000000000 + 926 2 5 -0.42 15.985100000000006 12.920602503232326 4.613070000000000 + 927 2 6 -0.42 15.985100000000006 12.920602503232326 7.806930000000000 + 928 2 4 0.84 17.583610000000006 13.843502682034635 6.210000000000000 + 929 2 5 -0.42 17.583610000000006 15.689303039639253 4.613070000000000 + 930 2 6 -0.42 17.583610000000006 15.689303039639253 7.806930000000000 + 931 2 4 0.84 19.182120000000007 16.612203218441562 6.210000000000000 + 932 2 5 -0.42 19.182120000000007 18.458003576046180 4.613070000000000 + 933 2 6 -0.42 19.182120000000007 18.458003576046180 7.806930000000000 + 934 2 4 0.84 20.780630000000007 19.380903754848489 6.210000000000000 + 935 2 5 -0.42 20.780630000000007 21.226704112453107 4.613070000000000 + 936 2 6 -0.42 20.780630000000007 21.226704112453107 7.806930000000000 + 937 2 4 0.84 22.379140000000008 22.149604291255416 6.210000000000000 + 938 2 5 -0.42 22.379140000000008 23.995404648860034 4.613070000000000 + 939 2 6 -0.42 22.379140000000008 23.995404648860034 7.806930000000000 + 940 2 4 0.84 23.977650000000008 24.918304827662343 6.210000000000000 + 941 2 5 -0.42 23.977650000000008 26.764105185266961 4.613070000000000 + 942 2 6 -0.42 23.977650000000008 26.764105185266961 7.806930000000000 + 943 2 4 0.84 25.576160000000009 27.687005364069270 6.210000000000000 + 944 2 5 -0.42 25.576160000000009 29.532805721673888 4.613070000000000 + 945 2 6 -0.42 25.576160000000009 29.532805721673888 7.806930000000000 + 946 2 4 0.84 27.174670000000009 30.455705900476197 6.210000000000000 + 947 2 5 -0.42 27.174670000000009 32.301506258080815 4.613070000000000 + 948 2 6 -0.42 27.174670000000009 32.301506258080815 7.806930000000000 + 949 2 4 0.84 28.773180000000010 33.224406436883124 6.210000000000000 + 950 2 5 -0.42 28.773180000000010 35.070206794487742 4.613070000000000 + 951 2 6 -0.42 28.773180000000010 35.070206794487742 7.806930000000000 + 952 2 4 0.84 30.371690000000011 35.993106973290051 6.210000000000000 + 953 2 5 -0.42 30.371690000000011 37.838907330894669 4.613070000000000 + 954 2 6 -0.42 30.371690000000011 37.838907330894669 7.806930000000000 + 955 2 4 0.84 31.970200000000011 38.761807509696978 6.210000000000000 + 956 2 5 -0.42 31.970200000000011 40.607607867301596 4.613070000000000 + 957 2 6 -0.42 31.970200000000011 40.607607867301596 7.806930000000000 + 958 2 4 0.84 33.568710000000012 41.530508046103905 6.210000000000000 + 959 2 5 -0.42 33.568710000000012 43.376308403708523 4.613070000000000 + 960 2 6 -0.42 33.568710000000012 43.376308403708523 7.806930000000000 + 961 2 4 0.84 12.788080000000004 0.000000000000000 6.210000000000000 + 962 2 5 -0.42 12.788080000000004 1.845800357604618 4.613070000000000 + 963 2 6 -0.42 12.788080000000004 1.845800357604618 7.806930000000000 + 964 2 4 0.84 14.386590000000005 2.768700536406927 6.210000000000000 + 965 2 5 -0.42 14.386590000000005 4.614500894011545 4.613070000000000 + 966 2 6 -0.42 14.386590000000005 4.614500894011545 7.806930000000000 + 967 2 4 0.84 15.985100000000006 5.537401072813854 6.210000000000000 + 968 2 5 -0.42 15.985100000000006 7.383201430418472 4.613070000000000 + 969 2 6 -0.42 15.985100000000006 7.383201430418472 7.806930000000000 + 970 2 4 0.84 17.583610000000006 8.306101609220781 6.210000000000000 + 971 2 5 -0.42 17.583610000000006 10.151901966825399 4.613070000000000 + 972 2 6 -0.42 17.583610000000006 10.151901966825399 7.806930000000000 + 973 2 4 0.84 19.182120000000007 11.074802145627708 6.210000000000000 + 974 2 5 -0.42 19.182120000000007 12.920602503232326 4.613070000000000 + 975 2 6 -0.42 19.182120000000007 12.920602503232326 7.806930000000000 + 976 2 4 0.84 20.780630000000007 13.843502682034635 6.210000000000000 + 977 2 5 -0.42 20.780630000000007 15.689303039639253 4.613070000000000 + 978 2 6 -0.42 20.780630000000007 15.689303039639253 7.806930000000000 + 979 2 4 0.84 22.379140000000008 16.612203218441562 6.210000000000000 + 980 2 5 -0.42 22.379140000000008 18.458003576046180 4.613070000000000 + 981 2 6 -0.42 22.379140000000008 18.458003576046180 7.806930000000000 + 982 2 4 0.84 23.977650000000008 19.380903754848489 6.210000000000000 + 983 2 5 -0.42 23.977650000000008 21.226704112453107 4.613070000000000 + 984 2 6 -0.42 23.977650000000008 21.226704112453107 7.806930000000000 + 985 2 4 0.84 25.576160000000009 22.149604291255416 6.210000000000000 + 986 2 5 -0.42 25.576160000000009 23.995404648860034 4.613070000000000 + 987 2 6 -0.42 25.576160000000009 23.995404648860034 7.806930000000000 + 988 2 4 0.84 27.174670000000009 24.918304827662343 6.210000000000000 + 989 2 5 -0.42 27.174670000000009 26.764105185266961 4.613070000000000 + 990 2 6 -0.42 27.174670000000009 26.764105185266961 7.806930000000000 + 991 2 4 0.84 28.773180000000010 27.687005364069270 6.210000000000000 + 992 2 5 -0.42 28.773180000000010 29.532805721673888 4.613070000000000 + 993 2 6 -0.42 28.773180000000010 29.532805721673888 7.806930000000000 + 994 2 4 0.84 30.371690000000011 30.455705900476197 6.210000000000000 + 995 2 5 -0.42 30.371690000000011 32.301506258080815 4.613070000000000 + 996 2 6 -0.42 30.371690000000011 32.301506258080815 7.806930000000000 + 997 2 4 0.84 31.970200000000011 33.224406436883124 6.210000000000000 + 998 2 5 -0.42 31.970200000000011 35.070206794487742 4.613070000000000 + 999 2 6 -0.42 31.970200000000011 35.070206794487742 7.806930000000000 + 1000 2 4 0.84 33.568710000000012 35.993106973290051 6.210000000000000 + 1001 2 5 -0.42 33.568710000000012 37.838907330894669 4.613070000000000 + 1002 2 6 -0.42 33.568710000000012 37.838907330894669 7.806930000000000 + 1003 2 4 0.84 35.167220000000012 38.761807509696978 6.210000000000000 + 1004 2 5 -0.42 35.167220000000012 40.607607867301596 4.613070000000000 + 1005 2 6 -0.42 35.167220000000012 40.607607867301596 7.806930000000000 + 1006 2 4 0.84 36.765730000000013 41.530508046103905 6.210000000000000 + 1007 2 5 -0.42 36.765730000000013 43.376308403708523 4.613070000000000 + 1008 2 6 -0.42 36.765730000000013 43.376308403708523 7.806930000000000 + 1009 2 4 0.84 15.985100000000006 0.000000000000000 6.210000000000000 + 1010 2 5 -0.42 15.985100000000006 1.845800357604618 4.613070000000000 + 1011 2 6 -0.42 15.985100000000006 1.845800357604618 7.806930000000000 + 1012 2 4 0.84 17.583610000000006 2.768700536406927 6.210000000000000 + 1013 2 5 -0.42 17.583610000000006 4.614500894011545 4.613070000000000 + 1014 2 6 -0.42 17.583610000000006 4.614500894011545 7.806930000000000 + 1015 2 4 0.84 19.182120000000007 5.537401072813854 6.210000000000000 + 1016 2 5 -0.42 19.182120000000007 7.383201430418472 4.613070000000000 + 1017 2 6 -0.42 19.182120000000007 7.383201430418472 7.806930000000000 + 1018 2 4 0.84 20.780630000000007 8.306101609220781 6.210000000000000 + 1019 2 5 -0.42 20.780630000000007 10.151901966825399 4.613070000000000 + 1020 2 6 -0.42 20.780630000000007 10.151901966825399 7.806930000000000 + 1021 2 4 0.84 22.379140000000008 11.074802145627708 6.210000000000000 + 1022 2 5 -0.42 22.379140000000008 12.920602503232326 4.613070000000000 + 1023 2 6 -0.42 22.379140000000008 12.920602503232326 7.806930000000000 + 1024 2 4 0.84 23.977650000000008 13.843502682034635 6.210000000000000 + 1025 2 5 -0.42 23.977650000000008 15.689303039639253 4.613070000000000 + 1026 2 6 -0.42 23.977650000000008 15.689303039639253 7.806930000000000 + 1027 2 4 0.84 25.576160000000009 16.612203218441562 6.210000000000000 + 1028 2 5 -0.42 25.576160000000009 18.458003576046180 4.613070000000000 + 1029 2 6 -0.42 25.576160000000009 18.458003576046180 7.806930000000000 + 1030 2 4 0.84 27.174670000000009 19.380903754848489 6.210000000000000 + 1031 2 5 -0.42 27.174670000000009 21.226704112453107 4.613070000000000 + 1032 2 6 -0.42 27.174670000000009 21.226704112453107 7.806930000000000 + 1033 2 4 0.84 28.773180000000010 22.149604291255416 6.210000000000000 + 1034 2 5 -0.42 28.773180000000010 23.995404648860034 4.613070000000000 + 1035 2 6 -0.42 28.773180000000010 23.995404648860034 7.806930000000000 + 1036 2 4 0.84 30.371690000000011 24.918304827662343 6.210000000000000 + 1037 2 5 -0.42 30.371690000000011 26.764105185266961 4.613070000000000 + 1038 2 6 -0.42 30.371690000000011 26.764105185266961 7.806930000000000 + 1039 2 4 0.84 31.970200000000011 27.687005364069270 6.210000000000000 + 1040 2 5 -0.42 31.970200000000011 29.532805721673888 4.613070000000000 + 1041 2 6 -0.42 31.970200000000011 29.532805721673888 7.806930000000000 + 1042 2 4 0.84 33.568710000000012 30.455705900476197 6.210000000000000 + 1043 2 5 -0.42 33.568710000000012 32.301506258080815 4.613070000000000 + 1044 2 6 -0.42 33.568710000000012 32.301506258080815 7.806930000000000 + 1045 2 4 0.84 35.167220000000012 33.224406436883124 6.210000000000000 + 1046 2 5 -0.42 35.167220000000012 35.070206794487742 4.613070000000000 + 1047 2 6 -0.42 35.167220000000012 35.070206794487742 7.806930000000000 + 1048 2 4 0.84 36.765730000000013 35.993106973290051 6.210000000000000 + 1049 2 5 -0.42 36.765730000000013 37.838907330894669 4.613070000000000 + 1050 2 6 -0.42 36.765730000000013 37.838907330894669 7.806930000000000 + 1051 2 4 0.84 38.364240000000013 38.761807509696978 6.210000000000000 + 1052 2 5 -0.42 38.364240000000013 40.607607867301596 4.613070000000000 + 1053 2 6 -0.42 38.364240000000013 40.607607867301596 7.806930000000000 + 1054 2 4 0.84 39.962750000000014 41.530508046103905 6.210000000000000 + 1055 2 5 -0.42 39.962750000000014 43.376308403708523 4.613070000000000 + 1056 2 6 -0.42 39.962750000000014 43.376308403708523 7.806930000000000 + 1057 2 4 0.84 19.182120000000007 0.000000000000000 6.210000000000000 + 1058 2 5 -0.42 19.182120000000007 1.845800357604618 4.613070000000000 + 1059 2 6 -0.42 19.182120000000007 1.845800357604618 7.806930000000000 + 1060 2 4 0.84 20.780630000000007 2.768700536406927 6.210000000000000 + 1061 2 5 -0.42 20.780630000000007 4.614500894011545 4.613070000000000 + 1062 2 6 -0.42 20.780630000000007 4.614500894011545 7.806930000000000 + 1063 2 4 0.84 22.379140000000008 5.537401072813854 6.210000000000000 + 1064 2 5 -0.42 22.379140000000008 7.383201430418472 4.613070000000000 + 1065 2 6 -0.42 22.379140000000008 7.383201430418472 7.806930000000000 + 1066 2 4 0.84 23.977650000000008 8.306101609220781 6.210000000000000 + 1067 2 5 -0.42 23.977650000000008 10.151901966825399 4.613070000000000 + 1068 2 6 -0.42 23.977650000000008 10.151901966825399 7.806930000000000 + 1069 2 4 0.84 25.576160000000009 11.074802145627708 6.210000000000000 + 1070 2 5 -0.42 25.576160000000009 12.920602503232326 4.613070000000000 + 1071 2 6 -0.42 25.576160000000009 12.920602503232326 7.806930000000000 + 1072 2 4 0.84 27.174670000000009 13.843502682034635 6.210000000000000 + 1073 2 5 -0.42 27.174670000000009 15.689303039639253 4.613070000000000 + 1074 2 6 -0.42 27.174670000000009 15.689303039639253 7.806930000000000 + 1075 2 4 0.84 28.773180000000010 16.612203218441562 6.210000000000000 + 1076 2 5 -0.42 28.773180000000010 18.458003576046180 4.613070000000000 + 1077 2 6 -0.42 28.773180000000010 18.458003576046180 7.806930000000000 + 1078 2 4 0.84 30.371690000000011 19.380903754848489 6.210000000000000 + 1079 2 5 -0.42 30.371690000000011 21.226704112453107 4.613070000000000 + 1080 2 6 -0.42 30.371690000000011 21.226704112453107 7.806930000000000 + 1081 2 4 0.84 31.970200000000011 22.149604291255416 6.210000000000000 + 1082 2 5 -0.42 31.970200000000011 23.995404648860034 4.613070000000000 + 1083 2 6 -0.42 31.970200000000011 23.995404648860034 7.806930000000000 + 1084 2 4 0.84 33.568710000000012 24.918304827662343 6.210000000000000 + 1085 2 5 -0.42 33.568710000000012 26.764105185266961 4.613070000000000 + 1086 2 6 -0.42 33.568710000000012 26.764105185266961 7.806930000000000 + 1087 2 4 0.84 35.167220000000012 27.687005364069270 6.210000000000000 + 1088 2 5 -0.42 35.167220000000012 29.532805721673888 4.613070000000000 + 1089 2 6 -0.42 35.167220000000012 29.532805721673888 7.806930000000000 + 1090 2 4 0.84 36.765730000000013 30.455705900476197 6.210000000000000 + 1091 2 5 -0.42 36.765730000000013 32.301506258080815 4.613070000000000 + 1092 2 6 -0.42 36.765730000000013 32.301506258080815 7.806930000000000 + 1093 2 4 0.84 38.364240000000013 33.224406436883124 6.210000000000000 + 1094 2 5 -0.42 38.364240000000013 35.070206794487742 4.613070000000000 + 1095 2 6 -0.42 38.364240000000013 35.070206794487742 7.806930000000000 + 1096 2 4 0.84 39.962750000000014 35.993106973290051 6.210000000000000 + 1097 2 5 -0.42 39.962750000000014 37.838907330894669 4.613070000000000 + 1098 2 6 -0.42 39.962750000000014 37.838907330894669 7.806930000000000 + 1099 2 4 0.84 41.561260000000014 38.761807509696978 6.210000000000000 + 1100 2 5 -0.42 41.561260000000014 40.607607867301596 4.613070000000000 + 1101 2 6 -0.42 41.561260000000014 40.607607867301596 7.806930000000000 + 1102 2 4 0.84 43.159770000000015 41.530508046103905 6.210000000000000 + 1103 2 5 -0.42 43.159770000000015 43.376308403708523 4.613070000000000 + 1104 2 6 -0.42 43.159770000000015 43.376308403708523 7.806930000000000 + 1105 2 4 0.84 22.379140000000008 0.000000000000000 6.210000000000000 + 1106 2 5 -0.42 22.379140000000008 1.845800357604618 4.613070000000000 + 1107 2 6 -0.42 22.379140000000008 1.845800357604618 7.806930000000000 + 1108 2 4 0.84 23.977650000000008 2.768700536406927 6.210000000000000 + 1109 2 5 -0.42 23.977650000000008 4.614500894011545 4.613070000000000 + 1110 2 6 -0.42 23.977650000000008 4.614500894011545 7.806930000000000 + 1111 2 4 0.84 25.576160000000009 5.537401072813854 6.210000000000000 + 1112 2 5 -0.42 25.576160000000009 7.383201430418472 4.613070000000000 + 1113 2 6 -0.42 25.576160000000009 7.383201430418472 7.806930000000000 + 1114 2 4 0.84 27.174670000000009 8.306101609220781 6.210000000000000 + 1115 2 5 -0.42 27.174670000000009 10.151901966825399 4.613070000000000 + 1116 2 6 -0.42 27.174670000000009 10.151901966825399 7.806930000000000 + 1117 2 4 0.84 28.773180000000010 11.074802145627708 6.210000000000000 + 1118 2 5 -0.42 28.773180000000010 12.920602503232326 4.613070000000000 + 1119 2 6 -0.42 28.773180000000010 12.920602503232326 7.806930000000000 + 1120 2 4 0.84 30.371690000000011 13.843502682034635 6.210000000000000 + 1121 2 5 -0.42 30.371690000000011 15.689303039639253 4.613070000000000 + 1122 2 6 -0.42 30.371690000000011 15.689303039639253 7.806930000000000 + 1123 2 4 0.84 31.970200000000011 16.612203218441562 6.210000000000000 + 1124 2 5 -0.42 31.970200000000011 18.458003576046180 4.613070000000000 + 1125 2 6 -0.42 31.970200000000011 18.458003576046180 7.806930000000000 + 1126 2 4 0.84 33.568710000000012 19.380903754848489 6.210000000000000 + 1127 2 5 -0.42 33.568710000000012 21.226704112453107 4.613070000000000 + 1128 2 6 -0.42 33.568710000000012 21.226704112453107 7.806930000000000 + 1129 2 4 0.84 35.167220000000012 22.149604291255416 6.210000000000000 + 1130 2 5 -0.42 35.167220000000012 23.995404648860034 4.613070000000000 + 1131 2 6 -0.42 35.167220000000012 23.995404648860034 7.806930000000000 + 1132 2 4 0.84 36.765730000000013 24.918304827662343 6.210000000000000 + 1133 2 5 -0.42 36.765730000000013 26.764105185266961 4.613070000000000 + 1134 2 6 -0.42 36.765730000000013 26.764105185266961 7.806930000000000 + 1135 2 4 0.84 38.364240000000013 27.687005364069270 6.210000000000000 + 1136 2 5 -0.42 38.364240000000013 29.532805721673888 4.613070000000000 + 1137 2 6 -0.42 38.364240000000013 29.532805721673888 7.806930000000000 + 1138 2 4 0.84 39.962750000000014 30.455705900476197 6.210000000000000 + 1139 2 5 -0.42 39.962750000000014 32.301506258080815 4.613070000000000 + 1140 2 6 -0.42 39.962750000000014 32.301506258080815 7.806930000000000 + 1141 2 4 0.84 41.561260000000014 33.224406436883124 6.210000000000000 + 1142 2 5 -0.42 41.561260000000014 35.070206794487742 4.613070000000000 + 1143 2 6 -0.42 41.561260000000014 35.070206794487742 7.806930000000000 + 1144 2 4 0.84 43.159770000000015 35.993106973290051 6.210000000000000 + 1145 2 5 -0.42 43.159770000000015 37.838907330894669 4.613070000000000 + 1146 2 6 -0.42 43.159770000000015 37.838907330894669 7.806930000000000 + 1147 2 4 0.84 44.758280000000015 38.761807509696978 6.210000000000000 + 1148 2 5 -0.42 44.758280000000015 40.607607867301596 4.613070000000000 + 1149 2 6 -0.42 44.758280000000015 40.607607867301596 7.806930000000000 + 1150 2 4 0.84 46.356790000000016 41.530508046103905 6.210000000000000 + 1151 2 5 -0.42 46.356790000000016 43.376308403708523 4.613070000000000 + 1152 2 6 -0.42 46.356790000000016 43.376308403708523 7.806930000000000 + 1153 2 4 0.84 25.576160000000009 0.000000000000000 6.210000000000000 + 1154 2 5 -0.42 25.576160000000009 1.845800357604618 4.613070000000000 + 1155 2 6 -0.42 25.576160000000009 1.845800357604618 7.806930000000000 + 1156 2 4 0.84 27.174670000000009 2.768700536406927 6.210000000000000 + 1157 2 5 -0.42 27.174670000000009 4.614500894011545 4.613070000000000 + 1158 2 6 -0.42 27.174670000000009 4.614500894011545 7.806930000000000 + 1159 2 4 0.84 28.773180000000010 5.537401072813854 6.210000000000000 + 1160 2 5 -0.42 28.773180000000010 7.383201430418472 4.613070000000000 + 1161 2 6 -0.42 28.773180000000010 7.383201430418472 7.806930000000000 + 1162 2 4 0.84 30.371690000000011 8.306101609220781 6.210000000000000 + 1163 2 5 -0.42 30.371690000000011 10.151901966825399 4.613070000000000 + 1164 2 6 -0.42 30.371690000000011 10.151901966825399 7.806930000000000 + 1165 2 4 0.84 31.970200000000011 11.074802145627708 6.210000000000000 + 1166 2 5 -0.42 31.970200000000011 12.920602503232326 4.613070000000000 + 1167 2 6 -0.42 31.970200000000011 12.920602503232326 7.806930000000000 + 1168 2 4 0.84 33.568710000000012 13.843502682034635 6.210000000000000 + 1169 2 5 -0.42 33.568710000000012 15.689303039639253 4.613070000000000 + 1170 2 6 -0.42 33.568710000000012 15.689303039639253 7.806930000000000 + 1171 2 4 0.84 35.167220000000012 16.612203218441562 6.210000000000000 + 1172 2 5 -0.42 35.167220000000012 18.458003576046180 4.613070000000000 + 1173 2 6 -0.42 35.167220000000012 18.458003576046180 7.806930000000000 + 1174 2 4 0.84 36.765730000000013 19.380903754848489 6.210000000000000 + 1175 2 5 -0.42 36.765730000000013 21.226704112453107 4.613070000000000 + 1176 2 6 -0.42 36.765730000000013 21.226704112453107 7.806930000000000 + 1177 2 4 0.84 38.364240000000013 22.149604291255416 6.210000000000000 + 1178 2 5 -0.42 38.364240000000013 23.995404648860034 4.613070000000000 + 1179 2 6 -0.42 38.364240000000013 23.995404648860034 7.806930000000000 + 1180 2 4 0.84 39.962750000000014 24.918304827662343 6.210000000000000 + 1181 2 5 -0.42 39.962750000000014 26.764105185266961 4.613070000000000 + 1182 2 6 -0.42 39.962750000000014 26.764105185266961 7.806930000000000 + 1183 2 4 0.84 41.561260000000014 27.687005364069270 6.210000000000000 + 1184 2 5 -0.42 41.561260000000014 29.532805721673888 4.613070000000000 + 1185 2 6 -0.42 41.561260000000014 29.532805721673888 7.806930000000000 + 1186 2 4 0.84 43.159770000000015 30.455705900476197 6.210000000000000 + 1187 2 5 -0.42 43.159770000000015 32.301506258080815 4.613070000000000 + 1188 2 6 -0.42 43.159770000000015 32.301506258080815 7.806930000000000 + 1189 2 4 0.84 44.758280000000015 33.224406436883124 6.210000000000000 + 1190 2 5 -0.42 44.758280000000015 35.070206794487742 4.613070000000000 + 1191 2 6 -0.42 44.758280000000015 35.070206794487742 7.806930000000000 + 1192 2 4 0.84 46.356790000000016 35.993106973290051 6.210000000000000 + 1193 2 5 -0.42 46.356790000000016 37.838907330894669 4.613070000000000 + 1194 2 6 -0.42 46.356790000000016 37.838907330894669 7.806930000000000 + 1195 2 4 0.84 47.955300000000017 38.761807509696978 6.210000000000000 + 1196 2 5 -0.42 47.955300000000017 40.607607867301596 4.613070000000000 + 1197 2 6 -0.42 47.955300000000017 40.607607867301596 7.806930000000000 + 1198 2 4 0.84 49.553810000000017 41.530508046103905 6.210000000000000 + 1199 2 5 -0.42 49.553810000000017 43.376308403708523 4.613070000000000 + 1200 2 6 -0.42 49.553810000000017 43.376308403708523 7.806930000000000 + 1201 2 4 0.84 28.773180000000010 0.000000000000000 6.210000000000000 + 1202 2 5 -0.42 28.773180000000010 1.845800357604618 4.613070000000000 + 1203 2 6 -0.42 28.773180000000010 1.845800357604618 7.806930000000000 + 1204 2 4 0.84 30.371690000000011 2.768700536406927 6.210000000000000 + 1205 2 5 -0.42 30.371690000000011 4.614500894011545 4.613070000000000 + 1206 2 6 -0.42 30.371690000000011 4.614500894011545 7.806930000000000 + 1207 2 4 0.84 31.970200000000011 5.537401072813854 6.210000000000000 + 1208 2 5 -0.42 31.970200000000011 7.383201430418472 4.613070000000000 + 1209 2 6 -0.42 31.970200000000011 7.383201430418472 7.806930000000000 + 1210 2 4 0.84 33.568710000000012 8.306101609220781 6.210000000000000 + 1211 2 5 -0.42 33.568710000000012 10.151901966825399 4.613070000000000 + 1212 2 6 -0.42 33.568710000000012 10.151901966825399 7.806930000000000 + 1213 2 4 0.84 35.167220000000012 11.074802145627708 6.210000000000000 + 1214 2 5 -0.42 35.167220000000012 12.920602503232326 4.613070000000000 + 1215 2 6 -0.42 35.167220000000012 12.920602503232326 7.806930000000000 + 1216 2 4 0.84 36.765730000000013 13.843502682034635 6.210000000000000 + 1217 2 5 -0.42 36.765730000000013 15.689303039639253 4.613070000000000 + 1218 2 6 -0.42 36.765730000000013 15.689303039639253 7.806930000000000 + 1219 2 4 0.84 38.364240000000013 16.612203218441562 6.210000000000000 + 1220 2 5 -0.42 38.364240000000013 18.458003576046180 4.613070000000000 + 1221 2 6 -0.42 38.364240000000013 18.458003576046180 7.806930000000000 + 1222 2 4 0.84 39.962750000000014 19.380903754848489 6.210000000000000 + 1223 2 5 -0.42 39.962750000000014 21.226704112453107 4.613070000000000 + 1224 2 6 -0.42 39.962750000000014 21.226704112453107 7.806930000000000 + 1225 2 4 0.84 41.561260000000014 22.149604291255416 6.210000000000000 + 1226 2 5 -0.42 41.561260000000014 23.995404648860034 4.613070000000000 + 1227 2 6 -0.42 41.561260000000014 23.995404648860034 7.806930000000000 + 1228 2 4 0.84 43.159770000000015 24.918304827662343 6.210000000000000 + 1229 2 5 -0.42 43.159770000000015 26.764105185266961 4.613070000000000 + 1230 2 6 -0.42 43.159770000000015 26.764105185266961 7.806930000000000 + 1231 2 4 0.84 44.758280000000015 27.687005364069270 6.210000000000000 + 1232 2 5 -0.42 44.758280000000015 29.532805721673888 4.613070000000000 + 1233 2 6 -0.42 44.758280000000015 29.532805721673888 7.806930000000000 + 1234 2 4 0.84 46.356790000000016 30.455705900476197 6.210000000000000 + 1235 2 5 -0.42 46.356790000000016 32.301506258080815 4.613070000000000 + 1236 2 6 -0.42 46.356790000000016 32.301506258080815 7.806930000000000 + 1237 2 4 0.84 47.955300000000017 33.224406436883124 6.210000000000000 + 1238 2 5 -0.42 47.955300000000017 35.070206794487742 4.613070000000000 + 1239 2 6 -0.42 47.955300000000017 35.070206794487742 7.806930000000000 + 1240 2 4 0.84 49.553810000000017 35.993106973290051 6.210000000000000 + 1241 2 5 -0.42 49.553810000000017 37.838907330894669 4.613070000000000 + 1242 2 6 -0.42 49.553810000000017 37.838907330894669 7.806930000000000 + 1243 2 4 0.84 51.152320000000018 38.761807509696978 6.210000000000000 + 1244 2 5 -0.42 51.152320000000018 40.607607867301596 4.613070000000000 + 1245 2 6 -0.42 51.152320000000018 40.607607867301596 7.806930000000000 + 1246 2 4 0.84 52.750830000000018 41.530508046103905 6.210000000000000 + 1247 2 5 -0.42 52.750830000000018 43.376308403708523 4.613070000000000 + 1248 2 6 -0.42 52.750830000000018 43.376308403708523 7.806930000000000 + 1249 2 4 0.84 31.970200000000011 0.000000000000000 6.210000000000000 + 1250 2 5 -0.42 31.970200000000011 1.845800357604618 4.613070000000000 + 1251 2 6 -0.42 31.970200000000011 1.845800357604618 7.806930000000000 + 1252 2 4 0.84 33.568710000000012 2.768700536406927 6.210000000000000 + 1253 2 5 -0.42 33.568710000000012 4.614500894011545 4.613070000000000 + 1254 2 6 -0.42 33.568710000000012 4.614500894011545 7.806930000000000 + 1255 2 4 0.84 35.167220000000012 5.537401072813854 6.210000000000000 + 1256 2 5 -0.42 35.167220000000012 7.383201430418472 4.613070000000000 + 1257 2 6 -0.42 35.167220000000012 7.383201430418472 7.806930000000000 + 1258 2 4 0.84 36.765730000000013 8.306101609220781 6.210000000000000 + 1259 2 5 -0.42 36.765730000000013 10.151901966825399 4.613070000000000 + 1260 2 6 -0.42 36.765730000000013 10.151901966825399 7.806930000000000 + 1261 2 4 0.84 38.364240000000013 11.074802145627708 6.210000000000000 + 1262 2 5 -0.42 38.364240000000013 12.920602503232326 4.613070000000000 + 1263 2 6 -0.42 38.364240000000013 12.920602503232326 7.806930000000000 + 1264 2 4 0.84 39.962750000000014 13.843502682034635 6.210000000000000 + 1265 2 5 -0.42 39.962750000000014 15.689303039639253 4.613070000000000 + 1266 2 6 -0.42 39.962750000000014 15.689303039639253 7.806930000000000 + 1267 2 4 0.84 41.561260000000014 16.612203218441562 6.210000000000000 + 1268 2 5 -0.42 41.561260000000014 18.458003576046180 4.613070000000000 + 1269 2 6 -0.42 41.561260000000014 18.458003576046180 7.806930000000000 + 1270 2 4 0.84 43.159770000000015 19.380903754848489 6.210000000000000 + 1271 2 5 -0.42 43.159770000000015 21.226704112453107 4.613070000000000 + 1272 2 6 -0.42 43.159770000000015 21.226704112453107 7.806930000000000 + 1273 2 4 0.84 44.758280000000015 22.149604291255416 6.210000000000000 + 1274 2 5 -0.42 44.758280000000015 23.995404648860034 4.613070000000000 + 1275 2 6 -0.42 44.758280000000015 23.995404648860034 7.806930000000000 + 1276 2 4 0.84 46.356790000000016 24.918304827662343 6.210000000000000 + 1277 2 5 -0.42 46.356790000000016 26.764105185266961 4.613070000000000 + 1278 2 6 -0.42 46.356790000000016 26.764105185266961 7.806930000000000 + 1279 2 4 0.84 47.955300000000017 27.687005364069270 6.210000000000000 + 1280 2 5 -0.42 47.955300000000017 29.532805721673888 4.613070000000000 + 1281 2 6 -0.42 47.955300000000017 29.532805721673888 7.806930000000000 + 1282 2 4 0.84 49.553810000000017 30.455705900476197 6.210000000000000 + 1283 2 5 -0.42 49.553810000000017 32.301506258080815 4.613070000000000 + 1284 2 6 -0.42 49.553810000000017 32.301506258080815 7.806930000000000 + 1285 2 4 0.84 51.152320000000018 33.224406436883124 6.210000000000000 + 1286 2 5 -0.42 51.152320000000018 35.070206794487742 4.613070000000000 + 1287 2 6 -0.42 51.152320000000018 35.070206794487742 7.806930000000000 + 1288 2 4 0.84 52.750830000000018 35.993106973290051 6.210000000000000 + 1289 2 5 -0.42 52.750830000000018 37.838907330894669 4.613070000000000 + 1290 2 6 -0.42 52.750830000000018 37.838907330894669 7.806930000000000 + 1291 2 4 0.84 54.349340000000019 38.761807509696978 6.210000000000000 + 1292 2 5 -0.42 54.349340000000019 40.607607867301596 4.613070000000000 + 1293 2 6 -0.42 54.349340000000019 40.607607867301596 7.806930000000000 + 1294 2 4 0.84 55.947850000000019 41.530508046103905 6.210000000000000 + 1295 2 5 -0.42 55.947850000000019 43.376308403708523 4.613070000000000 + 1296 2 6 -0.42 55.947850000000019 43.376308403708523 7.806930000000000 + 1297 2 4 0.84 35.167220000000012 0.000000000000000 6.210000000000000 + 1298 2 5 -0.42 35.167220000000012 1.845800357604618 4.613070000000000 + 1299 2 6 -0.42 35.167220000000012 1.845800357604618 7.806930000000000 + 1300 2 4 0.84 36.765730000000013 2.768700536406927 6.210000000000000 + 1301 2 5 -0.42 36.765730000000013 4.614500894011545 4.613070000000000 + 1302 2 6 -0.42 36.765730000000013 4.614500894011545 7.806930000000000 + 1303 2 4 0.84 38.364240000000013 5.537401072813854 6.210000000000000 + 1304 2 5 -0.42 38.364240000000013 7.383201430418472 4.613070000000000 + 1305 2 6 -0.42 38.364240000000013 7.383201430418472 7.806930000000000 + 1306 2 4 0.84 39.962750000000014 8.306101609220781 6.210000000000000 + 1307 2 5 -0.42 39.962750000000014 10.151901966825399 4.613070000000000 + 1308 2 6 -0.42 39.962750000000014 10.151901966825399 7.806930000000000 + 1309 2 4 0.84 41.561260000000014 11.074802145627708 6.210000000000000 + 1310 2 5 -0.42 41.561260000000014 12.920602503232326 4.613070000000000 + 1311 2 6 -0.42 41.561260000000014 12.920602503232326 7.806930000000000 + 1312 2 4 0.84 43.159770000000015 13.843502682034635 6.210000000000000 + 1313 2 5 -0.42 43.159770000000015 15.689303039639253 4.613070000000000 + 1314 2 6 -0.42 43.159770000000015 15.689303039639253 7.806930000000000 + 1315 2 4 0.84 44.758280000000015 16.612203218441562 6.210000000000000 + 1316 2 5 -0.42 44.758280000000015 18.458003576046180 4.613070000000000 + 1317 2 6 -0.42 44.758280000000015 18.458003576046180 7.806930000000000 + 1318 2 4 0.84 46.356790000000016 19.380903754848489 6.210000000000000 + 1319 2 5 -0.42 46.356790000000016 21.226704112453107 4.613070000000000 + 1320 2 6 -0.42 46.356790000000016 21.226704112453107 7.806930000000000 + 1321 2 4 0.84 47.955300000000017 22.149604291255416 6.210000000000000 + 1322 2 5 -0.42 47.955300000000017 23.995404648860034 4.613070000000000 + 1323 2 6 -0.42 47.955300000000017 23.995404648860034 7.806930000000000 + 1324 2 4 0.84 49.553810000000017 24.918304827662343 6.210000000000000 + 1325 2 5 -0.42 49.553810000000017 26.764105185266961 4.613070000000000 + 1326 2 6 -0.42 49.553810000000017 26.764105185266961 7.806930000000000 + 1327 2 4 0.84 51.152320000000018 27.687005364069270 6.210000000000000 + 1328 2 5 -0.42 51.152320000000018 29.532805721673888 4.613070000000000 + 1329 2 6 -0.42 51.152320000000018 29.532805721673888 7.806930000000000 + 1330 2 4 0.84 52.750830000000018 30.455705900476197 6.210000000000000 + 1331 2 5 -0.42 52.750830000000018 32.301506258080815 4.613070000000000 + 1332 2 6 -0.42 52.750830000000018 32.301506258080815 7.806930000000000 + 1333 2 4 0.84 54.349340000000019 33.224406436883124 6.210000000000000 + 1334 2 5 -0.42 54.349340000000019 35.070206794487742 4.613070000000000 + 1335 2 6 -0.42 54.349340000000019 35.070206794487742 7.806930000000000 + 1336 2 4 0.84 55.947850000000019 35.993106973290051 6.210000000000000 + 1337 2 5 -0.42 55.947850000000019 37.838907330894669 4.613070000000000 + 1338 2 6 -0.42 55.947850000000019 37.838907330894669 7.806930000000000 + 1339 2 4 0.84 57.546360000000020 38.761807509696978 6.210000000000000 + 1340 2 5 -0.42 57.546360000000020 40.607607867301596 4.613070000000000 + 1341 2 6 -0.42 57.546360000000020 40.607607867301596 7.806930000000000 + 1342 2 4 0.84 59.144870000000020 41.530508046103905 6.210000000000000 + 1343 2 5 -0.42 59.144870000000020 43.376308403708523 4.613070000000000 + 1344 2 6 -0.42 59.144870000000020 43.376308403708523 7.806930000000000 + 1345 2 4 0.84 38.364240000000013 0.000000000000000 6.210000000000000 + 1346 2 5 -0.42 38.364240000000013 1.845800357604618 4.613070000000000 + 1347 2 6 -0.42 38.364240000000013 1.845800357604618 7.806930000000000 + 1348 2 4 0.84 39.962750000000014 2.768700536406927 6.210000000000000 + 1349 2 5 -0.42 39.962750000000014 4.614500894011545 4.613070000000000 + 1350 2 6 -0.42 39.962750000000014 4.614500894011545 7.806930000000000 + 1351 2 4 0.84 41.561260000000014 5.537401072813854 6.210000000000000 + 1352 2 5 -0.42 41.561260000000014 7.383201430418472 4.613070000000000 + 1353 2 6 -0.42 41.561260000000014 7.383201430418472 7.806930000000000 + 1354 2 4 0.84 43.159770000000015 8.306101609220781 6.210000000000000 + 1355 2 5 -0.42 43.159770000000015 10.151901966825399 4.613070000000000 + 1356 2 6 -0.42 43.159770000000015 10.151901966825399 7.806930000000000 + 1357 2 4 0.84 44.758280000000015 11.074802145627708 6.210000000000000 + 1358 2 5 -0.42 44.758280000000015 12.920602503232326 4.613070000000000 + 1359 2 6 -0.42 44.758280000000015 12.920602503232326 7.806930000000000 + 1360 2 4 0.84 46.356790000000016 13.843502682034635 6.210000000000000 + 1361 2 5 -0.42 46.356790000000016 15.689303039639253 4.613070000000000 + 1362 2 6 -0.42 46.356790000000016 15.689303039639253 7.806930000000000 + 1363 2 4 0.84 47.955300000000017 16.612203218441562 6.210000000000000 + 1364 2 5 -0.42 47.955300000000017 18.458003576046180 4.613070000000000 + 1365 2 6 -0.42 47.955300000000017 18.458003576046180 7.806930000000000 + 1366 2 4 0.84 49.553810000000017 19.380903754848489 6.210000000000000 + 1367 2 5 -0.42 49.553810000000017 21.226704112453107 4.613070000000000 + 1368 2 6 -0.42 49.553810000000017 21.226704112453107 7.806930000000000 + 1369 2 4 0.84 51.152320000000018 22.149604291255416 6.210000000000000 + 1370 2 5 -0.42 51.152320000000018 23.995404648860034 4.613070000000000 + 1371 2 6 -0.42 51.152320000000018 23.995404648860034 7.806930000000000 + 1372 2 4 0.84 52.750830000000018 24.918304827662343 6.210000000000000 + 1373 2 5 -0.42 52.750830000000018 26.764105185266961 4.613070000000000 + 1374 2 6 -0.42 52.750830000000018 26.764105185266961 7.806930000000000 + 1375 2 4 0.84 54.349340000000019 27.687005364069270 6.210000000000000 + 1376 2 5 -0.42 54.349340000000019 29.532805721673888 4.613070000000000 + 1377 2 6 -0.42 54.349340000000019 29.532805721673888 7.806930000000000 + 1378 2 4 0.84 55.947850000000019 30.455705900476197 6.210000000000000 + 1379 2 5 -0.42 55.947850000000019 32.301506258080815 4.613070000000000 + 1380 2 6 -0.42 55.947850000000019 32.301506258080815 7.806930000000000 + 1381 2 4 0.84 57.546360000000020 33.224406436883124 6.210000000000000 + 1382 2 5 -0.42 57.546360000000020 35.070206794487742 4.613070000000000 + 1383 2 6 -0.42 57.546360000000020 35.070206794487742 7.806930000000000 + 1384 2 4 0.84 59.144870000000020 35.993106973290051 6.210000000000000 + 1385 2 5 -0.42 59.144870000000020 37.838907330894669 4.613070000000000 + 1386 2 6 -0.42 59.144870000000020 37.838907330894669 7.806930000000000 + 1387 2 4 0.84 60.743380000000021 38.761807509696978 6.210000000000000 + 1388 2 5 -0.42 60.743380000000021 40.607607867301596 4.613070000000000 + 1389 2 6 -0.42 60.743380000000021 40.607607867301596 7.806930000000000 + 1390 2 4 0.84 62.341890000000022 41.530508046103905 6.210000000000000 + 1391 2 5 -0.42 62.341890000000022 43.376308403708523 4.613070000000000 + 1392 2 6 -0.42 62.341890000000022 43.376308403708523 7.806930000000000 + 1393 2 4 0.84 41.561260000000014 0.000000000000000 6.210000000000000 + 1394 2 5 -0.42 41.561260000000014 1.845800357604618 4.613070000000000 + 1395 2 6 -0.42 41.561260000000014 1.845800357604618 7.806930000000000 + 1396 2 4 0.84 43.159770000000015 2.768700536406927 6.210000000000000 + 1397 2 5 -0.42 43.159770000000015 4.614500894011545 4.613070000000000 + 1398 2 6 -0.42 43.159770000000015 4.614500894011545 7.806930000000000 + 1399 2 4 0.84 44.758280000000015 5.537401072813854 6.210000000000000 + 1400 2 5 -0.42 44.758280000000015 7.383201430418472 4.613070000000000 + 1401 2 6 -0.42 44.758280000000015 7.383201430418472 7.806930000000000 + 1402 2 4 0.84 46.356790000000016 8.306101609220781 6.210000000000000 + 1403 2 5 -0.42 46.356790000000016 10.151901966825399 4.613070000000000 + 1404 2 6 -0.42 46.356790000000016 10.151901966825399 7.806930000000000 + 1405 2 4 0.84 47.955300000000017 11.074802145627708 6.210000000000000 + 1406 2 5 -0.42 47.955300000000017 12.920602503232326 4.613070000000000 + 1407 2 6 -0.42 47.955300000000017 12.920602503232326 7.806930000000000 + 1408 2 4 0.84 49.553810000000017 13.843502682034635 6.210000000000000 + 1409 2 5 -0.42 49.553810000000017 15.689303039639253 4.613070000000000 + 1410 2 6 -0.42 49.553810000000017 15.689303039639253 7.806930000000000 + 1411 2 4 0.84 51.152320000000018 16.612203218441562 6.210000000000000 + 1412 2 5 -0.42 51.152320000000018 18.458003576046180 4.613070000000000 + 1413 2 6 -0.42 51.152320000000018 18.458003576046180 7.806930000000000 + 1414 2 4 0.84 52.750830000000018 19.380903754848489 6.210000000000000 + 1415 2 5 -0.42 52.750830000000018 21.226704112453107 4.613070000000000 + 1416 2 6 -0.42 52.750830000000018 21.226704112453107 7.806930000000000 + 1417 2 4 0.84 54.349340000000019 22.149604291255416 6.210000000000000 + 1418 2 5 -0.42 54.349340000000019 23.995404648860034 4.613070000000000 + 1419 2 6 -0.42 54.349340000000019 23.995404648860034 7.806930000000000 + 1420 2 4 0.84 55.947850000000019 24.918304827662343 6.210000000000000 + 1421 2 5 -0.42 55.947850000000019 26.764105185266961 4.613070000000000 + 1422 2 6 -0.42 55.947850000000019 26.764105185266961 7.806930000000000 + 1423 2 4 0.84 57.546360000000020 27.687005364069270 6.210000000000000 + 1424 2 5 -0.42 57.546360000000020 29.532805721673888 4.613070000000000 + 1425 2 6 -0.42 57.546360000000020 29.532805721673888 7.806930000000000 + 1426 2 4 0.84 59.144870000000020 30.455705900476197 6.210000000000000 + 1427 2 5 -0.42 59.144870000000020 32.301506258080815 4.613070000000000 + 1428 2 6 -0.42 59.144870000000020 32.301506258080815 7.806930000000000 + 1429 2 4 0.84 60.743380000000021 33.224406436883124 6.210000000000000 + 1430 2 5 -0.42 60.743380000000021 35.070206794487742 4.613070000000000 + 1431 2 6 -0.42 60.743380000000021 35.070206794487742 7.806930000000000 + 1432 2 4 0.84 62.341890000000022 35.993106973290051 6.210000000000000 + 1433 2 5 -0.42 62.341890000000022 37.838907330894669 4.613070000000000 + 1434 2 6 -0.42 62.341890000000022 37.838907330894669 7.806930000000000 + 1435 2 4 0.84 63.940400000000022 38.761807509696978 6.210000000000000 + 1436 2 5 -0.42 63.940400000000022 40.607607867301596 4.613070000000000 + 1437 2 6 -0.42 63.940400000000022 40.607607867301596 7.806930000000000 + 1438 2 4 0.84 65.538910000000023 41.530508046103905 6.210000000000000 + 1439 2 5 -0.42 65.538910000000023 43.376308403708523 4.613070000000000 + 1440 2 6 -0.42 65.538910000000023 43.376308403708523 7.806930000000000 + 1441 2 4 0.84 44.758280000000015 0.000000000000000 6.210000000000000 + 1442 2 5 -0.42 44.758280000000015 1.845800357604618 4.613070000000000 + 1443 2 6 -0.42 44.758280000000015 1.845800357604618 7.806930000000000 + 1444 2 4 0.84 46.356790000000016 2.768700536406927 6.210000000000000 + 1445 2 5 -0.42 46.356790000000016 4.614500894011545 4.613070000000000 + 1446 2 6 -0.42 46.356790000000016 4.614500894011545 7.806930000000000 + 1447 2 4 0.84 47.955300000000017 5.537401072813854 6.210000000000000 + 1448 2 5 -0.42 47.955300000000017 7.383201430418472 4.613070000000000 + 1449 2 6 -0.42 47.955300000000017 7.383201430418472 7.806930000000000 + 1450 2 4 0.84 49.553810000000017 8.306101609220781 6.210000000000000 + 1451 2 5 -0.42 49.553810000000017 10.151901966825399 4.613070000000000 + 1452 2 6 -0.42 49.553810000000017 10.151901966825399 7.806930000000000 + 1453 2 4 0.84 51.152320000000018 11.074802145627708 6.210000000000000 + 1454 2 5 -0.42 51.152320000000018 12.920602503232326 4.613070000000000 + 1455 2 6 -0.42 51.152320000000018 12.920602503232326 7.806930000000000 + 1456 2 4 0.84 52.750830000000018 13.843502682034635 6.210000000000000 + 1457 2 5 -0.42 52.750830000000018 15.689303039639253 4.613070000000000 + 1458 2 6 -0.42 52.750830000000018 15.689303039639253 7.806930000000000 + 1459 2 4 0.84 54.349340000000019 16.612203218441562 6.210000000000000 + 1460 2 5 -0.42 54.349340000000019 18.458003576046180 4.613070000000000 + 1461 2 6 -0.42 54.349340000000019 18.458003576046180 7.806930000000000 + 1462 2 4 0.84 55.947850000000019 19.380903754848489 6.210000000000000 + 1463 2 5 -0.42 55.947850000000019 21.226704112453107 4.613070000000000 + 1464 2 6 -0.42 55.947850000000019 21.226704112453107 7.806930000000000 + 1465 2 4 0.84 57.546360000000020 22.149604291255416 6.210000000000000 + 1466 2 5 -0.42 57.546360000000020 23.995404648860034 4.613070000000000 + 1467 2 6 -0.42 57.546360000000020 23.995404648860034 7.806930000000000 + 1468 2 4 0.84 59.144870000000020 24.918304827662343 6.210000000000000 + 1469 2 5 -0.42 59.144870000000020 26.764105185266961 4.613070000000000 + 1470 2 6 -0.42 59.144870000000020 26.764105185266961 7.806930000000000 + 1471 2 4 0.84 60.743380000000021 27.687005364069270 6.210000000000000 + 1472 2 5 -0.42 60.743380000000021 29.532805721673888 4.613070000000000 + 1473 2 6 -0.42 60.743380000000021 29.532805721673888 7.806930000000000 + 1474 2 4 0.84 62.341890000000022 30.455705900476197 6.210000000000000 + 1475 2 5 -0.42 62.341890000000022 32.301506258080815 4.613070000000000 + 1476 2 6 -0.42 62.341890000000022 32.301506258080815 7.806930000000000 + 1477 2 4 0.84 63.940400000000022 33.224406436883124 6.210000000000000 + 1478 2 5 -0.42 63.940400000000022 35.070206794487742 4.613070000000000 + 1479 2 6 -0.42 63.940400000000022 35.070206794487742 7.806930000000000 + 1480 2 4 0.84 65.538910000000023 35.993106973290051 6.210000000000000 + 1481 2 5 -0.42 65.538910000000023 37.838907330894669 4.613070000000000 + 1482 2 6 -0.42 65.538910000000023 37.838907330894669 7.806930000000000 + 1483 2 4 0.84 67.137420000000023 38.761807509696978 6.210000000000000 + 1484 2 5 -0.42 67.137420000000023 40.607607867301596 4.613070000000000 + 1485 2 6 -0.42 67.137420000000023 40.607607867301596 7.806930000000000 + 1486 2 4 0.84 68.735930000000024 41.530508046103905 6.210000000000000 + 1487 2 5 -0.42 68.735930000000024 43.376308403708523 4.613070000000000 + 1488 2 6 -0.42 68.735930000000024 43.376308403708523 7.806930000000000 + 1489 2 4 0.84 47.955300000000017 0.000000000000000 6.210000000000000 + 1490 2 5 -0.42 47.955300000000017 1.845800357604618 4.613070000000000 + 1491 2 6 -0.42 47.955300000000017 1.845800357604618 7.806930000000000 + 1492 2 4 0.84 49.553810000000017 2.768700536406927 6.210000000000000 + 1493 2 5 -0.42 49.553810000000017 4.614500894011545 4.613070000000000 + 1494 2 6 -0.42 49.553810000000017 4.614500894011545 7.806930000000000 + 1495 2 4 0.84 51.152320000000018 5.537401072813854 6.210000000000000 + 1496 2 5 -0.42 51.152320000000018 7.383201430418472 4.613070000000000 + 1497 2 6 -0.42 51.152320000000018 7.383201430418472 7.806930000000000 + 1498 2 4 0.84 52.750830000000018 8.306101609220781 6.210000000000000 + 1499 2 5 -0.42 52.750830000000018 10.151901966825399 4.613070000000000 + 1500 2 6 -0.42 52.750830000000018 10.151901966825399 7.806930000000000 + 1501 2 4 0.84 54.349340000000019 11.074802145627708 6.210000000000000 + 1502 2 5 -0.42 54.349340000000019 12.920602503232326 4.613070000000000 + 1503 2 6 -0.42 54.349340000000019 12.920602503232326 7.806930000000000 + 1504 2 4 0.84 55.947850000000019 13.843502682034635 6.210000000000000 + 1505 2 5 -0.42 55.947850000000019 15.689303039639253 4.613070000000000 + 1506 2 6 -0.42 55.947850000000019 15.689303039639253 7.806930000000000 + 1507 2 4 0.84 57.546360000000020 16.612203218441562 6.210000000000000 + 1508 2 5 -0.42 57.546360000000020 18.458003576046180 4.613070000000000 + 1509 2 6 -0.42 57.546360000000020 18.458003576046180 7.806930000000000 + 1510 2 4 0.84 59.144870000000020 19.380903754848489 6.210000000000000 + 1511 2 5 -0.42 59.144870000000020 21.226704112453107 4.613070000000000 + 1512 2 6 -0.42 59.144870000000020 21.226704112453107 7.806930000000000 + 1513 2 4 0.84 60.743380000000021 22.149604291255416 6.210000000000000 + 1514 2 5 -0.42 60.743380000000021 23.995404648860034 4.613070000000000 + 1515 2 6 -0.42 60.743380000000021 23.995404648860034 7.806930000000000 + 1516 2 4 0.84 62.341890000000022 24.918304827662343 6.210000000000000 + 1517 2 5 -0.42 62.341890000000022 26.764105185266961 4.613070000000000 + 1518 2 6 -0.42 62.341890000000022 26.764105185266961 7.806930000000000 + 1519 2 4 0.84 63.940400000000022 27.687005364069270 6.210000000000000 + 1520 2 5 -0.42 63.940400000000022 29.532805721673888 4.613070000000000 + 1521 2 6 -0.42 63.940400000000022 29.532805721673888 7.806930000000000 + 1522 2 4 0.84 65.538910000000023 30.455705900476197 6.210000000000000 + 1523 2 5 -0.42 65.538910000000023 32.301506258080815 4.613070000000000 + 1524 2 6 -0.42 65.538910000000023 32.301506258080815 7.806930000000000 + 1525 2 4 0.84 67.137420000000023 33.224406436883124 6.210000000000000 + 1526 2 5 -0.42 67.137420000000023 35.070206794487742 4.613070000000000 + 1527 2 6 -0.42 67.137420000000023 35.070206794487742 7.806930000000000 + 1528 2 4 0.84 68.735930000000024 35.993106973290051 6.210000000000000 + 1529 2 5 -0.42 68.735930000000024 37.838907330894669 4.613070000000000 + 1530 2 6 -0.42 68.735930000000024 37.838907330894669 7.806930000000000 + 1531 2 4 0.84 70.334440000000024 38.761807509696978 6.210000000000000 + 1532 2 5 -0.42 70.334440000000024 40.607607867301596 4.613070000000000 + 1533 2 6 -0.42 70.334440000000024 40.607607867301596 7.806930000000000 + 1534 2 4 0.84 71.932950000000025 41.530508046103905 6.210000000000000 + 1535 2 5 -0.42 71.932950000000025 43.376308403708523 4.613070000000000 + 1536 2 6 -0.42 71.932950000000025 43.376308403708523 7.806930000000000 diff --git a/examples/PACKAGES/interlayer/ilp_tmds/in.mos2 b/examples/PACKAGES/interlayer/ilp_tmds/in.mos2 new file mode 100644 index 0000000000..b77f2fe719 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_tmds/in.mos2 @@ -0,0 +1,36 @@ +units metal +atom_style full +processors * * 1 +boundary p p f +read_data ./bilayer_MoS2_AAprime_stacking.data + +mass * 32.065 # mass of sulphur atom , uint: a.u.=1.66X10^(-27)kg +mass 1 95.94 # mass of molebdenum atom , uint: a.u.=1.66X10^(-27)kg +mass 4 95.94 + +# Define potentials +pair_style hybrid/overlay sw/mod sw/mod ilp/tmd 16.0 +pair_coeff * * sw/mod 1 tmd.sw.mod Mo S S NULL NULL NULL +pair_coeff * * sw/mod 2 tmd.sw.mod NULL NULL NULL Mo S S +pair_coeff * * ilp/tmd MoS2.ILP Mo S S Mo S S + +# Calculate the pair potential +compute 0 all pair ilp/tmd +compute 1 all pair sw/mod 1 +compute 2 all pair sw/mod 2 +variable SW1 equal c_1 +variable SW2 equal c_2 +variable ILP equal c_0 +variable Eatt equal c_0[1] +variable Erep equal c_0[2] + +thermo_style custom step etotal pe ke v_SW1 v_SW2 v_ILP v_Erep v_Eatt temp + +thermo 100 +thermo_modify lost error + +timestep 1e-3 + +velocity all create 300.0 12345 +fix intall all nve +run 1000 diff --git a/examples/PACKAGES/interlayer/ilp_tmds/log.7Jan22.mos2.g++.1 b/examples/PACKAGES/interlayer/ilp_tmds/log.7Jan22.mos2.g++.1 new file mode 100644 index 0000000000..4b14d95fd4 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_tmds/log.7Jan22.mos2.g++.1 @@ -0,0 +1,154 @@ +LAMMPS (7 Jan 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +units metal +atom_style full +processors * * 1 +boundary p p f +read_data ./bilayer_MoS2_AAprime_stacking.data +Reading data file ... + triclinic box = (0 0 -100) to (51.15232 44.299209 100) with tilt (25.57616 0 0) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 1536 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.007 seconds + +mass * 32.065 # mass of sulphur atom , uint: a.u.=1.66X10^(-27)kg +mass 1 95.94 # mass of molebdenum atom , uint: a.u.=1.66X10^(-27)kg +mass 4 95.94 + +# Define potentials +pair_style hybrid/overlay sw/mod sw/mod ilp/tmd 16.0 +pair_coeff * * sw/mod 1 tmd.sw.mod Mo S S NULL NULL NULL +Reading sw potential file tmd.sw.mod with DATE: 2018-03-26 +pair_coeff * * sw/mod 2 tmd.sw.mod NULL NULL NULL Mo S S +Reading sw potential file tmd.sw.mod with DATE: 2018-03-26 +pair_coeff * * ilp/tmd MoS2.ILP Mo S S Mo S S +Reading ilp/tmd potential file MoS2.ILP with DATE: 2021-12-02 + +# Calculate the pair potential +compute 0 all pair ilp/tmd +compute 1 all pair sw/mod 1 +compute 2 all pair sw/mod 2 +variable SW1 equal c_1 +variable SW2 equal c_2 +variable ILP equal c_0 +variable Eatt equal c_0[1] +variable Erep equal c_0[2] + +thermo_style custom step etotal pe ke v_SW1 v_SW2 v_ILP v_Erep v_Eatt temp + +thermo 100 +thermo_modify lost error + +timestep 1e-3 + +velocity all create 300.0 12345 +fix intall all nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7237–7245} + year = 2021, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 9 5 23 + 4 neighbor lists, perpetual/occasional/extra = 4 0 0 + (1) pair sw/mod, perpetual, skip from (4) + attributes: full, newton on + pair build: skip + stencil: none + bin: none + (2) pair sw/mod, perpetual, skip from (4) + attributes: full, newton on + pair build: skip + stencil: none + bin: none + (3) pair ilp/tmd, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (4) neighbor class addition, perpetual, copy from (3) + attributes: full, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 30.29 | 30.29 | 30.29 Mbytes +Step TotEng PotEng KinEng v_SW1 v_SW2 v_ILP v_Erep v_Eatt Temp + 0 -1834.4469 -1893.9712 59.524297 -929.02881 -929.02881 -35.913549 63.00343 -98.916979 300 + 100 -1834.4497 -1883.3105 48.860775 -924.84264 -925.08505 -33.382796 56.58255 -89.965346 246.25629 + 200 -1834.4381 -1873.7072 39.269085 -922.29961 -922.52535 -28.882252 50.08277 -78.965022 197.91457 + 300 -1834.4483 -1881.1263 46.678028 -923.39264 -923.65627 -34.077402 51.011967 -85.089369 235.25534 + 400 -1834.431 -1868.0728 33.64182 -916.85743 -916.27044 -34.944916 50.414038 -85.358954 169.55338 + 500 -1834.4499 -1881.9059 47.456 -925.22919 -924.29582 -32.380877 44.755168 -77.136045 239.17628 + 600 -1834.4343 -1869.8642 35.429976 -920.97805 -919.60784 -29.278358 43.270241 -72.548599 178.56562 + 700 -1834.443 -1878.144 43.700934 -921.8051 -921.55671 -34.782141 49.959943 -84.742084 220.2509 + 800 -1834.4327 -1869.824 35.391298 -917.19193 -917.91383 -34.718247 55.349728 -90.067976 178.37068 + 900 -1834.4465 -1877.6741 43.227638 -923.33877 -922.50874 -31.826599 53.965592 -85.792191 217.86551 + 1000 -1834.4412 -1876.1808 41.739587 -923.17282 -923.49367 -29.514347 55.454643 -84.96899 210.3658 +Loop time of 72.8218 on 1 procs for 1000 steps with 1536 atoms + +Performance: 1.186 ns/day, 20.228 hours/ns, 13.732 timesteps/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 72.781 | 72.781 | 72.781 | 0.0 | 99.94 +Bond | 0.00014503 | 0.00014503 | 0.00014503 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.016691 | 0.016691 | 0.016691 | 0.0 | 0.02 +Output | 0.00057989 | 0.00057989 | 0.00057989 | 0.0 | 0.00 +Modify | 0.013405 | 0.013405 | 0.013405 | 0.0 | 0.02 +Other | | 0.01044 | | | 0.01 + +Nlocal: 1536 ave 1536 max 1536 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3510 ave 3510 max 3510 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 992256 ave 992256 max 992256 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 992256 +Ave neighs/atom = 646 +Ave special neighs/atom = 0 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:01:12 diff --git a/examples/PACKAGES/interlayer/ilp_tmds/log.7Jan22.mos2.g++.4 b/examples/PACKAGES/interlayer/ilp_tmds/log.7Jan22.mos2.g++.4 new file mode 100644 index 0000000000..5524cdfbad --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_tmds/log.7Jan22.mos2.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (7 Jan 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +units metal +atom_style full +processors * * 1 +boundary p p f +read_data ./bilayer_MoS2_AAprime_stacking.data +Reading data file ... + triclinic box = (0 0 -100) to (51.15232 44.299209 100) with tilt (25.57616 0 0) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 1536 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.007 seconds + +mass * 32.065 # mass of sulphur atom , uint: a.u.=1.66X10^(-27)kg +mass 1 95.94 # mass of molebdenum atom , uint: a.u.=1.66X10^(-27)kg +mass 4 95.94 + +# Define potentials +pair_style hybrid/overlay sw/mod sw/mod ilp/tmd 16.0 +pair_coeff * * sw/mod 1 tmd.sw.mod Mo S S NULL NULL NULL +Reading sw potential file tmd.sw.mod with DATE: 2018-03-26 +pair_coeff * * sw/mod 2 tmd.sw.mod NULL NULL NULL Mo S S +Reading sw potential file tmd.sw.mod with DATE: 2018-03-26 +pair_coeff * * ilp/tmd MoS2.ILP Mo S S Mo S S +Reading ilp/tmd potential file MoS2.ILP with DATE: 2021-12-02 + +# Calculate the pair potential +compute 0 all pair ilp/tmd +compute 1 all pair sw/mod 1 +compute 2 all pair sw/mod 2 +variable SW1 equal c_1 +variable SW2 equal c_2 +variable ILP equal c_0 +variable Eatt equal c_0[1] +variable Erep equal c_0[2] + +thermo_style custom step etotal pe ke v_SW1 v_SW2 v_ILP v_Erep v_Eatt temp + +thermo 100 +thermo_modify lost error + +timestep 1e-3 + +velocity all create 300.0 12345 +fix intall all nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7237–7245} + year = 2021, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 9 5 23 + 4 neighbor lists, perpetual/occasional/extra = 4 0 0 + (1) pair sw/mod, perpetual, skip from (4) + attributes: full, newton on + pair build: skip + stencil: none + bin: none + (2) pair sw/mod, perpetual, skip from (4) + attributes: full, newton on + pair build: skip + stencil: none + bin: none + (3) pair ilp/tmd, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (4) neighbor class addition, perpetual, copy from (3) + attributes: full, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 17.98 | 17.98 | 17.98 Mbytes +Step TotEng PotEng KinEng v_SW1 v_SW2 v_ILP v_Erep v_Eatt Temp + 0 -1834.4469 -1893.9712 59.524297 -929.02881 -929.02881 -35.913549 63.00343 -98.916979 300 + 100 -1834.4497 -1883.3105 48.860775 -924.84264 -925.08505 -33.382796 56.58255 -89.965346 246.25629 + 200 -1834.4381 -1873.7072 39.269085 -922.29961 -922.52535 -28.882252 50.08277 -78.965022 197.91457 + 300 -1834.4483 -1881.1263 46.678028 -923.39264 -923.65627 -34.077402 51.011967 -85.089369 235.25534 + 400 -1834.431 -1868.0728 33.64182 -916.85743 -916.27044 -34.944916 50.414038 -85.358954 169.55338 + 500 -1834.4499 -1881.9059 47.456 -925.22919 -924.29582 -32.380877 44.755168 -77.136045 239.17628 + 600 -1834.4343 -1869.8642 35.429976 -920.97805 -919.60784 -29.278358 43.270241 -72.548599 178.56562 + 700 -1834.443 -1878.144 43.700934 -921.8051 -921.55671 -34.782141 49.959943 -84.742084 220.2509 + 800 -1834.4327 -1869.824 35.391298 -917.19193 -917.91383 -34.718247 55.349728 -90.067976 178.37068 + 900 -1834.4465 -1877.6741 43.227638 -923.33877 -922.50874 -31.826599 53.965592 -85.792191 217.86551 + 1000 -1834.4412 -1876.1808 41.739587 -923.17282 -923.49367 -29.514347 55.454643 -84.96899 210.3658 +Loop time of 24.6309 on 4 procs for 1000 steps with 1536 atoms + +Performance: 3.508 ns/day, 6.842 hours/ns, 40.599 timesteps/s +99.7% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 22.906 | 23.627 | 24.36 | 14.0 | 95.92 +Bond | 0.00010889 | 0.00011572 | 0.00012719 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.25886 | 0.992 | 1.7126 | 68.3 | 4.03 +Output | 0.00050901 | 0.00054202 | 0.00062029 | 0.0 | 0.00 +Modify | 0.0030735 | 0.0033236 | 0.0035581 | 0.3 | 0.01 +Other | | 0.008194 | | | 0.03 + +Nlocal: 384 ave 387 max 381 min +Histogram: 1 0 0 0 0 2 0 0 0 1 +Nghost: 2262 ave 2265 max 2259 min +Histogram: 1 0 0 0 0 2 0 0 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 248064 ave 250002 max 246126 min +Histogram: 1 0 0 0 0 2 0 0 0 1 + +Total # of neighbors = 992256 +Ave neighs/atom = 646 +Ave special neighs/atom = 0 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:24 diff --git a/examples/PACKAGES/interlayer/ilp_tmds/tmd.sw.mod b/examples/PACKAGES/interlayer/ilp_tmds/tmd.sw.mod new file mode 100644 index 0000000000..b88390ee26 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_tmds/tmd.sw.mod @@ -0,0 +1,143 @@ +# DATE: 2018-03-26 UNITS: metal CONTRIBUTOR: Jin-Wu Jiang jwjiang5918@hotmail.com +# CITATION: J.-W. Jiang, Acta Mech. Solida. Sin 32, 17 (2019). +# The Stillinger-Weber parameters, for transition-metal dichalcogenide (TMD) lateral heterostructures. +# M = Mo, W; X = S, Se, Te + +# these entries are in LAMMPS "metal" units: +# epsilon = eV; sigma = Angstroms +# other quantities are unitless + +# format of a single entry (one or more lines): +# element 1, element 2, element 3, +# epsilon, sigma, a, lambda, gamma, costheta0, A, B, p, q, tol + +# M-X-X terms +Mo S S 1.000 1.252 2.523 67.883 1.000 0.143 6.918 7.223 4 0 0.0 +Mo Se Se 1.000 0.913 3.672 32.526 1.000 0.143 5.737 27.084 4 0 0.0 +Mo Te Te 1.000 0.880 4.097 23.705 1.000 0.143 5.086 40.810 4 0 0.0 +W S S 1.000 0.889 3.558 37.687 1.000 0.143 5.664 24.525 4 0 0.0 +W Se Se 1.000 0.706 4.689 25.607 1.000 0.143 5.476 65.662 4 0 0.0 +W Te Te 1.000 0.778 4.632 21.313 1.000 0.143 4.326 62.148 4 0 0.0 +# X-M-M terms +S Mo Mo 1.000 1.252 2.523 62.449 1.000 0.143 6.918 7.223 4 0 0.0 +S W W 1.000 0.889 3.558 33.553 1.000 0.143 5.664 24.525 4 0 0.0 +Se Mo Mo 1.000 0.913 3.672 27.079 1.000 0.143 5.737 27.084 4 0 0.0 +Se W W 1.000 0.706 4.689 23.218 1.000 0.143 5.476 65.662 4 0 0.0 +Te Mo Mo 1.000 0.880 4.097 20.029 1.000 0.143 5.086 40.810 4 0 0.0 +Te W W 1.000 0.778 4.632 17.370 1.000 0.143 4.326 62.148 4 0 0.0 +# M-X1-X2 terms +Mo S Se 1.000 0.000 0.000 46.989 1.000 0.143 0.000 0.000 4 0 0.0 +Mo S Te 1.000 0.000 0.000 40.114 1.000 0.143 0.000 0.000 4 0 0.0 +Mo Se S 1.000 0.000 0.000 46.989 1.000 0.143 0.000 0.000 4 0 0.0 +Mo Se Te 1.000 0.000 0.000 27.767 1.000 0.143 0.000 0.000 4 0 0.0 +Mo Te S 1.000 0.000 0.000 40.114 1.000 0.143 0.000 0.000 4 0 0.0 +Mo Te Se 1.000 0.000 0.000 27.767 1.000 0.143 0.000 0.000 4 0 0.0 +W S Se 1.000 0.000 0.000 31.065 1.000 0.143 0.000 0.000 4 0 0.0 +W S Te 1.000 0.000 0.000 28.341 1.000 0.143 0.000 0.000 4 0 0.0 +W Se S 1.000 0.000 0.000 31.065 1.000 0.143 0.000 0.000 4 0 0.0 +W Se Te 1.000 0.000 0.000 23.362 1.000 0.143 0.000 0.000 4 0 0.0 +W Te S 1.000 0.000 0.000 28.341 1.000 0.143 0.000 0.000 4 0 0.0 +W Te Se 1.000 0.000 0.000 23.362 1.000 0.143 0.000 0.000 4 0 0.0 +# X-M1-M2 terms +S Mo W 1.000 0.000 0.000 45.775 1.000 0.143 0.000 0.000 4 0 0.0 +S W Mo 1.000 0.000 0.000 45.775 1.000 0.143 0.000 0.000 4 0 0.0 +Se Mo W 1.000 0.000 0.000 25.074 1.000 0.143 0.000 0.000 4 0 0.0 +Se W Mo 1.000 0.000 0.000 25.074 1.000 0.143 0.000 0.000 4 0 0.0 +Te Mo W 1.000 0.000 0.000 18.652 1.000 0.143 0.000 0.000 4 0 0.0 +Te W Mo 1.000 0.000 0.000 18.652 1.000 0.143 0.000 0.000 4 0 0.0 +# zero terms +Mo Mo Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Mo W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Mo S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Mo Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Mo Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo W Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo W W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo W S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo W Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo W Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo S Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo S W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Se Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Se W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Te Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Mo Te W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Mo Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Mo W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Mo S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Mo Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Mo Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W W Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W W W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W W S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W W Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W W Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W S Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W S W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Se Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Se W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Te Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +W Te W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Mo S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Mo Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Mo Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S W S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S W Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S W Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S S Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S S W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S S S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S S Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S S Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Se Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Se W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Se S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Se Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Se Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Te Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Te W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Te S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Te Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +S Te Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Mo S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Mo Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Mo Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se W S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se W Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se W Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se S Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se S W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se S S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se S Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se S Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Se Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Se W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Se S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Se Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Se Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Te Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Te W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Te S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Te Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Se Te Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Mo S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Mo Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Mo Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te W S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te W Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te W Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te S Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te S W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te S S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te S Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te S Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Se Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Se W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Se S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Se Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Se Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Te Mo 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Te W 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Te S 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Te Se 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 +Te Te Te 0.000 1.000 1.000 1.000 1.000 0.143 1.000 1.000 4 0 0.0 diff --git a/examples/PACKAGES/interlayer/saip_metal/3Lgold_1Lgr_atop_sliding.data b/examples/PACKAGES/interlayer/saip_metal/3Lgold_1Lgr_atop_sliding.data new file mode 100644 index 0000000000..83c3211aef --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/3Lgold_1Lgr_atop_sliding.data @@ -0,0 +1,218 @@ +Gold/graphene heterjunction atop2 + +206 atoms +2 atom types + +0 17.216640 xlo xhi +0 14.910048 ylo yhi +-30 30.000000 zlo zhi +8.60832 0 0 xy xz yz + +Atoms + +1 1 1 0 -8.60832 -4.97002 3.5 +2 1 1 0 -7.1736 -4.14166 5.85461 +3 1 1 0 -5.73888 -3.31334 8.20922 +4 1 1 0 -7.1736 -2.48501 3.5 +5 1 1 0 -5.73888 -1.65666 5.85461 +6 1 1 0 -4.30416 -0.828336 8.20922 +7 1 1 0 -5.73888 0 3.5 +8 1 1 0 -4.30416 0.828352 5.85461 +9 1 1 0 -2.86944 1.65667 8.20922 +10 1 1 0 -4.30416 2.48501 3.5 +11 1 1 0 -2.86944 3.31336 5.85461 +12 1 1 0 -1.43472 4.14168 8.20922 +13 1 1 0 -2.86944 4.97002 3.5 +14 1 1 0 -1.43472 5.79837 5.85461 +15 1 1 0 0 6.62669 8.20922 +16 1 1 0 -1.43472 7.45502 3.5 +17 1 1 0 0 8.28337 5.85461 +18 1 1 0 1.43472 9.11167 8.20922 +19 1 1 0 -5.73888 -4.97002 3.5 +20 1 1 0 -4.30416 -4.14166 5.85461 +21 1 1 0 -2.86944 -3.31334 8.20922 +22 1 1 0 -4.30416 -2.48501 3.5 +23 1 1 0 -2.86944 -1.65666 5.85461 +24 1 1 0 -1.43472 -0.828336 8.20922 +25 1 1 0 -2.86944 0 3.5 +26 1 1 0 -1.43472 0.828352 5.85461 +27 1 1 0 0 1.65667 8.20922 +28 1 1 0 -1.43472 2.48501 3.5 +29 1 1 0 0 3.31336 5.85461 +30 1 1 0 1.43472 4.14168 8.20922 +31 1 1 0 0 4.97002 3.5 +32 1 1 0 1.43472 5.79837 5.85461 +33 1 1 0 2.86944 6.62669 8.20922 +34 1 1 0 1.43472 7.45502 3.5 +35 1 1 0 2.86944 8.28337 5.85461 +36 1 1 0 4.30416 9.11167 8.20922 +37 1 1 0 -2.86944 -4.97002 3.5 +38 1 1 0 -1.43472 -4.14166 5.85461 +39 1 1 0 0 -3.31334 8.20922 +40 1 1 0 -1.43472 -2.48501 3.5 +41 1 1 0 0 -1.65666 5.85461 +42 1 1 0 1.43472 -0.828336 8.20922 +43 1 1 0 0 0 3.5 +44 1 1 0 1.43472 0.828352 5.85461 +45 1 1 0 2.86944 1.65667 8.20922 +46 1 1 0 1.43472 2.48501 3.5 +47 1 1 0 2.86944 3.31336 5.85461 +48 1 1 0 4.30416 4.14168 8.20922 +49 1 1 0 2.86944 4.97002 3.5 +50 1 1 0 4.30416 5.79837 5.85461 +51 1 1 0 5.73888 6.62669 8.20922 +52 1 1 0 4.30416 7.45502 3.5 +53 1 1 0 5.73888 8.28337 5.85461 +54 1 1 0 7.1736 9.11167 8.20922 +55 1 1 0 0 -4.97002 3.5 +56 1 1 0 1.43472 -4.14166 5.85461 +57 1 1 0 2.86944 -3.31334 8.20922 +58 1 1 0 1.43472 -2.48501 3.5 +59 1 1 0 2.86944 -1.65666 5.85461 +60 1 1 0 4.30416 -0.828336 8.20922 +61 1 1 0 2.86944 0 3.5 +62 1 1 0 4.30416 0.828352 5.85461 +63 1 1 0 5.73888 1.65667 8.20922 +64 1 1 0 4.30416 2.48501 3.5 +65 1 1 0 5.73888 3.31336 5.85461 +66 1 1 0 7.1736 4.14168 8.20922 +67 1 1 0 5.73888 4.97002 3.5 +68 1 1 0 7.1736 5.79837 5.85461 +69 1 1 0 8.60832 6.62669 8.20922 +70 1 1 0 7.1736 7.45502 3.5 +71 1 1 0 8.60832 8.28337 5.85461 +72 1 1 0 10.0431 9.11167 8.20922 +73 1 1 0 2.86944 -4.97002 3.5 +74 1 1 0 4.30416 -4.14166 5.85461 +75 1 1 0 5.73888 -3.31334 8.20922 +76 1 1 0 4.30416 -2.48501 3.5 +77 1 1 0 5.73888 -1.65666 5.85461 +78 1 1 0 7.1736 -0.828336 8.20922 +79 1 1 0 5.73888 0 3.5 +80 1 1 0 7.1736 0.828352 5.85461 +81 1 1 0 8.60832 1.65667 8.20922 +82 1 1 0 7.1736 2.48501 3.5 +83 1 1 0 8.60832 3.31336 5.85461 +84 1 1 0 10.0431 4.14168 8.20922 +85 1 1 0 8.60832 4.97002 3.5 +86 1 1 0 10.0431 5.79837 5.85461 +87 1 1 0 11.4777 6.62669 8.20922 +88 1 1 0 10.0431 7.45502 3.5 +89 1 1 0 11.4777 8.28337 5.85461 +90 1 1 0 12.9124 9.11167 8.20922 +91 1 1 0 5.73888 -4.97002 3.5 +92 1 1 0 7.1736 -4.14166 5.85461 +93 1 1 0 8.60832 -3.31334 8.20922 +94 1 1 0 7.1736 -2.48501 3.5 +95 1 1 0 8.60832 -1.65666 5.85461 +96 1 1 0 10.0431 -0.828336 8.20922 +97 1 1 0 8.60832 0 3.5 +98 1 1 0 10.0431 0.828352 5.85461 +99 1 1 0 11.4777 1.65667 8.20922 +100 1 1 0 10.0431 2.48501 3.5 +101 1 1 0 11.4777 3.31336 5.85461 +102 1 1 0 12.9124 4.14168 8.20922 +103 1 1 0 11.4777 4.97002 3.5 +104 1 1 0 12.9124 5.79837 5.85461 +105 1 1 0 14.3472 6.62669 8.20922 +106 1 1 0 12.9124 7.45502 3.5 +107 1 1 0 14.3472 8.28337 5.85461 +108 1 1 0 15.7819 9.11167 8.20922 +109 2 2 0 -11.0678 -6.39002 0 +110 2 2 0 -9.83808 -5.68001 0 +111 2 2 0 -9.83808 -4.26001 0 +112 2 2 0 -8.60832 -3.55001 0 +113 2 2 0 -8.60832 -2.13001 0 +114 2 2 0 -7.37856 -1.42 0 +115 2 2 0 -7.37856 0 0 +116 2 2 0 -6.1488 0.710007 0 +117 2 2 0 -6.1488 2.13001 0 +118 2 2 0 -4.91904 2.84001 0 +119 2 2 0 -4.91904 4.26001 0 +120 2 2 0 -3.68928 4.97002 0 +121 2 2 0 -3.68928 6.39002 0 +122 2 2 0 -2.45952 7.10003 0 +123 2 2 0 -8.60832 -6.39002 0 +124 2 2 0 -7.37856 -5.68001 0 +125 2 2 0 -7.37856 -4.26001 0 +126 2 2 0 -6.1488 -3.55001 0 +127 2 2 0 -6.1488 -2.13001 0 +128 2 2 0 -4.91904 -1.42 0 +129 2 2 0 -4.91904 0 0 +130 2 2 0 -3.68928 0.710007 0 +131 2 2 0 -3.68928 2.13001 0 +132 2 2 0 -2.45952 2.84001 0 +133 2 2 0 -2.45952 4.26001 0 +134 2 2 0 -1.22976 4.97002 0 +135 2 2 0 -1.22976 6.39002 0 +136 2 2 0 0 7.10003 0 +137 2 2 0 -6.1488 -6.39002 0 +138 2 2 0 -4.91904 -5.68001 0 +139 2 2 0 -4.91904 -4.26001 0 +140 2 2 0 -3.68928 -3.55001 0 +141 2 2 0 -3.68928 -2.13001 0 +142 2 2 0 -2.45952 -1.42 0 +143 2 2 0 -2.45952 0 0 +144 2 2 0 -1.22976 0.710007 0 +145 2 2 0 -1.22976 2.13001 0 +146 2 2 0 0 2.84001 0 +147 2 2 0 0 4.26001 0 +148 2 2 0 1.22976 4.97002 0 +149 2 2 0 1.22976 6.39002 0 +150 2 2 0 2.45952 7.10003 0 +151 2 2 0 -3.68928 -6.39002 0 +152 2 2 0 -2.45952 -5.68001 0 +153 2 2 0 -2.45952 -4.26001 0 +154 2 2 0 -1.22976 -3.55001 0 +155 2 2 0 -1.22976 -2.13001 0 +156 2 2 0 0 -1.42 0 +157 2 2 0 0 0 0 +158 2 2 0 1.22976 0.710007 0 +159 2 2 0 1.22976 2.13001 0 +160 2 2 0 2.45952 2.84001 0 +161 2 2 0 2.45952 4.26001 0 +162 2 2 0 3.68928 4.97002 0 +163 2 2 0 3.68928 6.39002 0 +164 2 2 0 4.91904 7.10003 0 +165 2 2 0 -1.22976 -6.39002 0 +166 2 2 0 0 -5.68001 0 +167 2 2 0 0 -4.26001 0 +168 2 2 0 1.22976 -3.55001 0 +169 2 2 0 1.22976 -2.13001 0 +170 2 2 0 2.45952 -1.42 0 +171 2 2 0 2.45952 0 0 +172 2 2 0 3.68928 0.710007 0 +173 2 2 0 3.68928 2.13001 0 +174 2 2 0 4.91904 2.84001 0 +175 2 2 0 4.91904 4.26001 0 +176 2 2 0 6.1488 4.97002 0 +177 2 2 0 6.1488 6.39002 0 +178 2 2 0 7.37856 7.10003 0 +179 2 2 0 1.22976 -6.39002 0 +180 2 2 0 2.45952 -5.68001 0 +181 2 2 0 2.45952 -4.26001 0 +182 2 2 0 3.68928 -3.55001 0 +183 2 2 0 3.68928 -2.13001 0 +184 2 2 0 4.91904 -1.42 0 +185 2 2 0 4.91904 0 0 +186 2 2 0 6.1488 0.710007 0 +187 2 2 0 6.1488 2.13001 0 +188 2 2 0 7.37856 2.84001 0 +189 2 2 0 7.37856 4.26001 0 +190 2 2 0 8.60832 4.97002 0 +191 2 2 0 8.60832 6.39002 0 +192 2 2 0 9.83808 7.10003 0 +193 2 2 0 3.68928 -6.39002 0 +194 2 2 0 4.91904 -5.68001 0 +195 2 2 0 4.91904 -4.26001 0 +196 2 2 0 6.1488 -3.55001 0 +197 2 2 0 6.1488 -2.13001 0 +198 2 2 0 7.37856 -1.42 0 +199 2 2 0 7.37856 0 0 +200 2 2 0 8.60832 0.710007 0 +201 2 2 0 8.60832 2.13001 0 +202 2 2 0 9.83808 2.84001 0 +203 2 2 0 9.83808 4.26001 0 +204 2 2 0 11.0678 4.97002 0 +205 2 2 0 11.0678 6.39002 0 +206 2 2 0 12.2976 7.10003 0 diff --git a/examples/PACKAGES/interlayer/saip_metal/Au_u3.eam b/examples/PACKAGES/interlayer/saip_metal/Au_u3.eam new file mode 120000 index 0000000000..2ace8a4162 --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/Au_u3.eam @@ -0,0 +1 @@ +../../../../potentials/Au_u3.eam \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/saip_metal/CH.rebo b/examples/PACKAGES/interlayer/saip_metal/CH.rebo new file mode 120000 index 0000000000..c5a6a40100 --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/CH.rebo @@ -0,0 +1 @@ +../../../../potentials/CH.rebo \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/saip_metal/CHAu.ILP b/examples/PACKAGES/interlayer/saip_metal/CHAu.ILP new file mode 120000 index 0000000000..a9a71ce92f --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/CHAu.ILP @@ -0,0 +1 @@ +../../../../potentials/CHAu.ILP \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/saip_metal/in.gold_gr b/examples/PACKAGES/interlayer/saip_metal/in.gold_gr new file mode 100644 index 0000000000..b3fb5a3a70 --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/in.gold_gr @@ -0,0 +1,44 @@ +units metal +atom_style full +processors * * 1 +boundary p p f +read_data ./3Lgold_1Lgr_atop_sliding.data + +# global group definition +group gold type 1 +group gra type 2 + +# Define mass +mass * 12.0107 # mass of carbon atom , uint: a.u.=1.66X10^(-27)kg +mass 1 196.96657 # mass of gold atom , uint: a.u.=1.66X10^(-27)kg + +# Define potentials +pair_style hybrid/overlay eam rebo saip/metal 16.0 +pair_coeff 1 1 eam ./Au_u3.eam +pair_coeff * * rebo ./CH.rebo NULL C +pair_coeff * * saip/metal ./CHAu.ILP Au C + +# compute energy +compute 0 all pair rebo +compute 1 all pair eam +compute 2 all pair saip/metal +variable REBO equal c_0 +variable EAM equal c_1 +variable ILP equal c_2 + +thermo_style custom step etotal pe ke v_REBO v_ILP temp + +thermo 100 +thermo_modify lost error + +# Creat initial velocity +velocity all set 0.0 0.0 0.0 +velocity gra create 300.0 4928459 mom yes rot yes dist gaussian +velocity gold create 300.0 4928459 mom yes rot yes dist gaussian + +# Integration +fix intsub gold nve +fix intrib gra nve + +timestep 1e-3 +run 1000 diff --git a/examples/PACKAGES/interlayer/saip_metal/log.7Jan22.gold_gr.g++.1 b/examples/PACKAGES/interlayer/saip_metal/log.7Jan22.gold_gr.g++.1 new file mode 100644 index 0000000000..b16fac300a --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/log.7Jan22.gold_gr.g++.1 @@ -0,0 +1,164 @@ +LAMMPS (7 Jan 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +units metal +atom_style full +processors * * 1 +boundary p p f +read_data ./3Lgold_1Lgr_atop_sliding.data +Reading data file ... + triclinic box = (0 0 -30) to (17.21664 14.910048 30) with tilt (8.60832 0 0) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 206 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.003 seconds + +# global group definition +group gold type 1 +108 atoms in group gold +group gra type 2 +98 atoms in group gra + +# Define mass +mass * 12.0107 # mass of carbon atom , uint: a.u.=1.66X10^(-27)kg +mass 1 196.96657 # mass of gold atom , uint: a.u.=1.66X10^(-27)kg + +# Define potentials +pair_style hybrid/overlay eam rebo saip/metal 16.0 +pair_coeff 1 1 eam ./Au_u3.eam +Reading eam potential file ./Au_u3.eam with DATE: 2007-06-11 +pair_coeff * * rebo ./CH.rebo NULL C +Reading rebo potential file ./CH.rebo with DATE: 2018-7-3 +pair_coeff * * saip/metal ./CHAu.ILP Au C +Reading saip/metal potential file ./CHAu.ILP with DATE: 2021-12-02 + +# compute energy +compute 0 all pair rebo +compute 1 all pair eam +compute 2 all pair saip/metal +variable REBO equal c_0 +variable EAM equal c_1 +variable ILP equal c_2 + +thermo_style custom step etotal pe ke v_REBO v_ILP temp + +thermo 100 +thermo_modify lost error + +# Creat initial velocity +velocity all set 0.0 0.0 0.0 +velocity gra create 300.0 4928459 mom yes rot yes dist gaussian +velocity gold create 300.0 4928459 mom yes rot yes dist gaussian + +# Integration +fix intsub gold nve +fix intrib gra nve + +timestep 1e-3 +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- saip/metal potential doi.org/10.1021/acs.jctc.1c00622 +@Article{Ouyang2021 + author = {W. Ouyang, O. Hod, and R. Guerra}, + title = {Registry-Dependent Potential for Interfaces of Gold with Graphitic Systems}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7215-7223} + year = 2021, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 3 2 7 + 4 neighbor lists, perpetual/occasional/extra = 4 0 0 + (1) pair eam, perpetual, skip from (4) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (2) pair rebo, perpetual, skip from (3) + attributes: full, newton on, ghost + pair build: skip/ghost + stencil: none + bin: none + (3) pair saip/metal, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (4) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton/tri + stencil: half/bin/3d/tri + bin: standard +Per MPI rank memory allocation (min/avg/max) = 9.747 | 9.747 | 9.747 Mbytes +Step TotEng PotEng KinEng v_REBO v_ILP Temp + 0 -1121.4621 -1129.3728 7.9107209 -724.70925 -6.0302289 298.53659 + 100 -1121.4483 -1124.9731 3.5248501 -723.03272 -5.9765533 133.02159 + 200 -1121.4403 -1125.2912 3.8509646 -722.66784 -6.0468507 145.32858 + 300 -1121.4424 -1126.4665 5.0240531 -722.72787 -6.0350568 189.59886 + 400 -1121.4419 -1125.1443 3.7023978 -722.59976 -5.8294548 139.72193 + 500 -1121.4413 -1125.2711 3.8297939 -722.5342 -6.0189944 144.52963 + 600 -1121.4449 -1125.8808 4.4359049 -722.77707 -5.8685221 167.40319 + 700 -1121.4489 -1126.1966 4.747709 -723.13681 -5.8666379 179.17012 + 800 -1121.4443 -1125.8469 4.402607 -722.94487 -6.0094567 166.14658 + 900 -1121.4424 -1125.8437 4.4013317 -722.94918 -5.8699702 166.09846 + 1000 -1121.4467 -1125.7453 4.2986881 -722.66682 -6.0651168 162.22487 +Loop time of 6.43246 on 1 procs for 1000 steps with 206 atoms + +Performance: 13.432 ns/day, 1.787 hours/ns, 155.462 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 6.4201 | 6.4201 | 6.4201 | 0.0 | 99.81 +Bond | 8.9059e-05 | 8.9059e-05 | 8.9059e-05 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.0071852 | 0.0071852 | 0.0071852 | 0.0 | 0.11 +Output | 0.00026031 | 0.00026031 | 0.00026031 | 0.0 | 0.00 +Modify | 0.0019433 | 0.0019433 | 0.0019433 | 0.0 | 0.03 +Other | | 0.002875 | | | 0.04 + +Nlocal: 206 ave 206 max 206 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2187 ave 2187 max 2187 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 158548 ave 158548 max 158548 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 158548 +Ave neighs/atom = 769.65049 +Ave special neighs/atom = 0 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:06 diff --git a/examples/PACKAGES/interlayer/saip_metal/log.7Jan22.gold_gr.g++.4 b/examples/PACKAGES/interlayer/saip_metal/log.7Jan22.gold_gr.g++.4 new file mode 100644 index 0000000000..cb6ba2f5e6 --- /dev/null +++ b/examples/PACKAGES/interlayer/saip_metal/log.7Jan22.gold_gr.g++.4 @@ -0,0 +1,164 @@ +LAMMPS (7 Jan 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +units metal +atom_style full +processors * * 1 +boundary p p f +read_data ./3Lgold_1Lgr_atop_sliding.data +Reading data file ... + triclinic box = (0 0 -30) to (17.21664 14.910048 30) with tilt (8.60832 0 0) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 206 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.003 seconds + +# global group definition +group gold type 1 +108 atoms in group gold +group gra type 2 +98 atoms in group gra + +# Define mass +mass * 12.0107 # mass of carbon atom , uint: a.u.=1.66X10^(-27)kg +mass 1 196.96657 # mass of gold atom , uint: a.u.=1.66X10^(-27)kg + +# Define potentials +pair_style hybrid/overlay eam rebo saip/metal 16.0 +pair_coeff 1 1 eam ./Au_u3.eam +Reading eam potential file ./Au_u3.eam with DATE: 2007-06-11 +pair_coeff * * rebo ./CH.rebo NULL C +Reading rebo potential file ./CH.rebo with DATE: 2018-7-3 +pair_coeff * * saip/metal ./CHAu.ILP Au C +Reading saip/metal potential file ./CHAu.ILP with DATE: 2021-12-02 + +# compute energy +compute 0 all pair rebo +compute 1 all pair eam +compute 2 all pair saip/metal +variable REBO equal c_0 +variable EAM equal c_1 +variable ILP equal c_2 + +thermo_style custom step etotal pe ke v_REBO v_ILP temp + +thermo 100 +thermo_modify lost error + +# Creat initial velocity +velocity all set 0.0 0.0 0.0 +velocity gra create 300.0 4928459 mom yes rot yes dist gaussian +velocity gold create 300.0 4928459 mom yes rot yes dist gaussian + +# Integration +fix intsub gold nve +fix intrib gra nve + +timestep 1e-3 +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- saip/metal potential doi.org/10.1021/acs.jctc.1c00622 +@Article{Ouyang2021 + author = {W. Ouyang, O. Hod, and R. Guerra}, + title = {Registry-Dependent Potential for Interfaces of Gold with Graphitic Systems}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7215-7223} + year = 2021, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 3 2 7 + 4 neighbor lists, perpetual/occasional/extra = 4 0 0 + (1) pair eam, perpetual, skip from (4) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (2) pair rebo, perpetual, skip from (3) + attributes: full, newton on, ghost + pair build: skip/ghost + stencil: none + bin: none + (3) pair saip/metal, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (4) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton/tri + stencil: half/bin/3d/tri + bin: standard +Per MPI rank memory allocation (min/avg/max) = 9.299 | 9.299 | 9.3 Mbytes +Step TotEng PotEng KinEng v_REBO v_ILP Temp + 0 -1121.4621 -1129.3728 7.9107209 -724.70925 -6.0302289 298.53659 + 100 -1121.4483 -1124.9731 3.5248501 -723.03272 -5.9765533 133.02159 + 200 -1121.4403 -1125.2912 3.8509646 -722.66784 -6.0468507 145.32858 + 300 -1121.4424 -1126.4665 5.0240531 -722.72787 -6.0350568 189.59886 + 400 -1121.4419 -1125.1443 3.7023978 -722.59976 -5.8294548 139.72193 + 500 -1121.4413 -1125.2711 3.8297939 -722.5342 -6.0189944 144.52963 + 600 -1121.4449 -1125.8808 4.4359049 -722.77707 -5.8685221 167.40319 + 700 -1121.4489 -1126.1966 4.747709 -723.13681 -5.8666379 179.17012 + 800 -1121.4443 -1125.8469 4.402607 -722.94487 -6.0094567 166.14658 + 900 -1121.4424 -1125.8437 4.4013317 -722.94918 -5.8699702 166.09846 + 1000 -1121.4467 -1125.7453 4.2986881 -722.66682 -6.0651168 162.22487 +Loop time of 2.44776 on 4 procs for 1000 steps with 206 atoms + +Performance: 35.298 ns/day, 0.680 hours/ns, 408.537 timesteps/s +99.7% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.6906 | 2.0172 | 2.3939 | 19.2 | 82.41 +Bond | 5.4278e-05 | 6.3818e-05 | 7.3153e-05 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.049363 | 0.42514 | 0.75161 | 41.7 | 17.37 +Output | 0.00018596 | 0.00020656 | 0.00024754 | 0.0 | 0.01 +Modify | 0.00063656 | 0.00074701 | 0.00089514 | 0.0 | 0.03 +Other | | 0.004362 | | | 0.18 + +Nlocal: 51.5 ave 61 max 44 min +Histogram: 1 1 0 0 0 0 1 0 0 1 +Nghost: 1670.75 ave 1699 max 1641 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 39637 ave 47080 max 33737 min +Histogram: 1 1 0 0 0 0 1 0 0 1 + +Total # of neighbors = 158548 +Ave neighs/atom = 769.65049 +Ave special neighs/atom = 0 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/README b/examples/README index c398579cde..0c09b6d847 100644 --- a/examples/README +++ b/examples/README @@ -94,7 +94,7 @@ msst: MSST shock dynamics nb3b: use of nonbonded 3-body harmonic pair style neb: nudged elastic band (NEB) calculation for barrier finding nemd: non-equilibrium MD of 2d sheared system -numdiff: numerical difference computation of forces +numdiff: numerical difference computation of forces and virial obstacle: flow around two voids in a 2d channel peptide: dynamics of a small solvated peptide chain (5-mer) peri: Peridynamic model of cylinder impacted by indenter diff --git a/examples/numdiff/in.numdiff b/examples/numdiff/in.numdiff index 6c4f99a3be..cd3d44a9e7 100644 --- a/examples/numdiff/in.numdiff +++ b/examples/numdiff/in.numdiff @@ -1,33 +1,74 @@ -# Numerical difference calculation of error in forces +# Numerical difference calculation +# of error in forces and virial stress -units metal -atom_style atomic +# adjustable parameters -atom_modify map yes -lattice fcc 5.358000 -region box block 0 6 0 6 0 6 -create_box 1 box -create_atoms 1 box -mass 1 39.903 +variable nsteps index 500 # length of run +variable nthermo index 10 # thermo output interval +variable ndump index 500 # dump output interval +variable nlat index 3 # size of box +variable fdelta index 1.0e-4 # displacement size +variable vdelta index 1.0e-6 # strain size +variable temp index 10.0 # temperature -velocity all create 10 2357 mom yes dist gaussian +units metal +atom_style atomic -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 +atom_modify map yes +lattice fcc 5.358000 +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +create_box 1 box +create_atoms 1 box +mass 1 39.903 -neighbor 1 bin +velocity all create ${temp} 2357 mom yes dist gaussian -timestep 0.001 +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 -fix numdiff all numdiff 200 0.0001 -fix nve all nve +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no -variable errx atom fx-f_numdiff[1] -variable erry atom fy-f_numdiff[2] -variable errz atom fz-f_numdiff[3] +timestep 0.001 +fix nve all nve -write_dump all custom tmp.error f_numdiff[1] f_numdiff[2] f_numdiff[3] +# define numerical force calculation -dump forces all custom 200 force_error.dump v_errx v_erry v_errz -thermo 200 -run 2000 +fix numforce all numdiff ${nthermo} ${fdelta} +variable ferrx atom f_numforce[1]-fx +variable ferry atom f_numforce[2]-fy +variable ferrz atom f_numforce[3]-fz +variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 +compute faverrsq all reduce ave v_ferrsq +variable fsq atom fx^2+fy^2+fz^2 +compute favsq all reduce ave v_fsq +variable frelerr equal sqrt(c_faverrsq/c_favsq) +dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz + +# define numerical virial stress tensor calculation + +compute myvirial all pressure NULL virial +fix numvirial all numdiff/virial ${nthermo} ${vdelta} +variable errxx equal f_numvirial[1]-c_myvirial[1] +variable erryy equal f_numvirial[2]-c_myvirial[2] +variable errzz equal f_numvirial[3]-c_myvirial[3] +variable erryz equal f_numvirial[4]-c_myvirial[6] +variable errxz equal f_numvirial[5]-c_myvirial[5] +variable errxy equal f_numvirial[6]-c_myvirial[4] +variable verrsq equal "v_errxx^2 + & + v_erryy^2 + & + v_errzz^2 + & + v_erryz^2 + & + v_errxz^2 + & + v_errxy^2" +variable vsq equal "c_myvirial[1]^2 + & + c_myvirial[3]^2 + & + c_myvirial[3]^2 + & + c_myvirial[4]^2 + & + c_myvirial[5]^2 + & + c_myvirial[6]^2" +variable vrelerr equal sqrt(v_verrsq/v_vsq) + +thermo_style custom step temp pe etotal press v_frelerr v_vrelerr +thermo ${nthermo} +run ${nsteps} diff --git a/examples/numdiff/log.28Jan2022.log.numdiff.g++.1 b/examples/numdiff/log.28Jan2022.log.numdiff.g++.1 new file mode 100644 index 0000000000..f32e72834f --- /dev/null +++ b/examples/numdiff/log.28Jan2022.log.numdiff.g++.1 @@ -0,0 +1,175 @@ +LAMMPS (7 Jan 2022) +# Numerical difference calculation +# of error in forces and virial stress + +# adjustable parameters + +variable nsteps index 500 # length of run +variable nthermo index 10 # thermo output interval +variable ndump index 500 # dump output interval +variable nlat index 3 # size of box +variable fdelta index 1.0e-4 # displacement size +variable vdelta index 1.0e-6 # strain size +variable temp index 10.0 # temperature + +units metal +atom_style atomic + +atom_modify map yes +lattice fcc 5.358000 +Lattice spacing in x,y,z = 5.358 5.358 5.358 +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +region box block 0 3 0 ${nlat} 0 ${nlat} +region box block 0 3 0 3 0 ${nlat} +region box block 0 3 0 3 0 3 +create_box 1 box +Created orthogonal box = (0 0 0) to (16.074 16.074 16.074) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 108 atoms + using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074) + create_atoms CPU = 0.000 seconds +mass 1 39.903 + +velocity all create ${temp} 2357 mom yes dist gaussian +velocity all create 10.0 2357 mom yes dist gaussian + +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 + +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no + +timestep 0.001 +fix nve all nve + +# define numerical force calculation + +fix numforce all numdiff ${nthermo} ${fdelta} +fix numforce all numdiff 10 ${fdelta} +fix numforce all numdiff 10 1.0e-4 +variable ferrx atom f_numforce[1]-fx +variable ferry atom f_numforce[2]-fy +variable ferrz atom f_numforce[3]-fz +variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 +compute faverrsq all reduce ave v_ferrsq +variable fsq atom fx^2+fy^2+fz^2 +compute favsq all reduce ave v_fsq +variable frelerr equal sqrt(c_faverrsq/c_favsq) +dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz +dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz + +# define numerical virial stress tensor calculation + +compute myvirial all pressure NULL virial +fix numvirial all numdiff/virial ${nthermo} ${vdelta} +fix numvirial all numdiff/virial 10 ${vdelta} +fix numvirial all numdiff/virial 10 1.0e-6 +variable errxx equal f_numvirial[1]-c_myvirial[1] +variable erryy equal f_numvirial[2]-c_myvirial[2] +variable errzz equal f_numvirial[3]-c_myvirial[3] +variable erryz equal f_numvirial[4]-c_myvirial[6] +variable errxz equal f_numvirial[5]-c_myvirial[5] +variable errxy equal f_numvirial[6]-c_myvirial[4] +variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2" +variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2" +variable vrelerr equal sqrt(v_verrsq/v_vsq) + +thermo_style custom step temp pe etotal press v_frelerr v_vrelerr +thermo ${nthermo} +thermo 10 +run ${nsteps} +run 500 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.9407173 + ghost atom cutoff = 5.9407173 + binsize = 2.9703587, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cubic, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.083 | 6.083 | 6.083 Mbytes +Step Temp PotEng TotEng Press v_frelerr v_vrelerr + 0 10 -7.0259569 -6.8876486 28.564278 19203.344 1.5660292e-06 + 10 9.9376583 -7.0250947 -6.8876486 30.254762 1.5040965e-08 2.1991382e-07 + 20 9.7520139 -7.022527 -6.8876485 35.28505 1.4756358e-08 2.6265315e-06 + 30 9.4477557 -7.0183188 -6.8876485 43.519863 1.4688198e-08 2.6356166e-07 + 40 9.0330215 -7.0125826 -6.8876484 54.727797 1.4637921e-08 5.2292327e-08 + 50 8.5192918 -7.0054772 -6.8876483 68.585553 1.4587854e-08 7.1324716e-08 + 60 7.9212026 -6.997205 -6.8876481 84.684636 1.4525561e-08 3.1108149e-08 + 70 7.2562592 -6.9880081 -6.8876479 102.54088 1.450885e-08 3.2311094e-08 + 80 6.5444294 -6.9781627 -6.8876478 121.60715 1.4444738e-08 2.1776998e-08 + 90 5.8075961 -6.9679715 -6.8876476 141.2895 1.4493562e-08 2.0400898e-08 + 100 5.0688629 -6.957754 -6.8876474 160.9668 1.445455e-08 1.2636688e-08 + 110 4.3517145 -6.947835 -6.8876472 180.0135 1.4460371e-08 1.2528038e-08 + 120 3.6790589 -6.9385314 -6.887647 197.82486 1.4371757e-08 1.4489522e-08 + 130 3.0721984 -6.9301379 -6.8876468 213.84331 1.4364708e-08 1.2461922e-08 + 140 2.5497991 -6.9229125 -6.8876467 227.58429 1.4330926e-08 9.3913926e-09 + 150 2.1269443 -6.917064 -6.8876466 238.6596 1.4287002e-08 4.1510266e-09 + 160 1.8143642 -6.9127407 -6.8876465 246.79599 1.4282669e-08 7.7048281e-09 + 170 1.6179191 -6.9100237 -6.8876465 251.84748 1.42726e-08 1.2719973e-08 + 180 1.5383946 -6.9089239 -6.8876466 253.79991 1.4236534e-08 8.1200831e-09 + 190 1.5716287 -6.9093836 -6.8876467 252.76745 1.41706e-08 6.5670612e-09 + 200 1.7089493 -6.911283 -6.8876468 248.98142 1.4096463e-08 1.1685863e-08 + 210 1.9378716 -6.9144493 -6.8876469 242.77289 1.4008978e-08 1.1226902e-08 + 220 2.2429731 -6.9186692 -6.887647 234.55055 1.3886901e-08 9.9914102e-09 + 230 2.606862 -6.9237023 -6.8876472 224.77626 1.3864576e-08 1.1540228e-08 + 240 3.0111524 -6.9292941 -6.8876474 213.93996 1.3696314e-08 1.1697747e-08 + 250 3.4373794 -6.9351893 -6.8876475 202.53583 1.3626701e-08 1.0398197e-08 + 260 3.8678047 -6.9411426 -6.8876476 191.04084 1.3489489e-08 6.6603364e-09 + 270 4.2860853 -6.9469279 -6.8876478 179.89646 1.3312014e-08 1.1687917e-08 + 280 4.6777954 -6.9523457 -6.8876479 169.49404 1.3081144e-08 1.1336675e-08 + 290 5.030805 -6.9572282 -6.887648 160.16371 1.2947385e-08 1.7342825e-08 + 300 5.3355278 -6.9614428 -6.887648 152.16682 1.2893673e-08 1.7510534e-08 + 310 5.5850532 -6.964894 -6.887648 145.69148 1.2842022e-08 1.2782546e-08 + 320 5.7751794 -6.9675236 -6.8876481 140.85102 1.2903488e-08 1.5319437e-08 + 330 5.9043601 -6.9693103 -6.887648 137.68497 1.3076809e-08 1.1208999e-08 + 340 5.9735784 -6.9702676 -6.887648 136.16232 1.3296904e-08 1.891087e-08 + 350 5.9861549 -6.9704415 -6.887648 136.18679 1.3504051e-08 2.5783601e-08 + 360 5.947496 -6.9699067 -6.8876479 137.60397 1.3731112e-08 2.0556839e-08 + 370 5.8647874 -6.9687627 -6.8876478 140.2101 1.4009878e-08 2.1771736e-08 + 380 5.7466376 -6.9671285 -6.8876477 143.76234 1.4092054e-08 1.1085162e-08 + 390 5.6026773 -6.9651374 -6.8876477 147.99019 1.4282872e-08 2.0221602e-08 + 400 5.4431231 -6.9629305 -6.8876476 152.60787 1.4317739e-08 1.7076065e-08 + 410 5.2783192 -6.960651 -6.8876475 157.32722 1.4415075e-08 2.5031776e-08 + 420 5.1182723 -6.9584374 -6.8876474 161.87063 1.4441435e-08 2.2519289e-08 + 430 4.9722 -6.956417 -6.8876473 165.98344 1.4550624e-08 2.4512613e-08 + 440 4.8481153 -6.9547008 -6.8876473 169.44527 1.4544672e-08 1.4758301e-08 + 450 4.7524707 -6.9533779 -6.8876472 172.07964 1.4546492e-08 1.324687e-08 + 460 4.6898817 -6.9525122 -6.8876472 173.76132 1.4537475e-08 1.351367e-08 + 470 4.6629495 -6.9521397 -6.8876472 174.42109 1.4530458e-08 1.521106e-08 + 480 4.6721922 -6.9522675 -6.8876472 174.04742 1.4543785e-08 1.0905422e-08 + 490 4.7160887 -6.9528747 -6.8876473 172.68525 1.4545591e-08 2.0128525e-08 + 500 4.7912313 -6.953914 -6.8876473 170.43183 1.4438981e-08 1.6062775e-08 +Loop time of 0.837333 on 1 procs for 500 steps with 108 atoms + +Performance: 51.592 ns/day, 0.465 hours/ns, 597.134 timesteps/s +99.8% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0097726 | 0.0097726 | 0.0097726 | 0.0 | 1.17 +Neigh | 0.03095 | 0.03095 | 0.03095 | 0.0 | 3.70 +Comm | 0.005564 | 0.005564 | 0.005564 | 0.0 | 0.66 +Output | 0.0042451 | 0.0042451 | 0.0042451 | 0.0 | 0.51 +Modify | 0.78618 | 0.78618 | 0.78618 | 0.0 | 93.89 +Other | | 0.0006258 | | | 0.07 + +Nlocal: 108 ave 108 max 108 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 558 ave 558 max 558 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 972 ave 972 max 972 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 972 +Ave neighs/atom = 9 +Neighbor list builds = 500 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/numdiff/log.28Jan2022.log.numdiff.g++.4 b/examples/numdiff/log.28Jan2022.log.numdiff.g++.4 new file mode 100644 index 0000000000..fc56c4aee8 --- /dev/null +++ b/examples/numdiff/log.28Jan2022.log.numdiff.g++.4 @@ -0,0 +1,175 @@ +LAMMPS (7 Jan 2022) +# Numerical difference calculation +# of error in forces and virial stress + +# adjustable parameters + +variable nsteps index 500 # length of run +variable nthermo index 10 # thermo output interval +variable ndump index 500 # dump output interval +variable nlat index 3 # size of box +variable fdelta index 1.0e-4 # displacement size +variable vdelta index 1.0e-6 # strain size +variable temp index 10.0 # temperature + +units metal +atom_style atomic + +atom_modify map yes +lattice fcc 5.358000 +Lattice spacing in x,y,z = 5.358 5.358 5.358 +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +region box block 0 3 0 ${nlat} 0 ${nlat} +region box block 0 3 0 3 0 ${nlat} +region box block 0 3 0 3 0 3 +create_box 1 box +Created orthogonal box = (0 0 0) to (16.074 16.074 16.074) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 108 atoms + using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074) + create_atoms CPU = 0.000 seconds +mass 1 39.903 + +velocity all create ${temp} 2357 mom yes dist gaussian +velocity all create 10.0 2357 mom yes dist gaussian + +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 + +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no + +timestep 0.001 +fix nve all nve + +# define numerical force calculation + +fix numforce all numdiff ${nthermo} ${fdelta} +fix numforce all numdiff 10 ${fdelta} +fix numforce all numdiff 10 1.0e-4 +variable ferrx atom f_numforce[1]-fx +variable ferry atom f_numforce[2]-fy +variable ferrz atom f_numforce[3]-fz +variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 +compute faverrsq all reduce ave v_ferrsq +variable fsq atom fx^2+fy^2+fz^2 +compute favsq all reduce ave v_fsq +variable frelerr equal sqrt(c_faverrsq/c_favsq) +dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz +dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz + +# define numerical virial stress tensor calculation + +compute myvirial all pressure NULL virial +fix numvirial all numdiff/virial ${nthermo} ${vdelta} +fix numvirial all numdiff/virial 10 ${vdelta} +fix numvirial all numdiff/virial 10 1.0e-6 +variable errxx equal f_numvirial[1]-c_myvirial[1] +variable erryy equal f_numvirial[2]-c_myvirial[2] +variable errzz equal f_numvirial[3]-c_myvirial[3] +variable erryz equal f_numvirial[4]-c_myvirial[6] +variable errxz equal f_numvirial[5]-c_myvirial[5] +variable errxy equal f_numvirial[6]-c_myvirial[4] +variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2" +variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2" +variable vrelerr equal sqrt(v_verrsq/v_vsq) + +thermo_style custom step temp pe etotal press v_frelerr v_vrelerr +thermo ${nthermo} +thermo 10 +run ${nsteps} +run 500 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.9407173 + ghost atom cutoff = 5.9407173 + binsize = 2.9703587, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cubic, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.067 | 6.067 | 6.067 Mbytes +Step Temp PotEng TotEng Press v_frelerr v_vrelerr + 0 10 -7.0259569 -6.8876486 28.564278 10664.391 9.1481187e-08 + 10 9.9388179 -7.0251107 -6.8876486 30.21736 1.4771865e-08 1.3452512e-07 + 20 9.7572185 -7.022599 -6.8876485 35.123527 1.437525e-08 8.0966999e-07 + 30 9.4606673 -7.0184974 -6.8876484 43.132052 1.4375468e-08 1.990012e-08 + 40 9.0579092 -7.0129268 -6.8876483 54.000927 1.4350331e-08 1.7239028e-08 + 50 8.5607685 -7.0060508 -6.8876482 67.403151 1.4353284e-08 7.813181e-09 + 60 7.9838726 -6.9980717 -6.8876481 82.935358 1.4398078e-08 2.022316e-08 + 70 7.3442875 -6.9892255 -6.8876479 100.12892 1.434409e-08 7.5938179e-09 + 80 6.6610579 -6.9797757 -6.8876477 118.46358 1.4324787e-08 7.1972571e-09 + 90 5.9546462 -6.9700053 -6.8876476 137.38365 1.4322718e-08 4.3978378e-09 + 100 5.2462727 -6.9602077 -6.8876474 156.31651 1.4273172e-08 4.6728038e-09 + 110 4.5571706 -6.9506767 -6.8876472 174.69294 1.4266163e-08 3.522225e-09 + 120 3.9077807 -6.9416949 -6.887647 191.96859 1.42241e-08 3.5357511e-09 + 130 3.3169241 -6.9335227 -6.8876469 207.64566 1.4203813e-08 2.5182488e-09 + 140 2.8010028 -6.926387 -6.8876468 221.29333 1.4164215e-08 2.3112509e-09 + 150 2.3732854 -6.9204712 -6.8876467 232.5658 1.4134122e-08 1.9368963e-09 + 160 2.0433329 -6.9159076 -6.8876466 241.21647 1.4095473e-08 3.6806452e-09 + 170 1.8166184 -6.912772 -6.8876466 247.10715 1.4049531e-08 2.5319322e-09 + 180 1.6943727 -6.9110813 -6.8876467 250.21143 1.3997912e-08 1.952404e-09 + 190 1.6736731 -6.910795 -6.8876467 250.61203 1.3915487e-08 1.4271767e-09 + 200 1.7477659 -6.9118199 -6.8876468 248.49223 1.3850618e-08 2.4515718e-09 + 210 1.9065921 -6.9140167 -6.8876469 244.12226 1.3747916e-08 1.7957531e-09 + 220 2.1374676 -6.91721 -6.887647 237.84173 1.3674779e-08 2.6613511e-09 + 230 2.4258607 -6.9211989 -6.8876472 230.0395 1.3565712e-08 3.0777067e-09 + 240 2.7562034 -6.9257679 -6.8876473 221.13265 1.3440442e-08 1.7111501e-09 + 250 3.1126827 -6.9306984 -6.8876474 211.54566 1.3270914e-08 1.6690112e-09 + 260 3.4799641 -6.9357784 -6.8876476 201.69126 1.3105092e-08 2.1637558e-09 + 270 3.8438148 -6.9408108 -6.8876477 191.95361 1.2962846e-08 4.4613506e-09 + 280 4.191607 -6.9456212 -6.8876478 182.6745 1.2846383e-08 3.3730203e-09 + 290 4.5126922 -6.9500621 -6.8876478 174.14285 1.2710692e-08 2.2809889e-09 + 300 4.7986487 -6.9540172 -6.8876479 166.58747 1.2657778e-08 6.9880891e-09 + 310 5.0434083 -6.9574025 -6.8876479 160.17316 1.266381e-08 4.2486217e-09 + 320 5.243275 -6.9601668 -6.8876479 154.99974 1.279856e-08 5.1505673e-09 + 330 5.3968455 -6.9622908 -6.8876479 151.1038 1.2981831e-08 3.3339333e-09 + 340 5.5048468 -6.9637845 -6.8876479 148.46296 1.3159021e-08 1.7881393e-09 + 350 5.569902 -6.9646843 -6.8876479 147.00205 1.3439465e-08 5.6876219e-09 + 360 5.5962378 -6.9650485 -6.8876478 146.60113 1.3645943e-08 7.233847e-09 + 370 5.5893468 -6.9649531 -6.8876478 147.10471 1.3829581e-08 4.5514318e-09 + 380 5.5556199 -6.9644866 -6.8876477 148.33195 1.4005893e-08 4.2971846e-09 + 390 5.5019639 -6.9637444 -6.8876476 150.08725 1.4157454e-08 3.3564262e-09 + 400 5.4354239 -6.962824 -6.8876476 152.17073 1.4226422e-08 4.2393923e-09 + 410 5.3628267 -6.9618199 -6.8876475 154.38825 1.4302679e-08 3.8937698e-09 + 420 5.2904639 -6.960819 -6.8876475 156.56034 1.4381099e-08 4.315875e-09 + 430 5.2238282 -6.9598973 -6.8876474 158.52969 1.4426567e-08 4.2658185e-09 + 440 5.1674149 -6.9591171 -6.8876474 160.16704 1.4453381e-08 5.7055268e-09 + 450 5.1245913 -6.9585248 -6.8876474 161.37513 1.4449488e-08 4.4308801e-09 + 460 5.0975361 -6.9581506 -6.8876474 162.09077 1.4445596e-08 5.8269923e-09 + 470 5.0872416 -6.9580082 -6.8876474 162.28517 1.4444348e-08 4.8263194e-09 + 480 5.0935712 -6.9580957 -6.8876474 161.96268 1.4411666e-08 6.222228e-09 + 490 5.115362 -6.9583971 -6.8876474 161.15816 1.4369716e-08 3.3926077e-09 + 500 5.1505605 -6.958884 -6.8876474 159.9333 1.4288515e-08 3.8845251e-09 +Loop time of 0.252598 on 4 procs for 500 steps with 108 atoms + +Performance: 171.023 ns/day, 0.140 hours/ns, 1979.430 timesteps/s +99.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0021545 | 0.0022845 | 0.0023794 | 0.2 | 0.90 +Neigh | 0.0063887 | 0.0067604 | 0.0069752 | 0.3 | 2.68 +Comm | 0.01048 | 0.010916 | 0.011408 | 0.3 | 4.32 +Output | 0.0026603 | 0.0027399 | 0.0029738 | 0.3 | 1.08 +Modify | 0.2295 | 0.22952 | 0.22954 | 0.0 | 90.86 +Other | | 0.0003814 | | | 0.15 + +Nlocal: 27 ave 29 max 25 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Nghost: 325 ave 327 max 323 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 243 ave 273 max 228 min +Histogram: 1 1 1 0 0 0 0 0 0 1 + +Total # of neighbors = 972 +Ave neighs/atom = 9 +Neighbor list builds = 500 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/plugins/angle_zero2.h b/examples/plugins/angle_zero2.h index 4c9e6e9b24..e9a5df3ae4 100644 --- a/examples/plugins/angle_zero2.h +++ b/examples/plugins/angle_zero2.h @@ -21,17 +21,17 @@ namespace LAMMPS_NS { class AngleZero2 : public Angle { public: AngleZero2(class LAMMPS *); - virtual ~AngleZero2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void settings(int, char **); + ~AngleZero2() override; + void compute(int, int) override; + void coeff(int, char **) override; + void settings(int, char **) override; - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; - double single(int, int, int, int); + double single(int, int, int, int) override; protected: double *theta0; diff --git a/examples/plugins/bond_zero2.h b/examples/plugins/bond_zero2.h index 247d3e2f63..e01ec8c1fc 100644 --- a/examples/plugins/bond_zero2.h +++ b/examples/plugins/bond_zero2.h @@ -21,18 +21,18 @@ namespace LAMMPS_NS { class BondZero2 : public Bond { public: BondZero2(class LAMMPS *); - virtual ~BondZero2(); - virtual void compute(int, int); - virtual void settings(int, char **); + ~BondZero2() override; + void compute(int, int) override; + void settings(int, char **) override; - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *r0; diff --git a/examples/plugins/dihedral_zero2.h b/examples/plugins/dihedral_zero2.h index c343849f7d..ca0e49b21a 100644 --- a/examples/plugins/dihedral_zero2.h +++ b/examples/plugins/dihedral_zero2.h @@ -25,14 +25,14 @@ namespace LAMMPS_NS { class DihedralZero2 : public Dihedral { public: DihedralZero2(class LAMMPS *); - virtual ~DihedralZero2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void settings(int, char **); + ~DihedralZero2() override; + void compute(int, int) override; + void coeff(int, char **) override; + void settings(int, char **) override; - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int coeffflag; diff --git a/examples/plugins/fix_nve2.h b/examples/plugins/fix_nve2.h index 423946f8c0..3be0131d28 100644 --- a/examples/plugins/fix_nve2.h +++ b/examples/plugins/fix_nve2.h @@ -11,12 +11,6 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef FIX_CLASS - -FixStyle(nve2, FixNVE2) - -#else - #ifndef LMP_FIX_NVE2_H #define LMP_FIX_NVE2_H @@ -27,14 +21,14 @@ namespace LAMMPS_NS { class FixNVE2 : public Fix { public: FixNVE2(class LAMMPS *, int, char **); - virtual ~FixNVE2() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - virtual void reset_dt(); + + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; protected: double dtv, dtf; @@ -44,7 +38,6 @@ class FixNVE2 : public Fix { } // namespace LAMMPS_NS -#endif #endif /* ERROR/WARNING messages: diff --git a/examples/plugins/improper_zero2.h b/examples/plugins/improper_zero2.h index 21cbd87c03..f561a4ae19 100644 --- a/examples/plugins/improper_zero2.h +++ b/examples/plugins/improper_zero2.h @@ -21,14 +21,14 @@ namespace LAMMPS_NS { class ImproperZero2 : public Improper { public: ImproperZero2(class LAMMPS *); - virtual ~ImproperZero2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void settings(int, char **); + ~ImproperZero2() override; + void compute(int, int) override; + void coeff(int, char **) override; + void settings(int, char **) override; - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int coeffflag; diff --git a/examples/plugins/pair_morse2.h b/examples/plugins/pair_morse2.h index 753743fc4e..c796cd1164 100644 --- a/examples/plugins/pair_morse2.h +++ b/examples/plugins/pair_morse2.h @@ -21,20 +21,20 @@ namespace LAMMPS_NS { class PairMorse2 : public Pair { public: PairMorse2(class LAMMPS *); - virtual ~PairMorse2(); - virtual void compute(int, int); + ~PairMorse2() override; + void compute(int, int) override; - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/examples/plugins/pair_morse2_omp.h b/examples/plugins/pair_morse2_omp.h index 6c27f42125..ec8f28e074 100644 --- a/examples/plugins/pair_morse2_omp.h +++ b/examples/plugins/pair_morse2_omp.h @@ -28,8 +28,8 @@ class PairMorse2OMP : public PairMorse2, public ThrOMP { public: PairMorse2OMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/examples/plugins/pair_zero2.h b/examples/plugins/pair_zero2.h index 9f96b7757c..8c8ed6f59e 100644 --- a/examples/plugins/pair_zero2.h +++ b/examples/plugins/pair_zero2.h @@ -31,19 +31,19 @@ namespace LAMMPS_NS { class PairZero2 : public Pair { public: PairZero2(class LAMMPS *); - virtual ~PairZero2(); - virtual void compute(int, int); - virtual void compute_outer(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairZero2() override; + void compute(int, int) override; + void compute_outer(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/lib/gpu/lal_answer.cpp b/lib/gpu/lal_answer.cpp index 9b5c0beca1..28be78a604 100644 --- a/lib/gpu/lal_answer.cpp +++ b/lib/gpu/lal_answer.cpp @@ -248,7 +248,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, return energy_virial(eatom,vatom,virial); double evdwl=0.0; - int ii, vstart=0, iend=_ev_stride; + int vstart=0, iend=_ev_stride; if (_eflag) { iend=_ev_stride*2; #if (LAL_USE_OMP_SIMD == 1) diff --git a/lib/gpu/lal_base_atomic.cpp b/lib/gpu/lal_base_atomic.cpp index 6aad138aa1..a8900a9c60 100644 --- a/lib/gpu/lal_base_atomic.cpp +++ b/lib/gpu/lal_base_atomic.cpp @@ -239,14 +239,14 @@ void BaseAtomicT::compute(const int f_ago, const int inum_full, // Reneighbor on GPU if necessary and then compute forces, virials, energies // --------------------------------------------------------------------------- template -int ** BaseAtomicT::compute(const int ago, const int inum_full, - const int nall, double **host_x, int *host_type, - double *sublo, double *subhi, tagint *tag, - int **nspecial, tagint **special, - const bool eflag_in, const bool vflag_in, - const bool eatom, const bool vatom, - int &host_start, int **ilist, int **jnum, - const double cpu_time, bool &success) { +int **BaseAtomicT::compute(const int ago, const int inum_full, + const int nall, double **host_x, int *host_type, + double *sublo, double *subhi, tagint *tag, + int **nspecial, tagint **special, + const bool eflag_in, const bool vflag_in, + const bool eatom, const bool vatom, + int &host_start, int **ilist, int **jnum, + const double cpu_time, bool &success) { acc_timers(); int eflag, vflag; if (eatom) eflag=2; diff --git a/lib/gpu/lal_base_atomic.h b/lib/gpu/lal_base_atomic.h index 701675390f..b9b249a164 100644 --- a/lib/gpu/lal_base_atomic.h +++ b/lib/gpu/lal_base_atomic.h @@ -133,20 +133,12 @@ class BaseAtomic { int &host_start, const double cpu_time, bool &success); /// Pair loop with device neighboring - int * compute(const int ago, const int inum_full, + int **compute(const int ago, const int inum_full, const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, - const double cpu_time, bool &success); - - /// Pair loop with device neighboring - int ** compute(const int ago, const int inum_full, - const int nall, double **host_x, int *host_type, double *sublo, - double *subhi, tagint *tag, int **nspecial, - tagint **special, const bool eflag, const bool vflag, - const bool eatom, const bool vatom, int &host_start, - int **ilist, int **numj, const double cpu_time, bool &success); + int **ilist, int **numj, const double cpu_time, bool &success); // -------------------------- DEVICE DATA ------------------------- diff --git a/lib/gpu/lal_base_ellipsoid.cpp b/lib/gpu/lal_base_ellipsoid.cpp index fa060bea5a..bb6b11799b 100644 --- a/lib/gpu/lal_base_ellipsoid.cpp +++ b/lib/gpu/lal_base_ellipsoid.cpp @@ -69,7 +69,7 @@ BaseEllipsoidT::~BaseEllipsoid() { } template -int BaseEllipsoidT::bytes_per_atom(const int max_nbors) const { +int BaseEllipsoidT::bytes_per_atom_ellipsoid(const int max_nbors) const { return device->atom.bytes_per_atom()+ans->bytes_per_atom()+ nbor->bytes_per_atom(max_nbors); } diff --git a/lib/gpu/lal_base_ellipsoid.h b/lib/gpu/lal_base_ellipsoid.h index f30a0062d2..9885e931ee 100644 --- a/lib/gpu/lal_base_ellipsoid.h +++ b/lib/gpu/lal_base_ellipsoid.h @@ -108,7 +108,7 @@ class BaseEllipsoid { void output_times(); /// Returns memory usage on device per atom - int bytes_per_atom(const int max_nbors) const; + int bytes_per_atom_ellipsoid(const int max_nbors) const; /// Total host memory used by library for pair style double host_memory_usage_base() const; @@ -173,18 +173,13 @@ class BaseEllipsoid { const double cpu_time, bool &success, double **quat); /// Pair loop with device neighboring - int** compute(const int ago, const int inum_full, const int nall, - double **host_x, int *host_type, double *sublo, - double *subhi, tagint *tag, int **nspecial, - tagint **special, const bool eflag, const bool vflag, - const bool eatom, const bool vatom, int &host_start, - int **ilist, int **numj, const double cpu_time, bool &success, - double **host_quat); - - /// Build neighbor list on accelerator - void build_nbor_list(const int inum, const int host_inum, const int nall, - double **host_x, int *host_type, double *sublo, - double *subhi, bool &success); + int**compute(const int ago, const int inum_full, const int nall, + double **host_x, int *host_type, double *sublo, + double *subhi, tagint *tag, int **nspecial, + tagint **special, const bool eflag, const bool vflag, + const bool eatom, const bool vatom, int &host_start, + int **ilist, int **numj, const double cpu_time, bool &success, + double **host_quat); // -------------------------- DEVICE DATA ------------------------- diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index 43a565c9fe..93c2f4e469 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -198,7 +198,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int ngpu, // Find deviceID with most CUs (priority given to the accelerator type) if (_first_device < 0) { int best_device = 0; - int best_cus = gpu->cus(0); + unsigned best_cus = gpu->cus(0); bool type_match = (gpu->device_type(0) == type); for (int i = 1; i < gpu->num_devices(); i++) { if (type_match==true && gpu->device_type(i)!=type) diff --git a/lib/gpu/lal_eam.h b/lib/gpu/lal_eam.h index efc38537d6..a02adbe878 100644 --- a/lib/gpu/lal_eam.h +++ b/lib/gpu/lal_eam.h @@ -62,9 +62,6 @@ class EAM : public BaseAtomic { /** \note This is called at the beginning of the init() routine **/ void clear(); - /// Returns memory usage on device per atom - int bytes_per_atom(const int max_nbors) const; - /// Total host memory used by library for pair style double host_memory_usage() const; diff --git a/lib/gpu/lal_gayberne.cpp b/lib/gpu/lal_gayberne.cpp index 2b1a190e5a..6b2fd42484 100644 --- a/lib/gpu/lal_gayberne.cpp +++ b/lib/gpu/lal_gayberne.cpp @@ -43,7 +43,7 @@ GayBerneT::~GayBerne() { template int GayBerneT::bytes_per_atom(const int max_nbors) const { - return this->bytes_per_atom(max_nbors); + return this->bytes_per_atom_ellipsoid(max_nbors); } template diff --git a/lib/gpu/lal_re_squared.cpp b/lib/gpu/lal_re_squared.cpp index aabfb9d39f..f6e88aa888 100644 --- a/lib/gpu/lal_re_squared.cpp +++ b/lib/gpu/lal_re_squared.cpp @@ -43,7 +43,7 @@ RESquaredT::~RESquared() { template int RESquaredT::bytes_per_atom(const int max_nbors) const { - return this->bytes_per_atom(max_nbors); + return this->bytes_per_atom_ellipsoid(max_nbors); } template diff --git a/lib/gpu/lal_sw.cu b/lib/gpu/lal_sw.cu index 621ba87208..a974c5f193 100644 --- a/lib/gpu/lal_sw.cu +++ b/lib/gpu/lal_sw.cu @@ -658,6 +658,7 @@ __kernel void k_sw_three_end(const __global numtyp4 *restrict x_, #ifndef ONETYPE const int ktype=kx.w; const int mtypek=jtype*ntypes+ktype; + const numtyp sw_cut_ik=cut_sig_gamma[mtypek].x; #endif numtyp delr2x = kx.x - jx.x; @@ -665,8 +666,12 @@ __kernel void k_sw_three_end(const __global numtyp4 *restrict x_, numtyp delr2z = kx.z - jx.z; numtyp rsq2 = delr2x*delr2x + delr2y*delr2y + delr2z*delr2z; + // for neigh no within pair hybrid: still need the check below + // this loop apparently iterates over neighbors of j that are not intended + const numtyp cutsq_jk=sw_cut_ik*sw_cut_ik; + if (!(rsq2>(numtyp)0 && rsq2(numtyp)0 && rsq2 CudaInternal::resize_team_scratch_space( int current_team_scratch = 0; int zero = 0; int one = 1; - while (m_team_scratch_pool[current_team_scratch].compare_exchange_weak( + while (!m_team_scratch_pool[current_team_scratch].compare_exchange_weak( zero, one, std::memory_order_release, std::memory_order_relaxed)) { current_team_scratch = (current_team_scratch + 1) % m_n_team_scratch; } diff --git a/lib/kokkos/core/src/desul/atomics/Generic.hpp b/lib/kokkos/core/src/desul/atomics/Generic.hpp index 9d5e87ece2..19d7a453fa 100644 --- a/lib/kokkos/core/src/desul/atomics/Generic.hpp +++ b/lib/kokkos/core/src/desul/atomics/Generic.hpp @@ -10,8 +10,10 @@ SPDX-License-Identifier: (BSD-3-Clause) #define DESUL_ATOMICS_GENERIC_HPP_ #include +#if defined(__GNUC__) && (!defined(__clang__)) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif #include "desul/atomics/Common.hpp" #include "desul/atomics/Compare_Exchange.hpp" #include "desul/atomics/Lock_Array.hpp" @@ -686,5 +688,7 @@ DESUL_INLINE_FUNCTION bool atomic_compare_exchange_weak(T* const dest, #include #include #include +#if defined(__GNUC__) && (!defined(__clang__)) #pragma GCC diagnostic pop #endif +#endif diff --git a/lib/kokkos/core/src/impl/Kokkos_Core.cpp b/lib/kokkos/core/src/impl/Kokkos_Core.cpp index a1f9d33632..00d6b5850b 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Core.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Core.cpp @@ -58,7 +58,7 @@ #ifndef _WIN32 #include #else -#include +#include #endif //---------------------------------------------------------------------------- diff --git a/potentials/CHAu.ILP b/potentials/CHAu.ILP new file mode 100644 index 0000000000..c3c27ef191 --- /dev/null +++ b/potentials/CHAu.ILP @@ -0,0 +1,18 @@ +# DATE: 2021-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com +# CITATION: W. Ouyang, O. Hod, and R. Guerra, J. Chem. Theory Comput. 17, 7215 (2021). +# Semi-anisotropic interlayer Potential (SAIP) for graphene/gold, benzene/gold heterojunctions +# The parameters below are fitted against the PBE + D3 DFT reference data. +# The parameters for C-C, C-H and H-H are taken from Nano Letters 18, 6009-6016 (2018). +# +# --------------- Repulsion Potential ----------------++++++++++++++ Vdw Potential ++++++++++++++++***** +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +C C 3.205843 7.511126 1.235334 1.528338E-5 37.530428 15.499947 0.7954443 3.681440 25.714535E3 1.0 2.0 +H H 3.974540 6.53799 1.080633 0.6700556 0.8333833 15.022371 0.7490632 2.767223 1.6159581E3 1.0 1.2 +C H 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 +Au C 3.6913278482 13.5655648421 1.0175514400 0.0070964784 -0.0010368264 11.0586486772 1.0635582839 3.7552608806 81.5847131142 1000.0 1.0 +Au H 3.7899616131 4.3065009639 10.6811825156 0.2250887843 -0.1116891520 18.6149213872 0.9833194192 3.3507558896 70.6865381780 1000.0 1.0 +Au Au 3.6671967387 12.8109735143 1.0353581041 0.0000000000 0.0000000000 10.1628585345 1.0642897301 3.7372959779 0.0000000000 1000.0 1.0 +# Symmetric part +C Au 3.6913278482 13.5655648421 1.0175514400 0.0070964784 -0.0010368264 11.0586486772 1.0635582839 3.7552608806 81.5847131142 1000.0 2.0 +H Au 3.7899616131 4.3065009639 10.6811825156 0.2250887843 -0.1116891520 18.6149213872 0.9833194192 3.3507558896 70.6865381780 1000.0 1.5 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 diff --git a/potentials/MoS2.ILP b/potentials/MoS2.ILP new file mode 100644 index 0000000000..53d30714d1 --- /dev/null +++ b/potentials/MoS2.ILP @@ -0,0 +1,12 @@ +# DATE: 2021-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com +# CITATION: W. Ouyang, et al., J. Chem. Theory Comput. 17, 7237 (2021). +# Interlayer Potential (ILP) for bilayer and bulk Molybdenum Disulfide. +# The parameters below are fitted against the HSE + MBD-NL DFT reference data. +# +# --------------- Repulsion Potential ----------------++++++++++++++ Vdw Potential ++++++++++++++++***** +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut + Mo Mo 5.5794503728 9.3776624643 2.0272224617 144.1517754265 97.9785701736 89.4375967588 2.0590305447 5.1220549022 491850.3161946840 1.0000 4.0 + S S 3.1614021873 8.0932627454 1.9531402037 4.5867641760 118.0654664611 58.8094158385 0.2153665787 4.2996001250 148811.2434089213 1.0000 4.0 + Mo S 3.6271521213 19.9713750996 7.5850312329 76.1019310047 3.3174955929 45.7203284638 0.9474703731 4.4104250318 150597.8577162951 1.0000 4.0 +# symmetric part + S Mo 3.6271521213 19.9713750996 7.5850312329 76.1019310047 3.3174955929 45.7203284638 0.9474703731 4.4104250318 150597.8577162951 1.0000 4.0 diff --git a/python/lammps/core.py b/python/lammps/core.py index fcd5c76ad5..23002b210c 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -89,6 +89,9 @@ class lammps(object): modpath = dirname(abspath(getsourcefile(lambda:0))) # for windows installers the shared library is in a different folder winpath = abspath(os.path.join(modpath,'..','..','bin')) + # allow override for running tests on Windows + if (os.environ.get("LAMMPSDLLPATH")): + winpath = os.environ.get("LAMMPSDLLPATH") self.lib = None self.lmp = None @@ -122,6 +125,9 @@ class lammps(object): for f in os.listdir(winpath)]): lib_ext = ".dll" modpath = winpath + elif any([f.startswith('liblammps') and f.endswith('.so') + for f in os.listdir(modpath)]): + lib_ext = ".so" else: import platform if platform.system() == "Darwin": @@ -158,6 +164,7 @@ class lammps(object): self.lib.lammps_open.restype = c_void_p self.lib.lammps_open_no_mpi.restype = c_void_p self.lib.lammps_close.argtypes = [c_void_p] + self.lib.lammps_flush_buffers.argtypes = [c_void_p] self.lib.lammps_free.argtypes = [c_void_p] self.lib.lammps_file.argtypes = [c_void_p, c_char_p] @@ -403,6 +410,10 @@ class lammps(object): pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object] self.lmp = c_void_p(pythonapi.PyCObject_AsVoidPtr(ptr)) + # check if library initilialization failed + if not self.lmp: + raise(RuntimeError("Failed to initialize LAMMPS object")) + # optional numpy support (lazy loading) self._numpy = None @@ -1112,6 +1123,16 @@ class lammps(object): # ------------------------------------------------------------------------- + def flush_buffers(self): + """Flush output buffers + + This is a wrapper around the :cpp:func:`lammps_flush_buffers` + function of the C-library interface. + """ + self.lib.lammps_flush_buffers(self.lmp) + + # ------------------------------------------------------------------------- + def set_variable(self,name,value): """Set a new value for a LAMMPS string style variable diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 20ec85d001..3619728081 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -92,7 +92,7 @@ class numpy_wrapper: if dim == LAMMPS_AUTODETECT: if dtype in (LAMMPS_INT_2D, LAMMPS_DOUBLE_2D, LAMMPS_INT64_2D): # TODO add other fields - if name in ("x", "v", "f", "x0", "omega", "angmom", "torque", "vforce", "vest"): + if name in ("x", "v", "f", "x0","omega", "angmom", "torque", "csforce", "vforce", "vest"): dim = 3 elif name == "smd_data_9": dim = 9 diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index abd4d6da98..cdb6620c27 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -20,47 +20,47 @@ from __future__ import print_function +import io import os import re -import select +import sys +import tempfile from collections import namedtuple from .core import lammps +# ------------------------------------------------------------------------- class OutputCapture(object): """ Utility class to capture LAMMPS library output """ - def __init__(self): - self.stdout_pipe_read, self.stdout_pipe_write = os.pipe() self.stdout_fd = 1 + self.captured_output = "" def __enter__(self): - self.stdout = os.dup(self.stdout_fd) - os.dup2(self.stdout_pipe_write, self.stdout_fd) + self.tmpfile = tempfile.TemporaryFile(mode='w+b') + + sys.stdout.flush() + + # make copy of original stdout + self.stdout_orig = os.dup(self.stdout_fd) + + # replace stdout and redirect to temp file + os.dup2(self.tmpfile.fileno(), self.stdout_fd) return self def __exit__(self, exc_type, exc_value, traceback): - os.dup2(self.stdout, self.stdout_fd) - os.close(self.stdout) - os.close(self.stdout_pipe_read) - os.close(self.stdout_pipe_write) - - # check if we have more to read from the pipe - def more_data(self, pipe): - r, _, _ = select.select([pipe], [], [], 0) - return bool(r) - - # read the whole pipe - def read_pipe(self, pipe): - out = "" - while self.more_data(pipe): - out += os.read(pipe, 1024).decode() - return out + os.dup2(self.stdout_orig, self.stdout_fd) + os.close(self.stdout_orig) + self.tmpfile.close() @property def output(self): - return self.read_pipe(self.stdout_pipe_read) + sys.stdout.flush() + self.tmpfile.flush() + self.tmpfile.seek(0, io.SEEK_SET) + self.captured_output = self.tmpfile.read().decode('utf-8') + return self.captured_output # ------------------------------------------------------------------------- @@ -109,9 +109,9 @@ class AtomList(object): """ if index not in self._loaded: if self.dimensions == 2: - atom = Atom2D(self._pylmp, index + 1) + atom = Atom2D(self._pylmp, index) else: - atom = Atom(self._pylmp, index + 1) + atom = Atom(self._pylmp, index) self._loaded[index] = atom return self._loaded[index] @@ -134,6 +134,12 @@ class Atom(object): def __dir__(self): return [k for k in super().__dir__() if not k.startswith('_')] + def get(self, name, index): + prop = self._pylmp.lmp.numpy.extract_atom(name) + if prop is not None: + return prop[index] + return None + @property def id(self): """ @@ -141,7 +147,7 @@ class Atom(object): :type: int """ - return int(self._pylmp.eval("id[%d]" % self.index)) + return self.get("id", self.index) @property def type(self): @@ -150,7 +156,7 @@ class Atom(object): :type: int """ - return int(self._pylmp.eval("type[%d]" % self.index)) + return self.get("type", self.index) @property def mol(self): @@ -159,7 +165,7 @@ class Atom(object): :type: int """ - return self._pylmp.eval("mol[%d]" % self.index) + return self.get("mol", self.index) @property def mass(self): @@ -168,52 +174,114 @@ class Atom(object): :type: float """ - return self._pylmp.eval("mass[%d]" % self.index) + return self.get("mass", self.index) + + @property + def radius(self): + """ + Return the particle radius + + :type: float + """ + return self.get("radius", self.index) @property def position(self): """ :getter: Return position of atom :setter: Set position of atom - :type: tuple (float, float, float) + :type: numpy.array (float, float, float) """ - return (self._pylmp.eval("x[%d]" % self.index), - self._pylmp.eval("y[%d]" % self.index), - self._pylmp.eval("z[%d]" % self.index)) + return self.get("x", self.index) @position.setter def position(self, value): - """ - :getter: Return velocity of atom - :setter: Set velocity of atom - :type: tuple (float, float, float) - """ - self._pylmp.set("atom", self.index, "x", value[0]) - self._pylmp.set("atom", self.index, "y", value[1]) - self._pylmp.set("atom", self.index, "z", value[2]) + current = self.position + current[:] = value @property def velocity(self): - return (self._pylmp.eval("vx[%d]" % self.index), - self._pylmp.eval("vy[%d]" % self.index), - self._pylmp.eval("vz[%d]" % self.index)) + """ + :getter: Return velocity of atom + :setter: Set velocity of atom + :type: numpy.array (float, float, float) + """ + return self.get("v", self.index) @velocity.setter def velocity(self, value): - self._pylmp.set("atom", self.index, "vx", value[0]) - self._pylmp.set("atom", self.index, "vy", value[1]) - self._pylmp.set("atom", self.index, "vz", value[2]) + current = self.velocity + current[:] = value @property def force(self): """ Return the total force acting on the atom - :type: tuple (float, float, float) + :type: numpy.array (float, float, float) """ - return (self._pylmp.eval("fx[%d]" % self.index), - self._pylmp.eval("fy[%d]" % self.index), - self._pylmp.eval("fz[%d]" % self.index)) + return self.get("f", self.index) + + @force.setter + def force(self, value): + current = self.force + current[:] = value + + @property + def torque(self): + """ + Return the total torque acting on the atom + + :type: numpy.array (float, float, float) + """ + return self.get("torque", self.index) + + @force.setter + def torque(self, value): + current = self.torque + current[:] = value + + @property + def omega(self): + """ + Return the rotational velocity of the particle + + :type: numpy.array (float, float, float) + """ + return self.get("torque", self.index) + + @omega.setter + def omega(self, value): + current = self.torque + current[:] = value + + @property + def torque(self): + """ + Return the total torque acting on the particle + + :type: numpy.array (float, float, float) + """ + return self.get("torque", self.index) + + @torque.setter + def torque(self, value): + current = self.torque + current[:] = value + + @property + def angular_momentum(self): + """ + Return the angular momentum of the particle + + :type: numpy.array (float, float, float) + """ + return self.get("angmom", self.index) + + @angular_momentum.setter + def angular_momentum(self, value): + current = self.angular_momentum + current[:] = value @property def charge(self): @@ -222,7 +290,7 @@ class Atom(object): :type: float """ - return self._pylmp.eval("q[%d]" % self.index) + return self.get("q", self.index) # ------------------------------------------------------------------------- @@ -244,39 +312,42 @@ class Atom2D(Atom): :getter: Return position of atom :setter: Set position of atom - :type: tuple (float, float) + :type: numpy.array (float, float) """ - return (self._pylmp.eval("x[%d]" % self.index), - self._pylmp.eval("y[%d]" % self.index)) + return super(Atom2D, self).position[0:2] @position.setter def position(self, value): - self._pylmp.set("atom", self.index, "x", value[0]) - self._pylmp.set("atom", self.index, "y", value[1]) + current = self.position + current[:] = value @property def velocity(self): """Access to velocity of an atom :getter: Return velocity of atom :setter: Set velocity of atom - :type: tuple (float, float) + :type: numpy.array (float, float) """ - return (self._pylmp.eval("vx[%d]" % self.index), - self._pylmp.eval("vy[%d]" % self.index)) + return super(Atom2D, self).velocity[0:2] @velocity.setter def velocity(self, value): - self._pylmp.set("atom", self.index, "vx", value[0]) - self._pylmp.set("atom", self.index, "vy", value[1]) + current = self.velocity + current[:] = value @property def force(self): """Access to force of an atom - - :type: tuple (float, float) + :getter: Return force of atom + :setter: Set force of atom + :type: numpy.array (float, float) """ - return (self._pylmp.eval("fx[%d]" % self.index), - self._pylmp.eval("fy[%d]" % self.index)) + return super(Atom2D, self).force[0:2] + + @force.setter + def force(self, value): + current = self.force + current[:] = value # ------------------------------------------------------------------------- @@ -541,7 +612,8 @@ class PyLammps(object): :getter: Returns an object with properties storing the current system state :type: namedtuple """ - output = self.info("system") + output = self.lmp_info("system") + output = output[output.index("System information:")+1:] d = self._parse_info_system(output) return namedtuple('System', d.keys())(*d.values()) @@ -553,7 +625,8 @@ class PyLammps(object): :getter: Returns an object with properties storing the current communication state :type: namedtuple """ - output = self.info("communication") + output = self.lmp_info("communication") + output = output[output.index("Communication information:")+1:] d = self._parse_info_communication(output) return namedtuple('Communication', d.keys())(*d.values()) @@ -565,7 +638,8 @@ class PyLammps(object): :getter: Returns a list of computes that are currently active in this LAMMPS instance :type: list """ - output = self.info("computes") + output = self.lmp_info("computes") + output = output[output.index("Compute information:")+1:] return self._parse_element_list(output) @property @@ -576,7 +650,8 @@ class PyLammps(object): :getter: Returns a list of dumps that are currently active in this LAMMPS instance :type: list """ - output = self.info("dumps") + output = self.lmp_info("dumps") + output = output[output.index("Dump information:")+1:] return self._parse_element_list(output) @property @@ -587,7 +662,8 @@ class PyLammps(object): :getter: Returns a list of fixes that are currently active in this LAMMPS instance :type: list """ - output = self.info("fixes") + output = self.lmp_info("fixes") + output = output[output.index("Fix information:")+1:] return self._parse_element_list(output) @property @@ -598,7 +674,8 @@ class PyLammps(object): :getter: Returns a list of atom groups that are currently active in this LAMMPS instance :type: list """ - output = self.info("groups") + output = self.lmp_info("groups") + output = output[output.index("Group information:")+1:] return self._parse_groups(output) @property @@ -609,11 +686,12 @@ class PyLammps(object): :getter: Returns a dictionary of all variables that are defined in this LAMMPS instance :type: dict """ - output = self.info("variables") - vars = {} + output = self.lmp_info("variables") + output = output[output.index("Variable information:")+1:] + variables = {} for v in self._parse_element_list(output): - vars[v['name']] = Variable(self, v['name'], v['style'], v['def']) - return vars + variables[v['name']] = Variable(self, v['name'], v['style'], v['def']) + return variables def eval(self, expr): """ @@ -638,10 +716,9 @@ class PyLammps(object): return [x.strip() for x in value.split('=')] def _parse_info_system(self, output): - lines = output[5:-2] system = {} - for line in lines: + for line in output: if line.startswith("Units"): system['units'] = self._get_pair(line)[1] elif line.startswith("Atom style"): @@ -699,10 +776,9 @@ class PyLammps(object): return system def _parse_info_communication(self, output): - lines = output[5:-3] comm = {} - for line in lines: + for line in output: if line.startswith("MPI library"): comm['mpi_version'] = line.split(':')[1].strip() elif line.startswith("Comm style"): @@ -720,10 +796,10 @@ class PyLammps(object): return comm def _parse_element_list(self, output): - lines = output[5:-3] elements = [] - for line in lines: + for line in output: + if not line or (":" not in line): continue element_info = self._split_values(line.split(':')[1].strip()) element = {'name': element_info[0]} for key, value in [self._get_pair(x) for x in element_info[1:]]: @@ -732,11 +808,10 @@ class PyLammps(object): return elements def _parse_groups(self, output): - lines = output[5:-3] groups = [] group_pattern = re.compile(r"(?P.+) \((?P.+)\)") - for line in lines: + for line in output: m = group_pattern.match(line.split(':')[1].strip()) group = {'name': m.group('name'), 'type': m.group('type')} groups.append(group) @@ -747,7 +822,7 @@ class PyLammps(object): return self.__getattr__("print")(s) def __dir__(self): - return ['angle_coeff', 'angle_style', 'atom_modify', 'atom_style', 'atom_style', + return sorted(set(['angle_coeff', 'angle_style', 'atom_modify', 'atom_style', 'atom_style', 'bond_coeff', 'bond_style', 'boundary', 'change_box', 'communicate', 'compute', 'create_atoms', 'create_box', 'delete_atoms', 'delete_bonds', 'dielectric', 'dihedral_coeff', 'dihedral_style', 'dimension', 'dump', 'fix', 'fix_modify', @@ -757,7 +832,16 @@ class PyLammps(object): 'pair_style', 'processors', 'read', 'read_data', 'read_restart', 'region', 'replicate', 'reset_timestep', 'restart', 'run', 'run_style', 'thermo', 'thermo_modify', 'thermo_style', 'timestep', 'undump', 'unfix', 'units', - 'variable', 'velocity', 'write_restart'] + 'variable', 'velocity', 'write_restart'] + self.lmp.available_styles("command"))) + + def lmp_info(self, s): + # skip anything before and after Info-Info-Info + # also skip timestamp line + output = self.__getattr__("info")(s) + indices = [index for index, line in enumerate(output) if line.startswith("Info-Info-Info-Info")] + start = indices[0] + end = indices[1] + return [line for line in output[start+2:end] if line] def __getattr__(self, name): """ @@ -773,10 +857,12 @@ class PyLammps(object): """ def handler(*args, **kwargs): cmd_args = [name] + [str(x) for x in args] + self.lmp.flush_buffers() with OutputCapture() as capture: cmd = ' '.join(cmd_args) self.command(cmd) + self.lmp.flush_buffers() output = capture.output comm = self.lmp.get_mpi_comm() diff --git a/python/setup.py b/python/setup.py index 1ae423d59f..5a6a54258a 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,9 +1,8 @@ # this only installs the LAMMPS python package # it assumes the LAMMPS shared library is already installed -from distutils.core import setup +from setuptools import setup from sys import version_info import os,time - LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__)) LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR) LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src') diff --git a/src/.gitignore b/src/.gitignore index d604d1857c..4175d28513 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1502,6 +1502,8 @@ /pair_dpd_fdt.h /pair_dpd_fdt_energy.cpp /pair_dpd_fdt_energy.h +/pair_harmonic_cut.cpp +/pair_harmonic_cut.h /pair_lennard_mdf.cpp /pair_lennard_mdf.h /pair_lj_cut_coul_long_cs.cpp diff --git a/src/ADIOS/dump_atom_adios.h b/src/ADIOS/dump_atom_adios.h index 783abaf915..850c4dbf8e 100644 --- a/src/ADIOS/dump_atom_adios.h +++ b/src/ADIOS/dump_atom_adios.h @@ -30,12 +30,12 @@ class DumpAtomADIOS : public DumpAtom { public: DumpAtomADIOS(class LAMMPS *, int, char **); - virtual ~DumpAtomADIOS(); + ~DumpAtomADIOS() override; protected: - virtual void openfile(); - virtual void write(); - virtual void init_style(); + void openfile() override; + void write() override; + void init_style() override; private: DumpAtomADIOSInternal *internal; diff --git a/src/ADIOS/dump_custom_adios.h b/src/ADIOS/dump_custom_adios.h index ae327f0db5..fde46a0754 100644 --- a/src/ADIOS/dump_custom_adios.h +++ b/src/ADIOS/dump_custom_adios.h @@ -29,12 +29,12 @@ class DumpCustomADIOSInternal; class DumpCustomADIOS : public DumpCustom { public: DumpCustomADIOS(class LAMMPS *, int, char **); - virtual ~DumpCustomADIOS(); + ~DumpCustomADIOS() override; protected: - virtual void openfile(); - virtual void write(); - virtual void init_style(); + void openfile() override; + void write() override; + void init_style() override; private: DumpCustomADIOSInternal *internal; diff --git a/src/ADIOS/reader_adios.h b/src/ADIOS/reader_adios.h index 1d8f2a3773..e59c677489 100644 --- a/src/ADIOS/reader_adios.h +++ b/src/ADIOS/reader_adios.h @@ -34,18 +34,18 @@ class ReadADIOSInternal; class ReaderADIOS : public Reader { public: ReaderADIOS(class LAMMPS *); - virtual ~ReaderADIOS(); + ~ReaderADIOS() override; - virtual void settings(int, char **); + void settings(int, char **) override; - virtual int read_time(bigint &); - virtual void skip(); - virtual bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, - int &, int &, int &); - virtual void read_atoms(int, int, double **); + int read_time(bigint &) override; + void skip() override; + bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, + int &, int &, int &) override; + void read_atoms(int, int, double **) override; - virtual void open_file(const char *); - virtual void close_file(); + void open_file(const char *) override; + void close_file() override; private: int *fieldindex; // mapping of input fields to dump diff --git a/src/ASPHERE/compute_erotate_asphere.h b/src/ASPHERE/compute_erotate_asphere.h index 0805770bb6..895da694b2 100644 --- a/src/ASPHERE/compute_erotate_asphere.h +++ b/src/ASPHERE/compute_erotate_asphere.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class ComputeERotateAsphere : public Compute { public: ComputeERotateAsphere(class LAMMPS *, int, char **); - void init(); - double compute_scalar(); + void init() override; + double compute_scalar() override; private: double pfactor; diff --git a/src/ASPHERE/compute_temp_asphere.h b/src/ASPHERE/compute_temp_asphere.h index 18c0768fd0..f479459728 100644 --- a/src/ASPHERE/compute_temp_asphere.h +++ b/src/ASPHERE/compute_temp_asphere.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class ComputeTempAsphere : public Compute { public: ComputeTempAsphere(class LAMMPS *, int, char **); - ~ComputeTempAsphere(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempAsphere() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void restore_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void restore_bias_thr(int, double *, double *); + void remove_bias(int, double *) override; + void restore_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void restore_bias_thr(int, double *, double *) override; private: int mode; diff --git a/src/ASPHERE/fix_nh_asphere.h b/src/ASPHERE/fix_nh_asphere.h index cc4020ecf5..89e9d7d96e 100644 --- a/src/ASPHERE/fix_nh_asphere.h +++ b/src/ASPHERE/fix_nh_asphere.h @@ -21,16 +21,15 @@ namespace LAMMPS_NS { class FixNHAsphere : public FixNH { public: FixNHAsphere(class LAMMPS *, int, char **); - virtual ~FixNHAsphere() {} - void init(); + void init() override; protected: double dtq; class AtomVecEllipsoid *avec; - void nve_v(); - void nve_x(); - void nh_v_temp(); + void nve_v() override; + void nve_x() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/ASPHERE/fix_nph_asphere.h b/src/ASPHERE/fix_nph_asphere.h index 5fed646f63..db1d085384 100644 --- a/src/ASPHERE/fix_nph_asphere.h +++ b/src/ASPHERE/fix_nph_asphere.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHAsphere : public FixNHAsphere { public: FixNPHAsphere(class LAMMPS *, int, char **); - ~FixNPHAsphere() {} }; } // namespace LAMMPS_NS diff --git a/src/ASPHERE/fix_npt_asphere.h b/src/ASPHERE/fix_npt_asphere.h index 43410b78da..c0b54a3d82 100644 --- a/src/ASPHERE/fix_npt_asphere.h +++ b/src/ASPHERE/fix_npt_asphere.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTAsphere : public FixNHAsphere { public: FixNPTAsphere(class LAMMPS *, int, char **); - ~FixNPTAsphere() {} }; } // namespace LAMMPS_NS diff --git a/src/ASPHERE/fix_nve_asphere.h b/src/ASPHERE/fix_nve_asphere.h index fa7547af4b..8adfbac010 100644 --- a/src/ASPHERE/fix_nve_asphere.h +++ b/src/ASPHERE/fix_nve_asphere.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixNVEAsphere : public FixNVE { public: FixNVEAsphere(class LAMMPS *, int, char **); - void init(); - void initial_integrate(int); - void final_integrate(); + void init() override; + void initial_integrate(int) override; + void final_integrate() override; private: double dtq; diff --git a/src/ASPHERE/fix_nve_asphere_noforce.h b/src/ASPHERE/fix_nve_asphere_noforce.h index 90b84a79d6..0467d443c0 100644 --- a/src/ASPHERE/fix_nve_asphere_noforce.h +++ b/src/ASPHERE/fix_nve_asphere_noforce.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixNVEAsphereNoforce : public FixNVENoforce { public: FixNVEAsphereNoforce(class LAMMPS *, int, char **); - void initial_integrate(int); - void init(); + void initial_integrate(int) override; + void init() override; private: double dtq; diff --git a/src/ASPHERE/fix_nve_line.h b/src/ASPHERE/fix_nve_line.h index c706072a18..d5076dea51 100644 --- a/src/ASPHERE/fix_nve_line.h +++ b/src/ASPHERE/fix_nve_line.h @@ -27,11 +27,10 @@ namespace LAMMPS_NS { class FixNVELine : public FixNVE { public: FixNVELine(class LAMMPS *, int, char **); - ~FixNVELine() {} - int setmask(); - void init(); - void initial_integrate(int); - void final_integrate(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; private: double MINUSPI, TWOPI; diff --git a/src/ASPHERE/fix_nve_tri.h b/src/ASPHERE/fix_nve_tri.h index 1fc11c5d7e..daba41b538 100644 --- a/src/ASPHERE/fix_nve_tri.h +++ b/src/ASPHERE/fix_nve_tri.h @@ -27,11 +27,10 @@ namespace LAMMPS_NS { class FixNVETri : public FixNVE { public: FixNVETri(class LAMMPS *, int, char **); - ~FixNVETri() {} - int setmask(); - void init(); - void initial_integrate(int); - void final_integrate(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; private: double dtq; diff --git a/src/ASPHERE/fix_nvt_asphere.h b/src/ASPHERE/fix_nvt_asphere.h index 24b070ba78..cd6c3f8d63 100644 --- a/src/ASPHERE/fix_nvt_asphere.h +++ b/src/ASPHERE/fix_nvt_asphere.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTAsphere : public FixNHAsphere { public: FixNVTAsphere(class LAMMPS *, int, char **); - ~FixNVTAsphere() {} }; } // namespace LAMMPS_NS diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 08af6ee3c9..39cb88f81b 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -18,18 +18,18 @@ #include "pair_gayberne.h" -#include -#include "math_extra.h" #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" #include "citeme.h" -#include "memory.h" +#include "comm.h" #include "error.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/ASPHERE/pair_gayberne.h b/src/ASPHERE/pair_gayberne.h index 59ee1a0f97..a4bc07587f 100644 --- a/src/ASPHERE/pair_gayberne.h +++ b/src/ASPHERE/pair_gayberne.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairGayBerne : public Pair { public: PairGayBerne(LAMMPS *lmp); - virtual ~PairGayBerne(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); + ~PairGayBerne() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; protected: enum { SPHERE_SPHERE, SPHERE_ELLIPSE, ELLIPSE_SPHERE, ELLIPSE_ELLIPSE }; diff --git a/src/ASPHERE/pair_line_lj.h b/src/ASPHERE/pair_line_lj.h index ac345ba3e4..c76d601b2f 100644 --- a/src/ASPHERE/pair_line_lj.h +++ b/src/ASPHERE/pair_line_lj.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLineLJ : public Pair { public: PairLineLJ(class LAMMPS *); - virtual ~PairLineLJ(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); + ~PairLineLJ() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: double cut_global; diff --git a/src/ASPHERE/pair_resquared.h b/src/ASPHERE/pair_resquared.h index b548311ed5..3f09ca50d8 100644 --- a/src/ASPHERE/pair_resquared.h +++ b/src/ASPHERE/pair_resquared.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PairRESquared : public Pair { public: PairRESquared(LAMMPS *lmp); - virtual ~PairRESquared(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + ~PairRESquared() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; protected: enum { SPHERE_SPHERE, SPHERE_ELLIPSE, ELLIPSE_SPHERE, ELLIPSE_ELLIPSE }; diff --git a/src/ASPHERE/pair_tri_lj.h b/src/ASPHERE/pair_tri_lj.h index beda914f4a..918a90916e 100644 --- a/src/ASPHERE/pair_tri_lj.h +++ b/src/ASPHERE/pair_tri_lj.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairTriLJ : public Pair { public: PairTriLJ(class LAMMPS *); - virtual ~PairTriLJ(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); + ~PairTriLJ() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: double cut_global; diff --git a/src/ATC/fix_atc.h b/src/ATC/fix_atc.h index 1b34604aa2..cf8c555cac 100644 --- a/src/ATC/fix_atc.h +++ b/src/ATC/fix_atc.h @@ -37,91 +37,91 @@ class FixATC : public Fix { public: /** constructor & destructor */ FixATC(class LAMMPS *, int, char **); - ~FixATC(); + ~FixATC() override; /** initialization functions */ - void init(); - void init_list(int id, NeighList *ptr); - void setup(int vflag); - void min_setup(int vflag); + void init() override; + void init_list(int id, NeighList *ptr) override; + void setup(int vflag) override; + void min_setup(int vflag) override; /** setmask: tell LAMMPS which fix methods to call */ - int setmask(); + int setmask() override; /** initial_integrate */ - void initial_integrate(int vflag); + void initial_integrate(int vflag) override; /** after first integrate phase */ - void post_integrate(); + void post_integrate() override; /** final_integrate */ - void final_integrate(); + void final_integrate() override; /** end of step for run or minimize */ - void end_of_step(); + void end_of_step() override; /** pre_exchange is used to modify fix-specific data and is called before domain->pbc() and comm->exchange(). */ - void setup_pre_exchange(); - void pre_exchange(); - void min_pre_exchange(); + void setup_pre_exchange() override; + void pre_exchange() override; + void min_pre_exchange() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; /** pack_exchange called from atom_vec->pack_exchange() and packs fix-specific data for a given real (local) atom being sent to another processor. */ - int pack_exchange(int, double *); + int pack_exchange(int, double *) override; /** unpack_exchange called from atom_vec->unpack_exchange() and unpacks fix-specific data for a given real (local) atom received from another processor. */ - int unpack_exchange(int, double *); + int unpack_exchange(int, double *) override; /** pack_comm called from comm->forward_comm_fix and packs fix-specific data for a given ghost atom from exchange with another proc */ - int pack_forward_comm(int, int *, double *, int, int *); + int pack_forward_comm(int, int *, double *, int, int *) override; /** unpack_comm called from comm->forward_comm_fix and unpacks fix-specific data for a given ghost atom from exchange with another proc */ - void unpack_forward_comm(int, int, double *); + void unpack_forward_comm(int, int, double *) override; /** pre_neighbor is used to modify fix-specific data and is called before neighbor list is built in neighbor->build(). */ - void pre_neighbor(); - void setup_pre_neighbor(); + void pre_neighbor() override; + void setup_pre_neighbor() override; /** pre/post_force is used to modify fix-specific data and is before/after the various force computations. */ - void pre_force(int vflag); - void post_force(int vflag); + void pre_force(int vflag) override; + void post_force(int vflag) override; /** post_run is called after a run completes */ - void post_run(); + void post_run() override; /** min_pre_force is called before forces are calculated in minimize */ - void min_pre_force(int vflag); + void min_pre_force(int vflag) override; /** min_post_force is called after forces are calculated in minimize */ - void min_post_force(int vflag); + void min_post_force(int vflag) override; /** modify atc parameters (parser) */ - int modify_param(int narg, char **arg); + int modify_param(int narg, char **arg) override; /** calls ATC_Method to handle restarting/checkpointing */ /** these four methods are for writing per-atom quantities */ - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; /** these two methods are for writing all other quantities */ - void write_restart(FILE *); - void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; /** accessor function for ATC_Method class pointer */ const ATC::ATC_Method *atc() { return atc_; } @@ -130,9 +130,9 @@ class FixATC : public Fix { LAMMPS *lammps_; /** functions for "thermo" output */ - virtual double compute_scalar(); - virtual double compute_vector(int n); - virtual double compute_array(int irow, int icol); + double compute_scalar() override; + double compute_vector(int n) override; + double compute_array(int irow, int icol) override; double dtv, dtf; ATC::ATC_Method *atc_; }; diff --git a/src/AWPMD/atom_vec_wavepacket.h b/src/AWPMD/atom_vec_wavepacket.h index 310180b1b4..0a23e23019 100644 --- a/src/AWPMD/atom_vec_wavepacket.h +++ b/src/AWPMD/atom_vec_wavepacket.h @@ -28,12 +28,12 @@ class AtomVecWavepacket : public AtomVec { public: AtomVecWavepacket(class LAMMPS *); - void grow_pointers(); - void force_clear(int, size_t); - void create_atom_post(int); - void data_atom_post(int); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void create_atom_post(int) override; + void data_atom_post(int) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; private: int *spin; diff --git a/src/AWPMD/fix_nve_awpmd.h b/src/AWPMD/fix_nve_awpmd.h index 700483ef6e..182470a702 100644 --- a/src/AWPMD/fix_nve_awpmd.h +++ b/src/AWPMD/fix_nve_awpmd.h @@ -31,13 +31,13 @@ namespace LAMMPS_NS { class FixNVEAwpmd : public Fix { public: FixNVEAwpmd(class LAMMPS *, int, char **); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); - void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/AWPMD/pair_awpmd_cut.h b/src/AWPMD/pair_awpmd_cut.h index 9fb906bfd0..203552dcab 100644 --- a/src/AWPMD/pair_awpmd_cut.h +++ b/src/AWPMD/pair_awpmd_cut.h @@ -34,22 +34,22 @@ class PairAWPMDCut : public Pair { public: PairAWPMDCut(class LAMMPS *); - virtual ~PairAWPMDCut(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); + ~PairAWPMDCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; void min_pointers(double **, double **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; - void min_xf_pointers(int, double **, double **); - void min_xf_get(int); - void min_x_set(int); - double memory_usage(); + void min_xf_pointers(int, double **, double **) override; + void min_xf_get(int) override; + void min_x_set(int) override; + double memory_usage() override; private: int flexible_pressure_flag; diff --git a/src/BOCS/compute_pressure_bocs.cpp b/src/BOCS/compute_pressure_bocs.cpp index 8d891006b2..19b1ef7d99 100644 --- a/src/BOCS/compute_pressure_bocs.cpp +++ b/src/BOCS/compute_pressure_bocs.cpp @@ -233,23 +233,14 @@ double ComputePressureBocs::get_cg_p_corr(double ** grid, int basis_type, double vCG) { int i = find_index(grid[0],vCG); - double correction, deltax = vCG - grid[0][i]; + double deltax = vCG - grid[0][i]; if (basis_type == BASIS_LINEAR_SPLINE) - { - correction = grid[1][i] + (deltax) * - ( grid[1][i+1] - grid[1][i] ) / ( grid[0][i+1] - grid[0][i] ); - } + return grid[1][i] + (deltax) * ( grid[1][i+1] - grid[1][i] ) / ( grid[0][i+1] - grid[0][i] ); else if (basis_type == BASIS_CUBIC_SPLINE) - { - correction = grid[1][i] + (grid[2][i] * deltax) + - (grid[3][i] * pow(deltax,2)) + (grid[4][i] * pow(deltax,3)); - } - else - { - error->all(FLERR,"bad spline type passed to get_cg_p_corr()\n"); - } - return correction; + return grid[1][i] + (grid[2][i] * deltax) + (grid[3][i] * pow(deltax,2)) + (grid[4][i] * pow(deltax,3)); + else error->all(FLERR,"bad spline type passed to get_cg_p_corr()\n"); + return 0.0; } /* ---------------------------------------------------------------------- @@ -261,11 +252,8 @@ void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis, double *sent_phi_coeff, int sent_N_mol, double sent_vavg) { - if (basis_type == BASIS_ANALYTIC) { p_basis_type = BASIS_ANALYTIC; } - else - { - error->all(FLERR,"Incorrect basis type passed to ComputePressureBocs\n"); - } + if (basis_type == BASIS_ANALYTIC) p_basis_type = BASIS_ANALYTIC; + else error->all(FLERR,"Incorrect basis type passed to ComputePressureBocs\n"); p_match_flag = 1; diff --git a/src/BOCS/compute_pressure_bocs.h b/src/BOCS/compute_pressure_bocs.h index ccae6ce0e3..d44127ca50 100644 --- a/src/BOCS/compute_pressure_bocs.h +++ b/src/BOCS/compute_pressure_bocs.h @@ -38,11 +38,11 @@ const int NUM_CUBIC_SPLINE_COLUMNS = 5; // cubic spline columns passed to co class ComputePressureBocs : public Compute { public: ComputePressureBocs(class LAMMPS *, int, char **); - virtual ~ComputePressureBocs(); - virtual void init(); - virtual double compute_scalar(); - virtual void compute_vector(); - void reset_extra_compute_fix(const char *); + ~ComputePressureBocs() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; + void reset_extra_compute_fix(const char *) override; double compute_cg_scalar(); double get_cg_p_corr(int, double *, int, double, double); diff --git a/src/BOCS/fix_bocs.h b/src/BOCS/fix_bocs.h index 69b32d4cd0..ee5c70e432 100644 --- a/src/BOCS/fix_bocs.h +++ b/src/BOCS/fix_bocs.h @@ -30,26 +30,26 @@ namespace LAMMPS_NS { class FixBocs : public Fix { public: FixBocs(class LAMMPS *, int, char **); // MRD NJD - virtual ~FixBocs(); // MRD NJD - int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void pre_force_respa(int, int, int); - void final_integrate_respa(int, int); - virtual void pre_exchange(); - double compute_scalar(); - virtual double compute_vector(int); - void write_restart(FILE *); + ~FixBocs() override; // MRD NJD + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void pre_force_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void pre_exchange() override; + double compute_scalar() override; + double compute_vector(int) override; + void write_restart(FILE *) override; virtual int pack_restart_data(double *); // pack restart data - virtual void restart(char *); - int modify_param(int, char **); - void reset_target(double); - void reset_dt(); - virtual void *extract(const char *, int &); - double memory_usage(); + void restart(char *) override; + int modify_param(int, char **) override; + void reset_target(double) override; + void reset_dt() override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int dimension, which; diff --git a/src/BODY/body_nparticle.h b/src/BODY/body_nparticle.h index 0c4c590673..24db6a68bb 100644 --- a/src/BODY/body_nparticle.h +++ b/src/BODY/body_nparticle.h @@ -28,21 +28,21 @@ namespace LAMMPS_NS { class BodyNparticle : public Body { public: BodyNparticle(class LAMMPS *, int, char **); - ~BodyNparticle(); + ~BodyNparticle() override; int nsub(struct AtomVecBody::Bonus *); double *coords(struct AtomVecBody::Bonus *); - int pack_border_body(struct AtomVecBody::Bonus *, double *); - int unpack_border_body(struct AtomVecBody::Bonus *, double *); - void data_body(int, int, int, int *, double *); - int pack_data_body(tagint, int, double *); - int write_data_body(FILE *, double *); - double radius_body(int, int, int *, double *); + int pack_border_body(struct AtomVecBody::Bonus *, double *) override; + int unpack_border_body(struct AtomVecBody::Bonus *, double *) override; + void data_body(int, int, int, int *, double *) override; + int pack_data_body(tagint, int, double *) override; + int write_data_body(FILE *, double *) override; + double radius_body(int, int, int *, double *) override; - int noutrow(int); - int noutcol(); - void output(int, int, double *); - int image(int, double, double, int *&, double **&); + int noutrow(int) override; + int noutcol() override; + void output(int, int, double *) override; + int image(int, double, double, int *&, double **&) override; private: int *imflag; diff --git a/src/BODY/body_rounded_polygon.h b/src/BODY/body_rounded_polygon.h index b76a0afaff..284965c466 100644 --- a/src/BODY/body_rounded_polygon.h +++ b/src/BODY/body_rounded_polygon.h @@ -28,7 +28,7 @@ namespace LAMMPS_NS { class BodyRoundedPolygon : public Body { public: BodyRoundedPolygon(class LAMMPS *, int, char **); - ~BodyRoundedPolygon(); + ~BodyRoundedPolygon() override; int nsub(struct AtomVecBody::Bonus *); double *coords(struct AtomVecBody::Bonus *); int nedges(struct AtomVecBody::Bonus *); @@ -36,17 +36,17 @@ class BodyRoundedPolygon : public Body { double enclosing_radius(struct AtomVecBody::Bonus *); double rounded_radius(struct AtomVecBody::Bonus *); - int pack_border_body(struct AtomVecBody::Bonus *, double *); - int unpack_border_body(struct AtomVecBody::Bonus *, double *); - void data_body(int, int, int, int *, double *); - int pack_data_body(tagint, int, double *); - int write_data_body(FILE *, double *); - double radius_body(int, int, int *, double *); + int pack_border_body(struct AtomVecBody::Bonus *, double *) override; + int unpack_border_body(struct AtomVecBody::Bonus *, double *) override; + void data_body(int, int, int, int *, double *) override; + int pack_data_body(tagint, int, double *) override; + int write_data_body(FILE *, double *) override; + double radius_body(int, int, int *, double *) override; - int noutrow(int); - int noutcol(); - void output(int, int, double *); - int image(int, double, double, int *&, double **&); + int noutrow(int) override; + int noutcol() override; + void output(int, int, double *) override; + int image(int, double, double, int *&, double **&) override; private: int *imflag; diff --git a/src/BODY/body_rounded_polyhedron.h b/src/BODY/body_rounded_polyhedron.h index 47c0943299..56392391fa 100644 --- a/src/BODY/body_rounded_polyhedron.h +++ b/src/BODY/body_rounded_polyhedron.h @@ -28,7 +28,7 @@ namespace LAMMPS_NS { class BodyRoundedPolyhedron : public Body { public: BodyRoundedPolyhedron(class LAMMPS *, int, char **); - ~BodyRoundedPolyhedron(); + ~BodyRoundedPolyhedron() override; int nsub(struct AtomVecBody::Bonus *); double *coords(struct AtomVecBody::Bonus *); int nedges(struct AtomVecBody::Bonus *); @@ -38,17 +38,17 @@ class BodyRoundedPolyhedron : public Body { double enclosing_radius(struct AtomVecBody::Bonus *); double rounded_radius(struct AtomVecBody::Bonus *); - int pack_border_body(struct AtomVecBody::Bonus *, double *); - int unpack_border_body(struct AtomVecBody::Bonus *, double *); - void data_body(int, int, int, int *, double *); - int pack_data_body(tagint, int, double *); - int write_data_body(FILE *, double *); - double radius_body(int, int, int *, double *); + int pack_border_body(struct AtomVecBody::Bonus *, double *) override; + int unpack_border_body(struct AtomVecBody::Bonus *, double *) override; + void data_body(int, int, int, int *, double *) override; + int pack_data_body(tagint, int, double *) override; + int write_data_body(FILE *, double *) override; + double radius_body(int, int, int *, double *) override; - int noutrow(int); - int noutcol(); - void output(int, int, double *); - int image(int, double, double, int *&, double **&); + int noutrow(int) override; + int noutcol() override; + void output(int, int, double *) override; + int image(int, double, double, int *&, double **&) override; private: int *imflag; diff --git a/src/BODY/compute_body_local.h b/src/BODY/compute_body_local.h index b0016aebaf..824d562637 100644 --- a/src/BODY/compute_body_local.h +++ b/src/BODY/compute_body_local.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeBodyLocal : public Compute { public: ComputeBodyLocal(class LAMMPS *, int, char **); - ~ComputeBodyLocal(); - void init(); - void compute_local(); - double memory_usage(); + ~ComputeBodyLocal() override; + void init() override; + void compute_local() override; + double memory_usage() override; private: int nvalues; diff --git a/src/BODY/compute_temp_body.h b/src/BODY/compute_temp_body.h index 19115ad209..5e6275ae12 100644 --- a/src/BODY/compute_temp_body.h +++ b/src/BODY/compute_temp_body.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class ComputeTempBody : public Compute { public: ComputeTempBody(class LAMMPS *, int, char **); - ~ComputeTempBody(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempBody() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void restore_bias(int, double *); + void remove_bias(int, double *) override; + void restore_bias(int, double *) override; private: int mode; diff --git a/src/BODY/fix_nh_body.h b/src/BODY/fix_nh_body.h index f5fb545e05..899a12c3d6 100644 --- a/src/BODY/fix_nh_body.h +++ b/src/BODY/fix_nh_body.h @@ -21,16 +21,15 @@ namespace LAMMPS_NS { class FixNHBody : public FixNH { public: FixNHBody(class LAMMPS *, int, char **); - virtual ~FixNHBody() {} - void init(); + void init() override; protected: double dtq; class AtomVecBody *avec; - void nve_v(); - void nve_x(); - void nh_v_temp(); + void nve_v() override; + void nve_x() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/BODY/fix_nph_body.h b/src/BODY/fix_nph_body.h index da59bd93e2..38247e93cb 100644 --- a/src/BODY/fix_nph_body.h +++ b/src/BODY/fix_nph_body.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHBody : public FixNHBody { public: FixNPHBody(class LAMMPS *, int, char **); - ~FixNPHBody() {} }; } // namespace LAMMPS_NS diff --git a/src/BODY/fix_npt_body.h b/src/BODY/fix_npt_body.h index e5d6b44da6..5fe0c45994 100644 --- a/src/BODY/fix_npt_body.h +++ b/src/BODY/fix_npt_body.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTBody : public FixNHBody { public: FixNPTBody(class LAMMPS *, int, char **); - ~FixNPTBody() {} }; } // namespace LAMMPS_NS diff --git a/src/BODY/fix_nve_body.h b/src/BODY/fix_nve_body.h index 504a86e0d0..c0ea6d8f7d 100644 --- a/src/BODY/fix_nve_body.h +++ b/src/BODY/fix_nve_body.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixNVEBody : public FixNVE { public: FixNVEBody(class LAMMPS *, int, char **); - void init(); - void initial_integrate(int); - void final_integrate(); + void init() override; + void initial_integrate(int) override; + void final_integrate() override; private: double dtq; diff --git a/src/BODY/fix_nvt_body.h b/src/BODY/fix_nvt_body.h index e5fef9d30d..19a75dfd2a 100644 --- a/src/BODY/fix_nvt_body.h +++ b/src/BODY/fix_nvt_body.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTBody : public FixNHBody { public: FixNVTBody(class LAMMPS *, int, char **); - ~FixNVTBody() {} }; } // namespace LAMMPS_NS diff --git a/src/BODY/fix_wall_body_polygon.h b/src/BODY/fix_wall_body_polygon.h index 7da2655c9c..caf57b45bf 100644 --- a/src/BODY/fix_wall_body_polygon.h +++ b/src/BODY/fix_wall_body_polygon.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixWallBodyPolygon : public Fix { public: FixWallBodyPolygon(class LAMMPS *, int, char **); - virtual ~FixWallBodyPolygon(); - int setmask(); - void init(); - void setup(int); - virtual void post_force(int); - void reset_dt(); + ~FixWallBodyPolygon() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void reset_dt() override; struct Contact { int ibody, jbody; // body (i.e. atom) indices (not tags) diff --git a/src/BODY/fix_wall_body_polyhedron.h b/src/BODY/fix_wall_body_polyhedron.h index 54c290b255..c931f963d2 100644 --- a/src/BODY/fix_wall_body_polyhedron.h +++ b/src/BODY/fix_wall_body_polyhedron.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixWallBodyPolyhedron : public Fix { public: FixWallBodyPolyhedron(class LAMMPS *, int, char **); - virtual ~FixWallBodyPolyhedron(); - int setmask(); - void init(); - void setup(int); - virtual void post_force(int); - void reset_dt(); + ~FixWallBodyPolyhedron() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void reset_dt() override; struct Contact { int ibody, jbody; // body (i.e. atom) indices (not tags) diff --git a/src/BODY/pair_body_nparticle.h b/src/BODY/pair_body_nparticle.h index dad44a38e3..1f3d706201 100644 --- a/src/BODY/pair_body_nparticle.h +++ b/src/BODY/pair_body_nparticle.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairBodyNparticle : public Pair { public: PairBodyNparticle(class LAMMPS *); - ~PairBodyNparticle(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairBodyNparticle() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: double cut_global; diff --git a/src/BODY/pair_body_rounded_polygon.h b/src/BODY/pair_body_rounded_polygon.h index b5a9d7969e..adce835f20 100644 --- a/src/BODY/pair_body_rounded_polygon.h +++ b/src/BODY/pair_body_rounded_polygon.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairBodyRoundedPolygon : public Pair { public: PairBodyRoundedPolygon(class LAMMPS *); - ~PairBodyRoundedPolygon(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairBodyRoundedPolygon() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct Contact { int ibody, jbody; // body (i.e. atom) indices (not tags) diff --git a/src/BODY/pair_body_rounded_polyhedron.h b/src/BODY/pair_body_rounded_polyhedron.h index 4cc225a296..457583b9b1 100644 --- a/src/BODY/pair_body_rounded_polyhedron.h +++ b/src/BODY/pair_body_rounded_polyhedron.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairBodyRoundedPolyhedron : public Pair { public: PairBodyRoundedPolyhedron(class LAMMPS *); - ~PairBodyRoundedPolyhedron(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairBodyRoundedPolyhedron() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; virtual void kernel_force(double R, int itype, int jtype, double &energy, double &fpair); diff --git a/src/BPM/atom_vec_sphere_bpm.h b/src/BPM/atom_vec_sphere_bpm.h index 3a84e3999e..2a8aa36d32 100644 --- a/src/BPM/atom_vec_sphere_bpm.h +++ b/src/BPM/atom_vec_sphere_bpm.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class AtomVecSphereBPM : public AtomVec { public: AtomVecSphereBPM(class LAMMPS *); - void process_args(int, char **); - void init(); + void process_args(int, char **) override; + void init() override; - void grow_pointers(); - void create_atom_post(int); - void pack_restart_pre(int); - void pack_restart_post(int); - void unpack_restart_init(int); - void data_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); + void grow_pointers() override; + void create_atom_post(int) override; + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; private: diff --git a/src/BPM/bond_bpm.h b/src/BPM/bond_bpm.h index 8dbab8c683..05dc96e161 100644 --- a/src/BPM/bond_bpm.h +++ b/src/BPM/bond_bpm.h @@ -23,16 +23,16 @@ namespace LAMMPS_NS { class BondBPM : public Bond { public: BondBPM(class LAMMPS *); - virtual ~BondBPM(); - virtual void compute(int, int) = 0; - virtual void coeff(int, char **) = 0; - virtual void init_style(); - void settings(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *){}; - void read_restart(FILE *){}; - void write_data(FILE *) {}; - double single(int, double, int, int, double &) = 0; + virtual ~BondBPM() override; + virtual void compute(int, int) override = 0; + virtual void coeff(int, char **) override = 0; + virtual void init_style() override; + void settings(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override {}; + void read_restart(FILE *) override {}; + void write_data(FILE *) override {}; + double single(int, double, int, int, double &) override = 0; protected: double r0_max_estimate; diff --git a/src/BPM/bond_bpm_rotational.h b/src/BPM/bond_bpm_rotational.h index 150c7444bd..d4dafbe9b4 100644 --- a/src/BPM/bond_bpm_rotational.h +++ b/src/BPM/bond_bpm_rotational.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondBPMRotational : public BondBPM { public: BondBPMRotational(class LAMMPS *); - virtual ~BondBPMRotational(); - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - void settings(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + virtual ~BondBPMRotational() override; + virtual void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void settings(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist; diff --git a/src/BPM/bond_bpm_spring.h b/src/BPM/bond_bpm_spring.h index a81f49e81a..385ee38da3 100644 --- a/src/BPM/bond_bpm_spring.h +++ b/src/BPM/bond_bpm_spring.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondBPMSpring : public BondBPM { public: BondBPMSpring(class LAMMPS *); - virtual ~BondBPMSpring(); - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - void settings(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + virtual ~BondBPMSpring() override; + virtual void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void settings(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *k, *ecrit, *gamma; diff --git a/src/BPM/compute_nbond_atom.h b/src/BPM/compute_nbond_atom.h index 3f92ef99c8..fcca25db11 100644 --- a/src/BPM/compute_nbond_atom.h +++ b/src/BPM/compute_nbond_atom.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeNBondAtom : public Compute { public: ComputeNBondAtom(class LAMMPS *, int, char **); - ~ComputeNBondAtom(); - void init() {} - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeNBondAtom() override; + void init() override {} + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int nmax; diff --git a/src/BPM/fix_nve_sphere_bpm.h b/src/BPM/fix_nve_sphere_bpm.h index 8e4d89ad67..ee6f1b452c 100644 --- a/src/BPM/fix_nve_sphere_bpm.h +++ b/src/BPM/fix_nve_sphere_bpm.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixNVESphereBPM : public FixNVE { public: FixNVESphereBPM(class LAMMPS *, int, char **); - virtual ~FixNVESphereBPM() {} - void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); + + void init() override; + void initial_integrate(int) override; + void final_integrate() override; protected: double inertia, inv_inertia; diff --git a/src/BPM/pair_bpm_spring.h b/src/BPM/pair_bpm_spring.h index da1d887cf6..44a93dec21 100644 --- a/src/BPM/pair_bpm_spring.h +++ b/src/BPM/pair_bpm_spring.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PairBPMSpring : public Pair { public: PairBPMSpring(class LAMMPS *); - virtual ~PairBPMSpring(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + virtual ~PairBPMSpring() override; + virtual void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double **k,**cut,**gamma; diff --git a/src/BROWNIAN/fix_brownian.h b/src/BROWNIAN/fix_brownian.h index 5847c1e8dc..f9f4ab9cd1 100644 --- a/src/BROWNIAN/fix_brownian.h +++ b/src/BROWNIAN/fix_brownian.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixBrownian : public FixBrownianBase { public: FixBrownian(class LAMMPS *, int, char **); - virtual ~FixBrownian(){}; - void init(); - void initial_integrate(int); + + void init() override; + void initial_integrate(int) override; private: template void initial_integrate_templated(); diff --git a/src/BROWNIAN/fix_brownian_asphere.h b/src/BROWNIAN/fix_brownian_asphere.h index b40f797dd3..f20b80a5be 100644 --- a/src/BROWNIAN/fix_brownian_asphere.h +++ b/src/BROWNIAN/fix_brownian_asphere.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixBrownianAsphere : public FixBrownianBase { public: FixBrownianAsphere(class LAMMPS *, int, char **); - virtual ~FixBrownianAsphere(){}; - void initial_integrate(int); - void init(); + + void initial_integrate(int) override; + void init() override; protected: class AtomVecEllipsoid *avec; diff --git a/src/BROWNIAN/fix_brownian_base.h b/src/BROWNIAN/fix_brownian_base.h index c13fc71a84..f26fc301b0 100644 --- a/src/BROWNIAN/fix_brownian_base.h +++ b/src/BROWNIAN/fix_brownian_base.h @@ -21,10 +21,10 @@ namespace LAMMPS_NS { class FixBrownianBase : public Fix { public: FixBrownianBase(class LAMMPS *, int, char **); - virtual ~FixBrownianBase(); - void init(); - int setmask(); - void reset_dt(); + ~FixBrownianBase() override; + void init() override; + int setmask() override; + void reset_dt() override; protected: int seed; // RNG seed diff --git a/src/BROWNIAN/fix_brownian_sphere.h b/src/BROWNIAN/fix_brownian_sphere.h index 73befb07f5..8f2e2de568 100644 --- a/src/BROWNIAN/fix_brownian_sphere.h +++ b/src/BROWNIAN/fix_brownian_sphere.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixBrownianSphere : public FixBrownianBase { public: FixBrownianSphere(class LAMMPS *, int, char **); - virtual ~FixBrownianSphere(){}; - void init(); - void initial_integrate(int); + + void init() override; + void initial_integrate(int) override; private: template void initial_integrate_templated(); diff --git a/src/BROWNIAN/fix_propel_self.h b/src/BROWNIAN/fix_propel_self.h index 7932e8af99..0b8ee4f4b1 100644 --- a/src/BROWNIAN/fix_propel_self.h +++ b/src/BROWNIAN/fix_propel_self.h @@ -26,11 +26,11 @@ namespace LAMMPS_NS { class FixPropelSelf : public Fix { public: FixPropelSelf(class LAMMPS *, int, char **); - virtual ~FixPropelSelf(){}; - void init(); - void post_force(int); - void setup(int); - int setmask(); + + void init() override; + void post_force(int) override; + void setup(int) override; + int setmask() override; private: double magnitude; diff --git a/src/CG-DNA/atom_vec_oxdna.h b/src/CG-DNA/atom_vec_oxdna.h index c100abdfff..7830aeaf33 100644 --- a/src/CG-DNA/atom_vec_oxdna.h +++ b/src/CG-DNA/atom_vec_oxdna.h @@ -27,11 +27,10 @@ namespace LAMMPS_NS { class AtomVecOxdna : public AtomVec { public: AtomVecOxdna(class LAMMPS *); - ~AtomVecOxdna() = default; - void grow_pointers(); - void data_atom_post(int); - void data_bonds_post(int, int, tagint, tagint, tagint); + void grow_pointers() override; + void data_atom_post(int) override; + void data_bonds_post(int, int, tagint, tagint, tagint) override; private: tagint *id5p; diff --git a/src/CG-DNA/bond_oxdna2_fene.h b/src/CG-DNA/bond_oxdna2_fene.h index 6c932f9421..3b0c5e0a36 100644 --- a/src/CG-DNA/bond_oxdna2_fene.h +++ b/src/CG-DNA/bond_oxdna2_fene.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class BondOxdna2Fene : public BondOxdnaFene { public: BondOxdna2Fene(class LAMMPS *lmp) : BondOxdnaFene(lmp) {} - virtual ~BondOxdna2Fene() {} - virtual void compute_interaction_sites(double *, double *, double *, double *) const; + void compute_interaction_sites(double *, double *, double *, double *) const override; }; } // namespace LAMMPS_NS diff --git a/src/CG-DNA/bond_oxdna_fene.cpp b/src/CG-DNA/bond_oxdna_fene.cpp index 6b720f6a7f..58b127c63c 100644 --- a/src/CG-DNA/bond_oxdna_fene.cpp +++ b/src/CG-DNA/bond_oxdna_fene.cpp @@ -24,8 +24,8 @@ #include "neighbor.h" #include "update.h" -#include "atom_vec_ellipsoid.h" #include "math_extra.h" +#include "pair.h" #include @@ -145,25 +145,21 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, doub ------------------------------------------------------------------------- */ void BondOxdnaFene::compute(int eflag, int vflag) { - int a, b, in, type; - double delf[3], delta[3], deltb[3]; // force, torque increment;; - double delr[3], ebond, fbond; - double rsq, Deltasq, rlogarg; - double r, rr0, rr0sq; + int a,b,in,type; + double delf[3],delta[3],deltb[3]; // force, torque increment;; + double delr[3],ebond,fbond; + double rsq,Deltasq,rlogarg; + double r,rr0,rr0sq; // vectors COM-backbone site in lab frame - double ra_cs[3], rb_cs[3]; - - double *qa, ax[3], ay[3], az[3]; - double *qb, bx[3], by[3], bz[3]; + double ra_cs[3],rb_cs[3]; + // Cartesian unit vectors in lab frame + double ax[3],ay[3],az[3]; + double bx[3],by[3],bz[3]; double **x = atom->x; double **f = atom->f; double **torque = atom->torque; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int **bondlist = neighbor->bondlist; int nbondlist = neighbor->nbondlist; int nlocal = atom->nlocal; @@ -172,6 +168,12 @@ void BondOxdnaFene::compute(int eflag, int vflag) ebond = 0.0; ev_init(eflag, vflag); + // n(x/y/z)_xtrct = extracted local unit vectors in lab frame from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over FENE bonds for (in = 0; in < nbondlist; in++) { @@ -180,10 +182,24 @@ void BondOxdnaFene::compute(int eflag, int vflag) b = bondlist[in][0]; type = bondlist[in][2]; - qa = bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa, ax, ay, az); - qb = bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb, bx, by, bz); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; + ay[0] = ny_xtrct[a][0]; + ay[1] = ny_xtrct[a][1]; + ay[2] = ny_xtrct[a][2]; + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; + by[0] = ny_xtrct[b][0]; + by[1] = ny_xtrct[b][1]; + by[2] = ny_xtrct[b][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; // vector COM-backbone site a and b compute_interaction_sites(ax, ay, az, ra_cs); diff --git a/src/CG-DNA/bond_oxdna_fene.h b/src/CG-DNA/bond_oxdna_fene.h index 42b542a6fb..d2aa84612a 100644 --- a/src/CG-DNA/bond_oxdna_fene.h +++ b/src/CG-DNA/bond_oxdna_fene.h @@ -27,19 +27,20 @@ namespace LAMMPS_NS { class BondOxdnaFene : public Bond { public: BondOxdnaFene(class LAMMPS *lmp) : Bond(lmp) {} - virtual ~BondOxdnaFene(); + ~BondOxdnaFene() override; virtual void compute_interaction_sites(double *, double *, double *, double *) const; - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *k, *Delta, *r0; // FENE + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors void allocate(); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double); diff --git a/src/CG-DNA/bond_oxrna2_fene.h b/src/CG-DNA/bond_oxrna2_fene.h index a805cd005f..4260b69174 100644 --- a/src/CG-DNA/bond_oxrna2_fene.h +++ b/src/CG-DNA/bond_oxrna2_fene.h @@ -27,9 +27,8 @@ namespace LAMMPS_NS { class BondOxrna2Fene : public BondOxdnaFene { public: BondOxrna2Fene(class LAMMPS *lmp) : BondOxdnaFene(lmp) {} - virtual ~BondOxrna2Fene() {} - virtual void compute_interaction_sites(double *, double *, double *, double *) const; + void compute_interaction_sites(double *, double *, double *, double *) const override; }; } // namespace LAMMPS_NS diff --git a/src/CG-DNA/fix_nve_dot.h b/src/CG-DNA/fix_nve_dot.h index 1f02536f51..baebaece22 100644 --- a/src/CG-DNA/fix_nve_dot.h +++ b/src/CG-DNA/fix_nve_dot.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixNVEDot : public FixNVE { public: FixNVEDot(class LAMMPS *, int, char **); - void init(); - void initial_integrate(int); - void final_integrate(); + void init() override; + void initial_integrate(int) override; + void final_integrate() override; private: double dt, dthlf, dthlfm; diff --git a/src/CG-DNA/fix_nve_dotc_langevin.h b/src/CG-DNA/fix_nve_dotc_langevin.h index 018db64c13..9353ae75b9 100644 --- a/src/CG-DNA/fix_nve_dotc_langevin.h +++ b/src/CG-DNA/fix_nve_dotc_langevin.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixNVEDotcLangevin : public FixNVE { public: FixNVEDotcLangevin(class LAMMPS *, int, char **); - virtual ~FixNVEDotcLangevin(); - void init(); - void initial_integrate(int); - void final_integrate(); + ~FixNVEDotcLangevin() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; private: double dt, dthlf, dthlfm, dtqrt; diff --git a/src/CG-DNA/pair_oxdna2_coaxstk.cpp b/src/CG-DNA/pair_oxdna2_coaxstk.cpp index e8ab197be1..1e53104003 100644 --- a/src/CG-DNA/pair_oxdna2_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna2_coaxstk.cpp @@ -18,7 +18,6 @@ #include "pair_oxdna2_coaxstk.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -102,7 +101,7 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) { double delf[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair,factor_lj; + double evdwl,finc,tpair,factor_lj; double v1tmp[3]; double delr_ss[3],delr_ss_norm[3],rsq_ss,r_ss,rinv_ss; double delr_st[3],delr_st_norm[3],rsq_st,r_st,rinv_st; @@ -118,9 +117,9 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) double ra_cs[3],ra_cst[3]; double rb_cs[3],rb_cst[3]; - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -132,10 +131,6 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) int *alist,*blist,*numneigh,**firstneigh; double *special_lj = force->special_lj; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,ia,ib,anum,bnum,atype,btype; double f2,f4f6t1,f4t4,f4t5,f4t6; @@ -149,6 +144,11 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // n(x/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -156,8 +156,9 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; // vector COM a - stacking site a ra_cst[0] = d_cst*ax[0]; @@ -180,8 +181,9 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; // vector COM b - stacking site b rb_cst[0] = d_cst*bx[0]; @@ -232,6 +234,13 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) // early rejection criterium if (f4f6t1) { + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; + cost4 = MathExtra::dot3(az,bz); if (cost4 > 1.0) cost4 = 1.0; if (cost4 < -1.0) cost4 = -1.0; @@ -306,9 +315,7 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) DF4(theta6p, a_cxst6[atype][btype], theta_cxst6_0[atype][btype], dtheta_cxst6_ast[atype][btype], b_cxst6[atype][btype], dtheta_cxst6_c[atype][btype])*rsint; - // force, torque and virial contribution for forces between stacking sites - - fpair = 0.0; + // force, torque and virial contribution for forces between stacking sites delf[0] = 0.0; delf[1] = 0.0; @@ -324,7 +331,6 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) // radial force finc = -df2 * f4f6t1 * f4t4 * f4t5 * f4t6 * rinv_st * factor_lj; - fpair += finc; delf[0] += delr_st[0] * finc; delf[1] += delr_st[1] * finc; @@ -334,7 +340,6 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) if (theta5 && theta5p) { finc = -f2 * f4f6t1 * f4t4 * df4t5 * f4t6 * rinv_st * factor_lj; - fpair += finc; delf[0] += (delr_st_norm[0]*cost5 - az[0]) * finc; delf[1] += (delr_st_norm[1]*cost5 - az[1]) * finc; @@ -346,7 +351,6 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) if (theta6 && theta6p) { finc = -f2 * f4f6t1* f4t4 * f4t5 * df4t6 * rinv_st * factor_lj; - fpair += finc; delf[0] += (delr_st_norm[0]*cost6 - bz[0]) * finc; delf[1] += (delr_st_norm[1]*cost6 - bz[1]) * finc; diff --git a/src/CG-DNA/pair_oxdna2_coaxstk.h b/src/CG-DNA/pair_oxdna2_coaxstk.h index 2a323be579..6bf763a1fe 100644 --- a/src/CG-DNA/pair_oxdna2_coaxstk.h +++ b/src/CG-DNA/pair_oxdna2_coaxstk.h @@ -27,39 +27,35 @@ namespace LAMMPS_NS { class PairOxdna2Coaxstk : public Pair { public: PairOxdna2Coaxstk(class LAMMPS *); - virtual ~PairOxdna2Coaxstk(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxdna2Coaxstk() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // coaxial stacking interaction double **k_cxst, **cut_cxst_0, **cut_cxst_c, **cut_cxst_lo, **cut_cxst_hi; double **cut_cxst_lc, **cut_cxst_hc, **b_cxst_lo, **b_cxst_hi; double **cutsq_cxst_hc; - double **a_cxst1, **theta_cxst1_0, **dtheta_cxst1_ast; double **b_cxst1, **dtheta_cxst1_c; - double **a_cxst4, **theta_cxst4_0, **dtheta_cxst4_ast; double **b_cxst4, **dtheta_cxst4_c; - double **a_cxst5, **theta_cxst5_0, **dtheta_cxst5_ast; double **b_cxst5, **dtheta_cxst5_c; - double **a_cxst6, **theta_cxst6_0, **dtheta_cxst6_ast; double **b_cxst6, **dtheta_cxst6_c; - double **AA_cxst1, **BB_cxst1; + double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; diff --git a/src/CG-DNA/pair_oxdna2_dh.cpp b/src/CG-DNA/pair_oxdna2_dh.cpp index 1a587e82e1..19b158ea61 100644 --- a/src/CG-DNA/pair_oxdna2_dh.cpp +++ b/src/CG-DNA/pair_oxdna2_dh.cpp @@ -18,7 +18,6 @@ #include "pair_oxdna2_dh.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -87,10 +86,9 @@ void PairOxdna2Dh::compute(int eflag, int vflag) // vectors COM-backbone sites in lab frame double ra_cs[3],rb_cs[3]; - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; - double *special_lj = force->special_lj; + // Cartesian unit vectors in lab frame + double ax[3],ay[3],az[3]; + double bx[3],by[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -100,10 +98,7 @@ void PairOxdna2Dh::compute(int eflag, int vflag) int nlocal = atom->nlocal; int newton_pair = force->newton_pair; int *alist,*blist,*numneigh,**firstneigh; - - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; + double *special_lj = force->special_lj; int a,b,ia,ib,anum,bnum,atype,btype; @@ -115,6 +110,12 @@ void PairOxdna2Dh::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // n(x/y/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -122,8 +123,15 @@ void PairOxdna2Dh::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; + ay[0] = ny_xtrct[a][0]; + ay[1] = ny_xtrct[a][1]; + ay[2] = ny_xtrct[a][2]; + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; // vector COM-backbone site a compute_interaction_sites(ax,ay,az,ra_cs); @@ -142,8 +150,15 @@ void PairOxdna2Dh::compute(int eflag, int vflag) b &= NEIGHMASK; btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; + by[0] = ny_xtrct[b][0]; + by[1] = ny_xtrct[b][1]; + by[2] = ny_xtrct[b][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; // vector COM-backbone site b compute_interaction_sites(bx,by,bz,rb_cs); diff --git a/src/CG-DNA/pair_oxdna2_dh.h b/src/CG-DNA/pair_oxdna2_dh.h index 925b53e322..db37ba0d43 100644 --- a/src/CG-DNA/pair_oxdna2_dh.h +++ b/src/CG-DNA/pair_oxdna2_dh.h @@ -27,24 +27,25 @@ namespace LAMMPS_NS { class PairOxdna2Dh : public Pair { public: PairOxdna2Dh(class LAMMPS *); - virtual ~PairOxdna2Dh(); + ~PairOxdna2Dh() override; virtual void compute_interaction_sites(double *, double *, double *, double *); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: double **qeff_dh_pf, **kappa_dh; double **b_dh, **cut_dh_ast, **cutsq_dh_ast, **cut_dh_c, **cutsq_dh_c; + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; diff --git a/src/CG-DNA/pair_oxdna2_excv.h b/src/CG-DNA/pair_oxdna2_excv.h index 0fc51406ad..6c37ed9dc8 100644 --- a/src/CG-DNA/pair_oxdna2_excv.h +++ b/src/CG-DNA/pair_oxdna2_excv.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairOxdna2Excv : public PairOxdnaExcv { public: PairOxdna2Excv(class LAMMPS *lmp) : PairOxdnaExcv(lmp) {} - virtual ~PairOxdna2Excv() {} - virtual void compute_interaction_sites(double *, double *, double *, double *, double *); + + void compute_interaction_sites(double *, double *, double *, double *, double *) override; }; } // namespace LAMMPS_NS diff --git a/src/CG-DNA/pair_oxdna_coaxstk.cpp b/src/CG-DNA/pair_oxdna_coaxstk.cpp index 2715b7c5e2..1976de0f62 100644 --- a/src/CG-DNA/pair_oxdna_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna_coaxstk.cpp @@ -18,7 +18,6 @@ #include "pair_oxdna_coaxstk.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -106,9 +105,8 @@ PairOxdnaCoaxstk::~PairOxdnaCoaxstk() void PairOxdnaCoaxstk::compute(int eflag, int vflag) { - double delf[3],delt[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair,factor_lj; + double evdwl,finc,tpair,factor_lj; double v1tmp[3],v2tmp[3],v3tmp[3]; double delr_ss[3],delr_ss_norm[3],rsq_ss,r_ss,rinv_ss; double delr_st[3],delr_st_norm[3],rsq_st,r_st,rinv_st; @@ -129,10 +127,9 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) // vectors COM-backbone site, COM-stacking site in lab frame double ra_cs[3],ra_cst[3]; double rb_cs[3],rb_cst[3]; - - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],ay[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -144,10 +141,6 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) int *alist,*blist,*numneigh,**firstneigh; double *special_lj = force->special_lj; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,ia,ib,anum,bnum,atype,btype; double f2,f4t1,f4t4,f4t5,f4t6,f5c3; @@ -161,6 +154,12 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // n(x/y/z)_xtrct = extracted local unit vectors in lab frame from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -168,8 +167,10 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; + // a(y/z) not needed here as oxDNA(1) co-linear // vector COM a - stacking site a ra_cst[0] = d_cst*ax[0]; @@ -192,8 +193,10 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; + // b(y/z) not needed here as oxDNA(1) co-linear // vector COM b - stacking site b rb_cst[0] = d_cst*bx[0]; @@ -245,6 +248,13 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) // early rejection criterium if (f4t1) { + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; + cost4 = MathExtra::dot3(az,bz); if (cost4 > 1.0) cost4 = 1.0; if (cost4 < -1.0) cost4 = -1.0; @@ -330,8 +340,6 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between stacking sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -346,7 +354,6 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) // radial force finc = -df2 * f4t1 * f4t4 * f4t5 * f4t6 * f5c3 * f5c3 * rinv_st * factor_lj; - fpair += finc; delf[0] += delr_st[0] * finc; delf[1] += delr_st[1] * finc; @@ -356,7 +363,6 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) if (theta5 && theta5p) { finc = -f2 * f4t1 * f4t4 * df4t5 * f4t6 * f5c3 * f5c3 * rinv_st * factor_lj; - fpair += finc; delf[0] += (delr_st_norm[0]*cost5 - az[0]) * finc; delf[1] += (delr_st_norm[1]*cost5 - az[1]) * finc; @@ -368,7 +374,6 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) if (theta6 && theta6p) { finc = -f2 * f4t1* f4t4 * f4t5 * df4t6 * f5c3 * f5c3 * rinv_st * factor_lj; - fpair += finc; delf[0] += (delr_st_norm[0]*cost6 - bz[0]) * finc; delf[1] += (delr_st_norm[1]*cost6 - bz[1]) * finc; @@ -380,8 +385,11 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) // cosphi3 and cosphi4 (=cosphi3) force and virial if (cosphi3) { + ay[0] = ny_xtrct[a][0]; + ay[1] = ny_xtrct[a][1]; + ay[2] = ny_xtrct[a][2]; + finc = -f2 * f4t1* f4t4 * f4t5 * f4t6 * 2.0 * f5c3 * df5c3 * factor_lj; - fpair += finc; gamma = d_cs - d_cst; gammacub = gamma * gamma * gamma; diff --git a/src/CG-DNA/pair_oxdna_coaxstk.h b/src/CG-DNA/pair_oxdna_coaxstk.h index 5771bbe592..62ffb7f2c1 100644 --- a/src/CG-DNA/pair_oxdna_coaxstk.h +++ b/src/CG-DNA/pair_oxdna_coaxstk.h @@ -28,40 +28,36 @@ namespace LAMMPS_NS { class PairOxdnaCoaxstk : public Pair { public: PairOxdnaCoaxstk(class LAMMPS *); - virtual ~PairOxdnaCoaxstk(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxdnaCoaxstk() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // coaxial stacking interaction double **k_cxst, **cut_cxst_0, **cut_cxst_c, **cut_cxst_lo, **cut_cxst_hi; double **cut_cxst_lc, **cut_cxst_hc, **b_cxst_lo, **b_cxst_hi; double **cutsq_cxst_hc; - double **a_cxst1, **theta_cxst1_0, **dtheta_cxst1_ast; double **b_cxst1, **dtheta_cxst1_c; - double **a_cxst4, **theta_cxst4_0, **dtheta_cxst4_ast; double **b_cxst4, **dtheta_cxst4_c; - double **a_cxst5, **theta_cxst5_0, **dtheta_cxst5_ast; double **b_cxst5, **dtheta_cxst5_c; - double **a_cxst6, **theta_cxst6_0, **dtheta_cxst6_ast; double **b_cxst6, **dtheta_cxst6_c; - double **a_cxst3p, **cosphi_cxst3p_ast, **b_cxst3p, **cosphi_cxst3p_c; double **a_cxst4p, **cosphi_cxst4p_ast, **b_cxst4p, **cosphi_cxst4p_c; + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; diff --git a/src/CG-DNA/pair_oxdna_excv.cpp b/src/CG-DNA/pair_oxdna_excv.cpp index d41976e86c..f47f92d63c 100644 --- a/src/CG-DNA/pair_oxdna_excv.cpp +++ b/src/CG-DNA/pair_oxdna_excv.cpp @@ -39,6 +39,9 @@ PairOxdnaExcv::PairOxdnaExcv(LAMMPS *lmp) : Pair(lmp) { single_enable = 0; writedata = 1; + + // set comm size needed by this Pair + comm_forward = 9; } /* ---------------------------------------------------------------------- */ @@ -47,6 +50,10 @@ PairOxdnaExcv::~PairOxdnaExcv() { if (allocated) { + memory->destroy(nx); + memory->destroy(ny); + memory->destroy(nz); + memory->destroy(setflag); memory->destroy(cutsq); @@ -108,7 +115,6 @@ void PairOxdnaExcv::compute_interaction_sites(double e1[3], double /*e2*/[3], void PairOxdnaExcv::compute(int eflag, int vflag) { - double delf[3],delta[3],deltb[3]; // force, torque increment; double evdwl,fpair,factor_lj; double rtmp_s[3],rtmp_b[3]; @@ -118,10 +124,10 @@ void PairOxdnaExcv::compute(int eflag, int vflag) // vectors COM-backbone site, COM-base site in lab frame double ra_cs[3],ra_cb[3]; double rb_cs[3],rb_cb[3]; + // Cartesian unit vectors in lab frame + double ax[3],ay[3],az[3]; + double bx[3],by[3],bz[3]; - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; double *special_lj = force->special_lj; double **x = atom->x; @@ -137,7 +143,7 @@ void PairOxdnaExcv::compute(int eflag, int vflag) AtomVecEllipsoid::Bonus *bonus = avec->bonus; int *ellipsoid = atom->ellipsoid; - int a,b,ia,ib,anum,bnum,atype,btype; + int a,b,in,ia,ib,anum,bnum,atype,btype; evdwl = 0.0; ev_init(eflag,vflag); @@ -147,6 +153,29 @@ void PairOxdnaExcv::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // loop over all local atoms, calculation of local reference frame + for (in = 0; in < atom->nlocal; in++) { + + int n = alist[in]; + double *qn,nx_temp[3],ny_temp[3],nz_temp[3]; // quaternion and Cartesian unit vectors in lab frame + + qn=bonus[ellipsoid[n]].quat; + MathExtra::q_to_exyz(qn,nx_temp,ny_temp,nz_temp); + + nx[n][0] = nx_temp[0]; + nx[n][1] = nx_temp[1]; + nx[n][2] = nx_temp[2]; + ny[n][0] = ny_temp[0]; + ny[n][1] = ny_temp[1]; + ny[n][2] = ny_temp[2]; + nz[n][0] = nz_temp[0]; + nz[n][1] = nz_temp[1]; + nz[n][2] = nz_temp[2]; + + } + + comm->forward_comm_pair(this); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -154,8 +183,15 @@ void PairOxdnaExcv::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx[a][0]; + ax[1] = nx[a][1]; + ax[2] = nx[a][2]; + ay[0] = ny[a][0]; + ay[1] = ny[a][1]; + ay[2] = ny[a][2]; + az[0] = nz[a][0]; + az[1] = nz[a][1]; + az[2] = nz[a][2]; // vector COM - backbone and base site a compute_interaction_sites(ax,ay,az,ra_cs,ra_cb); @@ -179,8 +215,15 @@ void PairOxdnaExcv::compute(int eflag, int vflag) btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx[b][0]; + bx[1] = nx[b][1]; + bx[2] = nx[b][2]; + by[0] = ny[b][0]; + by[1] = ny[b][1]; + by[2] = ny[b][2]; + bz[0] = nz[b][0]; + bz[1] = nz[b][1]; + bz[2] = nz[b][2]; // vector COM - backbone and base site b compute_interaction_sites(bx,by,bz,rb_cs,rb_cb); @@ -400,6 +443,10 @@ void PairOxdnaExcv::allocate() for (int j = i; j <= n; j++) setflag[i][j] = 0; + memory->create(nx,atom->nmax,3,"pair:nx"); + memory->create(ny,atom->nmax,3,"pair:ny"); + memory->create(nz,atom->nmax,3,"pair:nz"); + memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(epsilon_ss,n+1,n+1,"pair:epsilon_ss"); @@ -806,10 +853,58 @@ void PairOxdnaExcv::write_data_all(FILE *fp) /* ---------------------------------------------------------------------- */ +int PairOxdnaExcv::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = nx[j][0]; + buf[m++] = nx[j][1]; + buf[m++] = nx[j][2]; + buf[m++] = ny[j][0]; + buf[m++] = ny[j][1]; + buf[m++] = ny[j][2]; + buf[m++] = nz[j][0]; + buf[m++] = nz[j][1]; + buf[m++] = nz[j][2]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairOxdnaExcv::unpack_forward_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + nx[i][0] = buf[m++]; + nx[i][1] = buf[m++]; + nx[i][2] = buf[m++]; + ny[i][0] = buf[m++]; + ny[i][1] = buf[m++]; + ny[i][2] = buf[m++]; + nz[i][0] = buf[m++]; + nz[i][1] = buf[m++]; + nz[i][2] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + void *PairOxdnaExcv::extract(const char *str, int &dim) { dim = 2; + if (strcmp(str,"nx") == 0) return (void *) nx; + if (strcmp(str,"ny") == 0) return (void *) ny; + if (strcmp(str,"nz") == 0) return (void *) nz; + if (strcmp(str,"epsilon_ss") == 0) return (void *) epsilon_ss; if (strcmp(str,"sigma_ss") == 0) return (void *) sigma_ss; if (strcmp(str,"cut_ss_ast") == 0) return (void *) cut_ss_ast; diff --git a/src/CG-DNA/pair_oxdna_excv.h b/src/CG-DNA/pair_oxdna_excv.h index c3ad6cf37a..a255c954bb 100644 --- a/src/CG-DNA/pair_oxdna_excv.h +++ b/src/CG-DNA/pair_oxdna_excv.h @@ -27,20 +27,22 @@ namespace LAMMPS_NS { class PairOxdnaExcv : public Pair { public: PairOxdnaExcv(class LAMMPS *); - virtual ~PairOxdnaExcv(); + ~PairOxdnaExcv() override; virtual void compute_interaction_sites(double *, double *, double *, double *, double *); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: // s=sugar-phosphate backbone site, b=base site, st=stacking site @@ -52,6 +54,7 @@ class PairOxdnaExcv : public Pair { double **lj1_sb, **lj2_sb, **b_sb, **cut_sb_c, **cutsq_sb_c; double **epsilon_bb, **sigma_bb, **cut_bb_ast, **cutsq_bb_ast; double **lj1_bb, **lj2_bb, **b_bb, **cut_bb_c, **cutsq_bb_c; + double **nx, **ny, **nz; // per-atom arrays for local unit vectors virtual void allocate(); }; diff --git a/src/CG-DNA/pair_oxdna_hbond.cpp b/src/CG-DNA/pair_oxdna_hbond.cpp index 4bf0bc9c56..3f563767c5 100644 --- a/src/CG-DNA/pair_oxdna_hbond.cpp +++ b/src/CG-DNA/pair_oxdna_hbond.cpp @@ -18,7 +18,6 @@ #include "pair_oxdna_hbond.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -135,7 +134,7 @@ void PairOxdnaHbond::compute(int eflag, int vflag) { double delf[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair,factor_lj; + double evdwl,finc,tpair,factor_lj; double delr_hb[3],delr_hb_norm[3],rsq_hb,r_hb,rinv_hb; double theta1,t1dir[3],cost1; double theta2,t2dir[3],cost2; @@ -148,10 +147,9 @@ void PairOxdnaHbond::compute(int eflag, int vflag) double d_chb=+0.4; // vectors COM-h-bonding site in lab frame double ra_chb[3],rb_chb[3]; - - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -163,10 +161,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) int *alist,*blist,*numneigh,**firstneigh; double *special_lj = force->special_lj; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,ia,ib,anum,bnum,atype,btype; double f1,f4t1,f4t4,f4t2,f4t3,f4t7,f4t8; @@ -180,6 +174,12 @@ void PairOxdnaHbond::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // n(x/y/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -187,8 +187,9 @@ void PairOxdnaHbond::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; ra_chb[0] = d_chb*ax[0]; ra_chb[1] = d_chb*ax[1]; @@ -205,8 +206,9 @@ void PairOxdnaHbond::compute(int eflag, int vflag) btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; rb_chb[0] = d_chb*bx[0]; rb_chb[1] = d_chb*bx[1]; @@ -265,6 +267,13 @@ void PairOxdnaHbond::compute(int eflag, int vflag) // early rejection criterium if (f4t3) { + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; + cost4 = MathExtra::dot3(az,bz); if (cost4 > 1.0) cost4 = 1.0; if (cost4 < -1.0) cost4 = -1.0; @@ -324,8 +333,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) // force, torque and virial contribution for forces between h-bonding sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -340,7 +347,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) // radial force finc = -df1 * f4t1 * f4t2 * f4t3 * f4t4 * f4t7 * f4t8 * factor_lj; - fpair += finc; delf[0] += delr_hb[0] * finc; delf[1] += delr_hb[1] * finc; @@ -350,7 +356,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) if (theta2) { finc = -f1 * f4t1 * df4t2 * f4t3 * f4t4 * f4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost2 + ax[0]) * finc; delf[1] += (delr_hb_norm[1]*cost2 + ax[1]) * finc; @@ -362,7 +367,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) if (theta3) { finc = -f1 * f4t1 * f4t2 * df4t3 * f4t4 * f4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost3 - bx[0]) * finc; delf[1] += (delr_hb_norm[1]*cost3 - bx[1]) * finc; @@ -374,7 +378,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) if (theta7) { finc = -f1 * f4t1 * f4t2 * f4t3 * f4t4 * df4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost7 + az[0]) * finc; delf[1] += (delr_hb_norm[1]*cost7 + az[1]) * finc; @@ -386,7 +389,6 @@ void PairOxdnaHbond::compute(int eflag, int vflag) if (theta8) { finc = -f1 * f4t1 * f4t2 * f4t3 * f4t4 * f4t7 * df4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost8 - bz[0]) * finc; delf[1] += (delr_hb_norm[1]*cost8 - bz[1]) * finc; diff --git a/src/CG-DNA/pair_oxdna_hbond.h b/src/CG-DNA/pair_oxdna_hbond.h index fdc8e9823b..32120a79cf 100644 --- a/src/CG-DNA/pair_oxdna_hbond.h +++ b/src/CG-DNA/pair_oxdna_hbond.h @@ -28,19 +28,19 @@ namespace LAMMPS_NS { class PairOxdnaHbond : public Pair { public: PairOxdnaHbond(class LAMMPS *); - virtual ~PairOxdnaHbond(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxdnaHbond() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // h-bonding interaction @@ -48,25 +48,19 @@ class PairOxdnaHbond : public Pair { double **epsilon_hb, **a_hb, **cut_hb_0, **cut_hb_c, **cut_hb_lo, **cut_hb_hi; double **cut_hb_lc, **cut_hb_hc, **b_hb_lo, **b_hb_hi, **shift_hb; double **cutsq_hb_hc; - double **a_hb1, **theta_hb1_0, **dtheta_hb1_ast; double **b_hb1, **dtheta_hb1_c; - double **a_hb2, **theta_hb2_0, **dtheta_hb2_ast; double **b_hb2, **dtheta_hb2_c; - double **a_hb3, **theta_hb3_0, **dtheta_hb3_ast; double **b_hb3, **dtheta_hb3_c; - double **a_hb4, **theta_hb4_0, **dtheta_hb4_ast; double **b_hb4, **dtheta_hb4_c; - double **a_hb7, **theta_hb7_0, **dtheta_hb7_ast; double **b_hb7, **dtheta_hb7_c; - double **a_hb8, **theta_hb8_0, **dtheta_hb8_ast; double **b_hb8, **dtheta_hb8_c; - + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors int seqdepflag; virtual void allocate(); diff --git a/src/CG-DNA/pair_oxdna_stk.cpp b/src/CG-DNA/pair_oxdna_stk.cpp index 4980408986..0f17d332d6 100644 --- a/src/CG-DNA/pair_oxdna_stk.cpp +++ b/src/CG-DNA/pair_oxdna_stk.cpp @@ -18,7 +18,6 @@ #include "pair_oxdna_stk.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -212,9 +211,8 @@ void PairOxdnaStk::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, void PairOxdnaStk::compute(int eflag, int vflag) { - double delf[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair; + double evdwl,finc,tpair; double delr_ss[3],delr_ss_norm[3],rsq_ss,r_ss,rinv_ss; double delr_st[3],delr_st_norm[3],rsq_st,r_st,rinv_st; double theta4,t4dir[3],cost4; @@ -227,10 +225,9 @@ void PairOxdnaStk::compute(int eflag, int vflag) // vectors COM-backbone site, COM-stacking site in lab frame double ra_cs[3],ra_cst[3]; double rb_cs[3],rb_cst[3]; - - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],ay[3],az[3]; + double bx[3],by[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -245,10 +242,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) tagint *id5p = atom->id5p; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,btemp,in,atype,btype; double f1,f4t4,f4t5,f4t6,f5c1,f5c2; @@ -257,6 +250,12 @@ void PairOxdnaStk::compute(int eflag, int vflag) evdwl = 0.0; ev_init(eflag,vflag); + // n(x/y/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over stacking interaction neighbors using bond topology for (in = 0; in < nbondlist; in++) { @@ -275,10 +274,13 @@ void PairOxdnaStk::compute(int eflag, int vflag) // a now in 3' direction, b in 5' direction - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; + // (a/b)y/z not needed here as oxDNA(1) co-linear // vector COM a - stacking site a ra_cst[0] = d_cst*ax[0]; @@ -336,6 +338,13 @@ void PairOxdnaStk::compute(int eflag, int vflag) // early rejection criterium if (f1) { + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; + // theta4 angle and correction cost4 = MathExtra::dot3(bz,az); if (cost4 > 1.0) cost4 = 1.0; @@ -360,6 +369,13 @@ void PairOxdnaStk::compute(int eflag, int vflag) // early rejection criterium if (f4t5) { + ay[0] = ny_xtrct[a][0]; + ay[1] = ny_xtrct[a][1]; + ay[2] = ny_xtrct[a][2]; + by[0] = ny_xtrct[b][0]; + by[1] = ny_xtrct[b][1]; + by[2] = ny_xtrct[b][2]; + cost6p = MathExtra::dot3(delr_st_norm,az); if (cost6p > 1.0) cost6p = 1.0; if (cost6p < -1.0) cost6p = -1.0; @@ -409,8 +425,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between stacking sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -425,7 +439,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) // radial force finc = -df1 * f4t4 * f4t5 * f4t6 * f5c1 * f5c2; - fpair += finc; delf[0] += delr_st[0] * finc; delf[1] += delr_st[1] * finc; @@ -435,7 +448,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) if (theta5p) { finc = -f1 * f4t4 * df4t5 * f4t6 * f5c1 * f5c2 * rinv_st; - fpair += finc; delf[0] += (delr_st_norm[0]*cost5p - bz[0]) * finc; delf[1] += (delr_st_norm[1]*cost5p - bz[1]) * finc; @@ -447,7 +459,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) if (theta6p) { finc = -f1 * f4t4 * f4t5 * df4t6 * f5c1 * f5c2 * rinv_st; - fpair += finc; delf[0] += (delr_st_norm[0]*cost6p - az[0]) * finc; delf[1] += (delr_st_norm[1]*cost6p - az[1]) * finc; @@ -499,8 +510,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between backbone sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -517,7 +526,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) if (cosphi1) { finc = -f1 * f4t4 * f4t5 * f4t6 * df5c1 * f5c2 * rinv_ss; - fpair += finc; delf[0] += (delr_ss_norm[0]*cosphi1 - by[0]) * finc; delf[1] += (delr_ss_norm[1]*cosphi1 - by[1]) * finc; @@ -529,7 +537,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) if (cosphi2) { finc = -f1 * f4t4 * f4t5 * f4t6 * f5c1 * df5c2 * rinv_ss; - fpair += finc; delf[0] += (delr_ss_norm[0]*cosphi2 - ay[0]) * finc; delf[1] += (delr_ss_norm[1]*cosphi2 - ay[1]) * finc; diff --git a/src/CG-DNA/pair_oxdna_stk.h b/src/CG-DNA/pair_oxdna_stk.h index 8695f8fd36..5e9329ea57 100644 --- a/src/CG-DNA/pair_oxdna_stk.h +++ b/src/CG-DNA/pair_oxdna_stk.h @@ -28,20 +28,20 @@ namespace LAMMPS_NS { class PairOxdnaStk : public Pair { public: PairOxdnaStk(class LAMMPS *); - virtual ~PairOxdnaStk(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxdnaStk() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // stacking interaction @@ -59,7 +59,7 @@ class PairOxdnaStk : public Pair { double **b_st6, **dtheta_st6_c; double **a_st1, **cosphi_st1_ast, **b_st1, **cosphi_st1_c; double **a_st2, **cosphi_st2_ast, **b_st2, **cosphi_st2_c; - + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors int seqdepflag; virtual void allocate(); diff --git a/src/CG-DNA/pair_oxdna_xstk.cpp b/src/CG-DNA/pair_oxdna_xstk.cpp index 447483e413..f50d5219f9 100644 --- a/src/CG-DNA/pair_oxdna_xstk.cpp +++ b/src/CG-DNA/pair_oxdna_xstk.cpp @@ -18,7 +18,6 @@ #include "pair_oxdna_xstk.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -111,9 +110,8 @@ PairOxdnaXstk::~PairOxdnaXstk() void PairOxdnaXstk::compute(int eflag, int vflag) { - double delf[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair,factor_lj; + double evdwl,finc,tpair,factor_lj; double delr_hb[3],delr_hb_norm[3],rsq_hb,r_hb,rinv_hb; double theta1,t1dir[3],cost1; double theta2,t2dir[3],cost2; @@ -126,10 +124,9 @@ void PairOxdnaXstk::compute(int eflag, int vflag) double d_chb=+0.4; // vectors COM-h-bonding site in lab frame double ra_chb[3],rb_chb[3]; - - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -141,10 +138,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) int *alist,*blist,*numneigh,**firstneigh; double *special_lj = force->special_lj; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,ia,ib,anum,bnum,atype,btype; double f2,f4t1,f4t4,f4t2,f4t3,f4t7,f4t8; @@ -158,6 +151,12 @@ void PairOxdnaXstk::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // n(x/y/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -165,8 +164,10 @@ void PairOxdnaXstk::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; + // a(y/z) not needed here as oxDNA(1) co-linear ra_chb[0] = d_chb*ax[0]; ra_chb[1] = d_chb*ax[1]; @@ -183,8 +184,10 @@ void PairOxdnaXstk::compute(int eflag, int vflag) btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; + // b(y/z) not needed here as oxDNA(1) co-linear rb_chb[0] = d_chb*bx[0]; rb_chb[1] = d_chb*bx[1]; @@ -243,6 +246,13 @@ void PairOxdnaXstk::compute(int eflag, int vflag) // early rejection criterium if (f4t3) { + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; + cost4 = MathExtra::dot3(az,bz); if (cost4 > 1.0) cost4 = 1.0; if (cost4 < -1.0) cost4 = -1.0; @@ -322,8 +332,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between h-bonding sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -338,7 +346,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) // radial force finc = -df2 * f4t1 * f4t2 * f4t3 * f4t4 * f4t7 * f4t8 * rinv_hb *factor_lj; - fpair += finc; delf[0] += delr_hb[0] * finc; delf[1] += delr_hb[1] * finc; @@ -348,7 +355,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) if (theta2) { finc = -f2 * f4t1 * df4t2 * f4t3 * f4t4 * f4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost2 + ax[0]) * finc; delf[1] += (delr_hb_norm[1]*cost2 + ax[1]) * finc; @@ -360,7 +366,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) if (theta3) { finc = -f2 * f4t1 * f4t2 * df4t3 * f4t4 * f4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost3 - bx[0]) * finc; delf[1] += (delr_hb_norm[1]*cost3 - bx[1]) * finc; @@ -372,7 +377,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) if (theta7) { finc = -f2 * f4t1 * f4t2 * f4t3 * f4t4 * df4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost7 + az[0]) * finc; delf[1] += (delr_hb_norm[1]*cost7 + az[1]) * finc; @@ -384,7 +388,6 @@ void PairOxdnaXstk::compute(int eflag, int vflag) if (theta8) { finc = -f2 * f4t1 * f4t2 * f4t3 * f4t4 * f4t7 * df4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost8 - bz[0]) * finc; delf[1] += (delr_hb_norm[1]*cost8 - bz[1]) * finc; diff --git a/src/CG-DNA/pair_oxdna_xstk.h b/src/CG-DNA/pair_oxdna_xstk.h index 30089f53fb..8d0a126943 100644 --- a/src/CG-DNA/pair_oxdna_xstk.h +++ b/src/CG-DNA/pair_oxdna_xstk.h @@ -28,43 +28,38 @@ namespace LAMMPS_NS { class PairOxdnaXstk : public Pair { public: PairOxdnaXstk(class LAMMPS *); - virtual ~PairOxdnaXstk(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxdnaXstk() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // cross-stacking interaction double **k_xst, **cut_xst_0, **cut_xst_c, **cut_xst_lo, **cut_xst_hi; double **cut_xst_lc, **cut_xst_hc, **b_xst_lo, **b_xst_hi; double **cutsq_xst_hc; - double **a_xst1, **theta_xst1_0, **dtheta_xst1_ast; double **b_xst1, **dtheta_xst1_c; - double **a_xst2, **theta_xst2_0, **dtheta_xst2_ast; double **b_xst2, **dtheta_xst2_c; - double **a_xst3, **theta_xst3_0, **dtheta_xst3_ast; double **b_xst3, **dtheta_xst3_c; - double **a_xst4, **theta_xst4_0, **dtheta_xst4_ast; double **b_xst4, **dtheta_xst4_c; - double **a_xst7, **theta_xst7_0, **dtheta_xst7_ast; double **b_xst7, **dtheta_xst7_c; - double **a_xst8, **theta_xst8_0, **dtheta_xst8_ast; double **b_xst8, **dtheta_xst8_c; + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; diff --git a/src/CG-DNA/pair_oxrna2_dh.h b/src/CG-DNA/pair_oxrna2_dh.h index 3008b4cc8c..132805130e 100644 --- a/src/CG-DNA/pair_oxrna2_dh.h +++ b/src/CG-DNA/pair_oxrna2_dh.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairOxrna2Dh : public PairOxdna2Dh { public: PairOxrna2Dh(class LAMMPS *lmp) : PairOxdna2Dh(lmp) {} - virtual ~PairOxrna2Dh() {} - virtual void compute_interaction_sites(double *, double *, double *, double *); + + void compute_interaction_sites(double *, double *, double *, double *) override; }; } // namespace LAMMPS_NS diff --git a/src/CG-DNA/pair_oxrna2_excv.h b/src/CG-DNA/pair_oxrna2_excv.h index 4f404ef103..1f28f865a4 100644 --- a/src/CG-DNA/pair_oxrna2_excv.h +++ b/src/CG-DNA/pair_oxrna2_excv.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairOxrna2Excv : public PairOxdnaExcv { public: PairOxrna2Excv(class LAMMPS *lmp) : PairOxdnaExcv(lmp) {} - virtual ~PairOxrna2Excv() {} - virtual void compute_interaction_sites(double *, double *, double *, double *, double *); + + void compute_interaction_sites(double *, double *, double *, double *, double *) override; }; } // namespace LAMMPS_NS diff --git a/src/CG-DNA/pair_oxrna2_hbond.h b/src/CG-DNA/pair_oxrna2_hbond.h index fe213c5615..7fdd2e8c5b 100644 --- a/src/CG-DNA/pair_oxrna2_hbond.h +++ b/src/CG-DNA/pair_oxrna2_hbond.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class PairOxrna2Hbond : public PairOxdnaHbond { public: PairOxrna2Hbond(class LAMMPS *); - virtual ~PairOxrna2Hbond() {} }; } // namespace LAMMPS_NS diff --git a/src/CG-DNA/pair_oxrna2_stk.cpp b/src/CG-DNA/pair_oxrna2_stk.cpp index 18cd798fc7..a14f78e715 100644 --- a/src/CG-DNA/pair_oxrna2_stk.cpp +++ b/src/CG-DNA/pair_oxrna2_stk.cpp @@ -18,7 +18,6 @@ #include "pair_oxrna2_stk.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -222,7 +221,7 @@ void PairOxrna2Stk::compute(int eflag, int vflag) { double delf[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair; + double evdwl,finc,tpair; double delr_ss[3],delr_ss_norm[3],rsq_ss,r_ss,rinv_ss; double delr_st[3],delr_st_norm[3],rsq_st,r_st,rinv_st; double theta5p,t5pdir[3],cost5p; @@ -245,9 +244,9 @@ void PairOxrna2Stk::compute(int eflag, int vflag) double ra_cs[3],ra_cst[3]; double rb_cs[3],rb_cst[3]; - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],ay[3],az[3]; + double bx[3],by[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -262,10 +261,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) tagint *id5p = atom->id5p; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,btemp,in,atype,btype; double f1,f4t5,f4t6,f4t9,f4t10,f5c1,f5c2; @@ -274,6 +269,12 @@ void PairOxrna2Stk::compute(int eflag, int vflag) evdwl = 0.0; ev_init(eflag,vflag); + // n(x/y/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + ny_xtrct = (double **) force->pair->extract("ny",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over stacking interaction neighbors using bond topology for (in = 0; in < nbondlist; in++) { @@ -290,12 +291,26 @@ void PairOxrna2Stk::compute(int eflag, int vflag) } - // a now in 3' direction, b in 5' direction + // a now in 3' direction, b in 5' direction - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; + ay[0] = ny_xtrct[a][0]; + ay[1] = ny_xtrct[a][1]; + ay[2] = ny_xtrct[a][2]; + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; + by[0] = ny_xtrct[b][0]; + by[1] = ny_xtrct[b][1]; + by[2] = ny_xtrct[b][2]; + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; // vector COM a - 5'-stacking site a ra_cst[0] = d_cst_x_5p*ax[0] + d_cst_y_5p*ay[0]; @@ -442,8 +457,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between stacking sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -458,7 +471,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) // radial force finc = -df1 * f4t5 * f4t6 * f4t9 * f4t10 * f5c1 * f5c2; - fpair += finc; delf[0] += delr_st[0] * finc; delf[1] += delr_st[1] * finc; @@ -468,7 +480,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) if (theta5p) { finc = -f1 * df4t5 * f4t6 * f4t9 * f4t10 * f5c1 * f5c2 * rinv_st; - fpair += finc; delf[0] += (delr_st_norm[0]*cost5p - bz[0]) * finc; delf[1] += (delr_st_norm[1]*cost5p - bz[1]) * finc; @@ -480,7 +491,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) if (theta6p) { finc = -f1 * f4t5 * df4t6 * f4t9 * f4t10 * f5c1 * f5c2 * rinv_st; - fpair += finc; delf[0] += (delr_st_norm[0]*cost6p - az[0]) * finc; delf[1] += (delr_st_norm[1]*cost6p - az[1]) * finc; @@ -532,8 +542,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between backbone sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -550,7 +558,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) if (theta9) { finc = -f1 * f4t5 * f4t6 * df4t9 * f4t10 * f5c1 * f5c2 * rinv_ss; - fpair += finc; delf[0] += (delr_ss_norm[0]*cost9 - aux3p[0]) * finc; delf[1] += (delr_ss_norm[1]*cost9 - aux3p[1]) * finc; @@ -562,7 +569,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) if (theta10) { finc = -f1 * f4t5 * f4t6 * f4t9 * df4t10 * f5c1 * f5c2 * rinv_ss; - fpair += finc; delf[0] += (delr_ss_norm[0]*cost10 - aux5p[0]) * finc; delf[1] += (delr_ss_norm[1]*cost10 - aux5p[1]) * finc; @@ -574,7 +580,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) if (cosphi1) { finc = -f1 * f4t5 * f4t6 * f4t9 * f4t10 * df5c1 * f5c2 * rinv_ss; - fpair += finc; delf[0] += (delr_ss_norm[0]*cosphi1 - by[0]) * finc; delf[1] += (delr_ss_norm[1]*cosphi1 - by[1]) * finc; @@ -586,7 +591,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) if (cosphi2) { finc = -f1 * f4t5 * f4t6 * f4t9 * f4t10 * f5c1 * df5c2 * rinv_ss; - fpair += finc; delf[0] += (delr_ss_norm[0]*cosphi2 - ay[0]) * finc; delf[1] += (delr_ss_norm[1]*cosphi2 - ay[1]) * finc; diff --git a/src/CG-DNA/pair_oxrna2_stk.h b/src/CG-DNA/pair_oxrna2_stk.h index 23650c98b5..8530544fdc 100644 --- a/src/CG-DNA/pair_oxrna2_stk.h +++ b/src/CG-DNA/pair_oxrna2_stk.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairOxrna2Stk : public Pair { public: PairOxrna2Stk(class LAMMPS *); - virtual ~PairOxrna2Stk(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxrna2Stk() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // stacking interaction @@ -60,7 +60,7 @@ class PairOxrna2Stk : public Pair { double **b_st10, **dtheta_st10_c; double **a_st1, **cosphi_st1_ast, **b_st1, **cosphi_st1_c; double **a_st2, **cosphi_st2_ast, **b_st2, **cosphi_st2_c; - + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors int seqdepflag; virtual void allocate(); diff --git a/src/CG-DNA/pair_oxrna2_xstk.cpp b/src/CG-DNA/pair_oxrna2_xstk.cpp index 8b44a9bde1..09f8e68943 100644 --- a/src/CG-DNA/pair_oxrna2_xstk.cpp +++ b/src/CG-DNA/pair_oxrna2_xstk.cpp @@ -18,7 +18,6 @@ #include "pair_oxrna2_xstk.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" #include "comm.h" #include "error.h" #include "force.h" @@ -107,7 +106,7 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) { double delf[3],delta[3],deltb[3]; // force, torque increment; - double evdwl,fpair,finc,tpair,factor_lj; + double evdwl,finc,tpair,factor_lj; double delr_hb[3],delr_hb_norm[3],rsq_hb,r_hb,rinv_hb; double theta1,t1dir[3],cost1; double theta2,t2dir[3],cost2; @@ -120,9 +119,9 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) // vectors COM-h-bonding site in lab frame double ra_chb[3],rb_chb[3]; - // quaternions and Cartesian unit vectors in lab frame - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + // Cartesian unit vectors in lab frame + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; @@ -134,10 +133,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) int *alist,*blist,*numneigh,**firstneigh; double *special_lj = force->special_lj; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecEllipsoid::Bonus *bonus = avec->bonus; - int *ellipsoid = atom->ellipsoid; - int a,b,ia,ib,anum,bnum,atype,btype; double f2,f4t1,f4t2,f4t3,f4t7,f4t8; @@ -151,6 +146,11 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + // n(x/z)_xtrct = extracted local unit vectors from oxdna_excv + int dim; + nx_xtrct = (double **) force->pair->extract("nx",dim); + nz_xtrct = (double **) force->pair->extract("nz",dim); + // loop over pair interaction neighbors of my atoms for (ia = 0; ia < anum; ia++) { @@ -158,8 +158,9 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) a = alist[ia]; atype = type[a]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); + ax[0] = nx_xtrct[a][0]; + ax[1] = nx_xtrct[a][1]; + ax[2] = nx_xtrct[a][2]; ra_chb[0] = d_chb*ax[0]; ra_chb[1] = d_chb*ax[1]; @@ -176,8 +177,9 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) btype = type[b]; - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + bx[0] = nx_xtrct[b][0]; + bx[1] = nx_xtrct[b][1]; + bx[2] = nx_xtrct[b][2]; rb_chb[0] = d_chb*bx[0]; rb_chb[1] = d_chb*bx[1]; @@ -236,6 +238,10 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) // early rejection criterium if (f4t3) { + az[0] = nz_xtrct[a][0]; + az[1] = nz_xtrct[a][1]; + az[2] = nz_xtrct[a][2]; + cost7 = -1.0*MathExtra::dot3(az,delr_hb_norm); if (cost7 > 1.0) cost7 = 1.0; if (cost7 < -1.0) cost7 = -1.0; @@ -250,6 +256,10 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) // early rejection criterium if (f4t7) { + bz[0] = nz_xtrct[b][0]; + bz[1] = nz_xtrct[b][1]; + bz[2] = nz_xtrct[b][2]; + cost8 = MathExtra::dot3(bz,delr_hb_norm); if (cost8 > 1.0) cost8 = 1.0; if (cost8 < -1.0) cost8 = -1.0; @@ -295,8 +305,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) // force, torque and virial contribution for forces between h-bonding sites - fpair = 0.0; - delf[0] = 0.0; delf[1] = 0.0; delf[2] = 0.0; @@ -311,7 +319,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) // radial force finc = -df2 * f4t1 * f4t2 * f4t3 * f4t7 * f4t8 * rinv_hb *factor_lj; - fpair += finc; delf[0] += delr_hb[0] * finc; delf[1] += delr_hb[1] * finc; @@ -321,7 +328,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) if (theta2) { finc = -f2 * f4t1 * df4t2 * f4t3 * f4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost2 + ax[0]) * finc; delf[1] += (delr_hb_norm[1]*cost2 + ax[1]) * finc; @@ -333,7 +339,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) if (theta3) { finc = -f2 * f4t1 * f4t2 * df4t3 * f4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost3 - bx[0]) * finc; delf[1] += (delr_hb_norm[1]*cost3 - bx[1]) * finc; @@ -345,7 +350,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) if (theta7) { finc = -f2 * f4t1 * f4t2 * f4t3 * df4t7 * f4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost7 + az[0]) * finc; delf[1] += (delr_hb_norm[1]*cost7 + az[1]) * finc; @@ -357,7 +361,6 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) if (theta8) { finc = -f2 * f4t1 * f4t2 * f4t3 * f4t7 * df4t8 * rinv_hb * factor_lj; - fpair += finc; delf[0] += (delr_hb_norm[0]*cost8 - bz[0]) * finc; delf[1] += (delr_hb_norm[1]*cost8 - bz[1]) * finc; diff --git a/src/CG-DNA/pair_oxrna2_xstk.h b/src/CG-DNA/pair_oxrna2_xstk.h index 187d0b67ae..c73839b4a7 100644 --- a/src/CG-DNA/pair_oxrna2_xstk.h +++ b/src/CG-DNA/pair_oxrna2_xstk.h @@ -27,40 +27,36 @@ namespace LAMMPS_NS { class PairOxrna2Xstk : public Pair { public: PairOxrna2Xstk(class LAMMPS *); - virtual ~PairOxrna2Xstk(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_list(int, class NeighList *); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); + ~PairOxrna2Xstk() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: // cross-stacking interaction double **k_xst, **cut_xst_0, **cut_xst_c, **cut_xst_lo, **cut_xst_hi; double **cut_xst_lc, **cut_xst_hc, **b_xst_lo, **b_xst_hi; double **cutsq_xst_hc; - double **a_xst1, **theta_xst1_0, **dtheta_xst1_ast; double **b_xst1, **dtheta_xst1_c; - double **a_xst2, **theta_xst2_0, **dtheta_xst2_ast; double **b_xst2, **dtheta_xst2_c; - double **a_xst3, **theta_xst3_0, **dtheta_xst3_ast; double **b_xst3, **dtheta_xst3_c; - double **a_xst7, **theta_xst7_0, **dtheta_xst7_ast; double **b_xst7, **dtheta_xst7_c; - double **a_xst8, **theta_xst8_0, **dtheta_xst8_ast; double **b_xst8, **dtheta_xst8_c; + double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; diff --git a/src/CG-SDK/angle_sdk.h b/src/CG-SDK/angle_sdk.h index 880f086be4..0db35444bf 100644 --- a/src/CG-SDK/angle_sdk.h +++ b/src/CG-SDK/angle_sdk.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class AngleSDK : public Angle { public: AngleSDK(class LAMMPS *); - virtual ~AngleSDK(); - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleSDK() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *theta0; diff --git a/src/CG-SDK/pair_lj_sdk.h b/src/CG-SDK/pair_lj_sdk.h index fd6a9f7595..28cef78d44 100644 --- a/src/CG-SDK/pair_lj_sdk.h +++ b/src/CG-SDK/pair_lj_sdk.h @@ -31,20 +31,20 @@ namespace LAMMPS_NS { class PairLJSDK : public Pair { public: PairLJSDK(LAMMPS *); - virtual ~PairLJSDK(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); - virtual double memory_usage(); + ~PairLJSDK() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int **lj_type; // type of lennard jones potential diff --git a/src/CG-SDK/pair_lj_sdk_coul_long.h b/src/CG-SDK/pair_lj_sdk_coul_long.h index ea5986284b..6a81a921b5 100644 --- a/src/CG-SDK/pair_lj_sdk_coul_long.h +++ b/src/CG-SDK/pair_lj_sdk_coul_long.h @@ -31,21 +31,21 @@ namespace LAMMPS_NS { class PairLJSDKCoulLong : public Pair { public: PairLJSDKCoulLong(class LAMMPS *); - virtual ~PairLJSDKCoulLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); - virtual double memory_usage(); + ~PairLJSDKCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: double **cut_lj, **cut_ljsq; diff --git a/src/CG-SDK/pair_lj_sdk_coul_msm.h b/src/CG-SDK/pair_lj_sdk_coul_msm.h index 0b4031aa81..3b8c7afe47 100644 --- a/src/CG-SDK/pair_lj_sdk_coul_msm.h +++ b/src/CG-SDK/pair_lj_sdk_coul_msm.h @@ -31,10 +31,9 @@ namespace LAMMPS_NS { class PairLJSDKCoulMSM : public PairLJSDKCoulLong { public: PairLJSDKCoulMSM(class LAMMPS *); - virtual ~PairLJSDKCoulMSM(){}; - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; private: template void eval_msm(); diff --git a/src/CLASS2/angle_class2.h b/src/CLASS2/angle_class2.h index 9af64ac754..9c33e2c265 100644 --- a/src/CLASS2/angle_class2.h +++ b/src/CLASS2/angle_class2.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleClass2 : public Angle { public: AngleClass2(class LAMMPS *); - virtual ~AngleClass2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_angle(int); - virtual void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleClass2() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *theta0, *k2, *k3, *k4; diff --git a/src/CLASS2/bond_class2.h b/src/CLASS2/bond_class2.h index 75c1d52c1f..3708bcef95 100644 --- a/src/CLASS2/bond_class2.h +++ b/src/CLASS2/bond_class2.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondClass2 : public Bond { public: BondClass2(class LAMMPS *); - virtual ~BondClass2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondClass2() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *r0, *k2, *k3, *k4; diff --git a/src/CLASS2/dihedral_class2.h b/src/CLASS2/dihedral_class2.h index 4cf71f6a71..226981b746 100644 --- a/src/CLASS2/dihedral_class2.h +++ b/src/CLASS2/dihedral_class2.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralClass2 : public Dihedral { public: DihedralClass2(class LAMMPS *); - virtual ~DihedralClass2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); + ~DihedralClass2() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k1, *k2, *k3; diff --git a/src/CLASS2/improper_class2.h b/src/CLASS2/improper_class2.h index fc845cbf51..0017c04892 100644 --- a/src/CLASS2/improper_class2.h +++ b/src/CLASS2/improper_class2.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperClass2 : public Improper { public: ImproperClass2(class LAMMPS *); - virtual ~ImproperClass2(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); + ~ImproperClass2() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k0, *chi0; diff --git a/src/CLASS2/pair_lj_class2.h b/src/CLASS2/pair_lj_class2.h index 8a2e4e506a..bc42d434bc 100644 --- a/src/CLASS2/pair_lj_class2.h +++ b/src/CLASS2/pair_lj_class2.h @@ -25,24 +25,24 @@ namespace LAMMPS_NS { class PairLJClass2 : public Pair { public: PairLJClass2(class LAMMPS *); - virtual ~PairLJClass2(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJClass2() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_global; diff --git a/src/CLASS2/pair_lj_class2_coul_cut.h b/src/CLASS2/pair_lj_class2_coul_cut.h index cfb718c65f..ae2d54f7b4 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.h +++ b/src/CLASS2/pair_lj_class2_coul_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJClass2CoulCut : public Pair { public: PairLJClass2CoulCut(class LAMMPS *); - virtual ~PairLJClass2CoulCut(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJClass2CoulCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/CLASS2/pair_lj_class2_coul_long.h b/src/CLASS2/pair_lj_class2_coul_long.h index f91d3ec54a..06c6547cbd 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.h +++ b/src/CLASS2/pair_lj_class2_coul_long.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class PairLJClass2CoulLong : public Pair { public: PairLJClass2CoulLong(class LAMMPS *); - virtual ~PairLJClass2CoulLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairLJClass2CoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); - void *extract(const char *, int &); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/COLLOID/fix_wall_colloid.h b/src/COLLOID/fix_wall_colloid.h index 4c287052c0..4ccec8afb4 100644 --- a/src/COLLOID/fix_wall_colloid.h +++ b/src/COLLOID/fix_wall_colloid.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixWallColloid : public FixWall { public: FixWallColloid(class LAMMPS *, int, char **); - void init(); - void precompute(int); - void wall_particle(int, int, double); + void init() override; + void precompute(int) override; + void wall_particle(int, int, double) override; private: double coeff1[6], coeff2[6], coeff3[6], coeff4[6]; diff --git a/src/COLLOID/pair_brownian.h b/src/COLLOID/pair_brownian.h index 0e81f808b6..ded85d7df1 100644 --- a/src/COLLOID/pair_brownian.h +++ b/src/COLLOID/pair_brownian.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PairBrownian : public Pair { public: PairBrownian(class LAMMPS *); - virtual ~PairBrownian(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual void init_style(); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + ~PairBrownian() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; protected: double cut_inner_global, cut_global; diff --git a/src/COLLOID/pair_brownian_poly.h b/src/COLLOID/pair_brownian_poly.h index 6a9c628e40..110cb1ccd7 100644 --- a/src/COLLOID/pair_brownian_poly.h +++ b/src/COLLOID/pair_brownian_poly.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairBrownianPoly : public PairBrownian { public: PairBrownianPoly(class LAMMPS *); - ~PairBrownianPoly() {} - void compute(int, int); - double init_one(int, int); - void init_style(); + + void compute(int, int) override; + double init_one(int, int) override; + void init_style() override; }; } // namespace LAMMPS_NS diff --git a/src/COLLOID/pair_colloid.h b/src/COLLOID/pair_colloid.h index 6e570dd1f2..5e81051a11 100644 --- a/src/COLLOID/pair_colloid.h +++ b/src/COLLOID/pair_colloid.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairColloid : public Pair { public: PairColloid(class LAMMPS *); - virtual ~PairColloid(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairColloid() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: enum { SMALL_SMALL, SMALL_LARGE, LARGE_LARGE }; diff --git a/src/COLLOID/pair_lubricate.h b/src/COLLOID/pair_lubricate.h index 4fbc3c77a7..cc617f79de 100644 --- a/src/COLLOID/pair_lubricate.h +++ b/src/COLLOID/pair_lubricate.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class PairLubricate : public Pair { public: PairLubricate(class LAMMPS *); - virtual ~PairLubricate(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - virtual void init_style(); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + ~PairLubricate() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; int pre_adapt(char *, int, int, int, int); void adapt(int, int, int, int, int, double); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: double mu, cut_inner_global, cut_global; diff --git a/src/COLLOID/pair_lubricateU.h b/src/COLLOID/pair_lubricateU.h index c857b1ccc1..a8544f261a 100644 --- a/src/COLLOID/pair_lubricateU.h +++ b/src/COLLOID/pair_lubricateU.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLubricateU : public Pair { public: PairLubricateU(class LAMMPS *); - virtual ~PairLubricateU(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - virtual void init_style(); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~PairLubricateU() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: double cut_inner_global, cut_global; diff --git a/src/COLLOID/pair_lubricateU_poly.h b/src/COLLOID/pair_lubricateU_poly.h index af47e731c1..316edcefaf 100644 --- a/src/COLLOID/pair_lubricateU_poly.h +++ b/src/COLLOID/pair_lubricateU_poly.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairLubricateUPoly : public PairLubricateU { public: PairLubricateUPoly(class LAMMPS *); - ~PairLubricateUPoly() {} - void compute(int, int); - void settings(int, char **); - void init_style(); + + void compute(int, int) override; + void settings(int, char **) override; + void init_style() override; private: double vol_P; @@ -38,9 +38,9 @@ class PairLubricateUPoly : public PairLubricateU { class FixWall *wallfix; void iterate(double **, int); - void compute_RE(double **); - void compute_RU(double **); - void compute_Fh(double **); + void compute_RE(double **) override; + void compute_RU(double **) override; + void compute_Fh(double **) override; }; } // namespace LAMMPS_NS diff --git a/src/COLLOID/pair_lubricate_poly.h b/src/COLLOID/pair_lubricate_poly.h index 6fc79a2a3d..12a1dcde1e 100644 --- a/src/COLLOID/pair_lubricate_poly.h +++ b/src/COLLOID/pair_lubricate_poly.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class PairLubricatePoly : public PairLubricate { public: PairLubricatePoly(class LAMMPS *); - ~PairLubricatePoly() {} - void compute(int, int); - void init_style(); + + void compute(int, int) override; + void init_style() override; }; } // namespace LAMMPS_NS diff --git a/src/COLLOID/pair_yukawa_colloid.h b/src/COLLOID/pair_yukawa_colloid.h index fa0dce0d63..ad77da7eea 100644 --- a/src/COLLOID/pair_yukawa_colloid.h +++ b/src/COLLOID/pair_yukawa_colloid.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairYukawaColloid : public PairYukawa { public: PairYukawaColloid(class LAMMPS *); - virtual ~PairYukawaColloid() {} - virtual void compute(int, int); - void init_style(); - double init_one(int, int); - double single(int, int, int, int, double, double, double, double &); + + void compute(int, int) override; + void init_style() override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/COLVARS/colvarproxy_lammps.h b/src/COLVARS/colvarproxy_lammps.h index e10838cc15..5dbbe8fcfe 100644 --- a/src/COLVARS/colvarproxy_lammps.h +++ b/src/COLVARS/colvarproxy_lammps.h @@ -49,9 +49,9 @@ class colvarproxy_lammps : public colvarproxy { friend class cvm::atom; colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp, const char *, const char *, const int, const double, MPI_Comm); - virtual ~colvarproxy_lammps(); + ~colvarproxy_lammps() override; void init(const char *); - virtual int setup(); + int setup() override; // disable default and copy constructor private: @@ -61,8 +61,8 @@ class colvarproxy_lammps : public colvarproxy { // methods for lammps to move data or trigger actions in the proxy public: void set_temperature(double t) { t_target = t; }; - bool total_forces_enabled() const { return total_force_requested; }; - bool total_forces_same_step() const { return true; }; + bool total_forces_enabled() const override { return total_force_requested; }; + bool total_forces_same_step() const override { return true; }; bool want_exit() const { return do_exit; }; // perform colvars computation. returns biasing energy @@ -84,41 +84,41 @@ class colvarproxy_lammps : public colvarproxy { int read_state_file(char const *state_filename); // Request to set the units used internally by Colvars - int set_unit_system(std::string const &units_in, bool check_only); + int set_unit_system(std::string const &units_in, bool check_only) override; - inline cvm::real backend_angstrom_value() { return my_angstrom; }; + inline cvm::real backend_angstrom_value() override { return my_angstrom; }; - inline cvm::real boltzmann() { return my_boltzmann; }; - inline cvm::real temperature() { return t_target; }; - inline cvm::real dt() + inline cvm::real boltzmann() override { return my_boltzmann; }; + inline cvm::real temperature() override { return t_target; }; + inline cvm::real dt() override { return my_timestep; }; // return _lmp->update->dt * _lmp->force->femtosecond; }; - void add_energy(cvm::real energy) { bias_energy += energy; }; - void request_total_force(bool yesno) { total_force_requested = yesno; }; + void add_energy(cvm::real energy) override { bias_energy += energy; }; + void request_total_force(bool yesno) override { total_force_requested = yesno; }; - void log(std::string const &message); - void error(std::string const &message); + void log(std::string const &message) override; + void error(std::string const &message) override; - cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const; + cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const override; - int backup_file(char const *filename); + int backup_file(char const *filename) override; - cvm::real rand_gaussian(void) { return _random->gaussian(); }; + cvm::real rand_gaussian(void) override { return _random->gaussian(); }; - int init_atom(int atom_number); - int check_atom_id(int atom_number); + int init_atom(int atom_number) override; + int check_atom_id(int atom_number) override; inline std::vector *modify_atom_types() { return &atoms_types; } - virtual int replica_enabled(); - virtual int replica_index(); - virtual int num_replicas(); + int replica_enabled() override; + int replica_index() override; + int num_replicas() override; - virtual void replica_comm_barrier(); - virtual int replica_comm_recv(char *msg_data, int buf_len, int src_rep); - virtual int replica_comm_send(char *msg_data, int msg_len, int dest_rep); + void replica_comm_barrier() override; + int replica_comm_recv(char *msg_data, int buf_len, int src_rep) override; + int replica_comm_send(char *msg_data, int msg_len, int dest_rep) override; }; #endif diff --git a/src/COLVARS/fix_colvars.h b/src/COLVARS/fix_colvars.h index d382dcf1f7..eba9b0167f 100644 --- a/src/COLVARS/fix_colvars.h +++ b/src/COLVARS/fix_colvars.h @@ -43,23 +43,23 @@ class FixColvars : public Fix { public: FixColvars(class LAMMPS *, int, char **); - virtual ~FixColvars(); + ~FixColvars() override; - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual int modify_param(int, char **); - virtual void min_setup(int vflag) { setup(vflag); }; - virtual void min_post_force(int); - virtual void post_force(int); - virtual void post_force_respa(int, int, int); - virtual void end_of_step(); - virtual void post_run(); - virtual double compute_scalar(); - virtual double memory_usage(); + int setmask() override; + void init() override; + void setup(int) override; + int modify_param(int, char **) override; + void min_setup(int vflag) override { setup(vflag); }; + void min_post_force(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void end_of_step() override; + void post_run() override; + double compute_scalar() override; + double memory_usage() override; - virtual void write_restart(FILE *); - virtual void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; protected: colvarproxy_lammps *proxy; // pointer to the colvars proxy class diff --git a/src/COLVARS/group_ndx.h b/src/COLVARS/group_ndx.h index 4c1e7e93e5..c1d7c5298b 100644 --- a/src/COLVARS/group_ndx.h +++ b/src/COLVARS/group_ndx.h @@ -29,7 +29,7 @@ namespace LAMMPS_NS { class Group2Ndx : public Command { public: Group2Ndx(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; private: void write_group(FILE *, int); diff --git a/src/COLVARS/ndx_group.h b/src/COLVARS/ndx_group.h index 85831accaf..ef30f53b17 100644 --- a/src/COLVARS/ndx_group.h +++ b/src/COLVARS/ndx_group.h @@ -30,7 +30,7 @@ namespace LAMMPS_NS { class Ndx2Group : public Command { public: Ndx2Group(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; private: void create(const std::string &, const std::vector &); diff --git a/src/COMPRESS/dump_atom_gz.h b/src/COMPRESS/dump_atom_gz.h index 2b87e36f1d..b7cd1bf476 100644 --- a/src/COMPRESS/dump_atom_gz.h +++ b/src/COMPRESS/dump_atom_gz.h @@ -28,17 +28,16 @@ namespace LAMMPS_NS { class DumpAtomGZ : public DumpAtom { public: DumpAtomGZ(class LAMMPS *, int, char **); - virtual ~DumpAtomGZ() = default; protected: GzFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_atom_zstd.h b/src/COMPRESS/dump_atom_zstd.h index fb2da0c83b..9bc9796915 100644 --- a/src/COMPRESS/dump_atom_zstd.h +++ b/src/COMPRESS/dump_atom_zstd.h @@ -34,17 +34,16 @@ namespace LAMMPS_NS { class DumpAtomZstd : public DumpAtom { public: DumpAtomZstd(class LAMMPS *, int, char **); - virtual ~DumpAtomZstd() = default; protected: ZstdFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_cfg_gz.h b/src/COMPRESS/dump_cfg_gz.h index 153a4490c6..ca88600b51 100644 --- a/src/COMPRESS/dump_cfg_gz.h +++ b/src/COMPRESS/dump_cfg_gz.h @@ -28,17 +28,16 @@ namespace LAMMPS_NS { class DumpCFGGZ : public DumpCFG { public: DumpCFGGZ(class LAMMPS *, int, char **); - virtual ~DumpCFGGZ() = default; protected: GzFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_cfg_zstd.h b/src/COMPRESS/dump_cfg_zstd.h index 32013b274e..88541503f8 100644 --- a/src/COMPRESS/dump_cfg_zstd.h +++ b/src/COMPRESS/dump_cfg_zstd.h @@ -33,17 +33,16 @@ namespace LAMMPS_NS { class DumpCFGZstd : public DumpCFG { public: DumpCFGZstd(class LAMMPS *, int, char **); - virtual ~DumpCFGZstd() = default; protected: ZstdFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_custom_gz.h b/src/COMPRESS/dump_custom_gz.h index 660af8bfae..ba0a1a83fc 100644 --- a/src/COMPRESS/dump_custom_gz.h +++ b/src/COMPRESS/dump_custom_gz.h @@ -28,17 +28,16 @@ namespace LAMMPS_NS { class DumpCustomGZ : public DumpCustom { public: DumpCustomGZ(class LAMMPS *, int, char **); - virtual ~DumpCustomGZ() = default; protected: GzFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_custom_zstd.h b/src/COMPRESS/dump_custom_zstd.h index f179223265..d9b836c365 100644 --- a/src/COMPRESS/dump_custom_zstd.h +++ b/src/COMPRESS/dump_custom_zstd.h @@ -34,17 +34,16 @@ namespace LAMMPS_NS { class DumpCustomZstd : public DumpCustom { public: DumpCustomZstd(class LAMMPS *, int, char **); - virtual ~DumpCustomZstd() = default; protected: ZstdFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_local_gz.h b/src/COMPRESS/dump_local_gz.h index e2e7a028aa..b2e2c55127 100644 --- a/src/COMPRESS/dump_local_gz.h +++ b/src/COMPRESS/dump_local_gz.h @@ -28,17 +28,16 @@ namespace LAMMPS_NS { class DumpLocalGZ : public DumpLocal { public: DumpLocalGZ(class LAMMPS *, int, char **); - virtual ~DumpLocalGZ() = default; protected: GzFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_local_zstd.h b/src/COMPRESS/dump_local_zstd.h index fb4f017b3d..cc04c6512a 100644 --- a/src/COMPRESS/dump_local_zstd.h +++ b/src/COMPRESS/dump_local_zstd.h @@ -34,17 +34,16 @@ namespace LAMMPS_NS { class DumpLocalZstd : public DumpLocal { public: DumpLocalZstd(class LAMMPS *, int, char **); - virtual ~DumpLocalZstd() = default; protected: ZstdFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_xyz_gz.h b/src/COMPRESS/dump_xyz_gz.h index 62a25cfc66..714911c735 100644 --- a/src/COMPRESS/dump_xyz_gz.h +++ b/src/COMPRESS/dump_xyz_gz.h @@ -28,17 +28,16 @@ namespace LAMMPS_NS { class DumpXYZGZ : public DumpXYZ { public: DumpXYZGZ(class LAMMPS *, int, char **); - virtual ~DumpXYZGZ() = default; protected: GzFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/dump_xyz_zstd.h b/src/COMPRESS/dump_xyz_zstd.h index 110e27ab8f..fe93be1156 100644 --- a/src/COMPRESS/dump_xyz_zstd.h +++ b/src/COMPRESS/dump_xyz_zstd.h @@ -34,17 +34,16 @@ namespace LAMMPS_NS { class DumpXYZZstd : public DumpXYZ { public: DumpXYZZstd(class LAMMPS *, int, char **); - virtual ~DumpXYZZstd() = default; protected: ZstdFileWriter writer; - virtual void openfile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); - virtual void write(); + void openfile() override; + void write_header(bigint) override; + void write_data(int, double *) override; + void write() override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/COMPRESS/gz_file_writer.h b/src/COMPRESS/gz_file_writer.h index 3de1d0d2b8..2356675921 100644 --- a/src/COMPRESS/gz_file_writer.h +++ b/src/COMPRESS/gz_file_writer.h @@ -31,12 +31,12 @@ class GzFileWriter : public FileWriter { gzFile gzFp; // file pointer for the compressed output stream public: GzFileWriter(); - virtual ~GzFileWriter(); - virtual void open(const std::string &path, bool append = false) override; - virtual void close() override; - virtual void flush() override; - virtual size_t write(const void *buffer, size_t length) override; - virtual bool isopen() const override; + ~GzFileWriter() override; + void open(const std::string &path, bool append = false) override; + void close() override; + void flush() override; + size_t write(const void *buffer, size_t length) override; + bool isopen() const override; void setCompressionLevel(int level); }; diff --git a/src/COMPRESS/zstd_file_writer.h b/src/COMPRESS/zstd_file_writer.h index 3fde376b47..77b3838f83 100644 --- a/src/COMPRESS/zstd_file_writer.h +++ b/src/COMPRESS/zstd_file_writer.h @@ -42,12 +42,12 @@ class ZstdFileWriter : public FileWriter { public: ZstdFileWriter(); - virtual ~ZstdFileWriter(); - virtual void open(const std::string &path, bool append = false) override; - virtual void close() override; - virtual void flush() override; - virtual size_t write(const void *buffer, size_t length) override; - virtual bool isopen() const override; + ~ZstdFileWriter() override; + void open(const std::string &path, bool append = false) override; + void close() override; + void flush() override; + size_t write(const void *buffer, size_t length) override; + bool isopen() const override; void setCompressionLevel(int level); void setChecksum(bool enabled); diff --git a/src/CORESHELL/compute_temp_cs.h b/src/CORESHELL/compute_temp_cs.h index 70c681a264..34449afb47 100644 --- a/src/CORESHELL/compute_temp_cs.h +++ b/src/CORESHELL/compute_temp_cs.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class ComputeTempCS : public Compute { public: ComputeTempCS(class LAMMPS *, int, char **); - ~ComputeTempCS(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); - double memory_usage(); + ~ComputeTempCS() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; + double memory_usage() override; - void remove_bias(int, double *); - void remove_bias_all(); - void reapply_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); + void remove_bias(int, double *) override; + void remove_bias_all() override; + void reapply_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; private: int groupbit_c, groupbit_s; diff --git a/src/CORESHELL/pair_born_coul_dsf_cs.h b/src/CORESHELL/pair_born_coul_dsf_cs.h index ac9cf2676b..48d48f3cf9 100644 --- a/src/CORESHELL/pair_born_coul_dsf_cs.h +++ b/src/CORESHELL/pair_born_coul_dsf_cs.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairBornCoulDSFCS : public PairBornCoulDSF { public: PairBornCoulDSFCS(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_born_coul_long_cs.h b/src/CORESHELL/pair_born_coul_long_cs.h index c015a56641..61c6e1a22e 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.h +++ b/src/CORESHELL/pair_born_coul_long_cs.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairBornCoulLongCS : public PairBornCoulLong { public: PairBornCoulLongCS(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_born_coul_wolf_cs.h b/src/CORESHELL/pair_born_coul_wolf_cs.h index 70b1c5a261..433623a3d4 100644 --- a/src/CORESHELL/pair_born_coul_wolf_cs.h +++ b/src/CORESHELL/pair_born_coul_wolf_cs.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairBornCoulWolfCS : public PairBornCoulWolf { public: PairBornCoulWolfCS(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_buck_coul_long_cs.h b/src/CORESHELL/pair_buck_coul_long_cs.h index 12dfe12dc6..8a5ea985e6 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.h +++ b/src/CORESHELL/pair_buck_coul_long_cs.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairBuckCoulLongCS : public PairBuckCoulLong { public: PairBuckCoulLongCS(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_coul_long_cs.h b/src/CORESHELL/pair_coul_long_cs.h index 9b0780d247..d351556c68 100644 --- a/src/CORESHELL/pair_coul_long_cs.h +++ b/src/CORESHELL/pair_coul_long_cs.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairCoulLongCS : public PairCoulLong { public: PairCoulLongCS(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_coul_wolf_cs.h b/src/CORESHELL/pair_coul_wolf_cs.h index 811287548a..5ae626509a 100644 --- a/src/CORESHELL/pair_coul_wolf_cs.h +++ b/src/CORESHELL/pair_coul_wolf_cs.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairCoulWolfCS : public PairCoulWolf { public: PairCoulWolfCS(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_lj_class2_coul_long_cs.h b/src/CORESHELL/pair_lj_class2_coul_long_cs.h index c08cdb9700..b0f87f1ff3 100644 --- a/src/CORESHELL/pair_lj_class2_coul_long_cs.h +++ b/src/CORESHELL/pair_lj_class2_coul_long_cs.h @@ -28,10 +28,10 @@ class PairLJClass2CoulLongCS : public PairLJClass2CoulLong { public: PairLJClass2CoulLongCS(class LAMMPS *); - virtual void compute(int, int); - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); + void compute(int, int) override; + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.h b/src/CORESHELL/pair_lj_cut_coul_long_cs.h index 47cf2316da..4bb1f923f5 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.h +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.h @@ -28,10 +28,10 @@ class PairLJCutCoulLongCS : public PairLJCutCoulLong { public: PairLJCutCoulLongCS(class LAMMPS *); - virtual void compute(int, int); - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); + void compute(int, int) override; + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/DIELECTRIC/atom_vec_dielectric.h b/src/DIELECTRIC/atom_vec_dielectric.h index 8e342eda08..2d4510b330 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.h +++ b/src/DIELECTRIC/atom_vec_dielectric.h @@ -31,12 +31,12 @@ class AtomVecDielectric : public AtomVec { public: AtomVecDielectric(class LAMMPS *); - void grow_pointers(); - void create_atom_post(int); - void data_atom_post(int); - void unpack_restart_init(int); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + void grow_pointers() override; + void create_atom_post(int) override; + void data_atom_post(int) override; + void unpack_restart_init(int) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; protected: int *num_bond, *num_angle, *num_dihedral, *num_improper; diff --git a/src/DIELECTRIC/compute_efield_atom.h b/src/DIELECTRIC/compute_efield_atom.h index 1961e15d69..212893b385 100644 --- a/src/DIELECTRIC/compute_efield_atom.h +++ b/src/DIELECTRIC/compute_efield_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeEfieldAtom : public Compute { public: ComputeEfieldAtom(class LAMMPS *, int, char **); - ~ComputeEfieldAtom(); - void init(); - void setup(); - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeEfieldAtom() override; + void init() override; + void setup() override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int pairflag; diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.h b/src/DIELECTRIC/fix_polarize_bem_gmres.h index 7671ddf1c2..421fe8afb9 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.h +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class FixPolarizeBEMGMRES : public Fix { public: FixPolarizeBEMGMRES(class LAMMPS *, int, char **); - ~FixPolarizeBEMGMRES(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void pre_force(int); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - virtual double compute_vector(int); + ~FixPolarizeBEMGMRES() override; + int setmask() override; + void init() override; + void setup(int) override; + void pre_force(int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + double compute_vector(int) override; - int modify_param(int, char **); - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); + int modify_param(int, char **) override; + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; virtual void allocate(); virtual void deallocate(); diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.h b/src/DIELECTRIC/fix_polarize_bem_icc.h index df04b52fdf..e7af6edd08 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.h +++ b/src/DIELECTRIC/fix_polarize_bem_icc.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixPolarizeBEMICC : public Fix { public: FixPolarizeBEMICC(class LAMMPS *, int, char **); - ~FixPolarizeBEMICC() = default; - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void pre_force(int); - virtual double compute_vector(int); - int modify_param(int, char **); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + + int setmask() override; + void init() override; + void setup(int) override; + void pre_force(int) override; + double compute_vector(int) override; + int modify_param(int, char **) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; virtual void compute_induced_charges(); void set_dielectric_params(double, double, double, double, int, double); diff --git a/src/DIELECTRIC/fix_polarize_functional.h b/src/DIELECTRIC/fix_polarize_functional.h index 7a4b8c00da..010e958542 100644 --- a/src/DIELECTRIC/fix_polarize_functional.h +++ b/src/DIELECTRIC/fix_polarize_functional.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class FixPolarizeFunctional : public Fix { public: FixPolarizeFunctional(class LAMMPS *, int, char **); - ~FixPolarizeFunctional(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void setup_pre_force(int vflag); - void pre_force(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~FixPolarizeFunctional() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void setup_pre_force(int vflag) override; + void pre_force(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; - int modify_param(int, char **); - double memory_usage(); + int modify_param(int, char **) override; + double memory_usage() override; void allocate(); void deallocate(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; protected: int nmax; diff --git a/src/DIELECTRIC/msm_dielectric.h b/src/DIELECTRIC/msm_dielectric.h index 9874f5e0b2..64982afae2 100644 --- a/src/DIELECTRIC/msm_dielectric.h +++ b/src/DIELECTRIC/msm_dielectric.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class MSMDielectric : public MSM { public: MSMDielectric(class LAMMPS *); - virtual ~MSMDielectric(); - virtual void init(); - virtual void compute(int, int); - void fieldforce(); + ~MSMDielectric() override; + void init() override; + void compute(int, int) override; double **efield; double *phi; protected: + void fieldforce() override; class AtomVecDielectric *avec; }; diff --git a/src/DIELECTRIC/pair_coul_cut_dielectric.h b/src/DIELECTRIC/pair_coul_cut_dielectric.h index ef6fd3fb45..bc400302db 100644 --- a/src/DIELECTRIC/pair_coul_cut_dielectric.h +++ b/src/DIELECTRIC/pair_coul_cut_dielectric.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairCoulCutDielectric : public PairCoulCut { public: PairCoulCutDielectric(class LAMMPS *); - virtual ~PairCoulCutDielectric(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - void init_style(); + ~PairCoulCutDielectric() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void init_style() override; double **efield; diff --git a/src/DIELECTRIC/pair_coul_long_dielectric.h b/src/DIELECTRIC/pair_coul_long_dielectric.h index 993555e452..2db2ad1086 100644 --- a/src/DIELECTRIC/pair_coul_long_dielectric.h +++ b/src/DIELECTRIC/pair_coul_long_dielectric.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class PairCoulLongDielectric : public PairCoulLong { public: PairCoulLongDielectric(class LAMMPS *); - ~PairCoulLongDielectric(); - virtual void compute(int, int); - virtual void init_style(); + ~PairCoulLongDielectric() override; + void compute(int, int) override; + void init_style() override; double **efield; diff --git a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h index 93bee549c8..77869b09b9 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairLJCutCoulCutDielectric : public PairLJCutCoulCut { public: PairLJCutCoulCutDielectric(class LAMMPS *); - virtual ~PairLJCutCoulCutDielectric(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - void init_style(); + ~PairLJCutCoulCutDielectric() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void init_style() override; double **efield; double *epot; diff --git a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h index 0301ff4fbd..dbe626e669 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairLJCutCoulDebyeDielectric : public PairLJCutCoulDebye { public: PairLJCutCoulDebyeDielectric(class LAMMPS *); - virtual ~PairLJCutCoulDebyeDielectric(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - void init_style(); + ~PairLJCutCoulDebyeDielectric() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void init_style() override; double **efield; double *epot; diff --git a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h index 06ad1c5e7f..a267da9915 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h @@ -28,10 +28,10 @@ class PairLJCutCoulLongDielectric : public PairLJCutCoulLong { public: PairLJCutCoulLongDielectric(class LAMMPS *); - virtual ~PairLJCutCoulLongDielectric(); - virtual void compute(int, int); - virtual void init_style(); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairLJCutCoulLongDielectric() override; + void compute(int, int) override; + void init_style() override; + double single(int, int, int, int, double, double, double, double &) override; double **efield; double *epot; diff --git a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h index 3e9e06bbc9..8c0677fbe8 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutCoulMSMDielectric : public PairLJCutCoulLong { public: PairLJCutCoulMSMDielectric(class LAMMPS *); - virtual ~PairLJCutCoulMSMDielectric(); - virtual void init_style(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairLJCutCoulMSMDielectric() override; + void init_style() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; double **efield; diff --git a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h index 83ba66a9a0..ca81a16a1b 100644 --- a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h +++ b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairLJLongCoulLongDielectric : public PairLJLongCoulLong { public: PairLJLongCoulLongDielectric(class LAMMPS *); - virtual ~PairLJLongCoulLongDielectric(); - virtual void compute(int, int); - void init_style(); - double single(int, int, int, int, double, double, double, double &); + ~PairLJLongCoulLongDielectric() override; + void compute(int, int) override; + void init_style() override; + double single(int, int, int, int, double, double, double, double &) override; double **efield; double *epot; diff --git a/src/DIELECTRIC/pppm_dielectric.h b/src/DIELECTRIC/pppm_dielectric.h index 7ea6a831eb..f2427e83f6 100644 --- a/src/DIELECTRIC/pppm_dielectric.h +++ b/src/DIELECTRIC/pppm_dielectric.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PPPMDielectric : public PPPM { public: PPPMDielectric(class LAMMPS *); - virtual ~PPPMDielectric(); - virtual void compute(int, int); + ~PPPMDielectric() override; + void compute(int, int) override; double **efield; double *phi; @@ -37,10 +37,10 @@ class PPPMDielectric : public PPPM { void qsum_qsq(); protected: - void slabcorr(); + void slabcorr() override; - void fieldforce_ik(); - void fieldforce_ad(); + void fieldforce_ik() override; + void fieldforce_ad() override; class AtomVecDielectric *avec; }; diff --git a/src/DIELECTRIC/pppm_disp_dielectric.h b/src/DIELECTRIC/pppm_disp_dielectric.h index 8f0476ab40..46b46904f0 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.h +++ b/src/DIELECTRIC/pppm_disp_dielectric.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class PPPMDispDielectric : public PPPMDisp { public: PPPMDispDielectric(class LAMMPS *); - virtual ~PPPMDispDielectric(); - virtual double memory_usage(); - virtual void compute(int, int); + ~PPPMDispDielectric() override; + double memory_usage() override; + void compute(int, int) override; void qsum_qsq(); void slabcorr(int); @@ -38,9 +38,9 @@ class PPPMDispDielectric : public PPPMDisp { int potflag; // 1/0 if per-atom electrostatic potential phi is needed protected: - virtual void fieldforce_c_ik(); - virtual void fieldforce_c_ad(); - virtual void fieldforce_c_peratom(); + void fieldforce_c_ik() override; + void fieldforce_c_ad() override; + void fieldforce_c_peratom() override; class AtomVecDielectric *avec; int mu_flag; diff --git a/src/DIFFRACTION/compute_saed.h b/src/DIFFRACTION/compute_saed.h index 371e5c9c7f..379cb0d1e7 100644 --- a/src/DIFFRACTION/compute_saed.h +++ b/src/DIFFRACTION/compute_saed.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeSAED : public Compute { public: ComputeSAED(class LAMMPS *, int, char **); - ~ComputeSAED(); - void init(); - void compute_vector(); - double memory_usage(); + ~ComputeSAED() override; + void init() override; + void compute_vector() override; + double memory_usage() override; //testing double saed_var[10]; diff --git a/src/DIFFRACTION/compute_xrd.h b/src/DIFFRACTION/compute_xrd.h index 4254e50bf9..115ecfb6b4 100644 --- a/src/DIFFRACTION/compute_xrd.h +++ b/src/DIFFRACTION/compute_xrd.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeXRD : public Compute { public: ComputeXRD(class LAMMPS *, int, char **); - ~ComputeXRD(); - void init(); - void compute_array(); - double memory_usage(); + ~ComputeXRD() override; + void init() override; + void compute_array() override; + double memory_usage() override; private: int me; diff --git a/src/DIFFRACTION/fix_saed_vtk.h b/src/DIFFRACTION/fix_saed_vtk.h index a5691ea986..24be1d939c 100644 --- a/src/DIFFRACTION/fix_saed_vtk.h +++ b/src/DIFFRACTION/fix_saed_vtk.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixSAEDVTK : public Fix { public: FixSAEDVTK(class LAMMPS *, int, char **); - ~FixSAEDVTK(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); - double compute_vector(int); + ~FixSAEDVTK() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_vector(int) override; void reset_timestep(bigint); private: diff --git a/src/DIPOLE/angle_dipole.h b/src/DIPOLE/angle_dipole.h index d94315c5aa..d65ae84e20 100644 --- a/src/DIPOLE/angle_dipole.h +++ b/src/DIPOLE/angle_dipole.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class AngleDipole : public Angle { public: AngleDipole(class LAMMPS *); - virtual ~AngleDipole(); - virtual void compute(int, int); - virtual void init_style(); - virtual void coeff(int, char **); - virtual double equilibrium_angle(int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_data(FILE *); - virtual double single(int, int, int, int); + ~AngleDipole() override; + void compute(int, int) override; + void init_style() override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *gamma0; diff --git a/src/DIPOLE/atom_vec_dipole.h b/src/DIPOLE/atom_vec_dipole.h index d47e39beb5..0c76bb54bf 100644 --- a/src/DIPOLE/atom_vec_dipole.h +++ b/src/DIPOLE/atom_vec_dipole.h @@ -28,8 +28,8 @@ class AtomVecDipole : public AtomVec { public: AtomVecDipole(class LAMMPS *); - void grow_pointers(); - void data_atom_post(int); + void grow_pointers() override; + void data_atom_post(int) override; private: double **mu; diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.h b/src/DIPOLE/pair_lj_cut_dipole_cut.h index 1999e1612e..d2d87e3ae5 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.h +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairLJCutDipoleCut : public Pair { public: PairLJCutDipoleCut(class LAMMPS *); - virtual ~PairLJCutDipoleCut(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void *extract(const char *, int &); + ~PairLJCutDipoleCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.h b/src/DIPOLE/pair_lj_cut_dipole_long.h index bc9e3571da..d563f269a3 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.h +++ b/src/DIPOLE/pair_lj_cut_dipole_long.h @@ -30,17 +30,17 @@ class PairLJCutDipoleLong : public Pair { double **sigma; PairLJCutDipoleLong(class LAMMPS *); - ~PairLJCutDipoleLong(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void *extract(const char *, int &); + ~PairLJCutDipoleLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/DIPOLE/pair_lj_long_dipole_long.h b/src/DIPOLE/pair_lj_long_dipole_long.h index 3669834cc7..b9f09ec9b1 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.h +++ b/src/DIPOLE/pair_lj_long_dipole_long.h @@ -29,18 +29,18 @@ class PairLJLongDipoleLong : public Pair { double cut_coul; PairLJLongDipoleLong(class LAMMPS *); - virtual ~PairLJLongDipoleLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); + ~PairLJLongDipoleLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void *extract(const char *, int &); + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/DIPOLE/pair_lj_sf_dipole_sf.h b/src/DIPOLE/pair_lj_sf_dipole_sf.h index 93d416ec60..22b9320d8a 100644 --- a/src/DIPOLE/pair_lj_sf_dipole_sf.h +++ b/src/DIPOLE/pair_lj_sf_dipole_sf.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJSFDipoleSF : public Pair { public: PairLJSFDipoleSF(class LAMMPS *); - virtual ~PairLJSFDipoleSF(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJSFDipoleSF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/DPD-BASIC/pair_dpd.h b/src/DPD-BASIC/pair_dpd.h index 5bb2ab33ab..796228878c 100644 --- a/src/DPD-BASIC/pair_dpd.h +++ b/src/DPD-BASIC/pair_dpd.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairDPD : public Pair { public: PairDPD(class LAMMPS *); - virtual ~PairDPD(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairDPD() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global, temperature; diff --git a/src/DPD-BASIC/pair_dpd_ext.h b/src/DPD-BASIC/pair_dpd_ext.h index 01436470b0..66df395406 100644 --- a/src/DPD-BASIC/pair_dpd_ext.h +++ b/src/DPD-BASIC/pair_dpd_ext.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairDPDExt : public Pair { public: PairDPDExt(class LAMMPS *); - virtual ~PairDPDExt(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairDPDExt() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global, temperature; diff --git a/src/DPD-BASIC/pair_dpd_ext_tstat.h b/src/DPD-BASIC/pair_dpd_ext_tstat.h index 09f5c9a801..30974c7949 100644 --- a/src/DPD-BASIC/pair_dpd_ext_tstat.h +++ b/src/DPD-BASIC/pair_dpd_ext_tstat.h @@ -27,16 +27,15 @@ namespace LAMMPS_NS { class PairDPDExtTstat : public PairDPDExt { public: PairDPDExtTstat(class LAMMPS *); - ~PairDPDExtTstat() {} - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; protected: double t_start, t_stop; diff --git a/src/DPD-BASIC/pair_dpd_tstat.h b/src/DPD-BASIC/pair_dpd_tstat.h index 4d2e238bb4..c7c41f2b24 100644 --- a/src/DPD-BASIC/pair_dpd_tstat.h +++ b/src/DPD-BASIC/pair_dpd_tstat.h @@ -27,16 +27,15 @@ namespace LAMMPS_NS { class PairDPDTstat : public PairDPD { public: PairDPDTstat(class LAMMPS *); - ~PairDPDTstat() {} - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; protected: double t_start, t_stop; diff --git a/src/DPD-MESO/atom_vec_edpd.h b/src/DPD-MESO/atom_vec_edpd.h index da17a855eb..fb47fba628 100644 --- a/src/DPD-MESO/atom_vec_edpd.h +++ b/src/DPD-MESO/atom_vec_edpd.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class AtomVecEDPD : public AtomVec { public: AtomVecEDPD(class LAMMPS *); - void init(); + void init() override; - void grow_pointers(); - void force_clear(int, size_t); - void create_atom_post(int); - void data_atom_post(int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void create_atom_post(int) override; + void data_atom_post(int) override; private: double *edpd_cv, *edpd_temp, *edpd_flux; diff --git a/src/DPD-MESO/atom_vec_mdpd.h b/src/DPD-MESO/atom_vec_mdpd.h index 67134f30f0..4e8aefeebe 100644 --- a/src/DPD-MESO/atom_vec_mdpd.h +++ b/src/DPD-MESO/atom_vec_mdpd.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class AtomVecMDPD : public AtomVec { public: AtomVecMDPD(class LAMMPS *); - void init(); + void init() override; - void grow_pointers(); - void force_clear(int, size_t); - void data_atom_post(int); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void data_atom_post(int) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; private: double *rho, *drho; diff --git a/src/DPD-MESO/atom_vec_tdpd.h b/src/DPD-MESO/atom_vec_tdpd.h index 898c48c160..0ebffbe0de 100644 --- a/src/DPD-MESO/atom_vec_tdpd.h +++ b/src/DPD-MESO/atom_vec_tdpd.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class AtomVecTDPD : public AtomVec { public: AtomVecTDPD(class LAMMPS *); - void process_args(int, char **); - void init(); + void process_args(int, char **) override; + void init() override; - void grow_pointers(); - void force_clear(int, size_t); - void data_atom_post(int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void data_atom_post(int) override; protected: double **cc_flux; diff --git a/src/DPD-MESO/compute_edpd_temp_atom.h b/src/DPD-MESO/compute_edpd_temp_atom.h index 0dd7464bca..a361698be9 100644 --- a/src/DPD-MESO/compute_edpd_temp_atom.h +++ b/src/DPD-MESO/compute_edpd_temp_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeEDPDTempAtom : public Compute { public: ComputeEDPDTempAtom(class LAMMPS *, int, char **); - ~ComputeEDPDTempAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeEDPDTempAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/DPD-MESO/compute_tdpd_cc_atom.h b/src/DPD-MESO/compute_tdpd_cc_atom.h index 1f9fe76b25..403e32c6d5 100644 --- a/src/DPD-MESO/compute_tdpd_cc_atom.h +++ b/src/DPD-MESO/compute_tdpd_cc_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeTDPDCCAtom : public Compute { public: ComputeTDPDCCAtom(class LAMMPS *, int, char **); - ~ComputeTDPDCCAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeTDPDCCAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/DPD-MESO/fix_edpd_source.h b/src/DPD-MESO/fix_edpd_source.h index 13eecc7c56..73c0e13c56 100644 --- a/src/DPD-MESO/fix_edpd_source.h +++ b/src/DPD-MESO/fix_edpd_source.h @@ -27,10 +27,9 @@ namespace LAMMPS_NS { class FixEDPDSource : public Fix { public: FixEDPDSource(class LAMMPS *, int, char **); - ~FixEDPDSource() = default; - int setmask(); - void init(); - void post_force(int); + int setmask() override; + void init() override; + void post_force(int) override; protected: int option; diff --git a/src/DPD-MESO/fix_mvv_dpd.h b/src/DPD-MESO/fix_mvv_dpd.h index c8d1626a42..e6cf370de6 100644 --- a/src/DPD-MESO/fix_mvv_dpd.h +++ b/src/DPD-MESO/fix_mvv_dpd.h @@ -27,12 +27,11 @@ namespace LAMMPS_NS { class FixMvvDPD : public Fix { public: FixMvvDPD(class LAMMPS *, int, char **); - virtual ~FixMvvDPD() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/DPD-MESO/fix_mvv_edpd.h b/src/DPD-MESO/fix_mvv_edpd.h index 06fc373ca5..00b52e02b8 100644 --- a/src/DPD-MESO/fix_mvv_edpd.h +++ b/src/DPD-MESO/fix_mvv_edpd.h @@ -27,12 +27,11 @@ namespace LAMMPS_NS { class FixMvvEDPD : public Fix { public: FixMvvEDPD(class LAMMPS *, int, char **); - virtual ~FixMvvEDPD() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/DPD-MESO/fix_mvv_tdpd.h b/src/DPD-MESO/fix_mvv_tdpd.h index e30b285f6f..4cdd66b01e 100644 --- a/src/DPD-MESO/fix_mvv_tdpd.h +++ b/src/DPD-MESO/fix_mvv_tdpd.h @@ -27,12 +27,11 @@ namespace LAMMPS_NS { class FixMvvTDPD : public Fix { public: FixMvvTDPD(class LAMMPS *, int, char **); - virtual ~FixMvvTDPD() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/DPD-MESO/fix_tdpd_source.h b/src/DPD-MESO/fix_tdpd_source.h index 8bd9778ed0..f20bed4f74 100644 --- a/src/DPD-MESO/fix_tdpd_source.h +++ b/src/DPD-MESO/fix_tdpd_source.h @@ -27,10 +27,9 @@ namespace LAMMPS_NS { class FixTDPDSource : public Fix { public: FixTDPDSource(class LAMMPS *, int, char **); - ~FixTDPDSource() = default; - int setmask(); - void init(); - void post_force(int); + int setmask() override; + void init() override; + void post_force(int) override; protected: int option; diff --git a/src/DPD-MESO/pair_edpd.h b/src/DPD-MESO/pair_edpd.h index a872401a3b..da8cc37d11 100644 --- a/src/DPD-MESO/pair_edpd.h +++ b/src/DPD-MESO/pair_edpd.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairEDPD : public Pair { public: PairEDPD(class LAMMPS *); - virtual ~PairEDPD(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairEDPD() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/DPD-MESO/pair_mdpd.cpp b/src/DPD-MESO/pair_mdpd.cpp index 53994800d0..1b490aa190 100644 --- a/src/DPD-MESO/pair_mdpd.cpp +++ b/src/DPD-MESO/pair_mdpd.cpp @@ -31,7 +31,6 @@ #include "update.h" #include -#include using namespace LAMMPS_NS; diff --git a/src/DPD-MESO/pair_mdpd.h b/src/DPD-MESO/pair_mdpd.h index 746a9ee5c0..56a6636d29 100644 --- a/src/DPD-MESO/pair_mdpd.h +++ b/src/DPD-MESO/pair_mdpd.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairMDPD : public Pair { public: PairMDPD(class LAMMPS *); - virtual ~PairMDPD(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); + ~PairMDPD() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; protected: double cut_global, temperature; diff --git a/src/DPD-MESO/pair_mdpd_rhosum.h b/src/DPD-MESO/pair_mdpd_rhosum.h index c31b6be0ca..e7bc7dec23 100644 --- a/src/DPD-MESO/pair_mdpd_rhosum.h +++ b/src/DPD-MESO/pair_mdpd_rhosum.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairMDPDRhoSum : public Pair { public: PairMDPDRhoSum(class LAMMPS *); - virtual ~PairMDPDRhoSum(); - void init_style(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~PairMDPDRhoSum() override; + void init_style() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: double **cut; diff --git a/src/DPD-MESO/pair_tdpd.h b/src/DPD-MESO/pair_tdpd.h index 71be53934e..0390acad2e 100644 --- a/src/DPD-MESO/pair_tdpd.h +++ b/src/DPD-MESO/pair_tdpd.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairTDPD : public Pair { public: PairTDPD(class LAMMPS *); - virtual ~PairTDPD(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairTDPD() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global, temperature; diff --git a/src/DPD-REACT/atom_vec_dpd.h b/src/DPD-REACT/atom_vec_dpd.h index 3a4e4ecec1..da4387f553 100644 --- a/src/DPD-REACT/atom_vec_dpd.h +++ b/src/DPD-REACT/atom_vec_dpd.h @@ -28,9 +28,9 @@ class AtomVecDPD : public AtomVec { public: AtomVecDPD(class LAMMPS *); - void grow_pointers(); - void unpack_restart_init(int); - void data_atom_post(int); + void grow_pointers() override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; private: double *rho, *dpdTheta; diff --git a/src/DPD-REACT/compute_dpd.h b/src/DPD-REACT/compute_dpd.h index e010ad8288..94c69d0a13 100644 --- a/src/DPD-REACT/compute_dpd.h +++ b/src/DPD-REACT/compute_dpd.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeDpd : public Compute { public: ComputeDpd(class LAMMPS *, int, char **); - ~ComputeDpd(); - void init() {} - void compute_vector(); + ~ComputeDpd() override; + void init() override {} + void compute_vector() override; private: double *dpdU; diff --git a/src/DPD-REACT/compute_dpd_atom.h b/src/DPD-REACT/compute_dpd_atom.h index 7525e1cfab..4889987052 100644 --- a/src/DPD-REACT/compute_dpd_atom.h +++ b/src/DPD-REACT/compute_dpd_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeDpdAtom : public Compute { public: ComputeDpdAtom(class LAMMPS *, int, char **); - ~ComputeDpdAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeDpdAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/DPD-REACT/fix_dpd_energy.h b/src/DPD-REACT/fix_dpd_energy.h index 7a463f64a0..3787b770cd 100644 --- a/src/DPD-REACT/fix_dpd_energy.h +++ b/src/DPD-REACT/fix_dpd_energy.h @@ -27,10 +27,9 @@ namespace LAMMPS_NS { class FixDPDenergy : public Fix { public: FixDPDenergy(class LAMMPS *, int, char **); - virtual ~FixDPDenergy() {} - int setmask(); - virtual void initial_integrate(int); - virtual void final_integrate(); + int setmask() override; + void initial_integrate(int) override; + void final_integrate() override; protected: class PairDPDfdtEnergy *pairDPDE; diff --git a/src/DPD-REACT/fix_eos_cv.h b/src/DPD-REACT/fix_eos_cv.h index 129984b390..b6b663029b 100644 --- a/src/DPD-REACT/fix_eos_cv.h +++ b/src/DPD-REACT/fix_eos_cv.h @@ -27,11 +27,10 @@ namespace LAMMPS_NS { class FixEOScv : public Fix { public: FixEOScv(class LAMMPS *, int, char **); - virtual ~FixEOScv() {} - int setmask(); - virtual void init(); - virtual void post_integrate(); - virtual void end_of_step(); + int setmask() override; + void init() override; + void post_integrate() override; + void end_of_step() override; protected: double cvEOS; diff --git a/src/DPD-REACT/fix_eos_table.h b/src/DPD-REACT/fix_eos_table.h index 4aad90402a..8d6a8c03db 100644 --- a/src/DPD-REACT/fix_eos_table.h +++ b/src/DPD-REACT/fix_eos_table.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixEOStable : public Fix { public: FixEOStable(class LAMMPS *, int, char **); - virtual ~FixEOStable(); - int setmask(); - virtual void init(); - virtual void post_integrate(); - virtual void end_of_step(); + ~FixEOStable() override; + int setmask() override; + void init() override; + void post_integrate() override; + void end_of_step() override; void energy_lookup(double, double &); void temperature_lookup(double, double &); diff --git a/src/DPD-REACT/fix_eos_table_rx.h b/src/DPD-REACT/fix_eos_table_rx.h index a2c4d7860e..3724923276 100644 --- a/src/DPD-REACT/fix_eos_table_rx.h +++ b/src/DPD-REACT/fix_eos_table_rx.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixEOStableRX : public Fix { public: FixEOStableRX(class LAMMPS *, int, char **); - virtual ~FixEOStableRX(); - int setmask(); - void setup(int); - virtual void init(); - virtual void post_integrate(); - virtual void end_of_step(); + ~FixEOStableRX() override; + int setmask() override; + void setup(int) override; + void init() override; + void post_integrate() override; + void end_of_step() override; void energy_lookup(int, double, double &); void temperature_lookup(int, double, double &); @@ -69,10 +69,10 @@ class FixEOStableRX : public Fix { double *dHf, *energyCorr, *tempCorrCoeff, *moleculeCorrCoeff; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; int *eosSpecies; int ncolumn; diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index 165a3a6dbf..f55cb4d943 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -689,20 +689,14 @@ void FixRX::pre_force(int /*vflag*/) // Zero the counters for the ODE solvers. int nSteps = 0; - int nIters = 0; int nFuncs = 0; int nFails = 0; - if (odeIntegrationFlag == ODE_LAMMPS_RKF45 && diagnosticFrequency == 1) - { + if (odeIntegrationFlag == ODE_LAMMPS_RKF45 && diagnosticFrequency == 1) { memory->create( diagnosticCounterPerODE[StepSum], nlocal, "FixRX::diagnosticCounterPerODE"); memory->create( diagnosticCounterPerODE[FuncSum], nlocal, "FixRX::diagnosticCounterPerODE"); } -#if 0 - #pragma omp parallel \ - reduction(+: nSteps, nIters, nFuncs, nFails ) -#endif { double *rwork = new double[8*nspecies]; @@ -712,11 +706,8 @@ void FixRX::pre_force(int /*vflag*/) int ode_counter[4] = { 0 }; - //#pragma omp for schedule(runtime) - for (int i = 0; i < nlocal; i++) - { - if (mask[i] & groupbit) - { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { double theta; if (localTempFlag) theta = dpdThetaLocal[i]; @@ -735,7 +726,6 @@ void FixRX::pre_force(int /*vflag*/) } nSteps += ode_counter[0]; - nIters += ode_counter[1]; nFuncs += ode_counter[2]; nFails += ode_counter[3]; diff --git a/src/DPD-REACT/fix_rx.h b/src/DPD-REACT/fix_rx.h index bd3122e81d..d82eaa8419 100644 --- a/src/DPD-REACT/fix_rx.h +++ b/src/DPD-REACT/fix_rx.h @@ -30,19 +30,19 @@ enum { ODE_LAMMPS_RK4, ODE_LAMMPS_RKF45 }; class FixRX : public Fix { public: FixRX(class LAMMPS *, int, char **); - ~FixRX(); - int setmask(); - void post_constructor(); - virtual void init(); - void init_list(int, class NeighList *); - virtual void setup_pre_force(int); - virtual void pre_force(int); + ~FixRX() override; + int setmask() override; + void post_constructor() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup_pre_force(int) override; + void pre_force(int) override; protected: - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; class NeighList *list; diff --git a/src/DPD-REACT/fix_shardlow.h b/src/DPD-REACT/fix_shardlow.h index c95b90d964..a5481aea92 100644 --- a/src/DPD-REACT/fix_shardlow.h +++ b/src/DPD-REACT/fix_shardlow.h @@ -30,14 +30,14 @@ class FixShardlow : public Fix { class NeighList *list; // The SSA specific neighbor list FixShardlow(class LAMMPS *, int, char **); - ~FixShardlow(); - int setmask(); - virtual void init(); - virtual void init_list(int, class NeighList *); - virtual void setup(int); - virtual void initial_integrate(int); + ~FixShardlow() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void initial_integrate(int) override; - double memory_usage(); + double memory_usage() override; #ifdef DEBUG_SSA_PAIR_CT int counters[2][3]; @@ -45,10 +45,10 @@ class FixShardlow : public Fix { #endif protected: - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; class PairDPDfdt *pairDPD; class PairDPDfdtEnergy *pairDPDE; diff --git a/src/DPD-REACT/nbin_ssa.h b/src/DPD-REACT/nbin_ssa.h index 5285c5b44d..ca04ed4bd5 100644 --- a/src/DPD-REACT/nbin_ssa.h +++ b/src/DPD-REACT/nbin_ssa.h @@ -41,12 +41,11 @@ class NBinSSA : public NBinStandard { int lbinzhi; // highest local bin z-dim coordinate NBinSSA(class LAMMPS *); - virtual ~NBinSSA() = default; - void bin_atoms_setup(int); - void bin_atoms(); + void bin_atoms_setup(int) override; + void bin_atoms() override; - double memory_usage(); + double memory_usage() override; inline int coord2bin(const double &x, const double &y, const double &z, int &ixo, int &iyo, int &izo) const diff --git a/src/DPD-REACT/npair_half_bin_newton_ssa.h b/src/DPD-REACT/npair_half_bin_newton_ssa.h index 52f3bb5142..265087e7ed 100644 --- a/src/DPD-REACT/npair_half_bin_newton_ssa.h +++ b/src/DPD-REACT/npair_half_bin_newton_ssa.h @@ -41,8 +41,8 @@ class NPairHalfBinNewtonSSA : public NPair { int ssa_maxPhaseLen; NPairHalfBinNewtonSSA(class LAMMPS *); - ~NPairHalfBinNewtonSSA(); - void build(class NeighList *); + ~NPairHalfBinNewtonSSA() override; + void build(class NeighList *) override; private: int ssa_maxPhaseCt; diff --git a/src/DPD-REACT/nstencil_half_bin_2d_ssa.h b/src/DPD-REACT/nstencil_half_bin_2d_ssa.h index 252a59d806..b53deb5e4d 100644 --- a/src/DPD-REACT/nstencil_half_bin_2d_ssa.h +++ b/src/DPD-REACT/nstencil_half_bin_2d_ssa.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilHalfBin2dSSA : public NStencilSSA { public: NStencilHalfBin2dSSA(class LAMMPS *); - ~NStencilHalfBin2dSSA() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/DPD-REACT/nstencil_half_bin_3d_ssa.h b/src/DPD-REACT/nstencil_half_bin_3d_ssa.h index 97c1b891ae..0d3cfd6a26 100644 --- a/src/DPD-REACT/nstencil_half_bin_3d_ssa.h +++ b/src/DPD-REACT/nstencil_half_bin_3d_ssa.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilHalfBin3dSSA : public NStencilSSA { public: NStencilHalfBin3dSSA(class LAMMPS *); - ~NStencilHalfBin3dSSA() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/DPD-REACT/nstencil_ssa.h b/src/DPD-REACT/nstencil_ssa.h index 6cb0868c19..237a9d982f 100644 --- a/src/DPD-REACT/nstencil_ssa.h +++ b/src/DPD-REACT/nstencil_ssa.h @@ -21,8 +21,7 @@ namespace LAMMPS_NS { class NStencilSSA : public NStencil { public: NStencilSSA(class LAMMPS *lmp) : NStencil(lmp) { xyzflag = 1; } - ~NStencilSSA() {} - virtual void create() = 0; + void create() override = 0; // first stencil index for each subphase, with last index at end int nstencil_ssa[5]; diff --git a/src/DPD-REACT/pair_dpd_fdt.h b/src/DPD-REACT/pair_dpd_fdt.h index d721b056db..29c8808768 100644 --- a/src/DPD-REACT/pair_dpd_fdt.h +++ b/src/DPD-REACT/pair_dpd_fdt.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairDPDfdt : public Pair { public: PairDPDfdt(class LAMMPS *); - virtual ~PairDPDfdt(); - void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairDPDfdt() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; double **cut; double **a0; diff --git a/src/DPD-REACT/pair_dpd_fdt_energy.h b/src/DPD-REACT/pair_dpd_fdt_energy.h index 28fdc06de6..7868caa95e 100644 --- a/src/DPD-REACT/pair_dpd_fdt_energy.h +++ b/src/DPD-REACT/pair_dpd_fdt_energy.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairDPDfdtEnergy : public Pair { public: PairDPDfdtEnergy(class LAMMPS *); - virtual ~PairDPDfdtEnergy(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + ~PairDPDfdtEnergy() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; double **cut; double **a0; diff --git a/src/DPD-REACT/pair_exp6_rx.h b/src/DPD-REACT/pair_exp6_rx.h index 719d8776b0..8c254cd5aa 100644 --- a/src/DPD-REACT/pair_exp6_rx.h +++ b/src/DPD-REACT/pair_exp6_rx.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairExp6rx : public Pair { public: PairExp6rx(class LAMMPS *); - virtual ~PairExp6rx(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + ~PairExp6rx() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; struct Param { double epsilon, rm, alpha; @@ -62,7 +62,7 @@ class PairExp6rx : public Pair { int nspecies; virtual void read_file(char *); void read_file2(char *); - void setup(); + void setup() override; int isite1, isite2; char *site1, *site2; diff --git a/src/DPD-REACT/pair_multi_lucy.h b/src/DPD-REACT/pair_multi_lucy.h index 7de798e9d3..581310758d 100644 --- a/src/DPD-REACT/pair_multi_lucy.h +++ b/src/DPD-REACT/pair_multi_lucy.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairMultiLucy : public Pair { public: PairMultiLucy(class LAMMPS *); - virtual ~PairMultiLucy(); + ~PairMultiLucy() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void computeLocalDensity(); double rho_0; diff --git a/src/DPD-REACT/pair_multi_lucy_rx.h b/src/DPD-REACT/pair_multi_lucy_rx.h index a0d4caadf5..bfaf09b083 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.h +++ b/src/DPD-REACT/pair_multi_lucy_rx.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairMultiLucyRX : public Pair { public: PairMultiLucyRX(class LAMMPS *); - virtual ~PairMultiLucyRX(); + ~PairMultiLucyRX() override; - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - virtual int pack_reverse_comm(int, int, double *); - virtual void unpack_reverse_comm(int, int *, double *); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void computeLocalDensity(); double rho_0; diff --git a/src/DPD-REACT/pair_table_rx.h b/src/DPD-REACT/pair_table_rx.h index 49bf7811a3..1071c8822b 100644 --- a/src/DPD-REACT/pair_table_rx.h +++ b/src/DPD-REACT/pair_table_rx.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairTableRX : public PairTable { public: PairTableRX(class LAMMPS *); - virtual ~PairTableRX(); + ~PairTableRX() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double single(int, int, int, int, double, double, double, double &) override; protected: int nspecies; diff --git a/src/DPD-SMOOTH/fix_meso_move.h b/src/DPD-SMOOTH/fix_meso_move.h index 5a649128e5..5b05741fe5 100644 --- a/src/DPD-SMOOTH/fix_meso_move.h +++ b/src/DPD-SMOOTH/fix_meso_move.h @@ -27,27 +27,27 @@ namespace LAMMPS_NS { class FixMesoMove : public Fix { public: FixMesoMove(class LAMMPS *, int, char **); - ~FixMesoMove(); - int setmask(); - void init(); - void setup_pre_force(int); - void initial_integrate(int); - void final_integrate(); + ~FixMesoMove() override; + int setmask() override; + void init() override; + void setup_pre_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; - double memory_usage(); - void write_restart(FILE *); - void restart(char *); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int maxsize_restart(); - int size_restart(int); + double memory_usage() override; + void write_restart(FILE *) override; + void restart(char *) override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int maxsize_restart() override; + int size_restart(int) override; - void reset_dt(); + void reset_dt() override; private: char *xvarstr, *yvarstr, *zvarstr, *vxvarstr, *vyvarstr, *vzvarstr; diff --git a/src/DPD-SMOOTH/fix_rigid_meso.h b/src/DPD-SMOOTH/fix_rigid_meso.h index 02f6ca74da..3f44a81f03 100644 --- a/src/DPD-SMOOTH/fix_rigid_meso.h +++ b/src/DPD-SMOOTH/fix_rigid_meso.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixRigidMeso : public FixRigid { public: FixRigidMeso(class LAMMPS *, int, char **); - ~FixRigidMeso(); - int setmask(); - void setup(int); - void initial_integrate(int); - void final_integrate(); - double compute_scalar() { return 0.0; } - double compute_array(int, int); + ~FixRigidMeso() override; + int setmask() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + double compute_scalar() override { return 0.0; } + double compute_array(int, int) override; protected: void set_xv(); diff --git a/src/DPD-SMOOTH/pair_sdpd_taitwater_isothermal.h b/src/DPD-SMOOTH/pair_sdpd_taitwater_isothermal.h index bafd270e96..475ac1fb53 100644 --- a/src/DPD-SMOOTH/pair_sdpd_taitwater_isothermal.h +++ b/src/DPD-SMOOTH/pair_sdpd_taitwater_isothermal.h @@ -31,12 +31,12 @@ namespace LAMMPS_NS { class PairSDPDTaitwaterIsothermal : public Pair { public: PairSDPDTaitwaterIsothermal(class LAMMPS *); - virtual ~PairSDPDTaitwaterIsothermal(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual void init_style(); + ~PairSDPDTaitwaterIsothermal() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; protected: double viscosity, temperature; diff --git a/src/DRUDE/compute_temp_drude.h b/src/DRUDE/compute_temp_drude.h index e1cd54edc8..7a16b208cc 100644 --- a/src/DRUDE/compute_temp_drude.h +++ b/src/DRUDE/compute_temp_drude.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeTempDrude : public Compute { public: ComputeTempDrude(class LAMMPS *, int, char **); - ~ComputeTempDrude(); - void init(); - void setup(); - void compute_vector(); - double compute_scalar(); + ~ComputeTempDrude() override; + void init() override; + void setup() override; + void compute_vector() override; + double compute_scalar() override; int modify_param(int, char **); private: diff --git a/src/DRUDE/fix_drude.h b/src/DRUDE/fix_drude.h index b563de485d..fcec09a419 100644 --- a/src/DRUDE/fix_drude.h +++ b/src/DRUDE/fix_drude.h @@ -36,17 +36,17 @@ class FixDrude : public Fix { bool is_reduced; FixDrude(class LAMMPS *, int, char **); - virtual ~FixDrude(); - int setmask(); - void init(); + ~FixDrude() override; + int setmask() override; + void init() override; - void grow_arrays(int nmax); - void copy_arrays(int i, int j, int delflag); - void set_arrays(int i); - int pack_exchange(int i, double *buf); - int unpack_exchange(int nlocal, double *buf); - int pack_border(int n, int *list, double *buf); - int unpack_border(int n, int first, double *buf); + void grow_arrays(int nmax) override; + void copy_arrays(int i, int j, int delflag) override; + void set_arrays(int i) override; + int pack_exchange(int i, double *buf) override; + int unpack_exchange(int nlocal, double *buf) override; + int pack_border(int n, int *list, double *buf) override; + int unpack_border(int n, int first, double *buf) override; private: int rebuildflag; @@ -55,7 +55,7 @@ class FixDrude : public Fix { void build_drudeid(); static void ring_search_drudeid(int size, char *cbuf, void *ptr); static void ring_build_partner(int size, char *cbuf, void *ptr); - void rebuild_special(); + void rebuild_special() override; static void ring_remove_drude(int size, char *cbuf, void *ptr); static void ring_add_drude(int size, char *cbuf, void *ptr); static void ring_copy_drude(int size, char *cbuf, void *ptr); diff --git a/src/DRUDE/fix_drude_transform.h b/src/DRUDE/fix_drude_transform.h index 495ec8b175..cfe159c236 100644 --- a/src/DRUDE/fix_drude_transform.h +++ b/src/DRUDE/fix_drude_transform.h @@ -28,16 +28,16 @@ namespace LAMMPS_NS { template class FixDrudeTransform: public Fix { public: FixDrudeTransform(class LAMMPS *, int, char **); - ~FixDrudeTransform(); - int setmask(); - void init(); - void setup(int vflag); + ~FixDrudeTransform() override; + int setmask() override; + void init() override; + void setup(int vflag) override; void reduced_to_real(); void real_to_reduced(); - void initial_integrate(int vflag); - void final_integrate(); - int pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc); - void unpack_forward_comm(int n, int first, double *buf); + void initial_integrate(int vflag) override; + void final_integrate() override; + int pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) override; + void unpack_forward_comm(int n, int first, double *buf) override; protected: double *mcoeff; diff --git a/src/DRUDE/fix_langevin_drude.h b/src/DRUDE/fix_langevin_drude.h index 939de2db48..38bc417929 100644 --- a/src/DRUDE/fix_langevin_drude.h +++ b/src/DRUDE/fix_langevin_drude.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixLangevinDrude : public Fix { public: FixLangevinDrude(class LAMMPS *, int, char **); - virtual ~FixLangevinDrude(); - int setmask(); - void init(); - void setup(int vflag); - virtual void post_force(int vflag); - void reset_target(double); - virtual void *extract(const char *, int &); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int modify_param(int, char **); + ~FixLangevinDrude() override; + int setmask() override; + void init() override; + void setup(int vflag) override; + void post_force(int vflag) override; + void reset_target(double) override; + void *extract(const char *, int &) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int modify_param(int, char **) override; protected: double t_start_core, t_period_core, t_target_core; diff --git a/src/DRUDE/fix_tgnh_drude.h b/src/DRUDE/fix_tgnh_drude.h index 598a407ff4..c486c301f7 100644 --- a/src/DRUDE/fix_tgnh_drude.h +++ b/src/DRUDE/fix_tgnh_drude.h @@ -21,25 +21,25 @@ namespace LAMMPS_NS { class FixTGNHDrude : public Fix { public: FixTGNHDrude(class LAMMPS *, int, char **); - virtual ~FixTGNHDrude(); - int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - void pre_force_respa(int, int, int); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); - virtual void pre_exchange(); - double compute_scalar(); - virtual double compute_vector(int); - void write_restart(FILE *); + ~FixTGNHDrude() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void pre_force_respa(int, int, int) override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void pre_exchange() override; + double compute_scalar() override; + double compute_vector(int) override; + void write_restart(FILE *) override; virtual int pack_restart_data(double *); // pack restart data - virtual void restart(char *); - int modify_param(int, char **); - void reset_target(double); - void reset_dt(); - double memory_usage(); + void restart(char *) override; + int modify_param(int, char **) override; + void reset_target(double) override; + void reset_dt() override; + double memory_usage() override; protected: int dimension, which; diff --git a/src/DRUDE/fix_tgnpt_drude.h b/src/DRUDE/fix_tgnpt_drude.h index 1fe30705eb..c777cc1134 100644 --- a/src/DRUDE/fix_tgnpt_drude.h +++ b/src/DRUDE/fix_tgnpt_drude.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixTGNPTDrude : public FixTGNHDrude { public: FixTGNPTDrude(class LAMMPS *, int, char **); - ~FixTGNPTDrude() {} }; } // namespace LAMMPS_NS diff --git a/src/DRUDE/fix_tgnvt_drude.h b/src/DRUDE/fix_tgnvt_drude.h index 9c06df66a8..d192b2353c 100644 --- a/src/DRUDE/fix_tgnvt_drude.h +++ b/src/DRUDE/fix_tgnvt_drude.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixTGNVTDrude : public FixTGNHDrude { public: FixTGNVTDrude(class LAMMPS *, int, char **); - ~FixTGNVTDrude() {} }; } // namespace LAMMPS_NS diff --git a/src/DRUDE/pair_coul_tt.h b/src/DRUDE/pair_coul_tt.h index cb7139a720..bbd2163634 100644 --- a/src/DRUDE/pair_coul_tt.h +++ b/src/DRUDE/pair_coul_tt.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairCoulTT : public Pair { public: PairCoulTT(class LAMMPS *); - virtual ~PairCoulTT(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairCoulTT() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: int n_global; diff --git a/src/DRUDE/pair_lj_cut_thole_long.h b/src/DRUDE/pair_lj_cut_thole_long.h index eb26966d72..3497a78730 100644 --- a/src/DRUDE/pair_lj_cut_thole_long.h +++ b/src/DRUDE/pair_lj_cut_thole_long.h @@ -28,19 +28,19 @@ class PairLJCutTholeLong : public Pair { public: PairLJCutTholeLong(class LAMMPS *); - virtual ~PairLJCutTholeLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual void *extract(const char *, int &); + ~PairLJCutTholeLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/DRUDE/pair_thole.h b/src/DRUDE/pair_thole.h index 15dd1737be..164fb4c398 100644 --- a/src/DRUDE/pair_thole.h +++ b/src/DRUDE/pair_thole.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairThole : public Pair { public: PairThole(class LAMMPS *); - virtual ~PairThole(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairThole() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double thole_global; diff --git a/src/Depend.sh b/src/Depend.sh index a8e17e0546..5123354b1c 100755 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -135,6 +135,10 @@ if (test $1 = "PYTHON") then depend ML-IAP fi +if (test $1 = "PHONON") then + depend KOKKOS +fi + if (test $1 = "RIGID") then depend KOKKOS depend OPENMP diff --git a/src/EFF/atom_vec_electron.h b/src/EFF/atom_vec_electron.h index 50883e0764..6c9b11cccb 100644 --- a/src/EFF/atom_vec_electron.h +++ b/src/EFF/atom_vec_electron.h @@ -28,12 +28,12 @@ class AtomVecElectron : public AtomVec { public: AtomVecElectron(class LAMMPS *); - void grow_pointers(); - void force_clear(int, size_t); - void create_atom_post(int); - void data_atom_post(int); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void create_atom_post(int) override; + void data_atom_post(int) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; private: int *spin; diff --git a/src/EFF/compute_ke_atom_eff.h b/src/EFF/compute_ke_atom_eff.h index 160b8ac96e..b5ad27b524 100644 --- a/src/EFF/compute_ke_atom_eff.h +++ b/src/EFF/compute_ke_atom_eff.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeKEAtomEff : public Compute { public: ComputeKEAtomEff(class LAMMPS *, int, char **); - ~ComputeKEAtomEff(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeKEAtomEff() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/EFF/compute_ke_eff.h b/src/EFF/compute_ke_eff.h index 7e8063ba18..cc5baa863f 100644 --- a/src/EFF/compute_ke_eff.h +++ b/src/EFF/compute_ke_eff.h @@ -27,9 +27,8 @@ namespace LAMMPS_NS { class ComputeKEEff : public Compute { public: ComputeKEEff(class LAMMPS *, int, char **); - ~ComputeKEEff(){}; - void init(); - double compute_scalar(); + void init() override; + double compute_scalar() override; private: double pfactor; diff --git a/src/EFF/compute_temp_deform_eff.h b/src/EFF/compute_temp_deform_eff.h index e90ba0465e..5490abd9ca 100644 --- a/src/EFF/compute_temp_deform_eff.h +++ b/src/EFF/compute_temp_deform_eff.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class ComputeTempDeformEff : public Compute { public: ComputeTempDeformEff(class LAMMPS *, int, char **); - virtual ~ComputeTempDeformEff(); - void init(); - void setup(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputeTempDeformEff() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); - double memory_usage(); + void remove_bias(int, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; + double memory_usage() override; protected: double tfactor; diff --git a/src/EFF/compute_temp_eff.h b/src/EFF/compute_temp_eff.h index 112b51d9d7..bc2bbc3597 100644 --- a/src/EFF/compute_temp_eff.h +++ b/src/EFF/compute_temp_eff.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeTempEff : public Compute { public: ComputeTempEff(class LAMMPS *, int, char **); - virtual ~ComputeTempEff(); - void init() {} - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempEff() override; + void init() override {} + void setup() override; + double compute_scalar() override; + void compute_vector() override; private: double tfactor; diff --git a/src/EFF/compute_temp_region_eff.h b/src/EFF/compute_temp_region_eff.h index 08211c63c8..bc8f930374 100644 --- a/src/EFF/compute_temp_region_eff.h +++ b/src/EFF/compute_temp_region_eff.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class ComputeTempRegionEff : public Compute { public: ComputeTempRegionEff(class LAMMPS *, int, char **); - virtual ~ComputeTempRegionEff(); - void init(); - void setup(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputeTempRegionEff() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void dof_remove_pre(); - int dof_remove(int); - void remove_bias(int, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); - double memory_usage(); + void dof_remove_pre() override; + int dof_remove(int) override; + void remove_bias(int, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; + double memory_usage() override; protected: int iregion; diff --git a/src/EFF/fix_langevin_eff.h b/src/EFF/fix_langevin_eff.h index 3176fdf9c1..c7681fc4cf 100644 --- a/src/EFF/fix_langevin_eff.h +++ b/src/EFF/fix_langevin_eff.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixLangevinEff : public FixLangevin { public: FixLangevinEff(class LAMMPS *, int, char **); - ~FixLangevinEff(); - void end_of_step(); - double compute_scalar(); - void post_force(int); + ~FixLangevinEff() override; + void end_of_step() override; + double compute_scalar() override; + void post_force(int) override; private: double *erforcelangevin; diff --git a/src/EFF/fix_nh_eff.h b/src/EFF/fix_nh_eff.h index 32a96efd96..9860f81ba2 100644 --- a/src/EFF/fix_nh_eff.h +++ b/src/EFF/fix_nh_eff.h @@ -21,12 +21,11 @@ namespace LAMMPS_NS { class FixNHEff : public FixNH { public: FixNHEff(class LAMMPS *, int, char **); - virtual ~FixNHEff() {} protected: - void nve_v(); - void nve_x(); - virtual void nh_v_temp(); + void nve_v() override; + void nve_x() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/EFF/fix_nph_eff.h b/src/EFF/fix_nph_eff.h index 7fdbe38d5a..45e8c02ea5 100644 --- a/src/EFF/fix_nph_eff.h +++ b/src/EFF/fix_nph_eff.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHEff : public FixNHEff { public: FixNPHEff(class LAMMPS *, int, char **); - ~FixNPHEff() {} }; } // namespace LAMMPS_NS diff --git a/src/EFF/fix_npt_eff.h b/src/EFF/fix_npt_eff.h index 060b24b38a..107130685d 100644 --- a/src/EFF/fix_npt_eff.h +++ b/src/EFF/fix_npt_eff.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTEff : public FixNHEff { public: FixNPTEff(class LAMMPS *, int, char **); - ~FixNPTEff() {} }; } // namespace LAMMPS_NS diff --git a/src/EFF/fix_nve_eff.h b/src/EFF/fix_nve_eff.h index cab149ee36..b4fea154af 100644 --- a/src/EFF/fix_nve_eff.h +++ b/src/EFF/fix_nve_eff.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixNVEEff : public Fix { public: FixNVEEff(class LAMMPS *, int, char **); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); - void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/EFF/fix_nvt_eff.h b/src/EFF/fix_nvt_eff.h index 96e4cab6eb..602ff97eee 100644 --- a/src/EFF/fix_nvt_eff.h +++ b/src/EFF/fix_nvt_eff.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTEff : public FixNHEff { public: FixNVTEff(class LAMMPS *, int, char **); - ~FixNVTEff() {} }; } // namespace LAMMPS_NS diff --git a/src/EFF/fix_nvt_sllod_eff.h b/src/EFF/fix_nvt_sllod_eff.h index 8ac3357627..f014f9c956 100644 --- a/src/EFF/fix_nvt_sllod_eff.h +++ b/src/EFF/fix_nvt_sllod_eff.h @@ -27,13 +27,12 @@ namespace LAMMPS_NS { class FixNVTSllodEff : public FixNHEff { public: FixNVTSllodEff(class LAMMPS *, int, char **); - ~FixNVTSllodEff() {} - void init(); + void init() override; private: int nondeformbias; - void nh_v_temp(); + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/EFF/fix_temp_rescale_eff.h b/src/EFF/fix_temp_rescale_eff.h index d4e29d1c8c..bbcc3396aa 100644 --- a/src/EFF/fix_temp_rescale_eff.h +++ b/src/EFF/fix_temp_rescale_eff.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixTempRescaleEff : public Fix { public: FixTempRescaleEff(class LAMMPS *, int, char **); - virtual ~FixTempRescaleEff(); - int setmask(); - void init(); - virtual void end_of_step(); - int modify_param(int, char **); - void reset_target(double); - double compute_scalar(); + ~FixTempRescaleEff() override; + int setmask() override; + void init() override; + void end_of_step() override; + int modify_param(int, char **) override; + void reset_target(double) override; + double compute_scalar() override; protected: int which; diff --git a/src/EFF/pair_eff_cut.h b/src/EFF/pair_eff_cut.h index 0e086e62d6..5fcb98063b 100644 --- a/src/EFF/pair_eff_cut.h +++ b/src/EFF/pair_eff_cut.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairEffCut : public Pair { public: PairEffCut(class LAMMPS *); - virtual ~PairEffCut(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); + ~PairEffCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; void min_pointers(double **, double **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; - void min_xf_pointers(int, double **, double **); - void min_xf_get(int); - void min_x_set(int); - double memory_usage(); + void min_xf_pointers(int, double **, double **) override; + void min_xf_get(int) override; + void min_x_set(int) override; + double memory_usage() override; private: int limit_eradius_flag, pressure_with_evirials_flag; diff --git a/src/EXTRA-COMPUTE/compute_ackland_atom.h b/src/EXTRA-COMPUTE/compute_ackland_atom.h index 657f419c86..5c4234e728 100644 --- a/src/EXTRA-COMPUTE/compute_ackland_atom.h +++ b/src/EXTRA-COMPUTE/compute_ackland_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeAcklandAtom : public Compute { public: ComputeAcklandAtom(class LAMMPS *, int, char **); - ~ComputeAcklandAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeAcklandAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax, maxneigh, legacy; diff --git a/src/EXTRA-COMPUTE/compute_adf.h b/src/EXTRA-COMPUTE/compute_adf.h index 6f7f8f35a4..817fbfa01e 100644 --- a/src/EXTRA-COMPUTE/compute_adf.h +++ b/src/EXTRA-COMPUTE/compute_adf.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeADF : public Compute { public: ComputeADF(class LAMMPS *, int, char **); - ~ComputeADF(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); + ~ComputeADF() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_array() override; private: int nbin; // # of adf bins diff --git a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp index 14a4c364a1..7473aecdb2 100644 --- a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp @@ -17,9 +17,7 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "group.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" @@ -27,7 +25,6 @@ #include "update.h" #include "math_const.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h index 9b5e38750b..8e8ab0282d 100644 --- a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeAveSphereAtom : public Compute { public: ComputeAveSphereAtom(class LAMMPS *, int, char **); - virtual ~ComputeAveSphereAtom(); - virtual void init(); - void init_list(int, class NeighList *); - virtual void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~ComputeAveSphereAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; protected: int nmax; diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.h b/src/EXTRA-COMPUTE/compute_basal_atom.h index 45527411ec..75dabb22f9 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.h +++ b/src/EXTRA-COMPUTE/compute_basal_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeBasalAtom : public Compute { public: ComputeBasalAtom(class LAMMPS *, int, char **); - ~ComputeBasalAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeBasalAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax, maxneigh; diff --git a/src/EXTRA-COMPUTE/compute_cnp_atom.h b/src/EXTRA-COMPUTE/compute_cnp_atom.h index 03c52c401a..050a1a7fb2 100644 --- a/src/EXTRA-COMPUTE/compute_cnp_atom.h +++ b/src/EXTRA-COMPUTE/compute_cnp_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeCNPAtom : public Compute { public: ComputeCNPAtom(class LAMMPS *, int, char **); - ~ComputeCNPAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeCNPAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: //revise diff --git a/src/EXTRA-COMPUTE/compute_entropy_atom.h b/src/EXTRA-COMPUTE/compute_entropy_atom.h index a122b2595d..eaca1ee395 100644 --- a/src/EXTRA-COMPUTE/compute_entropy_atom.h +++ b/src/EXTRA-COMPUTE/compute_entropy_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeEntropyAtom : public Compute { public: ComputeEntropyAtom(class LAMMPS *, int, char **); - ~ComputeEntropyAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeEntropyAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax, maxneigh, nbin; diff --git a/src/EXTRA-COMPUTE/compute_gyration_shape.h b/src/EXTRA-COMPUTE/compute_gyration_shape.h index 8f74082eec..60419d2324 100644 --- a/src/EXTRA-COMPUTE/compute_gyration_shape.h +++ b/src/EXTRA-COMPUTE/compute_gyration_shape.h @@ -29,9 +29,9 @@ class ComputeGyrationShape : public Compute { char *id_gyration; // fields accessed by other classes ComputeGyrationShape(class LAMMPS *, int, char **); - ~ComputeGyrationShape(); - void init(); - void compute_vector(); + ~ComputeGyrationShape() override; + void init() override; + void compute_vector() override; private: class Compute *c_gyration; diff --git a/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h b/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h index bfabfaa46d..f6437873f3 100644 --- a/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h +++ b/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h @@ -29,14 +29,14 @@ class ComputeGyrationShapeChunk : public Compute { char *id_gyration_chunk; // fields accessed by other classes ComputeGyrationShapeChunk(class LAMMPS *, int, char **); - ~ComputeGyrationShapeChunk(); - void init(); - void setup(); - void compute_array(); + ~ComputeGyrationShapeChunk() override; + void init() override; + void setup() override; + void compute_array() override; - int lock_length(); + int lock_length() override; - double memory_usage(); + double memory_usage() override; private: int current_nchunks, former_nchunks; diff --git a/src/EXTRA-COMPUTE/compute_hexorder_atom.h b/src/EXTRA-COMPUTE/compute_hexorder_atom.h index 34653621ea..ad1fd45e15 100644 --- a/src/EXTRA-COMPUTE/compute_hexorder_atom.h +++ b/src/EXTRA-COMPUTE/compute_hexorder_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeHexOrderAtom : public Compute { public: ComputeHexOrderAtom(class LAMMPS *, int, char **); - ~ComputeHexOrderAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeHexOrderAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax, maxneigh, ncol, nnn, ndegree; diff --git a/src/EXTRA-COMPUTE/compute_hma.h b/src/EXTRA-COMPUTE/compute_hma.h index 750f5fc242..d15c6f4317 100644 --- a/src/EXTRA-COMPUTE/compute_hma.h +++ b/src/EXTRA-COMPUTE/compute_hma.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class ComputeHMA : public Compute { public: ComputeHMA(class LAMMPS *, int, char **); - ~ComputeHMA(); - void setup(); - void init(); - void init_list(int, class NeighList *); - void compute_vector(); - void set_arrays(int); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~ComputeHMA() override; + void setup() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_vector() override; + void set_arrays(int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: int nmax; diff --git a/src/EXTRA-COMPUTE/compute_momentum.h b/src/EXTRA-COMPUTE/compute_momentum.h index b6cfec95f6..60d5616d53 100644 --- a/src/EXTRA-COMPUTE/compute_momentum.h +++ b/src/EXTRA-COMPUTE/compute_momentum.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeMomentum : public Compute { public: ComputeMomentum(class LAMMPS *, int, char **); - virtual ~ComputeMomentum(); + ~ComputeMomentum() override; - virtual void init(); - virtual void compute_vector(); + void init() override; + void compute_vector() override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-COMPUTE/compute_msd_nongauss.h b/src/EXTRA-COMPUTE/compute_msd_nongauss.h index d94adf74c4..56edc90e3b 100644 --- a/src/EXTRA-COMPUTE/compute_msd_nongauss.h +++ b/src/EXTRA-COMPUTE/compute_msd_nongauss.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class ComputeMSDNonGauss : public ComputeMSD { public: ComputeMSDNonGauss(class LAMMPS *, int, char **); - ~ComputeMSDNonGauss() {} - void compute_vector(); + void compute_vector() override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-COMPUTE/compute_pressure_cylinder.h b/src/EXTRA-COMPUTE/compute_pressure_cylinder.h index 11202f6f85..871c820910 100644 --- a/src/EXTRA-COMPUTE/compute_pressure_cylinder.h +++ b/src/EXTRA-COMPUTE/compute_pressure_cylinder.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputePressureCyl : public Compute { public: ComputePressureCyl(class LAMMPS *, int, char **); - ~ComputePressureCyl(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); - double memory_usage(); + ~ComputePressureCyl() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_array() override; + double memory_usage() override; private: int nbins, nphi, nzbins; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index 29e85e190c..c247450019 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -31,10 +31,10 @@ namespace LAMMPS_NS { class ComputeStressMop : public Compute { public: ComputeStressMop(class LAMMPS *, int, char **); - virtual ~ComputeStressMop(); - void init(); - void init_list(int, class NeighList *); - void compute_vector(); + ~ComputeStressMop() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_vector() override; private: void compute_pairs(); diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h index 8269fff269..f67448ca40 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h @@ -31,10 +31,10 @@ namespace LAMMPS_NS { class ComputeStressMopProfile : public Compute { public: ComputeStressMopProfile(class LAMMPS *, int, char **); - virtual ~ComputeStressMopProfile(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); + ~ComputeStressMopProfile() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_array() override; private: void compute_pairs(); diff --git a/src/EXTRA-COMPUTE/compute_temp_rotate.h b/src/EXTRA-COMPUTE/compute_temp_rotate.h index af218e756c..76eec14c31 100644 --- a/src/EXTRA-COMPUTE/compute_temp_rotate.h +++ b/src/EXTRA-COMPUTE/compute_temp_rotate.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class ComputeTempRotate : public Compute { public: ComputeTempRotate(class LAMMPS *, int, char **); - ~ComputeTempRotate(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempRotate() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); - void restore_bias_thr(int, double *, double *); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; + void restore_bias_thr(int, double *, double *) override; - double memory_usage(); + double memory_usage() override; private: double tfactor, masstotal; diff --git a/src/EXTRA-COMPUTE/compute_ti.h b/src/EXTRA-COMPUTE/compute_ti.h index 55d10c446c..e68decdceb 100644 --- a/src/EXTRA-COMPUTE/compute_ti.h +++ b/src/EXTRA-COMPUTE/compute_ti.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeTI : public Compute { public: ComputeTI(class LAMMPS *, int, char **); - ~ComputeTI(); - void init(); - double compute_scalar(); + ~ComputeTI() override; + void init() override; + double compute_scalar() override; private: int nterms; diff --git a/src/EXTRA-DUMP/dump_dcd.h b/src/EXTRA-DUMP/dump_dcd.h index b445742104..e6e7e3c766 100644 --- a/src/EXTRA-DUMP/dump_dcd.h +++ b/src/EXTRA-DUMP/dump_dcd.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpDCD : public Dump { public: DumpDCD(LAMMPS *, int, char **); - virtual ~DumpDCD(); + ~DumpDCD() override; private: int natoms, ntotal; @@ -36,13 +36,13 @@ class DumpDCD : public Dump { float *coords, *xf, *yf, *zf; int unwrap_flag; // 1 if atom coords are unwrapped, 0 if no - void init_style(); - void openfile(); - void write_header(bigint); - void pack(tagint *); - void write_data(int, double *); - int modify_param(int, char **); - double memory_usage(); + void init_style() override; + void openfile() override; + void write_header(bigint) override; + void pack(tagint *) override; + void write_data(int, double *) override; + int modify_param(int, char **) override; + double memory_usage() override; void write_frame(); void write_dcd_header(const char *); diff --git a/src/EXTRA-DUMP/dump_xtc.h b/src/EXTRA-DUMP/dump_xtc.h index ef26b70295..4fd5ee57ff 100644 --- a/src/EXTRA-DUMP/dump_xtc.h +++ b/src/EXTRA-DUMP/dump_xtc.h @@ -28,7 +28,7 @@ namespace LAMMPS_NS { class DumpXTC : public Dump { public: DumpXTC(class LAMMPS *, int, char **); - virtual ~DumpXTC(); + ~DumpXTC() override; private: int natoms, ntotal; @@ -39,13 +39,13 @@ class DumpXTC : public Dump { double sfactor, tfactor; // scaling factors for positions and time unit XDR xd; - void init_style(); - int modify_param(int, char **); - void openfile(); - void write_header(bigint); - void pack(tagint *); - void write_data(int, double *); - double memory_usage(); + void init_style() override; + int modify_param(int, char **) override; + void openfile() override; + void write_header(bigint) override; + void pack(tagint *) override; + void write_data(int, double *) override; + double memory_usage() override; void write_frame(); }; diff --git a/src/EXTRA-FIX/fix_addtorque.h b/src/EXTRA-FIX/fix_addtorque.h index 74f6fa2495..827e47ab80 100644 --- a/src/EXTRA-FIX/fix_addtorque.h +++ b/src/EXTRA-FIX/fix_addtorque.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixAddTorque : public Fix { public: FixAddTorque(class LAMMPS *, int, char **); - ~FixAddTorque(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixAddTorque() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; private: double xvalue, yvalue, zvalue; diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.h b/src/EXTRA-FIX/fix_ave_correlate_long.h index a31ae78217..6c0ca63a39 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.h +++ b/src/EXTRA-FIX/fix_ave_correlate_long.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixAveCorrelateLong : public Fix { public: FixAveCorrelateLong(class LAMMPS *, int, char **); - ~FixAveCorrelateLong(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); + ~FixAveCorrelateLong() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; - void write_restart(FILE *); - void restart(char *); - double memory_usage(); + void write_restart(FILE *) override; + void restart(char *) override; + double memory_usage() override; double *t; // Time steps for result arrays double **f; // Result arrays diff --git a/src/EXTRA-FIX/fix_controller.h b/src/EXTRA-FIX/fix_controller.h index b5678690bd..f8f7c826b3 100644 --- a/src/EXTRA-FIX/fix_controller.h +++ b/src/EXTRA-FIX/fix_controller.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixController : public Fix { public: FixController(class LAMMPS *, int, char **); - ~FixController(); - int setmask(); - void init(); - void end_of_step(); - void reset_dt(); - double compute_vector(int); + ~FixController() override; + int setmask() override; + void init() override; + void end_of_step() override; + void reset_dt() override; + double compute_vector(int) override; private: double kp, ki, kd, alpha, tau; diff --git a/src/EXTRA-FIX/fix_drag.h b/src/EXTRA-FIX/fix_drag.h index b5e978f590..9c2739cfe9 100644 --- a/src/EXTRA-FIX/fix_drag.h +++ b/src/EXTRA-FIX/fix_drag.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixDrag : public Fix { public: FixDrag(class LAMMPS *, int, char **); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_vector(int); + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_vector(int) override; private: double xc, yc, zc; diff --git a/src/EXTRA-FIX/fix_electron_stopping.cpp b/src/EXTRA-FIX/fix_electron_stopping.cpp index bd54fea97d..5bb3831d46 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping.cpp @@ -29,11 +29,13 @@ #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" +#include "potential_file_reader.h" #include "region.h" #include "update.h" #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -236,49 +238,43 @@ double FixElectronStopping::compute_scalar() return SeLoss_all; } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + read electron stopping parameters. only called from MPI rank 0. + format: energy then one column per atom type + read as many lines as available. + energies must be sorted in ascending order. + ---------------------------------------------------------------------- */ void FixElectronStopping::read_table(const char *file) { - char line[MAXLINE]; - - FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == nullptr) - error->one(FLERR,"Cannot open stopping range table {}: {}", file, utils::getsyserror()); - const int ncol = atom->ntypes + 1; + int nlines = 0; + PotentialFileReader reader(lmp, file, "electron stopping data table"); - int l = 0; - while (true) { - if (fgets(line, MAXLINE, fp) == nullptr) break; // end of file - if (line[0] == '#') continue; // comment + try { + char *line; + double oldvalue = 0.0; - char *pch = strtok(line, " \t\n\r"); - if (pch == nullptr) continue; // blank line + while ((line = reader.next_line())) { + if (nlines >= maxlines) grow_table(); + ValueTokenizer values(line); + elstop_ranges[0][nlines] = values.next_double(); + if (elstop_ranges[0][nlines] <= oldvalue) + throw TokenizerException("energy values must be positive and in ascending order",line); - if (l >= maxlines) grow_table(); + oldvalue = elstop_ranges[0][nlines]; + for (int i = 1; i < ncol; ++i) + elstop_ranges[i][nlines] = values.next_double(); - int i = 0; - for ( ; i < ncol && pch != nullptr; i++) { - elstop_ranges[i][l] = utils::numeric(FLERR, pch,false,lmp); - pch = strtok(nullptr, " \t\n\r"); + ++nlines; } - - if (i != ncol || pch != nullptr) // too short or too long - error->one(FLERR, "fix electron/stopping: Invalid table line"); - - if (l >= 1 && elstop_ranges[0][l] <= elstop_ranges[0][l-1]) - error->one(FLERR, - "fix electron/stopping: Energies must be in ascending order"); - - l++; + } catch (std::exception &e) { + error->one(FLERR, "Problem parsing electron stopping data: {}", e.what()); } - table_entries = l; - - if (table_entries == 0) + if (nlines == 0) error->one(FLERR, "Did not find any data in electron/stopping table file"); - fclose(fp); + table_entries = nlines; } /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_electron_stopping.h b/src/EXTRA-FIX/fix_electron_stopping.h index f978164b67..015d444996 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.h +++ b/src/EXTRA-FIX/fix_electron_stopping.h @@ -32,12 +32,12 @@ namespace LAMMPS_NS { class FixElectronStopping : public Fix { public: FixElectronStopping(class LAMMPS *, int, char **); - ~FixElectronStopping(); - int setmask(); - void init(); - void post_force(int); - void init_list(int, class NeighList *); - double compute_scalar(); + ~FixElectronStopping() override; + int setmask() override; + void init() override; + void post_force(int) override; + void init_list(int, class NeighList *) override; + double compute_scalar() override; private: void read_table(const char *); diff --git a/src/EXTRA-FIX/fix_electron_stopping_fit.h b/src/EXTRA-FIX/fix_electron_stopping_fit.h index 304ea79cfa..f6d5a279fd 100644 --- a/src/EXTRA-FIX/fix_electron_stopping_fit.h +++ b/src/EXTRA-FIX/fix_electron_stopping_fit.h @@ -32,13 +32,13 @@ namespace LAMMPS_NS { class FixElectronStoppingFit : public Fix { public: FixElectronStoppingFit(class LAMMPS *, int, char **); - ~FixElectronStoppingFit(); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_scalar(); + ~FixElectronStoppingFit() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_scalar() override; private: double *energy_coh_in, *v_min_sq, *v_max_sq, *drag_fac_in_1, *drag_fac_in_2, *drag_fac_1, diff --git a/src/EXTRA-FIX/fix_ffl.h b/src/EXTRA-FIX/fix_ffl.h index 26e076cb8b..bd29254106 100644 --- a/src/EXTRA-FIX/fix_ffl.h +++ b/src/EXTRA-FIX/fix_ffl.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class FixFFL : public Fix { public: FixFFL(class LAMMPS *, int, char **); - virtual ~FixFFL(); - int setmask(); - void init(); - void setup(int); + ~FixFFL() override; + int setmask() override; + void init() override; + void setup(int) override; void ffl_integrate(); - void initial_integrate_respa(int vflag, int ilevel, int iloop); - void final_integrate_respa(int ilevel, int iloop); - void initial_integrate(int vflag); - void final_integrate(); - double compute_scalar(); - void reset_target(double); - virtual void reset_dt(); - double memory_usage(); - void grow_arrays(int); + void initial_integrate_respa(int vflag, int ilevel, int iloop) override; + void final_integrate_respa(int ilevel, int iloop) override; + void initial_integrate(int vflag) override; + void final_integrate() override; + double compute_scalar() override; + void reset_target(double) override; + void reset_dt() override; + double memory_usage() override; + void grow_arrays(int) override; - virtual void *extract(const char *, int &); + void *extract(const char *, int &) override; void init_ffl(); diff --git a/src/EXTRA-FIX/fix_filter_corotate.h b/src/EXTRA-FIX/fix_filter_corotate.h index d0af7bc2db..d7853aea88 100644 --- a/src/EXTRA-FIX/fix_filter_corotate.h +++ b/src/EXTRA-FIX/fix_filter_corotate.h @@ -32,31 +32,31 @@ namespace LAMMPS_NS { class FixFilterCorotate : public Fix { public: FixFilterCorotate(class LAMMPS *, int, char **); - ~FixFilterCorotate(); - void setup(int); - void setup_pre_neighbor(); - void pre_neighbor(); - void setup_pre_force_respa(int, int); + ~FixFilterCorotate() override; + void setup(int) override; + void setup_pre_neighbor() override; + void pre_neighbor() override; + void setup_pre_force_respa(int, int) override; // void setup_post_force_respa(int,int); - void pre_force_respa(int, int, int); - void post_force_respa(int, int, int); + void pre_force_respa(int, int, int) override; + void post_force_respa(int, int, int) override; - void init(); - int setmask(); + void init() override; + int setmask() override; - double compute_array(int, int); + double compute_array(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - void grow_arrays(int); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + void grow_arrays(int) override; + double memory_usage() override; - void copy_arrays(int, int, int); - void set_arrays(int); - void update_arrays(int, int); + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + void update_arrays(int, int) override; - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; protected: int me, nprocs; diff --git a/src/EXTRA-FIX/fix_flow_gauss.h b/src/EXTRA-FIX/fix_flow_gauss.h index 9ca12b61cc..d8482a67b0 100644 --- a/src/EXTRA-FIX/fix_flow_gauss.h +++ b/src/EXTRA-FIX/fix_flow_gauss.h @@ -29,13 +29,13 @@ namespace LAMMPS_NS { class FixFlowGauss : public Fix { public: FixFlowGauss(class LAMMPS *, int, char **); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_scalar(); - double compute_vector(int n); + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_scalar() override; + double compute_vector(int n) override; protected: int dimension; diff --git a/src/EXTRA-FIX/fix_gld.h b/src/EXTRA-FIX/fix_gld.h index 1424e5c5f4..538106939c 100644 --- a/src/EXTRA-FIX/fix_gld.h +++ b/src/EXTRA-FIX/fix_gld.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class FixGLD : public Fix { public: FixGLD(class LAMMPS *, int, char **); - virtual ~FixGLD(); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - void reset_target(double); - virtual void reset_dt(); + ~FixGLD() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_target(double) override; + void reset_dt() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; void init_s_gld(); protected: diff --git a/src/EXTRA-FIX/fix_gle.cpp b/src/EXTRA-FIX/fix_gle.cpp index de225c6980..0e19f6e58f 100644 --- a/src/EXTRA-FIX/fix_gle.cpp +++ b/src/EXTRA-FIX/fix_gle.cpp @@ -14,7 +14,7 @@ /* ---------------------------------------------------------------------- Contributing authors: Michele Ceriotti (EPFL), Joe Morrone (Stony Brook), - Axel Kohylmeyer (Temple U) + Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ #include "fix_gle.h" @@ -24,12 +24,14 @@ #include "error.h" #include "force.h" #include "memory.h" +#include "potential_file_reader.h" #include "random_mars.h" #include "respa.h" #include "update.h" #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -210,6 +212,8 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : S = new double[ns1sq]; TT = new double[ns1sq]; ST = new double[ns1sq]; + memset(A,0,sizeof(double)*ns1sq); + memset(C,0,sizeof(double)*ns1sq); // start temperature (t ramp) t_start = utils::numeric(FLERR,arg[4],false,lmp); @@ -221,46 +225,16 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : int seed = utils::inumeric(FLERR,arg[6],false,lmp); // LOADING A matrix - FILE *fgle = nullptr; char *fname = arg[7]; if (comm->me == 0) { - fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == nullptr) - error->one(FLERR,"Cannot open A-matrix file {}: {}",fname, utils::getsyserror()); - utils::logmesg(lmp,"Reading A-matrix from {}\n", fname); - } - - // read each line of the file, skipping blank lines or leading '#' - - char line[MAXLINE],*ptr; - int n,nwords,ndone=0,eof=0; - while (true) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fgle); - if (ptr == nullptr) { - eof = 1; - fclose(fgle); - } else n = strlen(line) + 1; + PotentialFileReader reader(lmp,fname,"fix gle A matrix"); + try { + reader.next_dvector(A, ns1sq); + } catch (std::exception &e) { + error->one(FLERR,"Error reading A-matrix: {}", e.what()); } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - - nwords = utils::count_words(line); - if (nwords == 0) continue; - - ptr = strtok(line," \t\n\r\f"); - do { - A[ndone] = atof(ptr); - ptr = strtok(nullptr," \t\n\r\f"); - ndone++; - } while ((ptr != nullptr) && (ndone < ns1sq)); } + MPI_Bcast(A,ns1sq,MPI_DOUBLE,0,world); fnoneq=0; gle_every=1; gle_step=0; for (int iarg=8; iargboltz / force->mvv2e; - memset(C,0,sizeof(double)*ns1sq); for (int i=0; ime == 0) { - fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == nullptr) - error->one(FLERR,"Cannot open C-matrix file {}: {}",fname, utils::getsyserror()); - utils::logmesg(lmp,"Reading C-matrix from {}\n", fname); - } - - // read each line of the file, skipping blank lines or leading '#' - ndone = eof = 0; - const double cfac = force->boltz / force->mvv2e; - - while (true) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fgle); - if (ptr == nullptr) { - eof = 1; - fclose(fgle); - } else n = strlen(line) + 1; + PotentialFileReader reader(lmp,fname,"fix gle C matrix"); + try { + reader.next_dvector(C, ns1sq); + } catch (std::exception &e) { + error->one(FLERR,"Error reading C-matrix: {}", e.what()); } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - - nwords = utils::count_words(line); - if (nwords == 0) continue; - - ptr = strtok(line," \t\n\r\f"); - do { - C[ndone] = cfac*atof(ptr); - ptr = strtok(nullptr," \t\n\r\f"); - ndone++; - } while ((ptr != nullptr) && (ndone < ns1sq)); } + MPI_Bcast(C,ns1sq,MPI_DOUBLE,0,world); + const double cfac = force->boltz / force->mvv2e; + for (int i=0; i < ns1sq; ++i) C[i] *= cfac; } #ifdef GLE_DEBUG @@ -366,12 +314,12 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : FixGLE::~FixGLE() { delete random; - delete [] A; - delete [] C; - delete [] S; - delete [] T; - delete [] TT; - delete [] ST; + delete[] A; + delete[] C; + delete[] S; + delete[] T; + delete[] TT; + delete[] ST; memory->destroy(sqrt_m); memory->destroy(gle_s); diff --git a/src/EXTRA-FIX/fix_gle.h b/src/EXTRA-FIX/fix_gle.h index 17150ea2be..e29daf76e8 100644 --- a/src/EXTRA-FIX/fix_gle.h +++ b/src/EXTRA-FIX/fix_gle.h @@ -27,30 +27,30 @@ namespace LAMMPS_NS { class FixGLE : public Fix { public: FixGLE(class LAMMPS *, int, char **); - virtual ~FixGLE(); - int setmask(); - void init(); - void setup(int); + ~FixGLE() override; + int setmask() override; + void init() override; + void setup(int) override; void gle_integrate(); - void initial_integrate_respa(int vflag, int ilevel, int iloop); - void final_integrate_respa(int ilevel, int iloop); - void initial_integrate(int vflag); - void final_integrate(); - double compute_scalar(); - void reset_target(double); - virtual void reset_dt(); + void initial_integrate_respa(int vflag, int ilevel, int iloop) override; + void final_integrate_respa(int ilevel, int iloop) override; + void initial_integrate(int vflag) override; + void final_integrate() override; + double compute_scalar() override; + void reset_target(double) override; + void reset_dt() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; - virtual void *extract(const char *, int &); + void *extract(const char *, int &) override; void init_gle(); void init_gles(); diff --git a/src/EXTRA-FIX/fix_momentum_chunk.h b/src/EXTRA-FIX/fix_momentum_chunk.h index d290582187..b3641a204a 100644 --- a/src/EXTRA-FIX/fix_momentum_chunk.h +++ b/src/EXTRA-FIX/fix_momentum_chunk.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixMomentumChunk : public Fix { public: FixMomentumChunk(class LAMMPS *, int, char **); - virtual ~FixMomentumChunk(); - int setmask(); - void init(); - void end_of_step(); - void post_run(); + ~FixMomentumChunk() override; + int setmask() override; + void init() override; + void end_of_step() override; + void post_run() override; protected: std::string id_chunk, id_com, id_vcm, id_omega; diff --git a/src/EXTRA-FIX/fix_npt_cauchy.h b/src/EXTRA-FIX/fix_npt_cauchy.h index 80122ad0ac..8150e59f6f 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.h +++ b/src/EXTRA-FIX/fix_npt_cauchy.h @@ -27,27 +27,27 @@ namespace LAMMPS_NS { class FixNPTCauchy : public Fix { public: FixNPTCauchy(class LAMMPS *, int, char **); - virtual void post_constructor(); - virtual ~FixNPTCauchy(); - int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void pre_force_respa(int, int, int); - void final_integrate_respa(int, int); - virtual void pre_exchange(); - double compute_scalar(); - virtual double compute_vector(int); - void write_restart(FILE *); + void post_constructor() override; + ~FixNPTCauchy() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void pre_force_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void pre_exchange() override; + double compute_scalar() override; + double compute_vector(int) override; + void write_restart(FILE *) override; virtual int pack_restart_data(double *); // pack restart data - virtual void restart(char *); - int modify_param(int, char **); - void reset_target(double); - void reset_dt(); - virtual void *extract(const char *, int &); - double memory_usage(); + void restart(char *) override; + int modify_param(int, char **) override; + void reset_target(double) override; + void reset_dt() override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int dimension, which; diff --git a/src/EXTRA-FIX/fix_numdiff.cpp b/src/EXTRA-FIX/fix_numdiff.cpp index 4c9c08b681..7265ec0b79 100644 --- a/src/EXTRA-FIX/fix_numdiff.cpp +++ b/src/EXTRA-FIX/fix_numdiff.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,22 +17,23 @@ #include "fix_numdiff.h" -#include -#include "atom.h" -#include "domain.h" -#include "update.h" -#include "modify.h" -#include "compute.h" -#include "respa.h" -#include "force.h" -#include "pair.h" -#include "bond.h" #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "compute.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "force.h" #include "improper.h" #include "kspace.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "pair.h" +#include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -41,20 +41,18 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(nullptr), numdiff_forces(nullptr), - temp_x(nullptr), temp_f(nullptr) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr), temp_f(nullptr) { - if (narg < 5) error->all(FLERR,"Illegal fix numdiff command"); + if (narg < 5) error->all(FLERR, "Illegal fix numdiff command"); peratom_flag = 1; peratom_freq = nevery; size_peratom_cols = 3; respa_level_support = 1; - nevery = utils::inumeric(FLERR,arg[3],false,lmp); - delta = utils::numeric(FLERR,arg[4],false,lmp); - if (nevery <= 0 || delta <= 0.0) - error->all(FLERR,"Illegal fix numdiff command"); + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + delta = utils::numeric(FLERR, arg[4], false, lmp); + if (nevery <= 0 || delta <= 0.0) error->all(FLERR, "Illegal fix numdiff command"); std::string cmd = id + std::string("_pe"); id_pe = utils::strdup(cmd); @@ -65,7 +63,7 @@ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : maxatom = 0; if (atom->map_style == Atom::MAP_NONE) - error->all(FLERR,"Fix numdiff requires an atom map, see atom_modify"); + error->all(FLERR, "Fix numdiff requires an atom map, see atom_modify"); // perform initial allocation of atom-based arrays // zero numdiff_forces since dump may access it on timestep 0 @@ -84,7 +82,7 @@ FixNumDiff::~FixNumDiff() memory->destroy(temp_f); modify->delete_compute(id_pe); - delete [] id_pe; + delete[] id_pe; } /* ---------------------------------------------------------------------- */ @@ -107,22 +105,25 @@ void FixNumDiff::init() // require consecutive atom IDs if (!atom->tag_enable || !atom->tag_consecutive()) - error->all(FLERR,"Fix numdiff requires consecutive atom IDs"); + error->all(FLERR, "Fix numdiff requires consecutive atom IDs"); // check for PE compute - int icompute = modify->find_compute(id_pe); - if (icompute < 0) error->all(FLERR,"Compute ID for fix numdiff does not exist"); - pe = modify->compute[icompute]; + pe = modify->get_compute_by_id(id_pe); + if (!pe) error->all(FLERR, "PE compute ID for fix numdiff does not exist"); - if (force->pair && force->pair->compute_flag) pair_compute_flag = 1; - else pair_compute_flag = 0; - if (force->kspace && force->kspace->compute_flag) kspace_compute_flag = 1; - else kspace_compute_flag = 0; + if (force->pair && force->pair->compute_flag) + pair_compute_flag = 1; + else + pair_compute_flag = 0; + if (force->kspace && force->kspace->compute_flag) + kspace_compute_flag = 1; + else + kspace_compute_flag = 0; - if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; - if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); + if (utils::strmatch(update->integrate_style, "^respa")) { + ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; + if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } } @@ -130,11 +131,11 @@ void FixNumDiff::init() void FixNumDiff::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); - post_force_respa(vflag,ilevel_respa,0); + post_force_respa(vflag, ilevel_respa, 0); ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); } } @@ -175,7 +176,7 @@ void FixNumDiff::min_post_force(int vflag) void FixNumDiff::calculate_forces() { - int i,j,ilocal; + int i, j, ilocal; double energy; // grow arrays if necessary @@ -202,43 +203,44 @@ void FixNumDiff::calculate_forces() // loop over all atoms in system // compute a finite difference force in each dimension - int flag,allflag; + int flag, allflag; double denominator = 0.5 / delta; int *mask = atom->mask; - int ntotal = static_cast (atom->natoms); + int ntotal = static_cast(atom->natoms); int dimension = domain->dimension; for (tagint m = 1; m <= ntotal; m++) { ilocal = atom->map(m); flag = 0; if ((ilocal >= 0 && ilocal < nlocal) && (mask[ilocal] & groupbit)) flag = 1; - MPI_Allreduce(&flag,&allflag,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&flag, &allflag, 1, MPI_INT, MPI_SUM, world); if (!allflag) continue; for (int idim = 0; idim < dimension; idim++) { - displace_atoms(ilocal,idim,1); + displace_atoms(ilocal, idim, 1); energy = update_energy(); - if (ilocal >= 0 && ilocal < nlocal) - numdiff_forces[ilocal][idim] -= energy; + if (ilocal >= 0 && ilocal < nlocal) numdiff_forces[ilocal][idim] -= energy; - displace_atoms(ilocal,idim,-2); + displace_atoms(ilocal, idim, -2); energy = update_energy(); if (ilocal >= 0 && ilocal < nlocal) { numdiff_forces[ilocal][idim] += energy; numdiff_forces[ilocal][idim] *= denominator; } - restore_atoms(ilocal,idim); + restore_atoms(ilocal, idim); } } + // recompute energy so all contributions are as before + + energy = update_energy(); + // restore original forces for owned and ghost atoms for (i = 0; i < nall; i++) - for (j = 0; j < 3; j++) { - f[i][j] = temp_f[i][j]; - } + for (j = 0; j < 3; j++) { f[i][j] = temp_f[i][j]; } } /* ---------------------------------------------------------------------- @@ -252,11 +254,11 @@ void FixNumDiff::displace_atoms(int ilocal, int idim, int magnitude) double **x = atom->x; int *sametag = atom->sametag; int j = ilocal; - x[ilocal][idim] += delta*magnitude; + x[ilocal][idim] += delta * magnitude; while (sametag[j] >= 0) { j = sametag[j]; - x[j][idim] += delta*magnitude; + x[j][idim] += delta * magnitude; } } @@ -290,16 +292,16 @@ double FixNumDiff::update_energy() int eflag = 1; - if (pair_compute_flag) force->pair->compute(eflag,0); + if (pair_compute_flag) force->pair->compute(eflag, 0); if (atom->molecular != Atom::ATOMIC) { - if (force->bond) force->bond->compute(eflag,0); - if (force->angle) force->angle->compute(eflag,0); - if (force->dihedral) force->dihedral->compute(eflag,0); - if (force->improper) force->improper->compute(eflag,0); + if (force->bond) force->bond->compute(eflag, 0); + if (force->angle) force->angle->compute(eflag, 0); + if (force->dihedral) force->dihedral->compute(eflag, 0); + if (force->improper) force->improper->compute(eflag, 0); } - if (kspace_compute_flag) force->kspace->compute(eflag,0); + if (kspace_compute_flag) force->kspace->compute(eflag, 0); double energy = pe->compute_scalar(); return energy; @@ -313,7 +315,7 @@ void FixNumDiff::force_clear(double **forces) { size_t nbytes = sizeof(double) * atom->nlocal; if (force->newton) nbytes += sizeof(double) * atom->nghost; - if (nbytes) memset(&forces[0][0],0,3*nbytes); + if (nbytes) memset(&forces[0][0], 0, 3 * nbytes); } /* ---------------------------------------------------------------------- @@ -326,9 +328,9 @@ void FixNumDiff::reallocate() memory->destroy(temp_x); memory->destroy(temp_f); maxatom = atom->nmax; - memory->create(numdiff_forces,maxatom,3,"numdiff:numdiff_force"); - memory->create(temp_x,maxatom,3,"numdiff:temp_x"); - memory->create(temp_f,maxatom,3,"numdiff:temp_f"); + memory->create(numdiff_forces, maxatom, 3, "numdiff:numdiff_force"); + memory->create(temp_x, maxatom, 3, "numdiff:temp_x"); + memory->create(temp_f, maxatom, 3, "numdiff:temp_f"); array_atom = numdiff_forces; } @@ -339,6 +341,6 @@ void FixNumDiff::reallocate() double FixNumDiff::memory_usage() { double bytes = 0.0; - bytes += (double)3 * maxatom*3 * sizeof(double); + bytes += (double) 3 * maxatom * 3 * sizeof(double); return bytes; } diff --git a/src/EXTRA-FIX/fix_numdiff.h b/src/EXTRA-FIX/fix_numdiff.h index b6b97c21bd..1f5fecf421 100644 --- a/src/EXTRA-FIX/fix_numdiff.h +++ b/src/EXTRA-FIX/fix_numdiff.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixNumDiff : public Fix { public: FixNumDiff(class LAMMPS *, int, char **); - ~FixNumDiff(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double memory_usage(); + ~FixNumDiff() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double memory_usage() override; private: double delta; diff --git a/src/EXTRA-FIX/fix_numdiff_virial.cpp b/src/EXTRA-FIX/fix_numdiff_virial.cpp new file mode 100644 index 0000000000..a87be67c89 --- /dev/null +++ b/src/EXTRA-FIX/fix_numdiff_virial.cpp @@ -0,0 +1,316 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Aidan Thompson (Sandia) +------------------------------------------------------------------------- */ + +#include "fix_numdiff_virial.h" + +#include "angle.h" +#include "atom.h" +#include "bond.h" +#include "compute.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "improper.h" +#include "kspace.h" +#include "memory.h" +#include "modify.h" +#include "pair.h" +#include "respa.h" +#include "update.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixNumDiffVirial::FixNumDiffVirial(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), temp_x(nullptr), temp_f(nullptr) +{ + if (narg < 5) error->all(FLERR, "Illegal fix numdiff/virial command"); + if (igroup) error->all(FLERR, "Compute numdiff/virial must use group all"); + + peratom_freq = nevery; + respa_level_support = 1; + vector_flag = 1; + size_vector = NDIR_VIRIAL; + extvector = 0; + maxatom = 0; + + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + delta = utils::numeric(FLERR, arg[4], false, lmp); + if (nevery <= 0 || delta <= 0.0) error->all(FLERR, "Illegal fix numdiff command"); + + std::string cmd = id + std::string("_pe"); + id_pe = utils::strdup(cmd); + cmd += " all pe"; + modify->add_compute(cmd); + + // perform initial allocation of atom-based arrays + // zero numdiff_forces since dump may access it on timestep 0 + // zero numdiff_forces since a variable may access it before first run + + reallocate(); + + // set fixed-point to default = center of cell + + fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); + fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); + fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); + + // define the cartesian indices for each strain (Voigt order) + + dirlist[0][0] = 0; + dirlist[0][1] = 0; + dirlist[1][0] = 1; + dirlist[1][1] = 1; + dirlist[2][0] = 2; + dirlist[2][1] = 2; + + dirlist[3][0] = 1; + dirlist[3][1] = 2; + dirlist[4][0] = 0; + dirlist[4][1] = 2; + dirlist[5][0] = 0; + dirlist[5][1] = 1; +} + +/* ---------------------------------------------------------------------- */ + +FixNumDiffVirial::~FixNumDiffVirial() +{ + memory->destroy(temp_x); + memory->destroy(temp_f); + + modify->delete_compute(id_pe); + delete[] id_pe; +} + +/* ---------------------------------------------------------------------- */ + +int FixNumDiffVirial::setmask() +{ + datamask_read = datamask_modify = 0; + + int mask = 0; + mask |= POST_FORCE; + mask |= POST_FORCE_RESPA; + mask |= MIN_POST_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixNumDiffVirial::init() +{ + // check for PE compute + + pe = modify->get_compute_by_id(id_pe); + if (!pe) error->all(FLERR, "PE compute ID for fix numdiff/virial does not exist"); + + if (force->pair && force->pair->compute_flag) + pair_compute_flag = 1; + else + pair_compute_flag = 0; + if (force->kspace && force->kspace->compute_flag) + kspace_compute_flag = 1; + else + kspace_compute_flag = 0; + + if (utils::strmatch(update->integrate_style, "^respa")) { + ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; + if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixNumDiffVirial::setup(int vflag) +{ + if (utils::strmatch(update->integrate_style, "^verlet")) + post_force(vflag); + else { + ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + post_force_respa(vflag, ilevel_respa, 0); + ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixNumDiffVirial::min_setup(int vflag) +{ + post_force(vflag); +} + +/* ---------------------------------------------------------------------- */ + +void FixNumDiffVirial::post_force(int /* vflag */) +{ + if (update->ntimestep % nevery) return; + + calculate_virial(); +} + +/* ---------------------------------------------------------------------- */ + +void FixNumDiffVirial::post_force_respa(int vflag, int ilevel, int /*iloop*/) +{ + if (ilevel == ilevel_respa) post_force(vflag); +} + +/* ---------------------------------------------------------------------- */ + +void FixNumDiffVirial::min_post_force(int vflag) +{ + post_force(vflag); +} + +/* ---------------------------------------------------------------------- + compute finite difference virial stress tensor +------------------------------------------------------------------------- */ + +void FixNumDiffVirial::calculate_virial() +{ + double energy; + + // grow arrays if necessary + + if (atom->nlocal + atom->nghost > maxatom) reallocate(); + + // store copy of current forces for owned and ghost atoms + + double **x = atom->x; + double **f = atom->f; + int nall = atom->nlocal + atom->nghost; + + for (int i = 0; i < nall; i++) + for (int k = 0; k < 3; k++) { + temp_x[i][k] = x[i][k]; + temp_f[i][k] = f[i][k]; + } + + // loop over 6 strain directions + // compute a finite difference force in each dimension + + double nktv2p = force->nktv2p; + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + + double denominator = -0.5 / delta * inv_volume * nktv2p; + + for (int idir = 0; idir < NDIR_VIRIAL; idir++) { + displace_atoms(nall, idir, 1.0); + energy = update_energy(); + virial[idir] = energy; + restore_atoms(nall, idir); + displace_atoms(nall, idir, -1.0); + energy = update_energy(); + virial[idir] -= energy; + virial[idir] *= denominator; + restore_atoms(nall, idir); + } + + // recompute energy so all contributions are as before + + energy = update_energy(); + + // restore original forces for owned and ghost atoms + + for (int i = 0; i < nall; i++) + for (int k = 0; k < 3; k++) f[i][k] = temp_f[i][k]; +} + +/* ---------------------------------------------------------------------- + displace position of all owned and ghost atoms +---------------------------------------------------------------------- */ + +void FixNumDiffVirial::displace_atoms(int nall, int idir, double magnitude) +{ + double **x = atom->x; + int k = dirlist[idir][0]; + int l = dirlist[idir][1]; + for (int i = 0; i < nall; i++) + x[i][k] = temp_x[i][k] + delta * magnitude * (temp_x[i][l] - fixedpoint[l]); +} + +/* ---------------------------------------------------------------------- + restore position of all owned and ghost atoms +---------------------------------------------------------------------- */ + +void FixNumDiffVirial::restore_atoms(int nall, int idir) +{ + double **x = atom->x; + int k = dirlist[idir][0]; + for (int i = 0; i < nall; i++) { x[i][k] = temp_x[i][k]; } +} + +/* ---------------------------------------------------------------------- + evaluate potential energy and forces + same logic as in Verlet +------------------------------------------------------------------------- */ + +double FixNumDiffVirial::update_energy() +{ + int eflag = 1; + + if (pair_compute_flag) force->pair->compute(eflag, 0); + + if (atom->molecular != Atom::ATOMIC) { + if (force->bond) force->bond->compute(eflag, 0); + if (force->angle) force->angle->compute(eflag, 0); + if (force->dihedral) force->dihedral->compute(eflag, 0); + if (force->improper) force->improper->compute(eflag, 0); + } + + if (kspace_compute_flag) force->kspace->compute(eflag, 0); + + double energy = pe->compute_scalar(); + return energy; +} + +/* ---------------------------------------------------------------------- + return Ith vector value, assume in range of size_vector +------------------------------------------------------------------------- */ + +double FixNumDiffVirial::compute_vector(int i) +{ + return virial[i]; +} + +/* ---------------------------------------------------------------------- + reallocated local per-atoms arrays +------------------------------------------------------------------------- */ + +void FixNumDiffVirial::reallocate() +{ + memory->destroy(temp_x); + memory->destroy(temp_f); + maxatom = atom->nmax; + memory->create(temp_x, maxatom, 3, "numdiff/virial:temp_x"); + memory->create(temp_f, maxatom, 3, "numdiff/virial:temp_f"); +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based arrays +------------------------------------------------------------------------- */ + +double FixNumDiffVirial::memory_usage() +{ + double bytes = 0.0; + bytes += (double) 2 * maxatom * 3 * sizeof(double); + return bytes; +} diff --git a/src/EXTRA-FIX/fix_numdiff_virial.h b/src/EXTRA-FIX/fix_numdiff_virial.h new file mode 100644 index 0000000000..71910afc1c --- /dev/null +++ b/src/EXTRA-FIX/fix_numdiff_virial.h @@ -0,0 +1,89 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(numdiff/virial,FixNumDiffVirial); +// clang-format on +#else + +#ifndef LMP_FIX_NUMDIFF_VIRIAL_H +#define LMP_FIX_NUMDIFF_VIRIAL_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixNumDiffVirial : public Fix { + public: + FixNumDiffVirial(class LAMMPS *, int, char **); + ~FixNumDiffVirial() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double memory_usage() override; + + private: + static constexpr int NDIR_VIRIAL = 6; // dimension of virial and strain vectors + double delta; // strain magnitude + int maxatom; // allocated size of atom arrays + int ilevel_respa; + + int pair_compute_flag; // 0 if pair->compute is skipped + int kspace_compute_flag; // 0 if kspace->compute is skipped + + char *id_pe; // name of energy compute + class Compute *pe; // pointer to energy compute + + double virial[NDIR_VIRIAL]; // finite diff virial components (Voigt order) + double **temp_x; // original coords + double **temp_f; // original forces + double fixedpoint[3]; // define displacement field origin + int dirlist[NDIR_VIRIAL][2]; // strain cartesian indices (Voigt order) + + double compute_vector(int) override; // access function for virial + void calculate_virial(); // virial calculation + void displace_atoms(int, int, double); // apply displacement field + void restore_atoms(int, int); // restore original positions + double update_energy(); // calculate new energy + void virial_clear(); // set virial to zero + void reallocate(); // grow the atom arrays +}; + +} // namespace LAMMPS_NS + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Compute ID for fix numdiff/virial does not exist + +Self-explanatory. + +E: Fix numdiff/virial must use group all + +Virial contributions computed by this fix are +computed on all atoms. + +*/ diff --git a/src/EXTRA-FIX/fix_nvk.h b/src/EXTRA-FIX/fix_nvk.h index 90162e2fc0..67b2cb6916 100644 --- a/src/EXTRA-FIX/fix_nvk.h +++ b/src/EXTRA-FIX/fix_nvk.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixNVK : public Fix { public: FixNVK(class LAMMPS *, int, char **); - virtual ~FixNVK() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - virtual void reset_dt(); + + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/EXTRA-FIX/fix_oneway.h b/src/EXTRA-FIX/fix_oneway.h index d3b2cf7b65..ad6a5dc106 100644 --- a/src/EXTRA-FIX/fix_oneway.h +++ b/src/EXTRA-FIX/fix_oneway.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixOneWay : public Fix { public: FixOneWay(class LAMMPS *, int, char **); - virtual ~FixOneWay(); - int setmask(); - virtual void init(); - virtual void end_of_step(); + ~FixOneWay() override; + int setmask() override; + void init() override; + void end_of_step() override; protected: int direction; diff --git a/src/EXTRA-FIX/fix_pafi.h b/src/EXTRA-FIX/fix_pafi.h index 32942bc1e1..7cf0bb9856 100644 --- a/src/EXTRA-FIX/fix_pafi.h +++ b/src/EXTRA-FIX/fix_pafi.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class FixPAFI : public Fix { public: FixPAFI(class LAMMPS *, int, char **); - virtual ~FixPAFI(); - int setmask(); - virtual void init(); + ~FixPAFI() override; + int setmask() override; + void init() override; - void setup(int); - void min_setup(int); - virtual void post_force(int); + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_vector(int); + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_vector(int) override; // nve - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - virtual void reset_dt(); + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; - double memory_usage(); + double memory_usage() override; protected: int varflag, icompute; diff --git a/src/EXTRA-FIX/fix_rhok.h b/src/EXTRA-FIX/fix_rhok.h index 1a69c7a24e..3ddabf1ebb 100644 --- a/src/EXTRA-FIX/fix_rhok.h +++ b/src/EXTRA-FIX/fix_rhok.h @@ -27,32 +27,31 @@ class FixRhok : public Fix { // Constructor: all the parameters to this fix specified in // the LAMMPS input get passed in FixRhok(LAMMPS *inLMP, int inArgc, char **inArgv); - virtual ~FixRhok(){}; // Methods that this fix implements // -------------------------------- // Tells LAMMPS where this fix should act - int setmask(); + int setmask() override; // Initializes the fix at the beginning of a run - void init(); + void init() override; // Initial application of the fix to a system (when doing MD / minimization) - void setup(int inVFlag); - void min_setup(int inVFlag); + void setup(int inVFlag) override; + void min_setup(int inVFlag) override; // Modify the forces calculated in the main force loop, either when // doing usual MD, RESPA MD or minimization - void post_force(int inVFlag); - void post_force_respa(int inVFlag, int inILevel, int inILoop); - void min_post_force(int inVFlag); + void post_force(int inVFlag) override; + void post_force_respa(int inVFlag, int inILevel, int inILoop) override; + void min_post_force(int inVFlag) override; // Compute the change in the potential energy induced by this fix - double compute_scalar(); + double compute_scalar() override; // Compute the ith component of the vector associated with this fix - double compute_vector(int inI); + double compute_vector(int inI) override; private: // RESPA boilerplate diff --git a/src/EXTRA-FIX/fix_smd.h b/src/EXTRA-FIX/fix_smd.h index d26ecd7600..cae1319dc1 100644 --- a/src/EXTRA-FIX/fix_smd.h +++ b/src/EXTRA-FIX/fix_smd.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixSMD : public Fix { public: FixSMD(class LAMMPS *, int, char **); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_vector(int); + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_vector(int) override; - void write_restart(FILE *); - void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; private: double xc, yc, zc, xn, yn, zn, r0; diff --git a/src/EXTRA-FIX/fix_spring_rg.h b/src/EXTRA-FIX/fix_spring_rg.h index 997580c4c2..d0cb93e25e 100644 --- a/src/EXTRA-FIX/fix_spring_rg.h +++ b/src/EXTRA-FIX/fix_spring_rg.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixSpringRG : public Fix { public: FixSpringRG(class LAMMPS *, int, char **); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void write_restart(FILE *); - void restart(char *); - double compute_scalar(); + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void write_restart(FILE *) override; + void restart(char *) override; + double compute_scalar() override; private: int ilevel_respa, rg0_flag; diff --git a/src/EXTRA-FIX/fix_temp_csld.h b/src/EXTRA-FIX/fix_temp_csld.h index 687e79079f..f6a2970389 100644 --- a/src/EXTRA-FIX/fix_temp_csld.h +++ b/src/EXTRA-FIX/fix_temp_csld.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixTempCSLD : public Fix { public: FixTempCSLD(class LAMMPS *, int, char **); - ~FixTempCSLD(); - int setmask(); - void init(); - void end_of_step(); - int modify_param(int, char **); - void reset_target(double); - virtual double compute_scalar(); - void write_restart(FILE *); - void restart(char *buf); - virtual void *extract(const char *, int &); + ~FixTempCSLD() override; + int setmask() override; + void init() override; + void end_of_step() override; + int modify_param(int, char **) override; + void reset_target(double) override; + double compute_scalar() override; + void write_restart(FILE *) override; + void restart(char *buf) override; + void *extract(const char *, int &) override; private: double t_start, t_stop, t_period, t_target; diff --git a/src/EXTRA-FIX/fix_temp_csvr.h b/src/EXTRA-FIX/fix_temp_csvr.h index ce6c785841..c1b4dbfd93 100644 --- a/src/EXTRA-FIX/fix_temp_csvr.h +++ b/src/EXTRA-FIX/fix_temp_csvr.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixTempCSVR : public Fix { public: FixTempCSVR(class LAMMPS *, int, char **); - ~FixTempCSVR(); - int setmask(); - void init(); - void end_of_step(); - int modify_param(int, char **); - void reset_target(double); - virtual double compute_scalar(); - void write_restart(FILE *); - void restart(char *buf); - virtual void *extract(const char *, int &); + ~FixTempCSVR() override; + int setmask() override; + void init() override; + void end_of_step() override; + int modify_param(int, char **) override; + void reset_target(double) override; + double compute_scalar() override; + void write_restart(FILE *) override; + void restart(char *buf) override; + void *extract(const char *, int &) override; private: double t_start, t_stop, t_period, t_target; diff --git a/src/EXTRA-FIX/fix_ti_spring.h b/src/EXTRA-FIX/fix_ti_spring.h index 0900a71dee..d2f02f8a3e 100644 --- a/src/EXTRA-FIX/fix_ti_spring.h +++ b/src/EXTRA-FIX/fix_ti_spring.h @@ -34,27 +34,27 @@ namespace LAMMPS_NS { class FixTISpring : public Fix { public: FixTISpring(class LAMMPS *, int, char **); - ~FixTISpring(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - void initial_integrate(int); - double compute_scalar(); - double compute_vector(int); + ~FixTISpring() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + void initial_integrate(int) override; + double compute_scalar() override; + double compute_vector(int) override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; private: double switch_func(double); // Switching function. diff --git a/src/EXTRA-FIX/fix_tmd.h b/src/EXTRA-FIX/fix_tmd.h index b85869930a..9ba8ad6096 100644 --- a/src/EXTRA-FIX/fix_tmd.h +++ b/src/EXTRA-FIX/fix_tmd.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class FixTMD : public Fix { public: FixTMD(class LAMMPS *, int, char **); - ~FixTMD(); - int setmask(); - void init(); - void initial_integrate(int); - void initial_integrate_respa(int, int, int); + ~FixTMD() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void initial_integrate_respa(int, int, int) override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void reset_dt(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void reset_dt() override; private: int me; diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index de4b0a4c7e..752610fd08 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -32,6 +32,7 @@ #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/EXTRA-FIX/fix_ttm.h b/src/EXTRA-FIX/fix_ttm.h index da782b1f5a..bbaf0b6429 100644 --- a/src/EXTRA-FIX/fix_ttm.h +++ b/src/EXTRA-FIX/fix_ttm.h @@ -21,33 +21,32 @@ FixStyle(ttm,FixTTM); #define LMP_FIX_TTM_H #include "fix.h" -#include namespace LAMMPS_NS { class FixTTM : public Fix { public: FixTTM(class LAMMPS *, int, char **); - virtual ~FixTTM(); - virtual void post_constructor(); - int setmask(); - virtual void init(); - void setup(int); + ~FixTTM() override; + void post_constructor() override; + int setmask() override; + void init() override; + void setup(int) override; void post_force_setup(int); - virtual void post_force(int); + void post_force(int) override; void post_force_respa_setup(int, int, int); - void post_force_respa(int, int, int); - virtual void end_of_step(); - void reset_dt(); - void grow_arrays(int); - virtual void write_restart(FILE *); - virtual void restart(char *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); - virtual double compute_vector(int); - virtual double memory_usage(); + void post_force_respa(int, int, int) override; + void end_of_step() override; + void reset_dt() override; + void grow_arrays(int) override; + void write_restart(FILE *) override; + void restart(char *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; + double compute_vector(int) override; + double memory_usage() override; protected: int nlevels_respa; diff --git a/src/EXTRA-FIX/fix_ttm_grid.h b/src/EXTRA-FIX/fix_ttm_grid.h index 46d5b67ec1..aeb1106e42 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.h +++ b/src/EXTRA-FIX/fix_ttm_grid.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class FixTTMGrid : public FixTTM { public: FixTTMGrid(class LAMMPS *, int, char **); - ~FixTTMGrid(); - void post_constructor(); - void init(); - void post_force(int); - void end_of_step(); + ~FixTTMGrid() override; + void post_constructor() override; + void init() override; + void post_force(int) override; + void end_of_step() override; // grid communication - void pack_forward_grid(int, void *, int, int *); - void unpack_forward_grid(int, void *, int, int *); - void pack_reverse_grid(int, void *, int, int *); - void unpack_reverse_grid(int, void *, int, int *); - void pack_gather_grid(int, void *); - void unpack_gather_grid(int, void *, void *, int, int, int, int, int, int); + void pack_forward_grid(int, void *, int, int *) override; + void unpack_forward_grid(int, void *, int, int *) override; + void pack_reverse_grid(int, void *, int, int *) override; + void unpack_reverse_grid(int, void *, int, int *) override; + void pack_gather_grid(int, void *) override; + void unpack_gather_grid(int, void *, void *, int, int, int, int, int, int) override; - void write_restart(FILE *); - void restart(char *); - double compute_vector(int); - double memory_usage(); + void write_restart(FILE *) override; + void restart(char *) override; + double compute_vector(int) override; + double memory_usage() override; private: int ngridmine,ngridout; @@ -59,10 +59,10 @@ class FixTTMGrid : public FixTTM { int ngc_buf1,ngc_buf2; double *gc_buf1,*gc_buf2; - void allocate_grid(); - void deallocate_grid(); - void read_electron_temperatures(const std::string &); - void write_electron_temperatures(const std::string &); + void allocate_grid() override; + void deallocate_grid() override; + void read_electron_temperatures(const std::string &) override; + void write_electron_temperatures(const std::string &) override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index 233f877e8c..a2c03db762 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -31,11 +31,11 @@ #include "random_mars.h" #include "respa.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include "update.h" #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/EXTRA-FIX/fix_ttm_mod.h b/src/EXTRA-FIX/fix_ttm_mod.h index 21eb0efcaa..d9967753fd 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.h +++ b/src/EXTRA-FIX/fix_ttm_mod.h @@ -21,7 +21,6 @@ FixStyle(ttm/mod,FixTTMMod); #define LMP_FIX_TTM_MOD_H #include "fix.h" -#include namespace LAMMPS_NS { @@ -33,25 +32,25 @@ struct el_heat_capacity_thermal_conductivity { class FixTTMMod : public Fix { public: FixTTMMod(class LAMMPS *, int, char **); - ~FixTTMMod(); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); + ~FixTTMMod() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; void post_force_setup(int); void post_force_respa_setup(int, int, int); - void end_of_step(); - void reset_dt(); - void write_restart(FILE *); - void restart(char *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); - double memory_usage(); - void grow_arrays(int); - double compute_vector(int); + void end_of_step() override; + void reset_dt() override; + void write_restart(FILE *) override; + void restart(char *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; + double memory_usage() override; + void grow_arrays(int) override; + double compute_vector(int) override; private: int nlevels_respa; diff --git a/src/EXTRA-FIX/fix_viscosity.h b/src/EXTRA-FIX/fix_viscosity.h index 559de6c362..e46dbafe84 100644 --- a/src/EXTRA-FIX/fix_viscosity.h +++ b/src/EXTRA-FIX/fix_viscosity.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixViscosity : public Fix { public: FixViscosity(class LAMMPS *, int, char **); - ~FixViscosity(); - int setmask(); - void init(); - void end_of_step(); - double compute_scalar(); + ~FixViscosity() override; + int setmask() override; + void init() override; + void end_of_step() override; + double compute_scalar() override; private: int me; diff --git a/src/EXTRA-FIX/fix_wall_ees.h b/src/EXTRA-FIX/fix_wall_ees.h index 5bfb821c43..af235af13b 100644 --- a/src/EXTRA-FIX/fix_wall_ees.h +++ b/src/EXTRA-FIX/fix_wall_ees.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixWallEES : public FixWall { public: FixWallEES(class LAMMPS *, int, char **); - void precompute(int); - void init(); - void wall_particle(int, int, double); + void precompute(int) override; + void init() override; + void wall_particle(int, int, double) override; private: double coeff1[6], coeff2[6], coeff3[6], coeff4[6], coeff5[6], coeff6[6]; diff --git a/src/EXTRA-FIX/fix_wall_reflect_stochastic.h b/src/EXTRA-FIX/fix_wall_reflect_stochastic.h index b895a569f0..e1794376cf 100644 --- a/src/EXTRA-FIX/fix_wall_reflect_stochastic.h +++ b/src/EXTRA-FIX/fix_wall_reflect_stochastic.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class FixWallReflectStochastic : public FixWallReflect { public: FixWallReflectStochastic(class LAMMPS *, int, char **); - virtual ~FixWallReflectStochastic(); + ~FixWallReflectStochastic() override; private: int seedfix; @@ -36,7 +36,7 @@ class FixWallReflectStochastic : public FixWallReflect { class RanMars *random; - void wall_particle(int m, int which, double coord); + void wall_particle(int m, int which, double coord) override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-FIX/fix_wall_region_ees.h b/src/EXTRA-FIX/fix_wall_region_ees.h index b34e8238a8..5163d99e90 100644 --- a/src/EXTRA-FIX/fix_wall_region_ees.h +++ b/src/EXTRA-FIX/fix_wall_region_ees.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixWallRegionEES : public Fix { public: FixWallRegionEES(class LAMMPS *, int, char **); - ~FixWallRegionEES(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixWallRegionEES() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; private: class AtomVecEllipsoid *avec; diff --git a/src/EXTRA-MOLECULE/angle_cosine_delta.h b/src/EXTRA-MOLECULE/angle_cosine_delta.h index ce5b001073..fda3821beb 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_delta.h +++ b/src/EXTRA-MOLECULE/angle_cosine_delta.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class AngleCosineDelta : public AngleCosineSquared { public: AngleCosineDelta(class LAMMPS *); - virtual void compute(int, int); - double single(int, int, int, int); + void compute(int, int) override; + double single(int, int, int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-MOLECULE/angle_cosine_periodic.h b/src/EXTRA-MOLECULE/angle_cosine_periodic.h index e5c9673b78..52404b885d 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_periodic.h +++ b/src/EXTRA-MOLECULE/angle_cosine_periodic.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCosinePeriodic : public Angle { public: AngleCosinePeriodic(class LAMMPS *); - virtual ~AngleCosinePeriodic(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCosinePeriodic() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k; diff --git a/src/EXTRA-MOLECULE/angle_cosine_shift.h b/src/EXTRA-MOLECULE/angle_cosine_shift.h index 038d31e501..f52c532bba 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_shift.h +++ b/src/EXTRA-MOLECULE/angle_cosine_shift.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCosineShift : public Angle { public: AngleCosineShift(class LAMMPS *); - virtual ~AngleCosineShift(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCosineShift() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k; diff --git a/src/EXTRA-MOLECULE/angle_cosine_shift_exp.h b/src/EXTRA-MOLECULE/angle_cosine_shift_exp.h index 6ebbb1185b..f372d9bc30 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_shift_exp.h +++ b/src/EXTRA-MOLECULE/angle_cosine_shift_exp.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCosineShiftExp : public Angle { public: AngleCosineShiftExp(class LAMMPS *); - virtual ~AngleCosineShiftExp(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCosineShiftExp() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: bool *doExpansion; diff --git a/src/EXTRA-MOLECULE/angle_fourier.h b/src/EXTRA-MOLECULE/angle_fourier.h index daaab5351f..84859fc216 100644 --- a/src/EXTRA-MOLECULE/angle_fourier.h +++ b/src/EXTRA-MOLECULE/angle_fourier.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleFourier : public Angle { public: AngleFourier(class LAMMPS *); - virtual ~AngleFourier(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - virtual double single(int, int, int, int); + ~AngleFourier() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *C0, *C1, *C2; diff --git a/src/EXTRA-MOLECULE/angle_fourier_simple.h b/src/EXTRA-MOLECULE/angle_fourier_simple.h index 815ed99109..d66f32f13f 100644 --- a/src/EXTRA-MOLECULE/angle_fourier_simple.h +++ b/src/EXTRA-MOLECULE/angle_fourier_simple.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleFourierSimple : public Angle { public: AngleFourierSimple(class LAMMPS *); - virtual ~AngleFourierSimple(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - virtual double single(int, int, int, int); + ~AngleFourierSimple() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *C, *N; diff --git a/src/EXTRA-MOLECULE/angle_gaussian.h b/src/EXTRA-MOLECULE/angle_gaussian.h index 654872205f..76c7552c31 100644 --- a/src/EXTRA-MOLECULE/angle_gaussian.h +++ b/src/EXTRA-MOLECULE/angle_gaussian.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleGaussian : public Angle { public: AngleGaussian(class LAMMPS *); - virtual ~AngleGaussian(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleGaussian() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: int *nterms; diff --git a/src/EXTRA-MOLECULE/angle_quartic.h b/src/EXTRA-MOLECULE/angle_quartic.h index 0d352fac52..1253ec2f0f 100644 --- a/src/EXTRA-MOLECULE/angle_quartic.h +++ b/src/EXTRA-MOLECULE/angle_quartic.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleQuartic : public Angle { public: AngleQuartic(class LAMMPS *); - virtual ~AngleQuartic(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleQuartic() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k2, *k3, *k4, *theta0; diff --git a/src/EXTRA-MOLECULE/bond_fene_nm.cpp b/src/EXTRA-MOLECULE/bond_fene_nm.cpp index 147a63512a..ea5c491de7 100644 --- a/src/EXTRA-MOLECULE/bond_fene_nm.cpp +++ b/src/EXTRA-MOLECULE/bond_fene_nm.cpp @@ -17,7 +17,6 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "math_const.h" #include "memory.h" #include "neighbor.h" #include "update.h" @@ -29,7 +28,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -BondFENENM::BondFENENM(LAMMPS *lmp) : BondFENE(lmp) {} +BondFENENM::BondFENENM(LAMMPS *lmp) : BondFENE(lmp), nn(nullptr), mm(nullptr) {} /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/bond_fene_nm.h b/src/EXTRA-MOLECULE/bond_fene_nm.h index f00394c6d8..9a6beffc62 100644 --- a/src/EXTRA-MOLECULE/bond_fene_nm.h +++ b/src/EXTRA-MOLECULE/bond_fene_nm.h @@ -26,22 +26,21 @@ namespace LAMMPS_NS { class BondFENENM : public BondFENE { public: BondFENENM(class LAMMPS *); - virtual ~BondFENENM(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void init_style(); - double equilibrium_distance(int); - virtual void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondFENENM() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: - double TWO_1_3; double *nn, *mm; - virtual void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-MOLECULE/bond_gaussian.h b/src/EXTRA-MOLECULE/bond_gaussian.h index 07ed5d771d..4287a6a388 100644 --- a/src/EXTRA-MOLECULE/bond_gaussian.h +++ b/src/EXTRA-MOLECULE/bond_gaussian.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class BondGaussian : public Bond { public: BondGaussian(class LAMMPS *); - virtual ~BondGaussian(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondGaussian() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: int *nterms; diff --git a/src/EXTRA-MOLECULE/bond_harmonic_shift.h b/src/EXTRA-MOLECULE/bond_harmonic_shift.h index 484a00b787..0b7d0ab6b8 100644 --- a/src/EXTRA-MOLECULE/bond_harmonic_shift.h +++ b/src/EXTRA-MOLECULE/bond_harmonic_shift.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class BondHarmonicShift : public Bond { public: BondHarmonicShift(class LAMMPS *); - virtual ~BondHarmonicShift(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondHarmonicShift() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *k, *r0, *r1; diff --git a/src/EXTRA-MOLECULE/bond_harmonic_shift_cut.h b/src/EXTRA-MOLECULE/bond_harmonic_shift_cut.h index 01dc9cb593..74d97143f7 100644 --- a/src/EXTRA-MOLECULE/bond_harmonic_shift_cut.h +++ b/src/EXTRA-MOLECULE/bond_harmonic_shift_cut.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class BondHarmonicShiftCut : public Bond { public: BondHarmonicShiftCut(class LAMMPS *); - virtual ~BondHarmonicShiftCut(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondHarmonicShiftCut() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *k, *r0, *r1; diff --git a/src/EXTRA-MOLECULE/bond_nonlinear.h b/src/EXTRA-MOLECULE/bond_nonlinear.h index 4fcf87cdf0..63e6279462 100644 --- a/src/EXTRA-MOLECULE/bond_nonlinear.h +++ b/src/EXTRA-MOLECULE/bond_nonlinear.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondNonlinear : public Bond { public: BondNonlinear(class LAMMPS *); - virtual ~BondNonlinear(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondNonlinear() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *epsilon, *r0, *lamda; diff --git a/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.h b/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.h index 31bc3332f5..f45eefdceb 100644 --- a/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.h +++ b/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralCosineShiftExp : public Dihedral { public: DihedralCosineShiftExp(class LAMMPS *); - virtual ~DihedralCosineShiftExp(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralCosineShiftExp() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: bool *doExpansion; diff --git a/src/EXTRA-MOLECULE/dihedral_fourier.h b/src/EXTRA-MOLECULE/dihedral_fourier.h index 557d4b5277..18116af25c 100644 --- a/src/EXTRA-MOLECULE/dihedral_fourier.h +++ b/src/EXTRA-MOLECULE/dihedral_fourier.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralFourier : public Dihedral { public: DihedralFourier(class LAMMPS *); - virtual ~DihedralFourier(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralFourier() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double **k, **cos_shift, **sin_shift, **shift; diff --git a/src/EXTRA-MOLECULE/dihedral_helix.h b/src/EXTRA-MOLECULE/dihedral_helix.h index dad281fa2e..729d1ec861 100644 --- a/src/EXTRA-MOLECULE/dihedral_helix.h +++ b/src/EXTRA-MOLECULE/dihedral_helix.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralHelix : public Dihedral { public: DihedralHelix(class LAMMPS *); - virtual ~DihedralHelix(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralHelix() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *aphi, *bphi, *cphi; diff --git a/src/EXTRA-MOLECULE/dihedral_nharmonic.h b/src/EXTRA-MOLECULE/dihedral_nharmonic.h index ff41bd7ef5..184cf1f740 100644 --- a/src/EXTRA-MOLECULE/dihedral_nharmonic.h +++ b/src/EXTRA-MOLECULE/dihedral_nharmonic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralNHarmonic : public Dihedral { public: DihedralNHarmonic(class LAMMPS *); - ~DihedralNHarmonic(); - void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralNHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int *nterms; diff --git a/src/EXTRA-MOLECULE/dihedral_quadratic.h b/src/EXTRA-MOLECULE/dihedral_quadratic.h index b61c29c1d9..7ea7839c1f 100644 --- a/src/EXTRA-MOLECULE/dihedral_quadratic.h +++ b/src/EXTRA-MOLECULE/dihedral_quadratic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralQuadratic : public Dihedral { public: DihedralQuadratic(class LAMMPS *); - ~DihedralQuadratic(); - void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralQuadratic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *phi0; diff --git a/src/EXTRA-MOLECULE/dihedral_spherical.h b/src/EXTRA-MOLECULE/dihedral_spherical.h index 0143e6348c..993f12ceb3 100644 --- a/src/EXTRA-MOLECULE/dihedral_spherical.h +++ b/src/EXTRA-MOLECULE/dihedral_spherical.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class DihedralSpherical : public Dihedral { public: DihedralSpherical(class LAMMPS *); - virtual ~DihedralSpherical(); - virtual void compute(int, int); + ~DihedralSpherical() override; + void compute(int, int) override; double CalcGeneralizedForces(int, double, double, double, double *, double *, double *); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int *nterms; diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.h b/src/EXTRA-MOLECULE/dihedral_table_cut.h index 99607a9e0b..f713af1f72 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.h +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class DihedralTableCut : public DihedralTable { public: DihedralTableCut(class LAMMPS *); - virtual ~DihedralTableCut(); - virtual void compute(int, int); - virtual void coeff(int, char **); + ~DihedralTableCut() override; + void compute(int, int) override; + void coeff(int, char **) override; protected: double *aat_k, *aat_theta0_1, *aat_theta0_2; - virtual void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-MOLECULE/improper_cossq.h b/src/EXTRA-MOLECULE/improper_cossq.h index fd22e438ce..854aa3ed05 100644 --- a/src/EXTRA-MOLECULE/improper_cossq.h +++ b/src/EXTRA-MOLECULE/improper_cossq.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperCossq : public Improper { public: ImproperCossq(class LAMMPS *); - virtual ~ImproperCossq(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperCossq() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *chi; diff --git a/src/EXTRA-MOLECULE/improper_distance.h b/src/EXTRA-MOLECULE/improper_distance.h index fbf8060c9f..d814405906 100644 --- a/src/EXTRA-MOLECULE/improper_distance.h +++ b/src/EXTRA-MOLECULE/improper_distance.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperDistance : public Improper { public: ImproperDistance(class LAMMPS *); - ~ImproperDistance(); - void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperDistance() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; private: double *k, *chi; diff --git a/src/EXTRA-MOLECULE/improper_fourier.h b/src/EXTRA-MOLECULE/improper_fourier.h index 25d03e623b..f420c534a2 100644 --- a/src/EXTRA-MOLECULE/improper_fourier.h +++ b/src/EXTRA-MOLECULE/improper_fourier.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperFourier : public Improper { public: ImproperFourier(class LAMMPS *); - ~ImproperFourier(); - void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperFourier() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *C0, *C1, *C2; diff --git a/src/EXTRA-MOLECULE/improper_ring.h b/src/EXTRA-MOLECULE/improper_ring.h index f428a7bfd6..3afb5a8d98 100644 --- a/src/EXTRA-MOLECULE/improper_ring.h +++ b/src/EXTRA-MOLECULE/improper_ring.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperRing : public Improper { public: ImproperRing(class LAMMPS *); - virtual ~ImproperRing(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperRing() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *chi; diff --git a/src/EXTRA-PAIR/pair_beck.h b/src/EXTRA-PAIR/pair_beck.h index dc19456d64..889004a579 100644 --- a/src/EXTRA-PAIR/pair_beck.h +++ b/src/EXTRA-PAIR/pair_beck.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PairBeck : public Pair { public: PairBeck(class LAMMPS *); - virtual ~PairBeck(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairBeck() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_born_coul_dsf.h b/src/EXTRA-PAIR/pair_born_coul_dsf.h index 01fa651630..bba1fce560 100644 --- a/src/EXTRA-PAIR/pair_born_coul_dsf.h +++ b/src/EXTRA-PAIR/pair_born_coul_dsf.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairBornCoulDSF : public Pair { public: PairBornCoulDSF(class LAMMPS *); - virtual ~PairBornCoulDSF(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairBornCoulDSF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_lj_global, alpha; diff --git a/src/EXTRA-PAIR/pair_born_coul_wolf.h b/src/EXTRA-PAIR/pair_born_coul_wolf.h index 2ddfe3ebcf..42d85c9b5c 100644 --- a/src/EXTRA-PAIR/pair_born_coul_wolf.h +++ b/src/EXTRA-PAIR/pair_born_coul_wolf.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairBornCoulWolf : public Pair { public: PairBornCoulWolf(class LAMMPS *); - virtual ~PairBornCoulWolf(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairBornCoulWolf() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_lj_global, alf; diff --git a/src/EXTRA-PAIR/pair_buck_mdf.h b/src/EXTRA-PAIR/pair_buck_mdf.h index 0718fbaf71..4dda4f6c10 100644 --- a/src/EXTRA-PAIR/pair_buck_mdf.h +++ b/src/EXTRA-PAIR/pair_buck_mdf.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairBuckMDF : public Pair { public: PairBuckMDF(class LAMMPS *); - virtual ~PairBuckMDF(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairBuckMDF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global, cut_inner_global; diff --git a/src/EXTRA-PAIR/pair_cosine_squared.h b/src/EXTRA-PAIR/pair_cosine_squared.h index e1c87525ed..2dc29daf10 100644 --- a/src/EXTRA-PAIR/pair_cosine_squared.h +++ b/src/EXTRA-PAIR/pair_cosine_squared.h @@ -30,20 +30,20 @@ namespace LAMMPS_NS { class PairCosineSquared : public Pair { public: PairCosineSquared(class LAMMPS *); - virtual ~PairCosineSquared(); - void settings(int, char **); - void coeff(int, char **); + ~PairCosineSquared() override; + void settings(int, char **) override; + void coeff(int, char **) override; // void init_style(); - double init_one(int, int); - void modify_params(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual void compute(int, int); - double single(int, int, int, int, double, double, double, double &); + double init_one(int, int) override; + void modify_params(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; // void *extract(const char *, int &); /* RESPA stuff not implemented... diff --git a/src/EXTRA-PAIR/pair_coul_cut_global.h b/src/EXTRA-PAIR/pair_coul_cut_global.h index c7520adc56..39e5e56d68 100644 --- a/src/EXTRA-PAIR/pair_coul_cut_global.h +++ b/src/EXTRA-PAIR/pair_coul_cut_global.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairCoulCutGlobal : public PairCoulCut { public: PairCoulCutGlobal(class LAMMPS *lmp) : PairCoulCut(lmp) {} - void coeff(int, char **); - void *extract(const char *, int &); + void coeff(int, char **) override; + void *extract(const char *, int &) override; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-PAIR/pair_coul_diel.h b/src/EXTRA-PAIR/pair_coul_diel.h index f15b300fb8..a7dbe6a6d7 100644 --- a/src/EXTRA-PAIR/pair_coul_diel.h +++ b/src/EXTRA-PAIR/pair_coul_diel.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairCoulDiel : public Pair { public: PairCoulDiel(class LAMMPS *); - virtual ~PairCoulDiel(); + ~PairCoulDiel() override; - virtual void compute(int, int); + void compute(int, int) override; - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; - virtual double single(int, int, int, int, double, double, double, double &); + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_coul_exclude.h b/src/EXTRA-PAIR/pair_coul_exclude.h index 38cd30cbb7..69ec59f5ba 100644 --- a/src/EXTRA-PAIR/pair_coul_exclude.h +++ b/src/EXTRA-PAIR/pair_coul_exclude.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairCoulExclude : public Pair { public: PairCoulExclude(class LAMMPS *); - virtual ~PairCoulExclude(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairCoulExclude() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_coul_slater_cut.h b/src/EXTRA-PAIR/pair_coul_slater_cut.h index 4fc43f97e0..1d24f75c39 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_cut.h +++ b/src/EXTRA-PAIR/pair_coul_slater_cut.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairCoulSlaterCut : public PairCoulCut { public: PairCoulSlaterCut(class LAMMPS *); - virtual void compute(int, int); - void settings(int, char **); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double lamda; diff --git a/src/EXTRA-PAIR/pair_coul_slater_long.h b/src/EXTRA-PAIR/pair_coul_slater_long.h index eaa99a9729..66002ca2fa 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_long.h +++ b/src/EXTRA-PAIR/pair_coul_slater_long.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairCoulSlaterLong : public Pair { public: PairCoulSlaterLong(class LAMMPS *); - ~PairCoulSlaterLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairCoulSlaterLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_coul, cut_coulsq, qdist; diff --git a/src/EXTRA-PAIR/pair_e3b.cpp b/src/EXTRA-PAIR/pair_e3b.cpp index 7e865ac6f8..3af8e754c0 100644 --- a/src/EXTRA-PAIR/pair_e3b.cpp +++ b/src/EXTRA-PAIR/pair_e3b.cpp @@ -99,7 +99,7 @@ void PairE3B::compute(int eflag, int vflag) ev_init(eflag, vflag); //clear sumExp array - memset(sumExp, 0.0, nbytes); + memset(sumExp, 0, sizeof(double)*maxID); evdwl = 0.0; pvector[0] = pvector[1] = pvector[2] = pvector[3] = 0.0; @@ -364,7 +364,6 @@ void PairE3B::allocateE3B() maxID = find_maxID(); if (!natoms) error->all(FLERR, "No atoms found"); memory->create(sumExp, maxID, "pair:sumExp"); - nbytes = sizeof(double) * maxID; } /* ---------------------------------------------------------------------- diff --git a/src/EXTRA-PAIR/pair_e3b.h b/src/EXTRA-PAIR/pair_e3b.h index f6cf916918..90fd48a8be 100644 --- a/src/EXTRA-PAIR/pair_e3b.h +++ b/src/EXTRA-PAIR/pair_e3b.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairE3B : public Pair { public: PairE3B(class LAMMPS *); - virtual ~PairE3B(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - virtual double init_one(int, int); - virtual void init_style(); + ~PairE3B() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; protected: //potential parameters @@ -50,7 +50,6 @@ class PairE3B : public Pair { int **pairO, ***pairH; // pair lists double ***exps, ****del3, ***fpair3, *sumExp; int maxID; //size of global sumExp array - size_t nbytes; //size of sumExp array in bytes int natoms; //to make sure number of atoms is constant virtual void allocate(); diff --git a/src/EXTRA-PAIR/pair_gauss.h b/src/EXTRA-PAIR/pair_gauss.h index d59ab074ef..70a412c0c1 100644 --- a/src/EXTRA-PAIR/pair_gauss.h +++ b/src/EXTRA-PAIR/pair_gauss.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairGauss : public Pair { public: PairGauss(class LAMMPS *); - virtual ~PairGauss(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *fp); - void write_data_all(FILE *fp); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairGauss() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *fp) override; + void write_data_all(FILE *fp) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_gauss_cut.h b/src/EXTRA-PAIR/pair_gauss_cut.h index b0a05c179d..a485c2637f 100644 --- a/src/EXTRA-PAIR/pair_gauss_cut.h +++ b/src/EXTRA-PAIR/pair_gauss_cut.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class PairGaussCut : public Pair { public: PairGaussCut(class LAMMPS *); - ~PairGaussCut(); + ~PairGaussCut() override; - virtual void compute(int, int); + void compute(int, int) override; - virtual double single(int, int, int, int, double, double, double, double &); + double single(int, int, int, int, double, double, double, double &) override; - virtual void settings(int, char **); - virtual void coeff(int, char **); + void settings(int, char **) override; + void coeff(int, char **) override; - virtual double init_one(int, int); + double init_one(int, int) override; - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *fp); - virtual void write_data_all(FILE *fp); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *fp) override; + void write_data_all(FILE *fp) override; - virtual double memory_usage(); + double memory_usage() override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_harmonic_cut.cpp b/src/EXTRA-PAIR/pair_harmonic_cut.cpp new file mode 100644 index 0000000000..7bef9bd443 --- /dev/null +++ b/src/EXTRA-PAIR/pair_harmonic_cut.cpp @@ -0,0 +1,312 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#include "pair_harmonic_cut.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "neigh_list.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace MathConst; + +/* ---------------------------------------------------------------------- */ + +PairHarmonicCut::PairHarmonicCut(LAMMPS *lmp) : Pair(lmp), k(nullptr), cut(nullptr) +{ + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +PairHarmonicCut::~PairHarmonicCut() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(k); + memory->destroy(cut); + memory->destroy(cutsq); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairHarmonicCut::compute(int eflag, int vflag) +{ + int i, j, ii, jj, inum, jnum, itype, jtype; + double xtmp, ytmp, ztmp, fxtmp, fytmp, fztmp; + double delx, dely, delz, rsq, factor_lj; + int *ilist, *jlist, *numneigh, **firstneigh; + + ev_init(eflag, vflag); + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + fxtmp = fytmp = fztmp = 0.0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + const double r = sqrt(rsq); + const double delta = cut[itype][jtype] - r; + const double philj = factor_lj * delta * k[itype][jtype]; + const double fpair = delta * philj / r; + + fxtmp += delx * fpair; + fytmp += dely * fpair; + fztmp += delz * fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx * fpair; + f[j][1] -= dely * fpair; + f[j][2] -= delz * fpair; + } + + if (evflag) ev_tally(i, j, nlocal, newton_pair, philj, 0.0, fpair, delx, dely, delz); + } + } + f[i][0] += fxtmp; + f[i][1] += fytmp; + f[i][2] += fztmp; + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairHarmonicCut::allocate() +{ + allocated = 1; + int n = atom->ntypes + 1; + + memory->create(setflag, n, n, "pair:setflag"); + for (int i = 1; i < n; i++) + for (int j = i; j < n; j++) setflag[i][j] = 0; + + memory->create(k, n, n, "pair:k"); + memory->create(cut, n, n, "pair:cut"); + memory->create(cutsq, n, n, "pair:cutsq"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairHarmonicCut::settings(int narg, char ** /*arg*/) +{ + if (narg > 0) error->all(FLERR, "Illegal pair_style command"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairHarmonicCut::coeff(int narg, char **arg) +{ + if (narg != 4) error->all(FLERR, "Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); + + double k_one = utils::numeric(FLERR, arg[2], false, lmp); + double cut_one = utils::numeric(FLERR, arg[3], false, lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { + k[i][j] = k_one; + cut[i][j] = cut_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairHarmonicCut::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + cut[i][j] = mix_distance(cut[i][i], cut[j][j]); + cut[j][i] = cut[i][j]; + k[i][j] = mix_energy(k[i][i], k[j][j], cut[i][i], cut[j][j]); + k[j][i] = k[i][j]; + } + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairHarmonicCut::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i, j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j], sizeof(int), 1, fp); + if (setflag[i][j]) { + fwrite(&k[i][j], sizeof(double), 1, fp); + fwrite(&cut[i][j], sizeof(double), 1, fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairHarmonicCut::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i, j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); + if (setflag[i][j]) { + if (me == 0) { + utils::sfread(FLERR, &k[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); + } + MPI_Bcast(&k[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairHarmonicCut::write_restart_settings(FILE *fp) +{ + fwrite(&offset_flag, sizeof(int), 1, fp); + fwrite(&mix_flag, sizeof(int), 1, fp); + fwrite(&tail_flag, sizeof(int), 1, fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairHarmonicCut::read_restart_settings(FILE *fp) +{ + int me = comm->me; + if (me == 0) { + utils::sfread(FLERR, &offset_flag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &mix_flag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &tail_flag, sizeof(int), 1, fp, nullptr, error); + } + MPI_Bcast(&offset_flag, 1, MPI_INT, 0, world); + MPI_Bcast(&mix_flag, 1, MPI_INT, 0, world); + MPI_Bcast(&tail_flag, 1, MPI_INT, 0, world); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairHarmonicCut::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) fprintf(fp, "%d %g %g\n", i, k[i][i], cut[i][i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairHarmonicCut::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) fprintf(fp, "%d %d %g %g\n", i, j, k[i][j], cut[i][j]); +} + +/* ---------------------------------------------------------------------- */ + +double PairHarmonicCut::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, + double /*factor_coul*/, double factor_lj, double &fforce) +{ + if (rsq >= cutsq[itype][jtype]) { + fforce = 0.0; + return 0.0; + } + const double r = sqrt(rsq); + const double delta = cut[itype][jtype] - r; + const double philj = factor_lj * delta * k[itype][jtype]; + fforce = delta * philj / r; + return philj; +} + +/* ---------------------------------------------------------------------- */ + +void *PairHarmonicCut::extract(const char *str, int &dim) +{ + dim = 2; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "cut") == 0) return (void *) cut; + return nullptr; +} diff --git a/src/EXTRA-PAIR/pair_harmonic_cut.h b/src/EXTRA-PAIR/pair_harmonic_cut.h new file mode 100644 index 0000000000..369791747f --- /dev/null +++ b/src/EXTRA-PAIR/pair_harmonic_cut.h @@ -0,0 +1,72 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(harmonic/cut,PairHarmonicCut); +// clang-format on +#else + +#ifndef LMP_PAIR_HARMONIC_CUT_H +#define LMP_PAIR_HARMONIC_CUT_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairHarmonicCut : public Pair { + public: + PairHarmonicCut(class LAMMPS *); + ~PairHarmonicCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; + + protected: + double **k, **cut; + + virtual void allocate(); +}; + +} // namespace LAMMPS_NS + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: Pair cutoff < Respa interior cutoff + +One or more pairwise cutoffs are too short to use with the specified +rRESPA cutoffs. + +*/ diff --git a/src/EXTRA-PAIR/pair_lennard_mdf.h b/src/EXTRA-PAIR/pair_lennard_mdf.h index 96e7ccb5f7..e830b4f397 100644 --- a/src/EXTRA-PAIR/pair_lennard_mdf.h +++ b/src/EXTRA-PAIR/pair_lennard_mdf.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLennardMDF : public Pair { public: PairLennardMDF(class LAMMPS *); - virtual ~PairLennardMDF(); + ~PairLennardMDF() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global, cut_inner_global; diff --git a/src/EXTRA-PAIR/pair_lj96_cut.h b/src/EXTRA-PAIR/pair_lj96_cut.h index 8bd9829b12..d5084b9719 100644 --- a/src/EXTRA-PAIR/pair_lj96_cut.h +++ b/src/EXTRA-PAIR/pair_lj96_cut.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class PairLJ96Cut : public Pair { public: PairLJ96Cut(class LAMMPS *); - virtual ~PairLJ96Cut(); + ~PairLJ96Cut() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_lj_cubic.h b/src/EXTRA-PAIR/pair_lj_cubic.h index b6db913460..d879020a05 100644 --- a/src/EXTRA-PAIR/pair_lj_cubic.h +++ b/src/EXTRA-PAIR/pair_lj_cubic.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairLJCubic : public Pair { public: PairLJCubic(class LAMMPS *); - virtual ~PairLJCubic(); + ~PairLJCubic() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double **cut, **cut_inner, **cut_inner_sq; diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h b/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h index 8d9629db86..208c626cfd 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLJCutCoulDebye : public PairLJCutCoulCut { public: PairLJCutCoulDebye(class LAMMPS *); - virtual ~PairLJCutCoulDebye() {} - virtual void compute(int, int); - void settings(int, char **); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + + void compute(int, int) override; + void settings(int, char **) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double kappa; diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h b/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h index 200038ae9f..2445c219db 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJCutCoulDSF : public Pair { public: PairLJCutCoulDSF(class LAMMPS *); - ~PairLJCutCoulDSF(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJCutCoulDSF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h b/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h index 779cc706e6..6ca4bb0166 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJCutCoulWolf : public Pair { public: PairLJCutCoulWolf(class LAMMPS *); - virtual ~PairLJCutCoulWolf(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); + ~PairLJCutCoulWolf() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; protected: double cut_lj_global; diff --git a/src/EXTRA-PAIR/pair_lj_expand_coul_long.h b/src/EXTRA-PAIR/pair_lj_expand_coul_long.h index 6d5dddb69e..e0f179ca10 100644 --- a/src/EXTRA-PAIR/pair_lj_expand_coul_long.h +++ b/src/EXTRA-PAIR/pair_lj_expand_coul_long.h @@ -28,24 +28,24 @@ class PairLJExpandCoulLong : public Pair { public: PairLJExpandCoulLong(class LAMMPS *); - virtual ~PairLJExpandCoulLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairLJExpandCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/EXTRA-PAIR/pair_lj_gromacs.h b/src/EXTRA-PAIR/pair_lj_gromacs.h index 5941be6ba5..b0a6cdfd9e 100644 --- a/src/EXTRA-PAIR/pair_lj_gromacs.h +++ b/src/EXTRA-PAIR/pair_lj_gromacs.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJGromacs : public Pair { public: PairLJGromacs(class LAMMPS *); - virtual ~PairLJGromacs(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairLJGromacs() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_inner_global, cut_global; diff --git a/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h b/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h index d7075262cc..71c8f0211c 100644 --- a/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h +++ b/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairLJGromacsCoulGromacs : public Pair { public: PairLJGromacsCoulGromacs(class LAMMPS *); - virtual ~PairLJGromacsCoulGromacs(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairLJGromacsCoulGromacs() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_lj_inner, cut_lj, cut_coul_inner, cut_coul; diff --git a/src/EXTRA-PAIR/pair_lj_mdf.h b/src/EXTRA-PAIR/pair_lj_mdf.h index 777e935624..423e8d2f9e 100644 --- a/src/EXTRA-PAIR/pair_lj_mdf.h +++ b/src/EXTRA-PAIR/pair_lj_mdf.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJMDF : public Pair { public: PairLJMDF(class LAMMPS *); - virtual ~PairLJMDF(); + ~PairLJMDF() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global, cut_inner_global; diff --git a/src/EXTRA-PAIR/pair_lj_relres.h b/src/EXTRA-PAIR/pair_lj_relres.h index 7493440abd..ed5ffa80d0 100644 --- a/src/EXTRA-PAIR/pair_lj_relres.h +++ b/src/EXTRA-PAIR/pair_lj_relres.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJRelRes : public Pair { public: PairLJRelRes(class LAMMPS *); - virtual ~PairLJRelRes(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairLJRelRes() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_inner_global, cut_global, cutf_inner_global, cutf_global; diff --git a/src/EXTRA-PAIR/pair_lj_smooth.h b/src/EXTRA-PAIR/pair_lj_smooth.h index bb37a098f6..fd66ff0a24 100644 --- a/src/EXTRA-PAIR/pair_lj_smooth.h +++ b/src/EXTRA-PAIR/pair_lj_smooth.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJSmooth : public Pair { public: PairLJSmooth(class LAMMPS *); - virtual ~PairLJSmooth(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairLJSmooth() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_inner_global, cut_global; diff --git a/src/EXTRA-PAIR/pair_lj_smooth_linear.h b/src/EXTRA-PAIR/pair_lj_smooth_linear.h index 6db6ef5c21..0b7d10ea48 100644 --- a/src/EXTRA-PAIR/pair_lj_smooth_linear.h +++ b/src/EXTRA-PAIR/pair_lj_smooth_linear.h @@ -28,17 +28,17 @@ namespace LAMMPS_NS { class PairLJSmoothLinear : public Pair { public: PairLJSmoothLinear(class LAMMPS *); - virtual ~PairLJSmoothLinear(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - double single_hessian(int, int, int, int, double, double[3], double, double, double &, double[6]); + ~PairLJSmoothLinear() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + double single_hessian(int, int, int, int, double, double[3], double, double, double &, double[6]) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_mie_cut.h b/src/EXTRA-PAIR/pair_mie_cut.h index 5e4238fddd..f7fe1ff0d2 100644 --- a/src/EXTRA-PAIR/pair_mie_cut.h +++ b/src/EXTRA-PAIR/pair_mie_cut.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairMIECut : public Pair { public: PairMIECut(class LAMMPS *); - virtual ~PairMIECut(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairMIECut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_momb.h b/src/EXTRA-PAIR/pair_momb.h index 1116320ef0..3944390604 100644 --- a/src/EXTRA-PAIR/pair_momb.h +++ b/src/EXTRA-PAIR/pair_momb.h @@ -29,17 +29,17 @@ namespace LAMMPS_NS { class PairMomb : public Pair { public: PairMomb(class LAMMPS *); - virtual ~PairMomb(); + ~PairMomb() override; - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_morse_smooth_linear.h b/src/EXTRA-PAIR/pair_morse_smooth_linear.h index 18f2767b5f..01d7c848ab 100644 --- a/src/EXTRA-PAIR/pair_morse_smooth_linear.h +++ b/src/EXTRA-PAIR/pair_morse_smooth_linear.h @@ -29,20 +29,20 @@ namespace LAMMPS_NS { class PairMorseSmoothLinear : public Pair { public: PairMorseSmoothLinear(class LAMMPS *); - virtual ~PairMorseSmoothLinear(); + ~PairMorseSmoothLinear() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_nm_cut.h b/src/EXTRA-PAIR/pair_nm_cut.h index bf40740abf..da3b6b837b 100644 --- a/src/EXTRA-PAIR/pair_nm_cut.h +++ b/src/EXTRA-PAIR/pair_nm_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairNMCut : public Pair { public: PairNMCut(class LAMMPS *); - virtual ~PairNMCut(); + ~PairNMCut() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h b/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h index a411c332de..ba054ef849 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h +++ b/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class PairNMCutCoulCut : public Pair { public: PairNMCutCoulCut(class LAMMPS *); - virtual ~PairNMCutCoulCut(); + ~PairNMCutCoulCut() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/EXTRA-PAIR/pair_nm_cut_coul_long.h b/src/EXTRA-PAIR/pair_nm_cut_coul_long.h index 1e4989717c..e2d19d14a5 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_coul_long.h +++ b/src/EXTRA-PAIR/pair_nm_cut_coul_long.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairNMCutCoulLong : public Pair { public: PairNMCutCoulLong(class LAMMPS *); - virtual ~PairNMCutCoulLong(); + ~PairNMCutCoulLong() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void *extract(const char *, int &); + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/EXTRA-PAIR/pair_nm_cut_split.cpp b/src/EXTRA-PAIR/pair_nm_cut_split.cpp index ca6feb1549..45323b931c 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_split.cpp +++ b/src/EXTRA-PAIR/pair_nm_cut_split.cpp @@ -19,16 +19,11 @@ #include "pair_nm_cut_split.h" #include "atom.h" -#include "comm.h" -#include "error.h" #include "force.h" -#include "math_const.h" #include "math_special.h" -#include "memory.h" #include "neigh_list.h" #include -#include using namespace LAMMPS_NS; using MathSpecial::powint; diff --git a/src/EXTRA-PAIR/pair_nm_cut_split.h b/src/EXTRA-PAIR/pair_nm_cut_split.h index a05634ada2..68d4dad7de 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_split.h +++ b/src/EXTRA-PAIR/pair_nm_cut_split.h @@ -26,8 +26,8 @@ namespace LAMMPS_NS { class PairNMCutSplit : public PairNMCut { public: PairNMCutSplit(class LAMMPS *); - double single(int, int, int, int, double, double, double, double &); - virtual void compute(int, int); + double single(int, int, int, int, double, double, double, double &) override; + void compute(int, int) override; }; } // namespace LAMMPS_NS #endif diff --git a/src/EXTRA-PAIR/pair_ufm.h b/src/EXTRA-PAIR/pair_ufm.h index 714f886eb0..d8091766a0 100644 --- a/src/EXTRA-PAIR/pair_ufm.h +++ b/src/EXTRA-PAIR/pair_ufm.h @@ -33,19 +33,19 @@ namespace LAMMPS_NS { class PairUFM : public Pair { public: PairUFM(class LAMMPS *); - virtual ~PairUFM(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairUFM() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/EXTRA-PAIR/pair_wf_cut.h b/src/EXTRA-PAIR/pair_wf_cut.h index 132703ce29..61d930b12e 100644 --- a/src/EXTRA-PAIR/pair_wf_cut.h +++ b/src/EXTRA-PAIR/pair_wf_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairWFCut : public Pair { public: PairWFCut(class LAMMPS *); - virtual ~PairWFCut(); + ~PairWFCut() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: int **nu, **mu; diff --git a/src/FEP/compute_fep.h b/src/FEP/compute_fep.h index d7f17abaf0..8f576124e0 100644 --- a/src/FEP/compute_fep.h +++ b/src/FEP/compute_fep.h @@ -31,9 +31,9 @@ namespace LAMMPS_NS { class ComputeFEP : public Compute { public: ComputeFEP(class LAMMPS *, int, char **); - ~ComputeFEP(); - void init(); - void compute_vector(); + ~ComputeFEP() override; + void init() override; + void compute_vector() override; private: int npert; diff --git a/src/FEP/fix_adapt_fep.h b/src/FEP/fix_adapt_fep.h index 2aadf373b5..a7cfdad868 100644 --- a/src/FEP/fix_adapt_fep.h +++ b/src/FEP/fix_adapt_fep.h @@ -30,16 +30,16 @@ class FixAdaptFEP : public Fix { int chgflag; FixAdaptFEP(class LAMMPS *, int, char **); - ~FixAdaptFEP(); - int setmask(); - void post_constructor(); - void init(); - void setup_pre_force(int); - void pre_force(int); - void post_run(); - void setup_pre_force_respa(int, int); - void pre_force_respa(int, int, int); - void set_arrays(int); + ~FixAdaptFEP() override; + int setmask() override; + void post_constructor() override; + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; + void post_run() override; + void setup_pre_force_respa(int, int) override; + void pre_force_respa(int, int, int) override; + void set_arrays(int) override; private: int nadapt, resetflag, scaleflag, afterflag; diff --git a/src/FEP/pair_coul_cut_soft.h b/src/FEP/pair_coul_cut_soft.h index 92f1fc6efc..862bafce8c 100644 --- a/src/FEP/pair_coul_cut_soft.h +++ b/src/FEP/pair_coul_cut_soft.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairCoulCutSoft : public Pair { public: PairCoulCutSoft(class LAMMPS *); - virtual ~PairCoulCutSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairCoulCutSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/FEP/pair_coul_long_soft.h b/src/FEP/pair_coul_long_soft.h index f5e2e52642..45afeef445 100644 --- a/src/FEP/pair_coul_long_soft.h +++ b/src/FEP/pair_coul_long_soft.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairCoulLongSoft : public Pair { public: PairCoulLongSoft(class LAMMPS *); - virtual ~PairCoulLongSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairCoulLongSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_coul, cut_coulsq; diff --git a/src/FEP/pair_lj_charmm_coul_long_soft.h b/src/FEP/pair_lj_charmm_coul_long_soft.h index 45cdcaf0d2..8190a5109b 100644 --- a/src/FEP/pair_lj_charmm_coul_long_soft.h +++ b/src/FEP/pair_lj_charmm_coul_long_soft.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class PairLJCharmmCoulLongSoft : public Pair { public: PairLJCharmmCoulLongSoft(class LAMMPS *); - virtual ~PairLJCharmmCoulLongSoft(); + ~PairLJCharmmCoulLongSoft() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: int implicit; diff --git a/src/FEP/pair_lj_class2_coul_cut_soft.h b/src/FEP/pair_lj_class2_coul_cut_soft.h index 8533862b0a..3b50b21151 100644 --- a/src/FEP/pair_lj_class2_coul_cut_soft.h +++ b/src/FEP/pair_lj_class2_coul_cut_soft.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJClass2CoulCutSoft : public Pair { public: PairLJClass2CoulCutSoft(class LAMMPS *); - virtual ~PairLJClass2CoulCutSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJClass2CoulCutSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/FEP/pair_lj_class2_coul_long_soft.h b/src/FEP/pair_lj_class2_coul_long_soft.h index 0b7212686b..2d374a91f6 100644 --- a/src/FEP/pair_lj_class2_coul_long_soft.h +++ b/src/FEP/pair_lj_class2_coul_long_soft.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJClass2CoulLongSoft : public Pair { public: PairLJClass2CoulLongSoft(class LAMMPS *); - virtual ~PairLJClass2CoulLongSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJClass2CoulLongSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/FEP/pair_lj_class2_soft.h b/src/FEP/pair_lj_class2_soft.h index 32930b9b86..2a7a3a286f 100644 --- a/src/FEP/pair_lj_class2_soft.h +++ b/src/FEP/pair_lj_class2_soft.h @@ -25,19 +25,19 @@ namespace LAMMPS_NS { class PairLJClass2Soft : public Pair { public: PairLJClass2Soft(class LAMMPS *); - virtual ~PairLJClass2Soft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJClass2Soft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/FEP/pair_lj_cut_coul_cut_soft.h b/src/FEP/pair_lj_cut_coul_cut_soft.h index 3d03da1b7d..b92e29ac44 100644 --- a/src/FEP/pair_lj_cut_coul_cut_soft.h +++ b/src/FEP/pair_lj_cut_coul_cut_soft.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJCutCoulCutSoft : public Pair { public: PairLJCutCoulCutSoft(class LAMMPS *); - virtual ~PairLJCutCoulCutSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJCutCoulCutSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/FEP/pair_lj_cut_coul_long_soft.h b/src/FEP/pair_lj_cut_coul_long_soft.h index b82c673dc5..04add045c8 100644 --- a/src/FEP/pair_lj_cut_coul_long_soft.h +++ b/src/FEP/pair_lj_cut_coul_long_soft.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class PairLJCutCoulLongSoft : public Pair { public: PairLJCutCoulLongSoft(class LAMMPS *); - virtual ~PairLJCutCoulLongSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairLJCutCoulLongSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_lj_global; diff --git a/src/FEP/pair_lj_cut_soft.h b/src/FEP/pair_lj_cut_soft.h index 00f579823c..9c86485ab2 100644 --- a/src/FEP/pair_lj_cut_soft.h +++ b/src/FEP/pair_lj_cut_soft.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class PairLJCutSoft : public Pair { public: PairLJCutSoft(class LAMMPS *); - virtual ~PairLJCutSoft(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJCutSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_global; diff --git a/src/FEP/pair_lj_cut_tip4p_long_soft.h b/src/FEP/pair_lj_cut_tip4p_long_soft.h index cf6ac22126..9a6615c95c 100644 --- a/src/FEP/pair_lj_cut_tip4p_long_soft.h +++ b/src/FEP/pair_lj_cut_tip4p_long_soft.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairLJCutTIP4PLongSoft : public PairLJCutCoulLongSoft { public: PairLJCutTIP4PLongSoft(class LAMMPS *); - virtual ~PairLJCutTIP4PLongSoft(); - virtual void compute(int, int); - void settings(int, char **); - void init_style(); - double init_one(int, int); - void write_restart_settings(FILE *fp); - void read_restart_settings(FILE *fp); - void *extract(const char *, int &); - virtual double memory_usage(); + ~PairLJCutTIP4PLongSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *fp) override; + void read_restart_settings(FILE *fp) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int typeH, typeO; // atom types of TIP4P water H and O atoms diff --git a/src/FEP/pair_morse_soft.h b/src/FEP/pair_morse_soft.h index f6ec254a44..b471938231 100644 --- a/src/FEP/pair_morse_soft.h +++ b/src/FEP/pair_morse_soft.h @@ -31,21 +31,21 @@ class PairMorseSoft : public PairMorse { public: PairMorseSoft(class LAMMPS *lmp) : PairMorse(lmp), lambda(nullptr), nlambda(0), shift_range(1.0){}; - virtual ~PairMorseSoft(); - virtual void compute(int, int); + ~PairMorseSoft() override; + void compute(int, int) override; - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double **lambda; @@ -53,7 +53,7 @@ class PairMorseSoft : public PairMorse { int nlambda; double shift_range; - virtual void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/FEP/pair_tip4p_long_soft.h b/src/FEP/pair_tip4p_long_soft.h index 9df7847993..bed6f7f39c 100644 --- a/src/FEP/pair_tip4p_long_soft.h +++ b/src/FEP/pair_tip4p_long_soft.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairTIP4PLongSoft : public PairCoulLongSoft { public: PairTIP4PLongSoft(class LAMMPS *); - virtual ~PairTIP4PLongSoft(); - virtual void compute(int, int); - void settings(int, char **); - void init_style(); - double init_one(int, int); - void write_restart_settings(FILE *fp); - void read_restart_settings(FILE *fp); - void *extract(const char *, int &); - virtual double memory_usage(); + ~PairTIP4PLongSoft() override; + void compute(int, int) override; + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *fp) override; + void read_restart_settings(FILE *fp) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int typeH, typeO; // atom types of TIP4P water H and O atoms diff --git a/src/GPU/fix_gpu.h b/src/GPU/fix_gpu.h index 4e344c85c7..c152c54fb3 100644 --- a/src/GPU/fix_gpu.h +++ b/src/GPU/fix_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixGPU : public Fix { public: FixGPU(class LAMMPS *, int, char **); - ~FixGPU(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void min_post_force(int); - void post_force_respa(int, int, int); - double memory_usage(); + ~FixGPU() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void min_post_force(int) override; + void post_force_respa(int, int, int) override; + double memory_usage() override; double binsize(const double subx, const double suby, const double subz, const int nlocal, const double cut); diff --git a/src/GPU/fix_nh_gpu.h b/src/GPU/fix_nh_gpu.h index 7a08b0382c..7461b20d64 100644 --- a/src/GPU/fix_nh_gpu.h +++ b/src/GPU/fix_nh_gpu.h @@ -25,21 +25,21 @@ namespace LAMMPS_NS { class FixNHGPU : public FixNH { public: FixNHGPU(class LAMMPS *, int, char **); - virtual ~FixNHGPU(); - virtual void setup(int vflag); - void reset_dt(); - virtual void final_integrate(); - virtual double memory_usage(); + ~FixNHGPU() override; + void setup(int vflag) override; + void reset_dt() override; + void final_integrate() override; + double memory_usage() override; protected: double *_dtfm; int _nlocal3, _nlocal_max, _respa_on; - virtual void remap(); - virtual void nve_x(); - virtual void nve_v(); - virtual void nh_v_press(); - virtual void nh_v_temp(); + void remap() override; + void nve_x() override; + void nve_v() override; + void nh_v_press() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/GPU/fix_npt_gpu.h b/src/GPU/fix_npt_gpu.h index d771acdd01..5068031132 100644 --- a/src/GPU/fix_npt_gpu.h +++ b/src/GPU/fix_npt_gpu.h @@ -31,7 +31,6 @@ namespace LAMMPS_NS { class FixNPTGPU : public FixNHGPU { public: FixNPTGPU(class LAMMPS *, int, char **); - ~FixNPTGPU() {} }; } // namespace LAMMPS_NS diff --git a/src/GPU/fix_nve_asphere_gpu.h b/src/GPU/fix_nve_asphere_gpu.h index d3fd0fb05a..a0420d6577 100644 --- a/src/GPU/fix_nve_asphere_gpu.h +++ b/src/GPU/fix_nve_asphere_gpu.h @@ -31,12 +31,12 @@ namespace LAMMPS_NS { class FixNVEAsphereGPU : public FixNVE { public: FixNVEAsphereGPU(class LAMMPS *, int, char **); - void init(); - void setup(int vflag); - void initial_integrate(int); - void final_integrate(); - void reset_dt(); - virtual double memory_usage(); + void init() override; + void setup(int vflag) override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; + double memory_usage() override; private: double reset_dt_omp(const int, const int, const int); diff --git a/src/GPU/fix_nve_gpu.h b/src/GPU/fix_nve_gpu.h index adeaeeff50..30e805c770 100644 --- a/src/GPU/fix_nve_gpu.h +++ b/src/GPU/fix_nve_gpu.h @@ -31,12 +31,12 @@ namespace LAMMPS_NS { class FixNVEGPU : public FixNVE { public: FixNVEGPU(class LAMMPS *, int, char **); - virtual ~FixNVEGPU(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void reset_dt(); - virtual double memory_usage(); + ~FixNVEGPU() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; + double memory_usage() override; protected: void reset_dt_omp(const int, const int, const int); diff --git a/src/GPU/fix_nvt_gpu.h b/src/GPU/fix_nvt_gpu.h index af0ab1de86..310eabdafa 100644 --- a/src/GPU/fix_nvt_gpu.h +++ b/src/GPU/fix_nvt_gpu.h @@ -31,7 +31,6 @@ namespace LAMMPS_NS { class FixNVTGPU : public FixNHGPU { public: FixNVTGPU(class LAMMPS *, int, char **); - ~FixNVTGPU() {} }; } // namespace LAMMPS_NS diff --git a/src/GPU/pair_beck_gpu.h b/src/GPU/pair_beck_gpu.h index 835bc7e54f..011f3b4177 100644 --- a/src/GPU/pair_beck_gpu.h +++ b/src/GPU/pair_beck_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBeckGPU : public PairBeck { public: PairBeckGPU(LAMMPS *lmp); - ~PairBeckGPU(); + ~PairBeckGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_born_coul_long_cs_gpu.h b/src/GPU/pair_born_coul_long_cs_gpu.h index 228eae6c9b..34a7f41fc4 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.h +++ b/src/GPU/pair_born_coul_long_cs_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBornCoulLongCSGPU : public PairBornCoulLongCS { public: PairBornCoulLongCSGPU(LAMMPS *lmp); - ~PairBornCoulLongCSGPU(); + ~PairBornCoulLongCSGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_born_coul_long_gpu.h b/src/GPU/pair_born_coul_long_gpu.h index 89c44005c2..bbb0f24807 100644 --- a/src/GPU/pair_born_coul_long_gpu.h +++ b/src/GPU/pair_born_coul_long_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBornCoulLongGPU : public PairBornCoulLong { public: PairBornCoulLongGPU(LAMMPS *lmp); - ~PairBornCoulLongGPU(); + ~PairBornCoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_born_coul_wolf_cs_gpu.h b/src/GPU/pair_born_coul_wolf_cs_gpu.h index 13a98ba3c0..21391c6588 100644 --- a/src/GPU/pair_born_coul_wolf_cs_gpu.h +++ b/src/GPU/pair_born_coul_wolf_cs_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBornCoulWolfCSGPU : public PairBornCoulWolfCS { public: PairBornCoulWolfCSGPU(LAMMPS *lmp); - ~PairBornCoulWolfCSGPU(); + ~PairBornCoulWolfCSGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_born_coul_wolf_gpu.h b/src/GPU/pair_born_coul_wolf_gpu.h index c4c002e841..30d5fff383 100644 --- a/src/GPU/pair_born_coul_wolf_gpu.h +++ b/src/GPU/pair_born_coul_wolf_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBornCoulWolfGPU : public PairBornCoulWolf { public: PairBornCoulWolfGPU(LAMMPS *lmp); - ~PairBornCoulWolfGPU(); + ~PairBornCoulWolfGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_born_gpu.h b/src/GPU/pair_born_gpu.h index b958da28f0..bab342b259 100644 --- a/src/GPU/pair_born_gpu.h +++ b/src/GPU/pair_born_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairBornGPU : public PairBorn { public: PairBornGPU(LAMMPS *lmp); - ~PairBornGPU(); + ~PairBornGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_buck_coul_cut_gpu.h b/src/GPU/pair_buck_coul_cut_gpu.h index 69965a1a53..56d69f00ba 100644 --- a/src/GPU/pair_buck_coul_cut_gpu.h +++ b/src/GPU/pair_buck_coul_cut_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBuckCoulCutGPU : public PairBuckCoulCut { public: PairBuckCoulCutGPU(LAMMPS *lmp); - ~PairBuckCoulCutGPU(); + ~PairBuckCoulCutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_buck_coul_long_gpu.h b/src/GPU/pair_buck_coul_long_gpu.h index 231462d4c4..3e3cb33112 100644 --- a/src/GPU/pair_buck_coul_long_gpu.h +++ b/src/GPU/pair_buck_coul_long_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairBuckCoulLongGPU : public PairBuckCoulLong { public: PairBuckCoulLongGPU(LAMMPS *lmp); - ~PairBuckCoulLongGPU(); + ~PairBuckCoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_buck_gpu.h b/src/GPU/pair_buck_gpu.h index c3b91cbbc1..99fe981d38 100644 --- a/src/GPU/pair_buck_gpu.h +++ b/src/GPU/pair_buck_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairBuckGPU : public PairBuck { public: PairBuckGPU(LAMMPS *lmp); - ~PairBuckGPU(); + ~PairBuckGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_colloid_gpu.h b/src/GPU/pair_colloid_gpu.h index 6e49b8e2ed..5f1f068429 100644 --- a/src/GPU/pair_colloid_gpu.h +++ b/src/GPU/pair_colloid_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairColloidGPU : public PairColloid { public: PairColloidGPU(LAMMPS *lmp); - ~PairColloidGPU(); + ~PairColloidGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_coul_cut_gpu.h b/src/GPU/pair_coul_cut_gpu.h index 9c6d8eb6d6..620f7185eb 100644 --- a/src/GPU/pair_coul_cut_gpu.h +++ b/src/GPU/pair_coul_cut_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairCoulCutGPU : public PairCoulCut { public: PairCoulCutGPU(LAMMPS *lmp); - ~PairCoulCutGPU(); + ~PairCoulCutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_coul_debye_gpu.h b/src/GPU/pair_coul_debye_gpu.h index 6e0efe8808..5efefd9a43 100644 --- a/src/GPU/pair_coul_debye_gpu.h +++ b/src/GPU/pair_coul_debye_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairCoulDebyeGPU : public PairCoulDebye { public: PairCoulDebyeGPU(LAMMPS *lmp); - ~PairCoulDebyeGPU(); + ~PairCoulDebyeGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_coul_dsf_gpu.h b/src/GPU/pair_coul_dsf_gpu.h index b1da9f0742..c6b8803400 100644 --- a/src/GPU/pair_coul_dsf_gpu.h +++ b/src/GPU/pair_coul_dsf_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairCoulDSFGPU : public PairCoulDSF { public: PairCoulDSFGPU(LAMMPS *lmp); - ~PairCoulDSFGPU(); + ~PairCoulDSFGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_coul_long_cs_gpu.h b/src/GPU/pair_coul_long_cs_gpu.h index b26e1c5eb9..30ff080e3c 100644 --- a/src/GPU/pair_coul_long_cs_gpu.h +++ b/src/GPU/pair_coul_long_cs_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairCoulLongCSGPU : public PairCoulLongCS { public: PairCoulLongCSGPU(LAMMPS *lmp); - ~PairCoulLongCSGPU(); + ~PairCoulLongCSGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_coul_long_gpu.h b/src/GPU/pair_coul_long_gpu.h index 8dbd0f936a..7012d489e1 100644 --- a/src/GPU/pair_coul_long_gpu.h +++ b/src/GPU/pair_coul_long_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairCoulLongGPU : public PairCoulLong { public: PairCoulLongGPU(LAMMPS *lmp); - ~PairCoulLongGPU(); + ~PairCoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_dpd_gpu.h b/src/GPU/pair_dpd_gpu.h index 72d2c249da..843e2c179d 100644 --- a/src/GPU/pair_dpd_gpu.h +++ b/src/GPU/pair_dpd_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairDPDGPU : public PairDPD { public: PairDPDGPU(LAMMPS *lmp); - ~PairDPDGPU(); + ~PairDPDGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_dpd_tstat_gpu.h b/src/GPU/pair_dpd_tstat_gpu.h index 132360bb1b..6b3da61696 100644 --- a/src/GPU/pair_dpd_tstat_gpu.h +++ b/src/GPU/pair_dpd_tstat_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairDPDTstatGPU : public PairDPDTstat { public: PairDPDTstatGPU(LAMMPS *lmp); - ~PairDPDTstatGPU(); + ~PairDPDTstatGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_eam_alloy_gpu.h b/src/GPU/pair_eam_alloy_gpu.h index 80125a8425..c2cd8a9732 100644 --- a/src/GPU/pair_eam_alloy_gpu.h +++ b/src/GPU/pair_eam_alloy_gpu.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairEAMAlloyGPU : public PairEAM { public: PairEAMAlloyGPU(class LAMMPS *); - virtual ~PairEAMAlloyGPU(); - void coeff(int, char **); - void compute(int, int); - void init_style(); - double single(int, int, int, int, double, double, double, double &); - double memory_usage(); - void *extract(const char *, int &) { return nullptr; } + ~PairEAMAlloyGPU() override; + void coeff(int, char **) override; + void compute(int, int) override; + void init_style() override; + double single(int, int, int, int, double, double, double, double &) override; + double memory_usage() override; + void *extract(const char *, int &) override { return nullptr; } - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; int gpu_mode; double cpu_time; diff --git a/src/GPU/pair_eam_fs_gpu.h b/src/GPU/pair_eam_fs_gpu.h index 2e5bb46cad..9bb48d2ba5 100644 --- a/src/GPU/pair_eam_fs_gpu.h +++ b/src/GPU/pair_eam_fs_gpu.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairEAMFSGPU : public PairEAM { public: PairEAMFSGPU(class LAMMPS *); - virtual ~PairEAMFSGPU(); - void coeff(int, char **); - void compute(int, int); - void init_style(); - double single(int, int, int, int, double, double, double, double &); - double memory_usage(); - void *extract(const char *, int &) { return nullptr; } + ~PairEAMFSGPU() override; + void coeff(int, char **) override; + void compute(int, int) override; + void init_style() override; + double single(int, int, int, int, double, double, double, double &) override; + double memory_usage() override; + void *extract(const char *, int &) override { return nullptr; } - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; int gpu_mode; double cpu_time; diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index 1c781dd60a..a3727051ba 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairEAMGPU : public PairEAM { public: PairEAMGPU(class LAMMPS *); - virtual ~PairEAMGPU(); - void compute(int, int); - void init_style(); - double single(int, int, int, int, double, double, double, double &); - double memory_usage(); - void *extract(const char *, int &) { return nullptr; } + ~PairEAMGPU() override; + void compute(int, int) override; + void init_style() override; + double single(int, int, int, int, double, double, double, double &) override; + double memory_usage() override; + void *extract(const char *, int &) override { return nullptr; } - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_gauss_gpu.h b/src/GPU/pair_gauss_gpu.h index 3abf57ade6..5df3cce372 100644 --- a/src/GPU/pair_gauss_gpu.h +++ b/src/GPU/pair_gauss_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairGaussGPU : public PairGauss { public: PairGaussGPU(LAMMPS *lmp); - ~PairGaussGPU(); + ~PairGaussGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_gayberne_gpu.h b/src/GPU/pair_gayberne_gpu.h index 37c8d59214..bcb9aea958 100644 --- a/src/GPU/pair_gayberne_gpu.h +++ b/src/GPU/pair_gayberne_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairGayBerneGPU : public PairGayBerne { public: PairGayBerneGPU(LAMMPS *lmp); - ~PairGayBerneGPU(); + ~PairGayBerneGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj96_cut_gpu.h b/src/GPU/pair_lj96_cut_gpu.h index eec6eab572..a4ff23f7e7 100644 --- a/src/GPU/pair_lj96_cut_gpu.h +++ b/src/GPU/pair_lj96_cut_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJ96CutGPU : public PairLJ96Cut { public: PairLJ96CutGPU(LAMMPS *lmp); - ~PairLJ96CutGPU(); + ~PairLJ96CutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_charmm_coul_charmm_gpu.h b/src/GPU/pair_lj_charmm_coul_charmm_gpu.h index fe3d13d59e..a9e3e6ab5c 100644 --- a/src/GPU/pair_lj_charmm_coul_charmm_gpu.h +++ b/src/GPU/pair_lj_charmm_coul_charmm_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCharmmCoulCharmmGPU : public PairLJCharmmCoulCharmm { public: PairLJCharmmCoulCharmmGPU(LAMMPS *lmp); - ~PairLJCharmmCoulCharmmGPU(); + ~PairLJCharmmCoulCharmmGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.h b/src/GPU/pair_lj_charmm_coul_long_gpu.h index 4c7313ab0f..d0c2716346 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.h +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCharmmCoulLongGPU : public PairLJCharmmCoulLong { public: PairLJCharmmCoulLongGPU(LAMMPS *lmp); - ~PairLJCharmmCoulLongGPU(); + ~PairLJCharmmCoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.h b/src/GPU/pair_lj_class2_coul_long_gpu.h index 8b18d659dd..46e8751ba4 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.h +++ b/src/GPU/pair_lj_class2_coul_long_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJClass2CoulLongGPU : public PairLJClass2CoulLong { public: PairLJClass2CoulLongGPU(LAMMPS *lmp); - ~PairLJClass2CoulLongGPU(); + ~PairLJClass2CoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_class2_gpu.h b/src/GPU/pair_lj_class2_gpu.h index 44e24c13f0..35627e5eea 100644 --- a/src/GPU/pair_lj_class2_gpu.h +++ b/src/GPU/pair_lj_class2_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJClass2GPU : public PairLJClass2 { public: PairLJClass2GPU(LAMMPS *lmp); - ~PairLJClass2GPU(); + ~PairLJClass2GPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cubic_gpu.h b/src/GPU/pair_lj_cubic_gpu.h index 30dd23671b..293e86621e 100644 --- a/src/GPU/pair_lj_cubic_gpu.h +++ b/src/GPU/pair_lj_cubic_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCubicGPU : public PairLJCubic { public: PairLJCubicGPU(LAMMPS *lmp); - ~PairLJCubicGPU(); + ~PairLJCubicGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_coul_cut_gpu.h b/src/GPU/pair_lj_cut_coul_cut_gpu.h index 7ccf2b4e0a..0e78142594 100644 --- a/src/GPU/pair_lj_cut_coul_cut_gpu.h +++ b/src/GPU/pair_lj_cut_coul_cut_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutCoulCutGPU : public PairLJCutCoulCut { public: PairLJCutCoulCutGPU(LAMMPS *lmp); - ~PairLJCutCoulCutGPU(); + ~PairLJCutCoulCutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_coul_debye_gpu.h b/src/GPU/pair_lj_cut_coul_debye_gpu.h index a6803eef1d..777369069b 100644 --- a/src/GPU/pair_lj_cut_coul_debye_gpu.h +++ b/src/GPU/pair_lj_cut_coul_debye_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutCoulDebyeGPU : public PairLJCutCoulDebye { public: PairLJCutCoulDebyeGPU(LAMMPS *lmp); - ~PairLJCutCoulDebyeGPU(); + ~PairLJCutCoulDebyeGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_coul_dsf_gpu.h b/src/GPU/pair_lj_cut_coul_dsf_gpu.h index d39a97bed1..900957de40 100644 --- a/src/GPU/pair_lj_cut_coul_dsf_gpu.h +++ b/src/GPU/pair_lj_cut_coul_dsf_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutCoulDSFGPU : public PairLJCutCoulDSF { public: PairLJCutCoulDSFGPU(LAMMPS *lmp); - ~PairLJCutCoulDSFGPU(); + ~PairLJCutCoulDSFGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.h b/src/GPU/pair_lj_cut_coul_long_gpu.h index ef2ed3633c..6eee3d3d96 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.h +++ b/src/GPU/pair_lj_cut_coul_long_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLJCutCoulLongGPU : public PairLJCutCoulLong { public: PairLJCutCoulLongGPU(LAMMPS *lmp); - ~PairLJCutCoulLongGPU(); + ~PairLJCutCoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.h b/src/GPU/pair_lj_cut_coul_msm_gpu.h index 0b6851d56f..ea40dd5d87 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.h +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutCoulMSMGPU : public PairLJCutCoulMSM { public: PairLJCutCoulMSMGPU(LAMMPS *lmp); - ~PairLJCutCoulMSMGPU(); + ~PairLJCutCoulMSMGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_dipole_cut_gpu.h b/src/GPU/pair_lj_cut_dipole_cut_gpu.h index 6a04332761..ae62abbf18 100644 --- a/src/GPU/pair_lj_cut_dipole_cut_gpu.h +++ b/src/GPU/pair_lj_cut_dipole_cut_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutDipoleCutGPU : public PairLJCutDipoleCut { public: PairLJCutDipoleCutGPU(LAMMPS *lmp); - ~PairLJCutDipoleCutGPU(); + ~PairLJCutDipoleCutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.h b/src/GPU/pair_lj_cut_dipole_long_gpu.h index c87e01ed86..cec97d55b6 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.h +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutDipoleLongGPU : public PairLJCutDipoleLong { public: PairLJCutDipoleLongGPU(LAMMPS *lmp); - ~PairLJCutDipoleLongGPU(); + ~PairLJCutDipoleLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_gpu.h b/src/GPU/pair_lj_cut_gpu.h index edc1436cdf..151e12cf01 100644 --- a/src/GPU/pair_lj_cut_gpu.h +++ b/src/GPU/pair_lj_cut_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLJCutGPU : public PairLJCut { public: PairLJCutGPU(LAMMPS *lmp); - ~PairLJCutGPU(); + ~PairLJCutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_cut_tip4p_long_gpu.h b/src/GPU/pair_lj_cut_tip4p_long_gpu.h index c2db10c9eb..3d567943c9 100644 --- a/src/GPU/pair_lj_cut_tip4p_long_gpu.h +++ b/src/GPU/pair_lj_cut_tip4p_long_gpu.h @@ -31,10 +31,10 @@ namespace LAMMPS_NS { class PairLJCutTIP4PLongGPU : public PairLJCutTIP4PLong { public: PairLJCutTIP4PLongGPU(LAMMPS *lmp); - ~PairLJCutTIP4PLongGPU(); - void compute(int, int); - void init_style(); - double memory_usage(); + ~PairLJCutTIP4PLongGPU() override; + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.cpp b/src/GPU/pair_lj_expand_coul_long_gpu.cpp index 068012227e..5dc53a57fa 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_expand_coul_long_gpu.cpp @@ -51,9 +51,9 @@ int ljecl_gpu_init(const int ntypes, double **cutsq, double **host_lj1, int &gpu_mode, FILE *screen, double **host_cut_ljsq, double host_cut_coulsq, double *host_special_coul, const double qqrd2e, const double g_ewald); -int ljecl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, - double **host_lj2, double **host_lj3, double **host_lj4, - double **offset, double **shift, double **host_lj_cutsq); +void ljecl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, + double **host_lj2, double **host_lj3, double **host_lj4, + double **offset, double **shift, double **host_lj_cutsq); void ljecl_gpu_clear(); int ** ljecl_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x, int *host_type, diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.h b/src/GPU/pair_lj_expand_coul_long_gpu.h index 02582e7b5e..d44cc9c11c 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.h +++ b/src/GPU/pair_lj_expand_coul_long_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLJExpandCoulLongGPU : public PairLJExpandCoulLong { public: PairLJExpandCoulLongGPU(LAMMPS *lmp); - ~PairLJExpandCoulLongGPU(); + ~PairLJExpandCoulLongGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_expand_gpu.h b/src/GPU/pair_lj_expand_gpu.h index 9edb217baa..dee3d25022 100644 --- a/src/GPU/pair_lj_expand_gpu.h +++ b/src/GPU/pair_lj_expand_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLJExpandGPU : public PairLJExpand { public: PairLJExpandGPU(LAMMPS *lmp); - ~PairLJExpandGPU(); + ~PairLJExpandGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_gromacs_gpu.h b/src/GPU/pair_lj_gromacs_gpu.h index 5df649c2c3..ea7bbe81a7 100644 --- a/src/GPU/pair_lj_gromacs_gpu.h +++ b/src/GPU/pair_lj_gromacs_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJGromacsGPU : public PairLJGromacs { public: PairLJGromacsGPU(LAMMPS *lmp); - ~PairLJGromacsGPU(); + ~PairLJGromacsGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.h b/src/GPU/pair_lj_sdk_coul_long_gpu.h index b3148efa0e..0ee52af754 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.h +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJSDKCoulLongGPU : public PairLJSDKCoulLong { public: PairLJSDKCoulLongGPU(LAMMPS *lmp); - ~PairLJSDKCoulLongGPU(); + ~PairLJSDKCoulLongGPU() override; template void cpu_compute(int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_sdk_gpu.h b/src/GPU/pair_lj_sdk_gpu.h index f71bf64efb..8a70f81a64 100644 --- a/src/GPU/pair_lj_sdk_gpu.h +++ b/src/GPU/pair_lj_sdk_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJSDKGPU : public PairLJSDK { public: PairLJSDKGPU(LAMMPS *lmp); - ~PairLJSDKGPU(); + ~PairLJSDKGPU() override; template void cpu_compute(int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_sf_dipole_sf_gpu.h b/src/GPU/pair_lj_sf_dipole_sf_gpu.h index 5aaec1e92b..91bb07f244 100644 --- a/src/GPU/pair_lj_sf_dipole_sf_gpu.h +++ b/src/GPU/pair_lj_sf_dipole_sf_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJSFDipoleSFGPU : public PairLJSFDipoleSF { public: PairLJSFDipoleSFGPU(LAMMPS *lmp); - ~PairLJSFDipoleSFGPU(); + ~PairLJSFDipoleSFGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_lj_smooth_gpu.h b/src/GPU/pair_lj_smooth_gpu.h index 2624e54a20..07d9284f56 100644 --- a/src/GPU/pair_lj_smooth_gpu.h +++ b/src/GPU/pair_lj_smooth_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairLJSmoothGPU : public PairLJSmooth { public: PairLJSmoothGPU(LAMMPS *lmp); - ~PairLJSmoothGPU(); + ~PairLJSmoothGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_mie_cut_gpu.h b/src/GPU/pair_mie_cut_gpu.h index c168c69c42..c6516eb01c 100644 --- a/src/GPU/pair_mie_cut_gpu.h +++ b/src/GPU/pair_mie_cut_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairMIECutGPU : public PairMIECut { public: PairMIECutGPU(LAMMPS *lmp); - ~PairMIECutGPU(); + ~PairMIECutGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_morse_gpu.h b/src/GPU/pair_morse_gpu.h index 09d6c53e3b..4da208de23 100644 --- a/src/GPU/pair_morse_gpu.h +++ b/src/GPU/pair_morse_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairMorseGPU : public PairMorse { public: PairMorseGPU(LAMMPS *lmp); - ~PairMorseGPU(); + ~PairMorseGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_resquared_gpu.h b/src/GPU/pair_resquared_gpu.h index 9096e88f3d..b808607af8 100644 --- a/src/GPU/pair_resquared_gpu.h +++ b/src/GPU/pair_resquared_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairRESquaredGPU : public PairRESquared { public: PairRESquaredGPU(LAMMPS *lmp); - ~PairRESquaredGPU(); + ~PairRESquaredGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_soft_gpu.h b/src/GPU/pair_soft_gpu.h index 3e84d2e58a..2f42a3a075 100644 --- a/src/GPU/pair_soft_gpu.h +++ b/src/GPU/pair_soft_gpu.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairSoftGPU : public PairSoft { public: PairSoftGPU(LAMMPS *lmp); - ~PairSoftGPU(); + ~PairSoftGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_sw_gpu.h b/src/GPU/pair_sw_gpu.h index 8f9abe6478..4fe5d538b3 100644 --- a/src/GPU/pair_sw_gpu.h +++ b/src/GPU/pair_sw_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairSWGPU : public PairSW { public: PairSWGPU(class LAMMPS *); - ~PairSWGPU(); - void compute(int, int); - double init_one(int, int); - void init_style(); + ~PairSWGPU() override; + void compute(int, int) override; + double init_one(int, int) override; + void init_style() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; protected: - void allocate(); + void allocate() override; int gpu_mode; double cpu_time; diff --git a/src/GPU/pair_table_gpu.h b/src/GPU/pair_table_gpu.h index 6623a4c41c..9653e65524 100644 --- a/src/GPU/pair_table_gpu.h +++ b/src/GPU/pair_table_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairTableGPU : public PairTable { public: PairTableGPU(LAMMPS *lmp); - ~PairTableGPU(); + ~PairTableGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_tersoff_gpu.h b/src/GPU/pair_tersoff_gpu.h index 9f981f8ca4..700b0b3284 100644 --- a/src/GPU/pair_tersoff_gpu.h +++ b/src/GPU/pair_tersoff_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairTersoffGPU : public PairTersoff { public: PairTersoffGPU(class LAMMPS *); - ~PairTersoffGPU(); - void compute(int, int); - double init_one(int, int); - void init_style(); + ~PairTersoffGPU() override; + void compute(int, int) override; + double init_one(int, int) override; + void init_style() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; protected: - void allocate(); + void allocate() override; int gpu_mode; double cpu_time; diff --git a/src/GPU/pair_tersoff_mod_gpu.h b/src/GPU/pair_tersoff_mod_gpu.h index 31abc0c258..e7a550b616 100644 --- a/src/GPU/pair_tersoff_mod_gpu.h +++ b/src/GPU/pair_tersoff_mod_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairTersoffMODGPU : public PairTersoffMOD { public: PairTersoffMODGPU(class LAMMPS *); - ~PairTersoffMODGPU(); - void compute(int, int); - double init_one(int, int); - void init_style(); + ~PairTersoffMODGPU() override; + void compute(int, int) override; + double init_one(int, int) override; + void init_style() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; protected: - void allocate(); + void allocate() override; int gpu_mode; double cpu_time; diff --git a/src/GPU/pair_tersoff_zbl_gpu.h b/src/GPU/pair_tersoff_zbl_gpu.h index a52b633302..566d3356b0 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.h +++ b/src/GPU/pair_tersoff_zbl_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairTersoffZBLGPU : public PairTersoffZBL { public: PairTersoffZBLGPU(class LAMMPS *); - ~PairTersoffZBLGPU(); - void compute(int, int); - double init_one(int, int); - void init_style(); + ~PairTersoffZBLGPU() override; + void compute(int, int) override; + double init_one(int, int) override; + void init_style() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; protected: - void allocate(); + void allocate() override; int gpu_mode; double cpu_time; diff --git a/src/GPU/pair_ufm_gpu.cpp b/src/GPU/pair_ufm_gpu.cpp index c7483c737b..5d8a2068e1 100644 --- a/src/GPU/pair_ufm_gpu.cpp +++ b/src/GPU/pair_ufm_gpu.cpp @@ -42,8 +42,8 @@ int ufml_gpu_init(const int ntypes, double **cutsq, double **host_uf1, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); -int ufml_gpu_reinit(const int ntypes, double **cutsq, double **host_uf1, - double **host_uf2, double **host_uf3, double **offset); +void ufml_gpu_reinit(const int ntypes, double **cutsq, double **host_uf1, + double **host_uf2, double **host_uf3, double **offset); void ufml_gpu_clear(); int ** ufml_gpu_compute_n(const int ago, const int inum, const int nall, diff --git a/src/GPU/pair_ufm_gpu.h b/src/GPU/pair_ufm_gpu.h index 0ebd6b7537..43104cb07d 100644 --- a/src/GPU/pair_ufm_gpu.h +++ b/src/GPU/pair_ufm_gpu.h @@ -33,12 +33,12 @@ namespace LAMMPS_NS { class PairUFMGPU : public PairUFM { public: PairUFMGPU(LAMMPS *lmp); - ~PairUFMGPU(); + ~PairUFMGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - void reinit(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + void reinit() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_vashishta_gpu.h b/src/GPU/pair_vashishta_gpu.h index 4f194bffc7..171f8b1b6d 100644 --- a/src/GPU/pair_vashishta_gpu.h +++ b/src/GPU/pair_vashishta_gpu.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairVashishtaGPU : public PairVashishta { public: PairVashishtaGPU(class LAMMPS *); - ~PairVashishtaGPU(); - void compute(int, int); - double init_one(int, int); - void init_style(); + ~PairVashishtaGPU() override; + void compute(int, int) override; + double init_one(int, int) override; + void init_style() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_yukawa_colloid_gpu.h b/src/GPU/pair_yukawa_colloid_gpu.h index 4af9dd1b63..e9a2cff98c 100644 --- a/src/GPU/pair_yukawa_colloid_gpu.h +++ b/src/GPU/pair_yukawa_colloid_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairYukawaColloidGPU : public PairYukawaColloid { public: PairYukawaColloidGPU(LAMMPS *lmp); - ~PairYukawaColloidGPU(); + ~PairYukawaColloidGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_yukawa_gpu.h b/src/GPU/pair_yukawa_gpu.h index a8a9194784..b08376e528 100644 --- a/src/GPU/pair_yukawa_gpu.h +++ b/src/GPU/pair_yukawa_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairYukawaGPU : public PairYukawa { public: PairYukawaGPU(LAMMPS *lmp); - ~PairYukawaGPU(); + ~PairYukawaGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pair_zbl_gpu.h b/src/GPU/pair_zbl_gpu.h index 39811598b3..6fcfd82abd 100644 --- a/src/GPU/pair_zbl_gpu.h +++ b/src/GPU/pair_zbl_gpu.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairZBLGPU : public PairZBL { public: PairZBLGPU(LAMMPS *lmp); - ~PairZBLGPU(); + ~PairZBLGPU() override; void cpu_compute(int, int, int, int, int *, int *, int **); - void compute(int, int); - void init_style(); - double memory_usage(); + void compute(int, int) override; + void init_style() override; + double memory_usage() override; enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GPU/pppm_gpu.h b/src/GPU/pppm_gpu.h index 9e39c50151..7835a4ec30 100644 --- a/src/GPU/pppm_gpu.h +++ b/src/GPU/pppm_gpu.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PPPMGPU : public PPPM { public: PPPMGPU(class LAMMPS *); - virtual ~PPPMGPU(); - void init(); - void setup(); - void compute(int, int); - int timing_1d(int, double &); - int timing_3d(int, double &); - double memory_usage(); + ~PPPMGPU() override; + void init() override; + void setup() override; + void compute(int, int) override; + int timing_1d(int, double &) override; + int timing_3d(int, double &) override; + double memory_usage() override; - virtual void compute_group_group(int, int, int); + void compute_group_group(int, int, int) override; protected: FFT_SCALAR ***density_brick_gpu, ***vd_brick; @@ -44,12 +44,12 @@ class PPPMGPU : public PPPM { double poisson_time; void brick2fft_gpu(); - virtual void poisson_ik(); + void poisson_ik() override; - void pack_forward_grid(int, void *, int, int *); - void unpack_forward_grid(int, void *, int, int *); - void pack_reverse_grid(int, void *, int, int *); - void unpack_reverse_grid(int, void *, int, int *); + void pack_forward_grid(int, void *, int, int *) override; + void unpack_forward_grid(int, void *, int, int *) override; + void pack_reverse_grid(int, void *, int, int *) override; + void unpack_reverse_grid(int, void *, int, int *) override; FFT_SCALAR ***create_3d_offset(int, int, int, int, int, int, const char *, FFT_SCALAR *, int); void destroy_3d_offset(FFT_SCALAR ***, int, int); diff --git a/src/GRANULAR/compute_contact_atom.h b/src/GRANULAR/compute_contact_atom.h index 6be62e4b31..784bff568f 100644 --- a/src/GRANULAR/compute_contact_atom.h +++ b/src/GRANULAR/compute_contact_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeContactAtom : public Compute { public: ComputeContactAtom(class LAMMPS *, int, char **); - ~ComputeContactAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeContactAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int nmax; diff --git a/src/GRANULAR/compute_fabric.h b/src/GRANULAR/compute_fabric.h index 5e20ea6562..b92f14bd2b 100644 --- a/src/GRANULAR/compute_fabric.h +++ b/src/GRANULAR/compute_fabric.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeFabric : public Compute { public: ComputeFabric(class LAMMPS *, int, char **); - ~ComputeFabric(); - void init(); - void init_list(int, class NeighList *); - void compute_vector(); - double compute_scalar(); + ~ComputeFabric() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_vector() override; + double compute_scalar() override; private: int ntensors, pstyle, cutstyle; diff --git a/src/GRANULAR/fix_freeze.h b/src/GRANULAR/fix_freeze.h index 5846bfd769..23cdc7c305 100644 --- a/src/GRANULAR/fix_freeze.h +++ b/src/GRANULAR/fix_freeze.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixFreeze : public Fix { public: FixFreeze(class LAMMPS *, int, char **); - int setmask(); - void init(); - void setup(int); - virtual void post_force(int); - void post_force_respa(int, int, int); - double compute_vector(int); + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_vector(int) override; protected: int force_flag; diff --git a/src/GRANULAR/fix_pour.h b/src/GRANULAR/fix_pour.h index 7c0bd5aff8..16ef3b7f32 100644 --- a/src/GRANULAR/fix_pour.h +++ b/src/GRANULAR/fix_pour.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixPour : public Fix { public: FixPour(class LAMMPS *, int, char **); - ~FixPour(); - int setmask(); - void init(); - void setup_pre_exchange(); - void pre_exchange(); - void reset_dt(); - void *extract(const char *, int &); + ~FixPour() override; + int setmask() override; + void init() override; + void setup_pre_exchange() override; + void pre_exchange() override; + void reset_dt() override; + void *extract(const char *, int &) override; private: int ninsert, ntype, seed; diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 9a7c4055a1..f59a43ae3f 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -30,24 +30,24 @@ class FixWallGran : public Fix { enum { NORMAL_NONE, NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR }; FixWallGran(class LAMMPS *, int, char **); - virtual ~FixWallGran(); - int setmask(); - virtual void init(); - void setup(int); - virtual void post_force(int); - virtual void post_force_respa(int, int, int); + ~FixWallGran() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; - virtual double memory_usage(); - virtual void grow_arrays(int); - virtual void copy_arrays(int, int, int); - virtual void set_arrays(int); - virtual int pack_exchange(int, double *); - virtual int unpack_exchange(int, double *); - virtual int pack_restart(int, double *); - virtual void unpack_restart(int, int); - virtual int size_restart(int); - virtual int maxsize_restart(); - void reset_dt(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; + void reset_dt() override; void hooke(double, double, double, double, double *, double *, double *, double *, double *, double, double, double *); diff --git a/src/GRANULAR/fix_wall_gran_region.h b/src/GRANULAR/fix_wall_gran_region.h index e7f9dc89ef..6e95afeabc 100644 --- a/src/GRANULAR/fix_wall_gran_region.h +++ b/src/GRANULAR/fix_wall_gran_region.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class FixWallGranRegion : public FixWallGran { public: FixWallGranRegion(class LAMMPS *, int, char **); - ~FixWallGranRegion(); - void post_force(int); - void write_restart(FILE *); - void restart(char *); - void init(); + ~FixWallGranRegion() override; + void post_force(int) override; + void write_restart(FILE *) override; + void restart(char *) override; + void init() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; private: class Region *region; diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index 85cbb51f90..801218f02b 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -208,11 +208,12 @@ void PairGranHertzHistory::compute(int eflag, int vflag) shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + shear[2]*shear[2]); - // rotate shear displacements - - rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz; - rsht *= rsqinv; if (shearupdate) { + + // rotate shear displacements + + rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz; + rsht *= rsqinv; shear[0] -= rsht*delx; shear[1] -= rsht*dely; shear[2] -= rsht*delz; @@ -330,7 +331,7 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double r,rinv,rsqinv,delx,dely,delz; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3,wr1,wr2,wr3; double mi,mj,meff,damp,ccel,polyhertz; - double vtr1,vtr2,vtr3,vrel,shrmag,rsht; + double vtr1,vtr2,vtr3,vrel,shrmag; double fs1,fs2,fs3,fs,fn; double *radius = atom->radius; @@ -436,11 +437,6 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + shear[2]*shear[2]); - // rotate shear displacements - - rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz; - rsht *= rsqinv; - // tangential forces = shear + tangential velocity damping fs1 = -polyhertz * (kt*shear[0] + meff*gammat*vtr1); diff --git a/src/GRANULAR/pair_gran_hertz_history.h b/src/GRANULAR/pair_gran_hertz_history.h index 1b02567119..cc8f79347c 100644 --- a/src/GRANULAR/pair_gran_hertz_history.h +++ b/src/GRANULAR/pair_gran_hertz_history.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class PairGranHertzHistory : public PairGranHookeHistory { public: PairGranHertzHistory(class LAMMPS *); - virtual void compute(int, int); - void settings(int, char **); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + double single(int, int, int, int, double, double, double, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/GRANULAR/pair_gran_hooke.h b/src/GRANULAR/pair_gran_hooke.h index c43394012b..7f616d9c98 100644 --- a/src/GRANULAR/pair_gran_hooke.h +++ b/src/GRANULAR/pair_gran_hooke.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairGranHooke : public PairGranHookeHistory { public: PairGranHooke(class LAMMPS *); - virtual void compute(int, int); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 3e1578724b..20f53b1fc7 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -268,11 +268,12 @@ void PairGranHookeHistory::compute(int eflag, int vflag) } shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]); - // rotate shear displacements - - rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz; - rsht *= rsqinv; if (shearupdate) { + + // rotate shear displacements + + rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz; + rsht *= rsqinv; shear[0] -= rsht * delx; shear[1] -= rsht * dely; shear[2] -= rsht * delz; @@ -626,7 +627,7 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double r, rinv, rsqinv, delx, dely, delz; double vr1, vr2, vr3, vnnr, vn1, vn2, vn3, vt1, vt2, vt3, wr1, wr2, wr3; double mi, mj, meff, damp, ccel; - double vtr1, vtr2, vtr3, vrel, shrmag, rsht; + double vtr1, vtr2, vtr3, vrel, shrmag; double fs1, fs2, fs3, fs, fn; double *radius = atom->radius; @@ -728,11 +729,6 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double *shear = &allshear[3 * neighprev]; shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]); - // rotate shear displacements - - rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz; - rsht *= rsqinv; - // tangential forces = shear + tangential velocity damping fs1 = -(kt * shear[0] + meff * gammat * vtr1); diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index 22557bba6a..e81e5c0939 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -27,23 +27,23 @@ namespace LAMMPS_NS { class PairGranHookeHistory : public Pair { public: PairGranHookeHistory(class LAMMPS *); - virtual ~PairGranHookeHistory(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void reset_dt(); - virtual double single(int, int, int, int, double, double, double, double &); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); - double atom2cut(int); - double radii2cut(double, double); + ~PairGranHookeHistory() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void reset_dt() override; + double single(int, int, int, int, double, double, double, double &) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; + double atom2cut(int) override; + double radii2cut(double, double) override; protected: double kn, kt, gamman, gammat, xmu; diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 3430f0ebb7..5961e28887 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class PairGranular : public Pair { public: PairGranular(class LAMMPS *); - ~PairGranular(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void reset_dt(); - double single(int, int, int, int, double, double, double, double &); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); - double atom2cut(int); - double radii2cut(double, double); + ~PairGranular() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void reset_dt() override; + double single(int, int, int, int, double, double, double, double &) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; + double atom2cut(int) override; + double radii2cut(double, double) override; protected: double dt; @@ -63,7 +63,7 @@ class PairGranular : public Pair { int nmax; // allocated size of mass_rigid void allocate(); - void transfer_history(double *, double *); + void transfer_history(double *, double *) override; private: int size_history; diff --git a/src/H5MD/dump_h5md.h b/src/H5MD/dump_h5md.h index 5e3f3f8279..7caf7f9583 100644 --- a/src/H5MD/dump_h5md.h +++ b/src/H5MD/dump_h5md.h @@ -29,7 +29,7 @@ namespace LAMMPS_NS { class DumpH5MD : public Dump { public: DumpH5MD(class LAMMPS *, int, char **); - virtual ~DumpH5MD(); + ~DumpH5MD() override; private: int natoms, ntotal; @@ -57,12 +57,12 @@ class DumpH5MD : public Dump { int *dump_charge; int every_charge; - void init_style(); - int modify_param(int, char **); - void openfile(); - void write_header(bigint); - void pack(tagint *); - void write_data(int, double *); + void init_style() override; + int modify_param(int, char **) override; + void openfile() override; + void write_header(bigint) override; + void pack(tagint *) override; + void write_data(int, double *) override; void write_frame(); void write_fixed_frame(); diff --git a/src/INTEL/angle_charmm_intel.h b/src/INTEL/angle_charmm_intel.h index 942ac942a1..6758602843 100644 --- a/src/INTEL/angle_charmm_intel.h +++ b/src/INTEL/angle_charmm_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class AngleCharmmIntel : public AngleCharmm { public: AngleCharmmIntel(class LAMMPS *); - virtual ~AngleCharmmIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~AngleCharmmIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; diff --git a/src/INTEL/angle_harmonic_intel.h b/src/INTEL/angle_harmonic_intel.h index 10bdcd9546..650e5363a3 100644 --- a/src/INTEL/angle_harmonic_intel.h +++ b/src/INTEL/angle_harmonic_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class AngleHarmonicIntel : public AngleHarmonic { public: AngleHarmonicIntel(class LAMMPS *); - virtual ~AngleHarmonicIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~AngleHarmonicIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; diff --git a/src/INTEL/bond_fene_intel.h b/src/INTEL/bond_fene_intel.h index 0c71f1a9d0..0bb5479ede 100644 --- a/src/INTEL/bond_fene_intel.h +++ b/src/INTEL/bond_fene_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class BondFENEIntel : public BondFENE { public: BondFENEIntel(class LAMMPS *); - virtual ~BondFENEIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~BondFENEIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; diff --git a/src/INTEL/bond_harmonic_intel.h b/src/INTEL/bond_harmonic_intel.h index 612f4e7ca1..7568dbe6e7 100644 --- a/src/INTEL/bond_harmonic_intel.h +++ b/src/INTEL/bond_harmonic_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class BondHarmonicIntel : public BondHarmonic { public: BondHarmonicIntel(class LAMMPS *); - virtual ~BondHarmonicIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~BondHarmonicIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; diff --git a/src/INTEL/dihedral_charmm_intel.h b/src/INTEL/dihedral_charmm_intel.h index ec213f5d75..9de87826f7 100644 --- a/src/INTEL/dihedral_charmm_intel.h +++ b/src/INTEL/dihedral_charmm_intel.h @@ -34,8 +34,8 @@ class DihedralCharmmIntel : public DihedralCharmm { public: DihedralCharmmIntel(class LAMMPS *lmp); - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; private: FixIntel *fix; diff --git a/src/INTEL/dihedral_fourier_intel.h b/src/INTEL/dihedral_fourier_intel.h index 3b1f594c28..57412c65a8 100644 --- a/src/INTEL/dihedral_fourier_intel.h +++ b/src/INTEL/dihedral_fourier_intel.h @@ -34,8 +34,8 @@ class DihedralFourierIntel : public DihedralFourier { public: DihedralFourierIntel(class LAMMPS *lmp); - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; private: FixIntel *fix; diff --git a/src/INTEL/dihedral_harmonic_intel.h b/src/INTEL/dihedral_harmonic_intel.h index 388df11e4f..bd98ec6b61 100644 --- a/src/INTEL/dihedral_harmonic_intel.h +++ b/src/INTEL/dihedral_harmonic_intel.h @@ -34,8 +34,8 @@ class DihedralHarmonicIntel : public DihedralHarmonic { public: DihedralHarmonicIntel(class LAMMPS *lmp); - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; private: FixIntel *fix; diff --git a/src/INTEL/dihedral_opls_intel.h b/src/INTEL/dihedral_opls_intel.h index 98206b184f..e11aae76f6 100644 --- a/src/INTEL/dihedral_opls_intel.h +++ b/src/INTEL/dihedral_opls_intel.h @@ -34,8 +34,8 @@ class DihedralOPLSIntel : public DihedralOPLS { public: DihedralOPLSIntel(class LAMMPS *lmp); - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; private: FixIntel *fix; diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 519181be52..a201386724 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -43,7 +43,7 @@ using namespace FixConst; #ifdef __INTEL_OFFLOAD #ifndef _LMP_INTEL_OFFLOAD -#warning "Not building Intel package with Xeon Phi offload support." +#warning "Not building INTEL package with Xeon Phi offload support." #endif #endif @@ -303,8 +303,7 @@ void FixIntel::init() if (force->pair_match("^hybrid", 0) != nullptr) { _pair_hybrid_flag = 1; if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) - error->all(FLERR, - "Intel package requires fdotr virial with newton on."); + error->all(FLERR,"INTEL package requires fdotr virial with newton on."); } else _pair_hybrid_flag = 0; @@ -325,8 +324,7 @@ void FixIntel::init() _pair_hybrid_zero = 0; if (force->newton_pair == 0) _pair_hybrid_flag = 0; if (nstyles > 1) - error->all(FLERR, - "Currently, cannot offload more than one intel style with hybrid."); + error->all(FLERR,"Currently, cannot offload more than one intel style with hybrid."); } #endif @@ -356,15 +354,12 @@ void FixIntel::init() void FixIntel::setup(int vflag) { if (neighbor->style != Neighbor::BIN) - error->all(FLERR, - "Currently, neighbor style BIN must be used with Intel package."); + error->all(FLERR,"Currently, neighbor style BIN must be used with INTEL package."); if (vflag > 3) - error->all(FLERR, - "Cannot currently get per-atom virials with Intel package."); + error->all(FLERR,"Cannot currently get per-atom virials with INTEL package."); #ifdef _LMP_INTEL_OFFLOAD if (neighbor->exclude_setting() != 0) - error->all(FLERR, - "Currently, cannot use neigh_modify exclude with Intel package offload."); + error->all(FLERR,"Currently, cannot use neigh_modify exclude with INTEL package offload."); post_force(vflag); #endif } @@ -425,14 +420,14 @@ void FixIntel::pair_init_check(const bool cdmessage) if (_offload_balance != 0.0 && comm->me == 0) { #ifndef __INTEL_COMPILER_BUILD_DATE - error->warning(FLERR, "Unknown Intel Compiler Version\n"); + error->warning(FLERR,"Unknown Intel Compiler Version\n"); #else if (__INTEL_COMPILER_BUILD_DATE != 20131008 && __INTEL_COMPILER_BUILD_DATE < 20141023) - error->warning(FLERR, "Unsupported Intel Compiler."); + error->warning(FLERR,"Unsupported Intel Compiler."); #endif #if !defined(__INTEL_COMPILER) - error->warning(FLERR, "Unsupported Intel Compiler."); + error->warning(FLERR,"Unsupported Intel Compiler."); #endif } @@ -452,7 +447,7 @@ void FixIntel::pair_init_check(const bool cdmessage) #endif int need_tag = 0; - if (atom->molecular != Atom::ATOMIC) need_tag = 1; + if (atom->molecular != Atom::ATOMIC || three_body_neighbor()) need_tag = 1; // Clear buffers used for pair style char kmode[80]; @@ -474,27 +469,28 @@ void FixIntel::pair_init_check(const bool cdmessage) #endif if (_print_pkg_info && comm->me == 0) { - if (screen) { - fprintf(screen, - "----------------------------------------------------------\n"); - if (_offload_balance != 0.0) { - fprintf(screen,"Using Intel Coprocessor with %d threads per core, ", - _offload_tpc); - fprintf(screen,"%d threads per task\n",_offload_threads); - } else { - fprintf(screen,"Using Intel Package without Coprocessor.\n"); - } - fprintf(screen,"Precision: %s\n",kmode); - if (cdmessage) { - #ifdef LMP_USE_AVXCD - fprintf(screen,"AVX512 CD Optimizations: Enabled\n"); - #else - fprintf(screen,"AVX512 CD Optimizations: Disabled\n"); - #endif - } - fprintf(screen, - "----------------------------------------------------------\n"); + utils::logmesg(lmp, "----------------------------------------------------------\n"); + if (_offload_balance != 0.0) { + utils::logmesg(lmp,"Using Intel Coprocessor with {} threads per core, " + "{} threads per task\n",_offload_tpc, _offload_threads); + } else { + utils::logmesg(lmp,"Using INTEL Package without Coprocessor.\n"); } + utils::logmesg(lmp,"Compiler: {}\n",platform::compiler_info()); + #ifdef LMP_SIMD_COMPILER + utils::logmesg(lmp,"SIMD compiler directives: Enabled\n"); + #else + utils::logmesg(lmp,"SIMD compiler directives: Disabled\n"); + #endif + utils::logmesg(lmp,"Precision: {}\n",kmode); + if (cdmessage) { + #ifdef LMP_USE_AVXCD + utils::logmesg(lmp,"AVX512 CD Optimizations: Enabled\n"); + #else + utils::logmesg(lmp,"AVX512 CD Optimizations: Disabled\n"); + #endif + } + utils::logmesg(lmp, "----------------------------------------------------------\n"); } _print_pkg_info = 0; } @@ -505,8 +501,7 @@ void FixIntel::bond_init_check() { if ((_offload_balance != 0.0) && (atom->molecular != Atom::ATOMIC) && (force->newton_pair != force->newton_bond)) - error->all(FLERR, - "INTEL package requires same setting for newton bond and non-bond."); + error->all(FLERR,"INTEL package requires same setting for newton bond and non-bond."); int intel_pair = 0; if (force->pair_match("/intel$", 0) != nullptr) @@ -517,8 +512,7 @@ void FixIntel::bond_init_check() } if (intel_pair == 0) - error->all(FLERR, "Intel styles for bond/angle/dihedral/improper " - "require intel pair style."); + error->all(FLERR,"Intel styles for bond/angle/dihedral/improper require intel pair style."); } /* ---------------------------------------------------------------------- */ @@ -534,7 +528,7 @@ void FixIntel::kspace_init_check() } if (intel_pair == 0) - error->all(FLERR, "Intel styles for kspace require intel pair style."); + error->all(FLERR,"Intel styles for kspace require intel pair style."); } /* ---------------------------------------------------------------------- */ @@ -551,7 +545,7 @@ void FixIntel::check_neighbor_intel() _offload_noghost = 0; } if (neighbor->requests[i]->skip && _offload_balance != 0.0) - error->all(FLERR, "Cannot yet use hybrid styles with Intel offload."); + error->all(FLERR,"Cannot yet use hybrid styles with Intel offload."); // avoid flagging a neighbor list as both INTEL and OPENMP if (neighbor->requests[i]->intel) @@ -786,8 +780,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, if (f_in[1].w == 1) error->all(FLERR,"Bad matrix inversion in mldivide3"); else - error->all(FLERR, - "Sphere particles not yet supported for gayberne/intel"); + error->all(FLERR,"Sphere particles not yet supported for gayberne/intel"); } } @@ -926,7 +919,7 @@ void FixIntel::add_off_results(const ft * _noalias const f_in, int nlocal = atom->nlocal; if (neighbor->ago == 0) { if (_off_overflow_flag[LMP_OVERFLOW]) - error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); + error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); _offload_nlocal = _off_overflow_flag[LMP_LOCAL_MAX] + 1; _offload_min_ghost = _off_overflow_flag[LMP_GHOST_MIN]; _offload_nghost = _off_overflow_flag[LMP_GHOST_MAX] + 1 - @@ -938,7 +931,7 @@ void FixIntel::add_off_results(const ft * _noalias const f_in, if (atom->torque) if (f_in[1].w < 0.0) - error->all(FLERR, "Bad matrix inversion in mldivide3"); + error->all(FLERR,"Bad matrix inversion in mldivide3"); add_results(f_in, ev_global, _off_results_eatom, _off_results_vatom, 1); // Load balance? @@ -1043,8 +1036,7 @@ void FixIntel::output_timing_data() { timers[TIME_OFFLOAD_PAIR]; double tt = MAX(ht,ct); if (timers[TIME_OFFLOAD_LATENCY] / tt > 0.07 && _separate_coi == 0) - error->warning(FLERR, - "Leaving a core free can improve performance for offload"); + error->warning(FLERR,"Leaving a core free can improve performance for offload"); } fprintf(_tscreen, "------------------------------------------------\n"); } @@ -1109,7 +1101,7 @@ void FixIntel::set_offload_affinity() int ppn = get_ppn(node_rank); if (ppn % _ncops != 0) - error->all(FLERR, "MPI tasks per node must be multiple of offload_cards"); + error->all(FLERR,"MPI tasks per node must be multiple of offload_cards"); ppn = ppn / _ncops; _cop = node_rank / ppn; node_rank = node_rank % ppn; @@ -1214,8 +1206,7 @@ int FixIntel::set_host_affinity(const int nomp) int subscription = nthreads * ppn; if (subscription > ncores) { if (rank == 0) - error->warning(FLERR, - "More MPI tasks/OpenMP threads than available cores"); + error->warning(FLERR,"More MPI tasks/OpenMP threads than available cores"); return 0; } if (subscription == ncores) diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 8e2ca5e7d1..18d8563a1e 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -40,27 +40,27 @@ template class IntelBuffers; class FixIntel : public Fix { public: FixIntel(class LAMMPS *, int, char **); - virtual ~FixIntel(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - inline void min_setup(int in) { setup(in); } - void setup_pre_reverse(int eflag = 0, int vflag = 0); + ~FixIntel() override; + int setmask() override; + void init() override; + void setup(int) override; + inline void min_setup(int in) override { setup(in); } + void setup_pre_reverse(int eflag = 0, int vflag = 0) override; bool pair_hybrid_check(); void pair_init_check(const bool cdmessage = false); void bond_init_check(); void kspace_init_check(); - void pre_reverse(int eflag = 0, int vflag = 0); - inline void min_pre_reverse(int eflag = 0, int vflag = 0) { pre_reverse(eflag, vflag); } + void pre_reverse(int eflag = 0, int vflag = 0) override; + inline void min_pre_reverse(int eflag = 0, int vflag = 0) override { pre_reverse(eflag, vflag); } - void post_run() { _print_pkg_info = 1; } + void post_run() override { _print_pkg_info = 1; } // Get all forces, calculation results from coprocesser void sync_coprocessor(); - double memory_usage(); + double memory_usage() override; typedef struct { double x, y, z; diff --git a/src/INTEL/fix_nh_intel.h b/src/INTEL/fix_nh_intel.h index 3d1a9c389f..3893a206f8 100644 --- a/src/INTEL/fix_nh_intel.h +++ b/src/INTEL/fix_nh_intel.h @@ -26,20 +26,20 @@ namespace LAMMPS_NS { class FixNHIntel : public FixNH { public: FixNHIntel(class LAMMPS *, int, char **); - virtual ~FixNHIntel(); - virtual void setup(int vflag); - void reset_dt(); - virtual double memory_usage(); + ~FixNHIntel() override; + void setup(int vflag) override; + void reset_dt() override; + double memory_usage() override; protected: double *_dtfm; int _nlocal3, _nlocal_max; - virtual void remap(); - virtual void nve_x(); - virtual void nve_v(); - virtual void nh_v_press(); - virtual void nh_v_temp(); + void remap() override; + void nve_x() override; + void nve_v() override; + void nh_v_press() override; + void nh_v_temp() override; }; } diff --git a/src/INTEL/fix_npt_intel.h b/src/INTEL/fix_npt_intel.h index 17d3793a9b..22179ec18e 100644 --- a/src/INTEL/fix_npt_intel.h +++ b/src/INTEL/fix_npt_intel.h @@ -32,7 +32,6 @@ namespace LAMMPS_NS { class FixNPTIntel : public FixNHIntel { public: FixNPTIntel(class LAMMPS *, int, char **); - ~FixNPTIntel() {} }; } // namespace LAMMPS_NS diff --git a/src/INTEL/fix_nve_asphere_intel.h b/src/INTEL/fix_nve_asphere_intel.h index 2b09f99548..b2d00de8c0 100644 --- a/src/INTEL/fix_nve_asphere_intel.h +++ b/src/INTEL/fix_nve_asphere_intel.h @@ -32,12 +32,12 @@ namespace LAMMPS_NS { class FixNVEAsphereIntel : public FixNVE { public: FixNVEAsphereIntel(class LAMMPS *, int, char **); - void init(); - void setup(int vflag); - void initial_integrate(int); - void final_integrate(); - void reset_dt(); - virtual double memory_usage(); + void init() override; + void setup(int vflag) override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; + double memory_usage() override; private: double *_dtfm, *_inertia0, *_inertia1, *_inertia2; diff --git a/src/INTEL/fix_nve_intel.h b/src/INTEL/fix_nve_intel.h index b37b5eaf65..ff793e3f20 100644 --- a/src/INTEL/fix_nve_intel.h +++ b/src/INTEL/fix_nve_intel.h @@ -32,12 +32,12 @@ namespace LAMMPS_NS { class FixNVEIntel : public FixNVE { public: FixNVEIntel(class LAMMPS *, int, char **); - virtual ~FixNVEIntel(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void reset_dt(); - virtual double memory_usage(); + ~FixNVEIntel() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; + double memory_usage() override; protected: double *_dtfm; diff --git a/src/INTEL/fix_nvt_intel.h b/src/INTEL/fix_nvt_intel.h index 93834c189e..585df9c542 100644 --- a/src/INTEL/fix_nvt_intel.h +++ b/src/INTEL/fix_nvt_intel.h @@ -32,7 +32,6 @@ namespace LAMMPS_NS { class FixNVTIntel : public FixNHIntel { public: FixNVTIntel(class LAMMPS *, int, char **); - ~FixNVTIntel() {} }; } // namespace LAMMPS_NS diff --git a/src/INTEL/fix_nvt_sllod_intel.h b/src/INTEL/fix_nvt_sllod_intel.h index 12f116dcba..aaa2f91a8e 100644 --- a/src/INTEL/fix_nvt_sllod_intel.h +++ b/src/INTEL/fix_nvt_sllod_intel.h @@ -32,13 +32,12 @@ namespace LAMMPS_NS { class FixNVTSllodIntel : public FixNHIntel { public: FixNVTSllodIntel(class LAMMPS *, int, char **); - ~FixNVTSllodIntel() {} - void init(); + void init() override; private: int nondeformbias; - void nh_v_temp(); + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/INTEL/improper_cvff_intel.h b/src/INTEL/improper_cvff_intel.h index 6ea95d0ff4..f09cc06a0d 100644 --- a/src/INTEL/improper_cvff_intel.h +++ b/src/INTEL/improper_cvff_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class ImproperCvffIntel : public ImproperCvff { public: ImproperCvffIntel(class LAMMPS *); - virtual ~ImproperCvffIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~ImproperCvffIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; diff --git a/src/INTEL/improper_harmonic_intel.h b/src/INTEL/improper_harmonic_intel.h index 3b9c5d2ec9..b8218614e1 100644 --- a/src/INTEL/improper_harmonic_intel.h +++ b/src/INTEL/improper_harmonic_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class ImproperHarmonicIntel : public ImproperHarmonic { public: ImproperHarmonicIntel(class LAMMPS *); - virtual ~ImproperHarmonicIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~ImproperHarmonicIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; diff --git a/src/INTEL/intel_buffers.cpp b/src/INTEL/intel_buffers.cpp index d86570b0d3..f84505955c 100644 --- a/src/INTEL/intel_buffers.cpp +++ b/src/INTEL/intel_buffers.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; template IntelBuffers::IntelBuffers(class LAMMPS *lmp_in) : lmp(lmp_in), _x(0), _q(0), _quat(0), _f(0), _off_threads(0), - _buf_size(0), _buf_local_size(0), _n_list_ptrs(1), _max_list_ptrs(4) { + _n_list_ptrs(1), _max_list_ptrs(4), _buf_size(0), _buf_local_size(0) { _neigh_list_ptrs = new IntelNeighListPtrs[_max_list_ptrs]; _neigh_list_ptrs[0].cnumneigh = 0; _list_alloc_atoms = 0; @@ -207,8 +207,6 @@ void IntelBuffers::free_nmax() template void IntelBuffers::_grow_nmax(const int offload_end) { - if (lmp->atom->molecular) _need_tag = 1; - else _need_tag = 0; #ifdef _LMP_INTEL_OFFLOAD free_nmax(); int size = lmp->atom->nmax; @@ -296,9 +294,7 @@ void IntelBuffers::free_list_ptrs() /* ---------------------------------------------------------------------- */ template -void IntelBuffers::grow_data3(NeighList *list, - int *&numneighhalf, - int *&cnumneigh) +void IntelBuffers::grow_data3(NeighList *list, int *&numneighhalf, int *&cnumneigh) { const int size = list->get_maxlocal(); int list_num; @@ -321,10 +317,8 @@ void IntelBuffers::grow_data3(NeighList *list, lmp->memory->destroy(_neigh_list_ptrs[list_num].cnumneigh); lmp->memory->destroy(_neigh_list_ptrs[list_num].numneighhalf); } - lmp->memory->create(_neigh_list_ptrs[list_num].cnumneigh, size, - "_cnumneigh"); - lmp->memory->create(_neigh_list_ptrs[list_num].numneighhalf, size, - "_cnumneigh"); + lmp->memory->create(_neigh_list_ptrs[list_num].cnumneigh, size, "_cnumneigh"); + lmp->memory->create(_neigh_list_ptrs[list_num].numneighhalf, size, "_cnumneigh"); _neigh_list_ptrs[list_num].size = size; } numneighhalf = _neigh_list_ptrs[list_num].numneighhalf; @@ -334,8 +328,7 @@ void IntelBuffers::grow_data3(NeighList *list, /* ---------------------------------------------------------------------- */ template -void IntelBuffers::_grow_list_local(NeighList *list, - const int three_body, +void IntelBuffers::_grow_list_local(NeighList *list, const int three_body, const int offload_end) { free_list_local(); diff --git a/src/INTEL/nbin_intel.cpp b/src/INTEL/nbin_intel.cpp index 94f18002a0..29bc7c9ced 100644 --- a/src/INTEL/nbin_intel.cpp +++ b/src/INTEL/nbin_intel.cpp @@ -161,10 +161,8 @@ void NBinIntel::bin_atoms(IntelBuffers * buffers) { const flt_t dx = (INTEL_BIGP - bboxhi[0]); const flt_t dy = (INTEL_BIGP - bboxhi[1]); const flt_t dz = (INTEL_BIGP - bboxhi[2]); - if (dx * dx + dy * dy + dz * dz < - static_cast(neighbor->cutneighmaxsq)) - error->one(FLERR, - "Intel package expects no atoms within cutoff of {1e15,1e15,1e15}."); + if (dx * dx + dy * dy + dz * dz < static_cast(neighbor->cutneighmaxsq)) + error->one(FLERR,"INTEL package expects no atoms within cutoff of (1e15,1e15,1e15)."); } // ---------- Grow and cast/pack buffers ------------- diff --git a/src/INTEL/nbin_intel.h b/src/INTEL/nbin_intel.h index dbed37b347..8e4e387581 100644 --- a/src/INTEL/nbin_intel.h +++ b/src/INTEL/nbin_intel.h @@ -32,16 +32,17 @@ namespace LAMMPS_NS { class NBinIntel : public NBinStandard { public: NBinIntel(class LAMMPS *); - ~NBinIntel(); - void bin_atoms_setup(int); - void bin_atoms(); + ~NBinIntel() override; + + void bin_atoms_setup(int) override; + void bin_atoms() override; int *get_binpacked() { return _binpacked; } private: FixIntel *_fix; int *_atombin, *_binpacked; int _precision_mode; - double memory_usage(); + double memory_usage() override; template void bin_atoms(IntelBuffers *); diff --git a/src/INTEL/npair_full_bin_ghost_intel.h b/src/INTEL/npair_full_bin_ghost_intel.h index 3830b07e6d..a14ac18909 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.h +++ b/src/INTEL/npair_full_bin_ghost_intel.h @@ -35,8 +35,7 @@ namespace LAMMPS_NS { class NPairFullBinGhostIntel : public NPairIntel { public: NPairFullBinGhostIntel(class LAMMPS *); - ~NPairFullBinGhostIntel() {} - void build(class NeighList *); + void build(class NeighList *) override; private: template diff --git a/src/INTEL/npair_full_bin_intel.h b/src/INTEL/npair_full_bin_intel.h index 720780898c..ce23b0d475 100644 --- a/src/INTEL/npair_full_bin_intel.h +++ b/src/INTEL/npair_full_bin_intel.h @@ -32,8 +32,7 @@ namespace LAMMPS_NS { class NPairFullBinIntel : public NPairIntel { public: NPairFullBinIntel(class LAMMPS *); - ~NPairFullBinIntel() {} - void build(class NeighList *); + void build(class NeighList *) override; private: template void fbi(NeighList *, IntelBuffers *); diff --git a/src/INTEL/npair_half_bin_newton_intel.h b/src/INTEL/npair_half_bin_newton_intel.h index 9c9dcab703..3830847954 100644 --- a/src/INTEL/npair_half_bin_newton_intel.h +++ b/src/INTEL/npair_half_bin_newton_intel.h @@ -31,8 +31,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtonIntel : public NPairIntel { public: NPairHalfBinNewtonIntel(class LAMMPS *); - ~NPairHalfBinNewtonIntel() {} - void build(class NeighList *); + void build(class NeighList *) override; private: template void hbni(NeighList *, IntelBuffers *); diff --git a/src/INTEL/npair_half_bin_newton_tri_intel.h b/src/INTEL/npair_half_bin_newton_tri_intel.h index 0d6f577b3d..e6e3c6ce16 100644 --- a/src/INTEL/npair_half_bin_newton_tri_intel.h +++ b/src/INTEL/npair_half_bin_newton_tri_intel.h @@ -31,8 +31,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtonTriIntel : public NPairIntel { public: NPairHalfBinNewtonTriIntel(class LAMMPS *); - ~NPairHalfBinNewtonTriIntel() {} - void build(class NeighList *); + void build(class NeighList *) override; private: template void hbnti(NeighList *, IntelBuffers *); diff --git a/src/INTEL/npair_halffull_newton_intel.h b/src/INTEL/npair_halffull_newton_intel.h index ea751c2421..7514adbe25 100644 --- a/src/INTEL/npair_halffull_newton_intel.h +++ b/src/INTEL/npair_halffull_newton_intel.h @@ -45,8 +45,7 @@ namespace LAMMPS_NS { class NPairHalffullNewtonIntel : public NPair { public: NPairHalffullNewtonIntel(class LAMMPS *); - ~NPairHalffullNewtonIntel() {} - void build(class NeighList *); + void build(class NeighList *) override; protected: FixIntel *_fix; diff --git a/src/INTEL/npair_intel.cpp b/src/INTEL/npair_intel.cpp index 395e50006c..2fffb2353a 100644 --- a/src/INTEL/npair_intel.cpp +++ b/src/INTEL/npair_intel.cpp @@ -31,8 +31,7 @@ using namespace LAMMPS_NS; NPairIntel::NPairIntel(LAMMPS *lmp) : NPair(lmp) { int ifix = modify->find_fix("package_intel"); if (ifix < 0) - error->all(FLERR, - "The 'package intel' command is required for /intel styles"); + error->all(FLERR,"The 'package intel' command is required for /intel styles"); _fix = static_cast(modify->fix[ifix]); #ifdef _LMP_INTEL_OFFLOAD _cop = _fix->coprocessor_number(); @@ -659,6 +658,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, ns += n2 - pack_offset - maxnbors; #ifdef LMP_INTEL_3BODY_FAST + int alln = n; n = lane; for (int u = pack_offset; u < alln; u++) { neighptr[n] = neighptr2[u]; diff --git a/src/INTEL/npair_intel.h b/src/INTEL/npair_intel.h index 8035f6f9be..a17733aed7 100644 --- a/src/INTEL/npair_intel.h +++ b/src/INTEL/npair_intel.h @@ -76,8 +76,8 @@ namespace LAMMPS_NS { class NPairIntel : public NPair { public: NPairIntel(class LAMMPS *); - ~NPairIntel(); - virtual void copy_neighbor_info(); + ~NPairIntel() override; + void copy_neighbor_info() override; #ifdef _LMP_INTEL_OFFLOAD void grow_stencil(); diff --git a/src/INTEL/npair_skip_intel.h b/src/INTEL/npair_skip_intel.h index 2c77b24cd5..b7ca847eee 100644 --- a/src/INTEL/npair_skip_intel.h +++ b/src/INTEL/npair_skip_intel.h @@ -43,9 +43,9 @@ namespace LAMMPS_NS { class NPairSkipIntel : public NPair { public: NPairSkipIntel(class LAMMPS *); - ~NPairSkipIntel(); - virtual void copy_neighbor_info(); - void build(class NeighList *); + ~NPairSkipIntel() override; + void copy_neighbor_info() override; + void build(class NeighList *) override; protected: FixIntel *_fix; diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 95b80fe801..c5fd47afd6 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -242,17 +242,17 @@ PairAIREBOIntelParam PairAIREBOIntel::get_param() PairAIREBOIntelParam fc; #define A(a) \ - for (int i = 0; i < sizeof(this->a)/sizeof(double); i++) { \ + for (size_t i = 0; i < sizeof(this->a)/sizeof(double); i++) { \ reinterpret_cast(&fc.a)[i] = \ reinterpret_cast(&this->a)[i]; \ } #define A0(a) \ - for (int i = 0; i < sizeof(fc.a)/sizeof(flt_t); i++) { \ + for (size_t i = 0; i < sizeof(fc.a)/sizeof(flt_t); i++) { \ reinterpret_cast(&fc.a)[i] = \ reinterpret_cast(this->a[0])[i]; \ } #define B(a) \ - for (int i = 0; i < sizeof(this->a)/sizeof(double); i++) { \ + for (size_t i = 0; i < sizeof(this->a)/sizeof(double); i++) { \ reinterpret_cast(&fc.a)[i] = \ reinterpret_cast(&this->a)[i]; \ } diff --git a/src/INTEL/pair_airebo_intel.h b/src/INTEL/pair_airebo_intel.h index 32ae3a6581..8cd504aadb 100644 --- a/src/INTEL/pair_airebo_intel.h +++ b/src/INTEL/pair_airebo_intel.h @@ -36,9 +36,9 @@ template struct PairAIREBOIntelParam; class PairAIREBOIntel : public PairAIREBO { public: PairAIREBOIntel(class LAMMPS *); - virtual ~PairAIREBOIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~PairAIREBOIntel() override; + void compute(int, int) override; + void init_style() override; protected: template diff --git a/src/INTEL/pair_airebo_morse_intel.h b/src/INTEL/pair_airebo_morse_intel.h index 75d5808e85..1d75c632ea 100644 --- a/src/INTEL/pair_airebo_morse_intel.h +++ b/src/INTEL/pair_airebo_morse_intel.h @@ -32,7 +32,7 @@ namespace LAMMPS_NS { class PairAIREBOMorseIntel : public PairAIREBOIntel { public: PairAIREBOMorseIntel(class LAMMPS *); - virtual void settings(int, char **); + void settings(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/INTEL/pair_buck_coul_cut_intel.h b/src/INTEL/pair_buck_coul_cut_intel.h index 9fe35affe4..731536a6c6 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.h +++ b/src/INTEL/pair_buck_coul_cut_intel.h @@ -35,9 +35,9 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { public: PairBuckCoulCutIntel(class LAMMPS *); - virtual ~PairBuckCoulCutIntel(); - virtual void compute(int, int); - void init_style(); + ~PairBuckCoulCutIntel() override; + void compute(int, int) override; + void init_style() override; typedef struct { float x, y, z; int w; diff --git a/src/INTEL/pair_buck_coul_long_intel.h b/src/INTEL/pair_buck_coul_long_intel.h index 01865afc56..4412e25a9c 100644 --- a/src/INTEL/pair_buck_coul_long_intel.h +++ b/src/INTEL/pair_buck_coul_long_intel.h @@ -34,9 +34,9 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { public: PairBuckCoulLongIntel(class LAMMPS *); - virtual ~PairBuckCoulLongIntel(); - virtual void compute(int, int); - void init_style(); + ~PairBuckCoulLongIntel() override; + void compute(int, int) override; + void init_style() override; typedef struct { float x, y, z; int w; diff --git a/src/INTEL/pair_buck_intel.h b/src/INTEL/pair_buck_intel.h index 307c8eb7b0..baebdf8fd6 100644 --- a/src/INTEL/pair_buck_intel.h +++ b/src/INTEL/pair_buck_intel.h @@ -34,9 +34,9 @@ class PairBuckIntel : public PairBuck { public: PairBuckIntel(class LAMMPS *); - virtual ~PairBuckIntel(); - virtual void compute(int, int); - void init_style(); + ~PairBuckIntel() override; + void compute(int, int) override; + void init_style() override; typedef struct { float x, y, z; int w; diff --git a/src/INTEL/pair_dpd_intel.h b/src/INTEL/pair_dpd_intel.h index 3e5c9b7d69..52ba6c3ed3 100644 --- a/src/INTEL/pair_dpd_intel.h +++ b/src/INTEL/pair_dpd_intel.h @@ -41,12 +41,12 @@ class PairDPDIntel : public PairDPD { public: PairDPDIntel(class LAMMPS *); - ~PairDPDIntel(); + ~PairDPDIntel() override; - virtual void compute(int, int); - void settings(int, char **); - void init_style(); - void read_restart_settings(FILE *); + void compute(int, int) override; + void settings(int, char **) override; + void init_style() override; + void read_restart_settings(FILE *) override; private: FixIntel *fix; diff --git a/src/INTEL/pair_eam_alloy_intel.h b/src/INTEL/pair_eam_alloy_intel.h index 07f7df11ca..3b2c640c6f 100644 --- a/src/INTEL/pair_eam_alloy_intel.h +++ b/src/INTEL/pair_eam_alloy_intel.h @@ -30,12 +30,12 @@ namespace LAMMPS_NS { class PairEAMAlloyIntel : virtual public PairEAMIntel { public: PairEAMAlloyIntel(class LAMMPS *); - virtual ~PairEAMAlloyIntel() {} - void coeff(int, char **); + + void coeff(int, char **) override; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; }; } // namespace LAMMPS_NS diff --git a/src/INTEL/pair_eam_fs_intel.h b/src/INTEL/pair_eam_fs_intel.h index 103e3a9c4b..f09274e02a 100644 --- a/src/INTEL/pair_eam_fs_intel.h +++ b/src/INTEL/pair_eam_fs_intel.h @@ -30,12 +30,12 @@ namespace LAMMPS_NS { class PairEAMFSIntel : virtual public PairEAMIntel { public: PairEAMFSIntel(class LAMMPS *); - virtual ~PairEAMFSIntel() {} - void coeff(int, char **); + + void coeff(int, char **) override; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; }; } // namespace LAMMPS_NS diff --git a/src/INTEL/pair_eam_intel.h b/src/INTEL/pair_eam_intel.h index 6ea6a6b06c..54f3da4271 100644 --- a/src/INTEL/pair_eam_intel.h +++ b/src/INTEL/pair_eam_intel.h @@ -31,11 +31,11 @@ class PairEAMIntel : public PairEAM { friend class FixSemiGrandCanonicalMC; // Alex Stukowski option PairEAMIntel(class LAMMPS *); - virtual ~PairEAMIntel(); - virtual void compute(int, int); - void init_style(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~PairEAMIntel() override; + void compute(int, int) override; + void init_style() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: FixIntel *fix; diff --git a/src/INTEL/pair_gayberne_intel.h b/src/INTEL/pair_gayberne_intel.h index 67132770bf..926cbda6fd 100644 --- a/src/INTEL/pair_gayberne_intel.h +++ b/src/INTEL/pair_gayberne_intel.h @@ -35,8 +35,8 @@ class PairGayBerneIntel : public PairGayBerne { public: PairGayBerneIntel(class LAMMPS *); - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; private: template class ForceConst; diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.h b/src/INTEL/pair_lj_charmm_coul_charmm_intel.h index 69cf1bcf17..4915a93dae 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.h +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.h @@ -34,10 +34,10 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { public: PairLJCharmmCoulCharmmIntel(class LAMMPS *); - virtual ~PairLJCharmmCoulCharmmIntel(); + ~PairLJCharmmCoulCharmmIntel() override; - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; typedef struct { float x, y, z; diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.h b/src/INTEL/pair_lj_charmm_coul_long_intel.h index 95366b6218..e3a2065e27 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.h +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.h @@ -34,10 +34,10 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { public: PairLJCharmmCoulLongIntel(class LAMMPS *); - virtual ~PairLJCharmmCoulLongIntel(); + ~PairLJCharmmCoulLongIntel() override; - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; typedef struct { float x, y, z; diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.h b/src/INTEL/pair_lj_cut_coul_long_intel.h index c72c9a9ded..903e60070b 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.h +++ b/src/INTEL/pair_lj_cut_coul_long_intel.h @@ -34,10 +34,10 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { public: PairLJCutCoulLongIntel(class LAMMPS *); - virtual ~PairLJCutCoulLongIntel(); + ~PairLJCutCoulLongIntel() override; - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; typedef struct { float x, y, z; diff --git a/src/INTEL/pair_lj_cut_intel.h b/src/INTEL/pair_lj_cut_intel.h index 6003a376a0..e65fbf9865 100644 --- a/src/INTEL/pair_lj_cut_intel.h +++ b/src/INTEL/pair_lj_cut_intel.h @@ -35,8 +35,8 @@ class PairLJCutIntel : public PairLJCut { public: PairLJCutIntel(class LAMMPS *); - virtual void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; private: FixIntel *fix; diff --git a/src/INTEL/pair_lj_long_coul_long_intel.h b/src/INTEL/pair_lj_long_coul_long_intel.h index 6faa2519a3..7055930087 100644 --- a/src/INTEL/pair_lj_long_coul_long_intel.h +++ b/src/INTEL/pair_lj_long_coul_long_intel.h @@ -32,7 +32,7 @@ namespace LAMMPS_NS { class PairLJLongCoulLongIntel : public PairLJLongCoulLong { public: PairLJLongCoulLongIntel(class LAMMPS *); - virtual ~PairLJLongCoulLongIntel(); + ~PairLJLongCoulLongIntel() override; }; } // namespace LAMMPS_NS #endif diff --git a/src/INTEL/pair_rebo_intel.h b/src/INTEL/pair_rebo_intel.h index 76b915a1d8..478a95e945 100644 --- a/src/INTEL/pair_rebo_intel.h +++ b/src/INTEL/pair_rebo_intel.h @@ -32,7 +32,7 @@ namespace LAMMPS_NS { class PairREBOIntel : public PairAIREBOIntel { public: PairREBOIntel(class LAMMPS *); - virtual void settings(int, char **); + void settings(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index fd043ae5a1..8743fbe54c 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -1115,8 +1115,7 @@ void PairSWIntel::init_style() int ifix = modify->find_fix("package_intel"); if (ifix < 0) - error->all(FLERR, - "The 'package intel' command is required for /intel styles"); + error->all(FLERR,"The 'package intel' command is required for /intel styles"); fix = static_cast(modify->fix[ifix]); fix->pair_init_check(true); diff --git a/src/INTEL/pair_sw_intel.h b/src/INTEL/pair_sw_intel.h index 55da7eb261..b0ade4bb9d 100644 --- a/src/INTEL/pair_sw_intel.h +++ b/src/INTEL/pair_sw_intel.h @@ -33,16 +33,16 @@ namespace LAMMPS_NS { class PairSWIntel : public PairSW { public: PairSWIntel(class LAMMPS *); - virtual ~PairSWIntel(); - virtual void compute(int, int); - virtual void init_style(); + ~PairSWIntel() override; + void compute(int, int) override; + void init_style() override; protected: FixIntel *fix; int _cop; template class ForceConst; - virtual void allocate(); + void allocate() override; template void compute(int eflag, int vflag, IntelBuffers *buffers, diff --git a/src/INTEL/pppm_disp_intel.h b/src/INTEL/pppm_disp_intel.h index 2bac82ec9a..7543688154 100644 --- a/src/INTEL/pppm_disp_intel.h +++ b/src/INTEL/pppm_disp_intel.h @@ -33,9 +33,9 @@ namespace LAMMPS_NS { class PPPMDispIntel : public PPPMDisp { public: PPPMDispIntel(class LAMMPS *); - virtual ~PPPMDispIntel(); - virtual void init(); - virtual void compute(int, int); + ~PPPMDispIntel() override; + void init() override; + void compute(int, int) override; #ifdef _LMP_INTEL_OFFLOAD int use_base(); diff --git a/src/INTEL/pppm_intel.h b/src/INTEL/pppm_intel.h index c6b3d83aa5..7679c8988f 100644 --- a/src/INTEL/pppm_intel.h +++ b/src/INTEL/pppm_intel.h @@ -36,10 +36,10 @@ namespace LAMMPS_NS { class PPPMIntel : public PPPM { public: PPPMIntel(class LAMMPS *); - virtual ~PPPMIntel(); - virtual void init(); - virtual void compute(int, int); - virtual double memory_usage(); + ~PPPMIntel() override; + void init() override; + void compute(int, int) override; + double memory_usage() override; void compute_first(int, int); void compute_second(int, int); void pack_buffers(); @@ -67,7 +67,7 @@ class PPPMIntel : public PPPM { int _use_base; #endif - virtual void allocate(); + void allocate() override; template void test_function(IntelBuffers *buffers); diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index 216ba98302..f867ad73e6 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -71,7 +71,7 @@ void VerletLRTIntel::init() #ifndef LMP_INTEL_USELRT error->all(FLERR, - "LRT otion for Intel package disabled at compile time"); + "LRT otion for INTEL package disabled at compile time"); #endif } diff --git a/src/INTEL/verlet_lrt_intel.h b/src/INTEL/verlet_lrt_intel.h index e13d2b44f6..c58d4916d2 100644 --- a/src/INTEL/verlet_lrt_intel.h +++ b/src/INTEL/verlet_lrt_intel.h @@ -46,10 +46,10 @@ namespace LAMMPS_NS { class VerletLRTIntel : public Verlet { public: VerletLRTIntel(class LAMMPS *, int, char **); - virtual ~VerletLRTIntel(); - virtual void init(); - virtual void setup(int flag); - virtual void run(int); + ~VerletLRTIntel() override; + void init() override; + void setup(int flag) override; + void run(int) override; protected: PPPMIntel *_intel_kspace; diff --git a/src/INTERLAYER/pair_coul_shield.h b/src/INTERLAYER/pair_coul_shield.h index 10ace5ebd2..9bc3a37fce 100644 --- a/src/INTERLAYER/pair_coul_shield.h +++ b/src/INTERLAYER/pair_coul_shield.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairCoulShield : public Pair { public: PairCoulShield(class LAMMPS *); - virtual ~PairCoulShield(); + ~PairCoulShield() override; - virtual void compute(int, int); + void compute(int, int) override; - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; - virtual double single(int, int, int, int, double, double, double, double &); + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/INTERLAYER/pair_drip.h b/src/INTERLAYER/pair_drip.h index eb854b585b..feaa3df570 100644 --- a/src/INTERLAYER/pair_drip.h +++ b/src/INTERLAYER/pair_drip.h @@ -36,13 +36,13 @@ namespace LAMMPS_NS { class PairDRIP : public Pair { public: PairDRIP(class LAMMPS *); - virtual ~PairDRIP(); + ~PairDRIP() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; static constexpr int NPARAMS_PER_LINE = 15; typedef double V3[3]; diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 632bb6ae70..85a2d8bfb5 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -34,10 +34,10 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include +#include using namespace LAMMPS_NS; using namespace InterLayer; @@ -57,9 +57,15 @@ static const char cite_ilp[] = " year = 2018,\n" "}\n\n"; +// to indicate which potential style was used in outputs +static std::map variant_map = { + {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, + {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, + {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; + /* ---------------------------------------------------------------------- */ -PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp) +PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp), variant(ILP_GrhBN) { restartinfo = 0; one_coeff = 1; @@ -87,6 +93,14 @@ PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp) dnormal = nullptr; dnormdri = nullptr; + // for ilp/tmd + dnn = nullptr; + vect = nullptr; + pvet = nullptr; + dpvet1 = nullptr; + dpvet2 = nullptr; + dNave = nullptr; + // always compute energy offset offset_flag = 1; @@ -105,6 +119,13 @@ PairILPGrapheneHBN::~PairILPGrapheneHBN() memory->destroy(normal); memory->destroy(dnormal); memory->destroy(dnormdri); + // adds for ilp/tmd + memory->destroy(dnn); + memory->destroy(vect); + memory->destroy(pvet); + memory->destroy(dpvet1); + memory->destroy(dpvet2); + memory->destroy(dNave); if (allocated) { memory->destroy(setflag); @@ -195,7 +216,7 @@ void PairILPGrapheneHBN::read_file(char *filename) // open file on proc 0 if (comm->me == 0) { - PotentialFileReader reader(lmp, filename, "ilp/graphene/hbn", unit_convert_flag); + PotentialFileReader reader(lmp, filename, variant_map[variant], unit_convert_flag); char *line; // transparently convert units for supported conversions @@ -293,11 +314,15 @@ void PairILPGrapheneHBN::read_file(char *filename) int n = -1; for (int m = 0; m < nparams; m++) { if (i == params[m].ielement && j == params[m].jelement) { - if (n >= 0) error->all(FLERR, "ILP potential file has duplicate entry"); + if (n >= 0) + error->all(FLERR, "{} potential file {} has a duplicate entry", variant_map[variant], + filename); n = m; } } - if (n < 0) error->all(FLERR, "Potential file is missing an entry"); + if (n < 0) + error->all(FLERR, "{} potential file {} is missing an entry", variant_map[variant], + filename); elem2param[i][j] = n; cutILPsq[i][j] = params[n].rcut * params[n].rcut; } @@ -311,9 +336,9 @@ void PairILPGrapheneHBN::read_file(char *filename) void PairILPGrapheneHBN::init_style() { if (force->newton_pair == 0) - error->all(FLERR, "Pair style ilp/graphene/hbn requires newton pair on"); + error->all(FLERR, "Pair style {} requires newton pair on", variant_map[variant]); if (!atom->molecule_flag) - error->all(FLERR, "Pair style ilp/graphene/hbn requires atom attribute molecule"); + error->all(FLERR, "Pair style {} requires atom attribute molecule", variant_map[variant]); // need a full neighbor list, including neighbors of ghosts diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index c89ef47a21..4bd7677737 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -27,23 +27,23 @@ namespace LAMMPS_NS { class PairILPGrapheneHBN : public Pair { public: PairILPGrapheneHBN(class LAMMPS *); - virtual ~PairILPGrapheneHBN(); + ~PairILPGrapheneHBN() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); - void ILP_neigh(); - void calc_normal(); - void calc_FRep(int, int); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; void calc_FvdW(int, int); - double single(int, int, int, int, double, double, double, double &); + double single(int, int, int, int, double, double, double, double &) override; static constexpr int NPARAMS_PER_LINE = 13; + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL }; // for telling class variants apart in shared code + protected: int me; + int variant; int maxlocal; // size of numneigh, firstneigh arrays int pgsize; // size of neighbor page int oneatom; // max # of neighbors for one atom @@ -68,6 +68,18 @@ class PairILPGrapheneHBN : public Pair { double ***dnormdri; double ****dnormal; + // adds for ilp/tmd + int Nnei; // max # of nearest neighbors for one atom + double **dnn; + double **vect; + double **pvet; + double ***dpvet1; + double ***dpvet2; + double ***dNave; + + virtual void ILP_neigh(); + virtual void calc_normal(); + virtual void calc_FRep(int, int); void read_file(char *); void allocate(); }; diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp new file mode 100644 index 0000000000..b6c89a2566 --- /dev/null +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -0,0 +1,885 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + This is a full version of the potential described in + [Ouyang et al, J. Chem. Theory Comput. 17, 7237 (2021).] +------------------------------------------------------------------------- */ + +#include "pair_ilp_tmd.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "interlayer_taper.h" +#include "memory.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace InterLayer; + +#define MAXLINE 1024 +#define DELTA 4 +#define PGDELTA 1 + +static const char cite_ilp_tmd[] = "ilp/tmd potential doi/10.1021/acs.jctc.1c00782\n" + "@Article{Ouyang2021\n" + " author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. " + "Tkatchenko, L. Kronik, M. Urbakh, and O. Hod},\n" + " title = {Anisotropic Interlayer Force Field for Transition " + "Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" + " journal = {J. Chem. Theory Comput.},\n" + " volume = 17,\n" + " pages = {7237–7245}\n" + " year = 2021,\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairILPTMD::PairILPTMD(LAMMPS *lmp) : PairILPGrapheneHBN(lmp) +{ + variant = ILP_TMD; + single_enable = 0; + + // for TMD, each atom have six neighbors + Nnei = 6; + + if (lmp->citeme) lmp->citeme->add(cite_ilp_tmd); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairILPTMD::settings(int narg, char **arg) +{ + if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); + if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) + error->all(FLERR, "Pair style ilp/tmd must be used as sub-style with hybrid/overlay"); + + cut_global = utils::numeric(FLERR, arg[0], false, lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); +} + +/* ---------------------------------------------------------------------- + Repulsive forces and energy +------------------------------------------------------------------------- */ + +void PairILPTMD::calc_FRep(int eflag, int /* vflag */) +{ + int i, j, ii, jj, inum, jnum, itype, jtype, k, kk; + double prodnorm1, fkcx, fkcy, fkcz; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair, fpair1; + double rsq, r, Rcut, rhosq1, exp0, exp1, r2inv, r6inv, r8inv, Tap, dTap, Vilp; + double frho1, TSvdw, TSvdw2inv, Erep, fsum, rdsq1; + int *ilist, *jlist, *numneigh, **firstneigh; + int *ILP_neighs_i; + + evdwl = 0.0; + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + double dprodnorm1[3] = {0.0, 0.0, 0.0}; + double fp1[3] = {0.0, 0.0, 0.0}; + double fprod1[3] = {0.0, 0.0, 0.0}; + double delki[3] = {0.0, 0.0, 0.0}; + double fk[3] = {0.0, 0.0, 0.0}; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + //calculate exp(-lambda*(r-z0))*[epsilon/2 + f(rho_ij)] + // loop over neighbors of owned atoms + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + jtype = type[j]; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + // only include the interation between different layers + if (rsq < cutsq[itype][jtype] && atom->molecule[i] != atom->molecule[j]) { + + int iparam_ij = elem2param[map[itype]][map[jtype]]; + Param &p = params[iparam_ij]; + + r = sqrt(rsq); + // turn on/off taper function + if (tap_flag) { + Rcut = sqrt(cutsq[itype][jtype]); + Tap = calc_Tap(r, Rcut); + dTap = calc_dTap(r, Rcut); + } else { + Tap = 1.0; + dTap = 0.0; + } + + // Calculate the transverse distance + // note that rho_ij does not equal to rho_ji except when normals are all along z + prodnorm1 = normal[i][0] * delx + normal[i][1] * dely + normal[i][2] * delz; + rhosq1 = rsq - prodnorm1 * prodnorm1; // rho_ij + rdsq1 = rhosq1 * p.delta2inv; // (rho_ij/delta)^2 + + // store exponents + exp0 = exp(-p.lambda * (r - p.z0)); + exp1 = exp(-rdsq1); + + frho1 = exp1 * p.C; + Erep = 0.5 * p.epsilon + frho1; + Vilp = exp0 * Erep; + + // derivatives + fpair = p.lambda * exp0 / r * Erep; + fpair1 = 2.0 * exp0 * frho1 * p.delta2inv; + fsum = fpair + fpair1; + // derivatives of the product of rij and ni, the result is a vector + dprodnorm1[0] = + dnormdri[i][0][0] * delx + dnormdri[i][1][0] * dely + dnormdri[i][2][0] * delz; + dprodnorm1[1] = + dnormdri[i][0][1] * delx + dnormdri[i][1][1] * dely + dnormdri[i][2][1] * delz; + dprodnorm1[2] = + dnormdri[i][0][2] * delx + dnormdri[i][1][2] * dely + dnormdri[i][2][2] * delz; + fp1[0] = prodnorm1 * normal[i][0] * fpair1; + fp1[1] = prodnorm1 * normal[i][1] * fpair1; + fp1[2] = prodnorm1 * normal[i][2] * fpair1; + fprod1[0] = prodnorm1 * dprodnorm1[0] * fpair1; + fprod1[1] = prodnorm1 * dprodnorm1[1] * fpair1; + fprod1[2] = prodnorm1 * dprodnorm1[2] * fpair1; + + fkcx = (delx * fsum - fp1[0]) * Tap - Vilp * dTap * delx / r; + fkcy = (dely * fsum - fp1[1]) * Tap - Vilp * dTap * dely / r; + fkcz = (delz * fsum - fp1[2]) * Tap - Vilp * dTap * delz / r; + + f[i][0] += fkcx - fprod1[0] * Tap; + f[i][1] += fkcy - fprod1[1] * Tap; + f[i][2] += fkcz - fprod1[2] * Tap; + f[j][0] -= fkcx; + f[j][1] -= fkcy; + f[j][2] -= fkcz; + + // calculate the forces acted on the neighbors of atom i from atom j + ILP_neighs_i = ILP_firstneigh[i]; + for (kk = 0; kk < ILP_numneigh[i]; kk++) { + k = ILP_neighs_i[kk]; + if (k == i) continue; + // derivatives of the product of rij and ni respect to rk, k=0,1,2, where atom k is the neighbors of atom i + dprodnorm1[0] = dnormal[i][0][kk][0] * delx + dnormal[i][1][kk][0] * dely + + dnormal[i][2][kk][0] * delz; + dprodnorm1[1] = dnormal[i][0][kk][1] * delx + dnormal[i][1][kk][1] * dely + + dnormal[i][2][kk][1] * delz; + dprodnorm1[2] = dnormal[i][0][kk][2] * delx + dnormal[i][1][kk][2] * dely + + dnormal[i][2][kk][2] * delz; + fk[0] = (-prodnorm1 * dprodnorm1[0] * fpair1) * Tap; + fk[1] = (-prodnorm1 * dprodnorm1[1] * fpair1) * Tap; + fk[2] = (-prodnorm1 * dprodnorm1[2] * fpair1) * Tap; + f[k][0] += fk[0]; + f[k][1] += fk[1]; + f[k][2] += fk[2]; + delki[0] = x[k][0] - x[i][0]; + delki[1] = x[k][1] - x[i][1]; + delki[2] = x[k][2] - x[i][2]; + if (evflag) + ev_tally_xyz(k, j, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delki[0], + delki[1], delki[2]); + } + + if (eflag) pvector[1] += evdwl = Tap * Vilp; + if (evflag) + ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0.0, fkcx, fkcy, fkcz, delx, dely, delz); + } + } + } +} + +/* ---------------------------------------------------------------------- + create ILP neighbor list from main neighbor list to calculate normals +------------------------------------------------------------------------- */ + +void PairILPTMD::ILP_neigh() +{ + int i, j, l, ii, jj, ll, n, allnum, jnum, itype, jtype, ltype, imol, jmol, count; + double xtmp, ytmp, ztmp, delx, dely, delz, deljx, deljy, deljz, rsq, rsqlj; + int *ilist, *jlist, *numneigh, **firstneigh; + int *neighsort; + int neighptr[10], check[10]; + + double **x = atom->x; + int *type = atom->type; + + if (atom->nmax > maxlocal) { + maxlocal = atom->nmax; + memory->destroy(ILP_numneigh); + memory->sfree(ILP_firstneigh); + memory->create(ILP_numneigh, maxlocal, "ILPTMD:numneigh"); + ILP_firstneigh = (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPTMD:firstneigh"); + } + + allnum = list->inum + list->gnum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // store all ILP neighs of owned and ghost atoms + // scan full neighbor list of I + + ipage->reset(); + + for (ii = 0; ii < allnum; ii++) { + i = ilist[ii]; + + //initialize varibles + n = 0; + neighsort = ipage->vget(); + for (ll = 0; ll < 10; ll++) { + neighptr[ll] = -1; + check[ll] = -1; + } + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = map[type[i]]; + imol = atom->molecule[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + jtype = map[type[j]]; + jmol = atom->molecule[j]; + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + // check if the atom i is TMD, i.e., Mo/S/W/Se + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + strcmp(elements[itype], "Te") == 0) { + if (rsq != 0 && rsq < cutILPsq[itype][jtype] && imol == jmol && type[i] == type[j]) { + neighptr[n++] = j; + } + } else { // atom i is C, B, N or H. + if (rsq != 0 && rsq < cutILPsq[itype][jtype] && imol == jmol) { neighptr[n++] = j; } + } + } // loop over jj + + // if atom i is Mo/W/S/Se/Te, then sorting the orders of neighbors + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + strcmp(elements[itype], "Te") == 0) { + // initialize neighsort + for (ll = 0; ll < n; ll++) { + neighsort[ll] = neighptr[ll]; + check[ll] = neighptr[ll]; + } + + // select the first neighbor of atomi + if (n == Nnei) { + neighsort[0] = neighptr[0]; + check[0] = -1; + } else if (n < Nnei && n > 0) { + for (jj = 0; jj < n; jj++) { //identify the first neighbor + j = neighptr[jj]; + jtype = map[type[j]]; + count = 0; + for (ll = 0; ll < n; ll++) { + l = neighptr[ll]; + ltype = map[type[l]]; + if (l == j) continue; + deljx = x[l][0] - x[j][0]; + deljy = x[l][1] - x[j][1]; + deljz = x[l][2] - x[j][2]; + rsqlj = deljx * deljx + deljy * deljy + deljz * deljz; + if (rsqlj != 0 && rsqlj < cutILPsq[ltype][jtype]) { count++; } + } + if (count == 1) { + neighsort[0] = neighptr[jj]; + check[jj] = -1; + break; + } + } // end of idenfying the first neighbor + } else if (n > Nnei) { + fprintf(screen, "Molecule ID = %d\n", imol); + fprintf(screen, "Atom Type = %d\n", type[i]); + fprintf(screen, "Neinum = %d\n", n); + error->one(FLERR, + "There are too many neighbors for TMD atoms, please check your configuration"); + } + + // sort the order of neighbors of atomi + for (jj = 0; jj < n; jj++) { + j = neighsort[jj]; + jtype = map[type[j]]; + ll = 0; + while (ll < n) { + l = neighptr[ll]; + if (check[ll] == -1) { + ll++; + continue; + } + ltype = map[type[l]]; + deljx = x[l][0] - x[j][0]; + deljy = x[l][1] - x[j][1]; + deljz = x[l][2] - x[j][2]; + rsqlj = deljx * deljx + deljy * deljy + deljz * deljz; + if (rsqlj != 0 && rsqlj < cutILPsq[ltype][jtype]) { + neighsort[jj + 1] = l; + check[ll] = -1; + break; + } + ll++; + } + } // end of sorting the order of neighbors + } else { // for B/N/C/H atoms + if (n > 3) + error->one( + FLERR, + "There are too many neighbors for B/N/C/H atoms, please check your configuration"); + for (ll = 0; ll < n; ll++) { neighsort[ll] = neighptr[ll]; } + } + + ILP_firstneigh[i] = neighsort; + ILP_numneigh[i] = n; + + ipage->vgot(n); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); + } +} + +/* ---------------------------------------------------------------------- + Calculate the normals for each atom +------------------------------------------------------------------------- */ +void PairILPTMD::calc_normal() +{ + int i, j, ii, jj, inum, jnum; + int cont, id, ip, m, k, itype; + double nn, xtp, ytp, ztp, delx, dely, delz, nn2; + int *ilist, *jlist; + double Nave[3], dni[3], dpvdri[3][3]; + + double **x = atom->x; + int *type = atom->type; + + memory->destroy(dnn); + memory->destroy(vect); + memory->destroy(pvet); + memory->destroy(dpvet1); + memory->destroy(dpvet2); + memory->destroy(dNave); + memory->create(dnn, Nnei, 3, "ILPTMD:dnn"); + memory->create(vect, Nnei, 3, "ILPTMD:vect"); + memory->create(pvet, Nnei, 3, "ILPTMD:pvet"); + memory->create(dpvet1, Nnei, 3, 3, "ILPTMD:dpvet1"); + memory->create(dpvet2, Nnei, 3, 3, "ILPTMD:dpvet2"); + memory->create(dNave, 3, Nnei, 3, "ILPTMD:dNave"); + + // grow normal array if necessary + + if (atom->nmax > nmax) { + memory->destroy(normal); + memory->destroy(dnormal); + memory->destroy(dnormdri); + nmax = atom->nmax; + memory->create(normal, nmax, 3, "ILPTMD:normal"); + memory->create(dnormdri, nmax, 3, 3, "ILPTMD:dnormdri"); + memory->create(dnormal, nmax, 3, Nnei, 3, "ILPTMD:dnormal"); + } + + inum = list->inum; + ilist = list->ilist; + //Calculate normals + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + itype = map[type[i]]; + xtp = x[i][0]; + ytp = x[i][1]; + ztp = x[i][2]; + + // Initialize the arrays + for (id = 0; id < 3; id++) { + Nave[id] = 0.0; + dni[id] = 0.0; + normal[i][id] = 0.0; + for (ip = 0; ip < 3; ip++) { + dpvdri[ip][id] = 0.0; + dnormdri[i][ip][id] = 0.0; + for (m = 0; m < Nnei; m++) { + dnn[m][id] = 0.0; + vect[m][id] = 0.0; + pvet[m][id] = 0.0; + dpvet1[m][ip][id] = 0.0; + dpvet2[m][ip][id] = 0.0; + dNave[id][m][ip] = 0.0; + dnormal[i][id][m][ip] = 0.0; + } + } + } + + cont = 0; + jlist = ILP_firstneigh[i]; + jnum = ILP_numneigh[i]; + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = x[j][0] - xtp; + dely = x[j][1] - ytp; + delz = x[j][2] - ztp; + vect[cont][0] = delx; + vect[cont][1] = dely; + vect[cont][2] = delz; + cont++; + } + + //############################ For the dangling atoms ############################ + if (cont <= 1) { + normal[i][0] = 0.0; + normal[i][1] = 0.0; + normal[i][2] = 1.0; + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = 0.0; + for (m = 0; m < Nnei; m++) { dnormal[i][id][m][ip] = 0.0; } + } + } + } + //############################ For the edge atoms of TMD ################################ + else if (cont > 1 && cont < Nnei) { + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0) { + // derivatives of Ni[l] respect to the cont neighbors + for (k = 0; k < cont - 1; k++) { + for (ip = 0; ip < 3; ip++) { + pvet[k][ip] = vect[k][modulo(ip + 1, 3)] * vect[k + 1][modulo(ip + 2, 3)] - + vect[k][modulo(ip + 2, 3)] * vect[k + 1][modulo(ip + 1, 3)]; + } + // dpvet1[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l + // derivatives respect to atom l + // dNik,x/drl + dpvet1[k][0][0] = 0.0; + dpvet1[k][0][1] = vect[modulo(k + 1, Nnei)][2]; + dpvet1[k][0][2] = -vect[modulo(k + 1, Nnei)][1]; + // dNik,y/drl + dpvet1[k][1][0] = -vect[modulo(k + 1, Nnei)][2]; + dpvet1[k][1][1] = 0.0; + dpvet1[k][1][2] = vect[modulo(k + 1, Nnei)][0]; + // dNik,z/drl + dpvet1[k][2][0] = vect[modulo(k + 1, Nnei)][1]; + dpvet1[k][2][1] = -vect[modulo(k + 1, Nnei)][0]; + dpvet1[k][2][2] = 0.0; + + // dpvet2[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l+1 + // derivatives respect to atom l+1 + // dNik,x/drl+1 + dpvet2[k][0][0] = 0.0; + dpvet2[k][0][1] = -vect[modulo(k, Nnei)][2]; + dpvet2[k][0][2] = vect[modulo(k, Nnei)][1]; + // dNik,y/drl+1 + dpvet2[k][1][0] = vect[modulo(k, Nnei)][2]; + dpvet2[k][1][1] = 0.0; + dpvet2[k][1][2] = -vect[modulo(k, Nnei)][0]; + // dNik,z/drl+1 + dpvet2[k][2][0] = -vect[modulo(k, Nnei)][1]; + dpvet2[k][2][1] = vect[modulo(k, Nnei)][0]; + dpvet2[k][2][2] = 0.0; + } + + // average the normal vectors by using the Nnei neighboring planes + for (ip = 0; ip < 3; ip++) { + Nave[ip] = 0.0; + for (k = 0; k < cont - 1; k++) { Nave[ip] += pvet[k][ip]; } + Nave[ip] /= (cont - 1); + } + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // derivatives of non-normalized normal vector, dNave:3xcontx3 array + // dNave[id][m][ip]: the derivatve of the id component of Nave respect to the ip component of atom m + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < cont; m++) { + if (m == 0) { + dNave[id][m][ip] = dpvet1[m][id][ip] / (cont - 1); + } else if (m == cont - 1) { + dNave[id][m][ip] = dpvet2[m - 1][id][ip] / (cont - 1); + } else { // sum of the derivatives of the mth and (m-1)th normal vector respect to the atom m + dNave[id][m][ip] = (dpvet1[m][id][ip] + dpvet2[m - 1][id][ip]) / (cont - 1); + } + } + } + } + // derivatives of nn, dnn:contx3 vector + // dnn[m][id]: the derivative of nn respect to r[m][id], m=0,...Nnei-1; id=0,1,2 + // r[m][id]: the id's component of atom m + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + + Nave[2] * dNave[2][m][id]) / + nn; + } + } + // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. + // for atom m, which is a neighbor atom of atom i, m = 0,...,Nnei-1 + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormal[i][id][m][ip] = dNave[id][m][ip] / nn - Nave[id] * dnn[m][ip] / nn2; + } + } + } + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dpvdri[id][ip] = 0.0; + for (k = 0; k < cont; k++) { dpvdri[id][ip] -= dNave[id][k][ip]; } + } + } + + // derivatives of nn, dnn:3x1 vector + dni[0] = (Nave[0] * dpvdri[0][0] + Nave[1] * dpvdri[1][0] + Nave[2] * dpvdri[2][0]) / nn; + dni[1] = (Nave[0] * dpvdri[0][1] + Nave[1] * dpvdri[1][1] + Nave[2] * dpvdri[2][1]) / nn; + dni[2] = (Nave[0] * dpvdri[0][2] + Nave[1] * dpvdri[1][2] + Nave[2] * dpvdri[2][2]) / nn; + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; + } + } + } // for TMD + //############################ For the edge & bulk atoms of GrhBN ################################ + else { + if (cont == 2) { + for (ip = 0; ip < 3; ip++) { + pvet[0][ip] = vect[0][modulo(ip + 1, 3)] * vect[1][modulo(ip + 2, 3)] - + vect[0][modulo(ip + 2, 3)] * vect[1][modulo(ip + 1, 3)]; + } + // dpvet1[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l + // derivatives respect to atom l + // dNik,x/drl + dpvet1[0][0][0] = 0.0; + dpvet1[0][0][1] = vect[1][2]; + dpvet1[0][0][2] = -vect[1][1]; + // dNi0,y/drl + dpvet1[0][1][0] = -vect[1][2]; + dpvet1[0][1][1] = 0.0; + dpvet1[0][1][2] = vect[1][0]; + // dNi0,z/drl + dpvet1[0][2][0] = vect[1][1]; + dpvet1[0][2][1] = -vect[1][0]; + dpvet1[0][2][2] = 0.0; + + // dpvet2[0][l][ip]: the derivatve of the 0 (=0,...cont-1)th Ni0 respect to the ip component of atom l+1 + // derivatives respect to atom l+1 + // dNi0,x/drl+1 + dpvet2[0][0][0] = 0.0; + dpvet2[0][0][1] = -vect[0][2]; + dpvet2[0][0][2] = vect[0][1]; + // dNi0,y/drl+1 + dpvet2[0][1][0] = vect[0][2]; + dpvet2[0][1][1] = 0.0; + dpvet2[0][1][2] = -vect[0][0]; + // dNi0,z/drl+1 + dpvet2[0][2][0] = -vect[0][1]; + dpvet2[0][2][1] = vect[0][0]; + dpvet2[0][2][2] = 0.0; + + for (ip = 0; ip < 3; ip++) { Nave[ip] += pvet[0][ip]; } + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // derivatives of non-normalized normal vector, dNave:3xcontx3 array + // dNave[id][m][ip]: the derivatve of the id component of Nave respect to the ip component of atom m + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < cont; m++) { + if (m == 0) { + dNave[id][m][ip] = dpvet1[m][id][ip] / (cont - 1); + } else if (m == cont - 1) { + dNave[id][m][ip] = dpvet2[m - 1][id][ip] / (cont - 1); + } else { // sum of the derivatives of the mth and (m-1)th normal vector respect to the atom m + dNave[id][m][ip] = (dpvet1[m][id][ip] + dpvet2[m - 1][id][ip]) / (cont - 1); + } + } + } + } + // derivatives of nn, dnn:contx3 vector + // dnn[m][id]: the derivative of nn respect to r[m][id], m=0,...Nnei-1; id=0,1,2 + // r[m][id]: the id's component of atom m + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + + Nave[2] * dNave[2][m][id]) / + nn; + } + } + // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. + // for atom m, which is a neighbor atom of atom i, m = 0,...,Nnei-1 + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormal[i][id][m][ip] = dNave[id][m][ip] / nn - Nave[id] * dnn[m][ip] / nn2; + } + } + } + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dpvdri[id][ip] = 0.0; + for (k = 0; k < cont; k++) { dpvdri[id][ip] -= dNave[id][k][ip]; } + } + } + // derivatives of nn, dnn:3x1 vector + dni[0] = (Nave[0] * dpvdri[0][0] + Nave[1] * dpvdri[1][0] + Nave[2] * dpvdri[2][0]) / nn; + dni[1] = (Nave[0] * dpvdri[0][1] + Nave[1] * dpvdri[1][1] + Nave[2] * dpvdri[2][1]) / nn; + dni[2] = (Nave[0] * dpvdri[0][2] + Nave[1] * dpvdri[1][2] + Nave[2] * dpvdri[2][2]) / nn; + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; + } + } + } // end of cont == 2 + else if (cont == 3) { + // derivatives of Ni[l] respect to the 3 neighbors + for (k = 0; k < 3; k++) { + for (ip = 0; ip < 3; ip++) { + pvet[k][ip] = vect[modulo(k, 3)][modulo(ip + 1, 3)] * + vect[modulo(k + 1, 3)][modulo(ip + 2, 3)] - + vect[modulo(k, 3)][modulo(ip + 2, 3)] * vect[modulo(k + 1, 3)][modulo(ip + 1, 3)]; + } + // dpvet1[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l + // derivatives respect to atom l + // dNik,x/drl + dpvet1[k][0][0] = 0.0; + dpvet1[k][0][1] = vect[modulo(k + 1, 3)][2]; + dpvet1[k][0][2] = -vect[modulo(k + 1, 3)][1]; + // dNik,y/drl + dpvet1[k][1][0] = -vect[modulo(k + 1, 3)][2]; + dpvet1[k][1][1] = 0.0; + dpvet1[k][1][2] = vect[modulo(k + 1, 3)][0]; + // dNik,z/drl + dpvet1[k][2][0] = vect[modulo(k + 1, 3)][1]; + dpvet1[k][2][1] = -vect[modulo(k + 1, 3)][0]; + dpvet1[k][2][2] = 0.0; + + // dpvet2[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l+1 + // derivatives respect to atom l+1 + // dNik,x/drl+1 + dpvet2[k][0][0] = 0.0; + dpvet2[k][0][1] = -vect[modulo(k, 3)][2]; + dpvet2[k][0][2] = vect[modulo(k, 3)][1]; + // dNik,y/drl+1 + dpvet2[k][1][0] = vect[modulo(k, 3)][2]; + dpvet2[k][1][1] = 0.0; + dpvet2[k][1][2] = -vect[modulo(k, 3)][0]; + // dNik,z/drl+1 + dpvet2[k][2][0] = -vect[modulo(k, 3)][1]; + dpvet2[k][2][1] = vect[modulo(k, 3)][0]; + dpvet2[k][2][2] = 0.0; + } + + // average the normal vectors by using the 3 neighboring planes + for (ip = 0; ip < 3; ip++) { + Nave[ip] = 0.0; + for (k = 0; k < 3; k++) { Nave[ip] += pvet[k][ip]; } + Nave[ip] /= 3; + } + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // for the central atoms, dnormdri is always zero + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[i][id][ip] = 0.0; } + } + + // derivatives of non-normalized normal vector, dNave:3x3x3 array + // dNave[id][m][ip]: the derivatve of the id component of Nave respect to the ip component of atom m + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for ( + m = 0; m < 3; + m++) { // sum of the derivatives of the mth and (m-1)th normal vector respect to the atom m + dNave[id][m][ip] = + (dpvet1[modulo(m, 3)][id][ip] + dpvet2[modulo(m - 1, 3)][id][ip]) / 3; + } + } + } + // derivatives of nn, dnn:3x3 vector + // dnn[m][id]: the derivative of nn respect to r[m][id], m=0,...3-1; id=0,1,2 + // r[m][id]: the id's component of atom m + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + + Nave[2] * dNave[2][m][id]) / + nn; + } + } + // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. + // for atom m, which is a neighbor atom of atom i, m = 0,...,3-1 + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormal[i][id][m][ip] = dNave[id][m][ip] / nn - Nave[id] * dnn[m][ip] / nn2; + } + } + } + } // end of cont == 3 + else + error->one(FLERR, + "There are too many neighbors for calculating normals of B/N/C/H atoms"); + } // for B/N/C/H + } // end of if(contone(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // for the central atoms, dnormdri is always zero + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[i][id][ip] = 0.0; } + } + + // derivatives of non-normalized normal vector, dNave:3xNneix3 array + // dNave[id][m][ip]: the derivatve of the id component of Nave respect to the ip component of atom m + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for ( + m = 0; m < Nnei; + m++) { // sum of the derivatives of the mth and (m-1)th normal vector respect to the atom m + dNave[id][m][ip] = + (dpvet1[modulo(m, Nnei)][id][ip] + dpvet2[modulo(m - 1, Nnei)][id][ip]) / Nnei; + } + } + } + // derivatives of nn, dnn:Nneix3 vector + // dnn[m][id]: the derivative of nn respect to r[m][id], m=0,...Nnei-1; id=0,1,2 + // r[m][id]: the id's component of atom m + for (m = 0; m < Nnei; m++) { + for (id = 0; id < 3; id++) { + dnn[m][id] = + (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + Nave[2] * dNave[2][m][id]) / + nn; + } + } + // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. + // for atom m, which is a neighbor atom of atom i, m = 0,...,Nnei-1 + for (m = 0; m < Nnei; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormal[i][id][m][ip] = dNave[id][m][ip] / nn - Nave[id] * dnn[m][ip] / nn2; + } + } + } + } else { + error->one(FLERR, "There are too many neighbors for calculating normals of TMD atoms"); + } // end of four cases of cont + } // end of i loop +} diff --git a/src/INTERLAYER/pair_ilp_tmd.h b/src/INTERLAYER/pair_ilp_tmd.h new file mode 100644 index 0000000000..5a633c8950 --- /dev/null +++ b/src/INTERLAYER/pair_ilp_tmd.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(ilp/tmd,PairILPTMD); +// clang-format on +#else + +#ifndef LMP_PAIR_ILP_TMD_H +#define LMP_PAIR_ILP_TMD_H + +#include "pair_ilp_graphene_hbn.h" + +namespace LAMMPS_NS { + +class PairILPTMD : public PairILPGrapheneHBN { + public: + PairILPTMD(class LAMMPS *); + + protected: + void settings(int, char **) override; + void ILP_neigh() override; + void calc_normal() override; + void calc_FRep(int, int) override; + + /**************************************************************/ + /* modulo operation with cycling around range */ + + inline int modulo(int k, int range) + { + if (k < 0) k += range; + return k % range; + } + /**************************************************************/ +}; + +} // namespace LAMMPS_NS + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.h b/src/INTERLAYER/pair_kolmogorov_crespi_full.h index b7264a0883..1176b13d52 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.h +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairKolmogorovCrespiFull : public Pair { public: PairKolmogorovCrespiFull(class LAMMPS *); - virtual ~PairKolmogorovCrespiFull(); + ~PairKolmogorovCrespiFull() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; void KC_neigh(); void calc_normal(); void calc_FRep(int, int); void calc_FvdW(int, int); - double single(int, int, int, int, double, double, double, double &); + double single(int, int, int, int, double, double, double, double &) override; static constexpr int NPARAMS_PER_LINE = 12; diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp index 8f219656b7..bd2ce680d5 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp @@ -28,10 +28,9 @@ #include "error.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" +#include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include @@ -161,15 +160,15 @@ void PairKolmogorovCrespiZ::compute(int eflag, int vflag) if (evflag) { ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); if (vflag_either) { - double fi[3],fj[3]; + double fi[3], fj[3]; fi[0] = delx * fpair1; fi[1] = dely * fpair1; fi[2] = 0; fj[0] = -delx * fpair1; fj[1] = -dely * fpair1; fj[2] = 0; - v_tally2_newton(i,fi,x[i]); - v_tally2_newton(j,fj,x[j]); + v_tally2_newton(i, fi, x[i]); + v_tally2_newton(j, fj, x[j]); } } } @@ -247,9 +246,9 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) void PairKolmogorovCrespiZ::init_style() { if (force->newton_pair == 0) - error->all(FLERR,"Pair style kolmogorov/crespi/z requires newton pair on"); + error->all(FLERR, "Pair style kolmogorov/crespi/z requires newton pair on"); - neighbor->request(this,instance_me); + neighbor->request(this, instance_me); } /* ---------------------------------------------------------------------- diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_z.h b/src/INTERLAYER/pair_kolmogorov_crespi_z.h index dc73f838a2..61e8dba7bd 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_z.h +++ b/src/INTERLAYER/pair_kolmogorov_crespi_z.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class PairKolmogorovCrespiZ : public Pair { public: PairKolmogorovCrespiZ(class LAMMPS *); - virtual ~PairKolmogorovCrespiZ(); + ~PairKolmogorovCrespiZ() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; static constexpr int NPARAMS_PER_LINE = 11; diff --git a/src/INTERLAYER/pair_lebedeva_z.cpp b/src/INTERLAYER/pair_lebedeva_z.cpp index cd788fdba6..f837934843 100644 --- a/src/INTERLAYER/pair_lebedeva_z.cpp +++ b/src/INTERLAYER/pair_lebedeva_z.cpp @@ -33,7 +33,6 @@ #include "neighbor.h" #include "neigh_list.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/INTERLAYER/pair_lebedeva_z.h b/src/INTERLAYER/pair_lebedeva_z.h index 9b715b185d..8b59e0115f 100644 --- a/src/INTERLAYER/pair_lebedeva_z.h +++ b/src/INTERLAYER/pair_lebedeva_z.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class PairLebedevaZ : public Pair { public: PairLebedevaZ(class LAMMPS *); - virtual ~PairLebedevaZ(); + ~PairLebedevaZ() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; static constexpr int NPARAMS_PER_LINE = 12; diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp new file mode 100644 index 0000000000..bb23cad840 --- /dev/null +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -0,0 +1,245 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + This is a full version of the potential described in + [Ouyang et al, J. Chem. Theory Comput. 17, 7215-7223 (2021)] +------------------------------------------------------------------------- */ + +#include "pair_saip_metal.h" + +#include "atom.h" +#include "citeme.h" +#include "error.h" +#include "force.h" +#include "interlayer_taper.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace InterLayer; + +#define MAXLINE 1024 +#define DELTA 4 +#define PGDELTA 1 + +static const char cite_saip[] = + "saip/metal potential doi.org/10.1021/acs.jctc.1c00622\n" + "@Article{Ouyang2021\n" + " author = {W. Ouyang, O. Hod, and R. Guerra},\n" + " title = {Registry-Dependent Potential for Interfaces of Gold with Graphitic Systems},\n" + " journal = {J. Chem. Theory Comput.},\n" + " volume = 17,\n" + " pages = {7215-7223}\n" + " year = 2021,\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairSAIPMETAL::PairSAIPMETAL(LAMMPS *lmp) : PairILPGrapheneHBN(lmp) +{ + variant = SAIP_METAL; + single_enable = 0; + if (lmp->citeme) lmp->citeme->add(cite_saip); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairSAIPMETAL::settings(int narg, char **arg) +{ + if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); + if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) + error->all(FLERR, "Pair style saip/metal must be used as sub-style with hybrid/overlay"); + + cut_global = utils::numeric(FLERR, arg[0], false, lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); +} + +/* ---------------------------------------------------------------------- + Repulsive forces and energy +------------------------------------------------------------------------- */ + +void PairSAIPMETAL::calc_FRep(int eflag, int /* vflag */) +{ + int i, j, ii, jj, inum, jnum, itype, jtype, k, kk; + double prodnorm1, fkcx, fkcy, fkcz, filp; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair, fpair1; + double rsq, r, Rcut, rhosq1, exp0, exp1, Tap, dTap, Vilp; + double frho1, Erep, fsum, rdsq1; + int *ilist, *jlist, *numneigh, **firstneigh; + int *ILP_neighs_i; + + evdwl = 0.0; + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + double dprodnorm1[3] = {0.0, 0.0, 0.0}; + double fp1[3] = {0.0, 0.0, 0.0}; + double fprod1[3] = {0.0, 0.0, 0.0}; + double delki[3] = {0.0, 0.0, 0.0}; + double fk[3] = {0.0, 0.0, 0.0}; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + //calculate exp(-lambda*(r-z0))*[epsilon/2 + f(rho_ij)] + // loop over neighbors of owned atoms + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + jtype = type[j]; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + // only include the interaction between different layers + if (rsq < cutsq[itype][jtype] && atom->molecule[i] != atom->molecule[j]) { + + int iparam_ij = elem2param[map[itype]][map[jtype]]; + Param &p = params[iparam_ij]; + + r = sqrt(rsq); + // turn on/off taper function + if (tap_flag) { + Rcut = sqrt(cutsq[itype][jtype]); + Tap = calc_Tap(r, Rcut); + dTap = calc_dTap(r, Rcut); + } else { + Tap = 1.0; + dTap = 0.0; + } + // for atoms in bulk materials + if (strcmp(elements[map[itype]], "C") != 0 && strcmp(elements[map[itype]], "H") != 0 && + strcmp(elements[map[itype]], "B") != 0 && strcmp(elements[map[itype]], "N") != 0) { + // Set ni along rij + exp0 = exp(-p.lambda * (r - p.z0)); + frho1 = 1.0 * p.C; + Erep = 0.5 * p.epsilon + frho1; + Vilp = exp0 * Erep; + // derivatives + fpair = p.lambda * exp0 / r * Erep; + filp = fpair * Tap - Vilp * dTap / r; + fkcx = delx * filp; + fkcy = dely * filp; + fkcz = delz * filp; + + f[i][0] += fkcx; + f[i][1] += fkcy; + f[i][2] += fkcz; + f[j][0] -= fkcx; + f[j][1] -= fkcy; + f[j][2] -= fkcz; + + if (eflag) pvector[1] += evdwl = Tap * Vilp; + if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, filp, delx, dely, delz); + } else { // for atoms in 2D materials + // Calculate the transverse distance + prodnorm1 = normal[i][0] * delx + normal[i][1] * dely + normal[i][2] * delz; + rhosq1 = rsq - prodnorm1 * prodnorm1; // rho_ij + rdsq1 = rhosq1 * p.delta2inv; // (rho_ij/delta)^2 + + // store exponents + exp0 = exp(-p.lambda * (r - p.z0)); + exp1 = exp(-rdsq1); + + frho1 = exp1 * p.C; + Erep = 0.5 * p.epsilon + frho1; + Vilp = exp0 * Erep; + + // derivatives + fpair = p.lambda * exp0 / r * Erep; + fpair1 = 2.0 * exp0 * frho1 * p.delta2inv; + fsum = fpair + fpair1; + // derivatives of the product of rij and ni, the result is a vector + dprodnorm1[0] = + dnormdri[0][0][i] * delx + dnormdri[1][0][i] * dely + dnormdri[2][0][i] * delz; + dprodnorm1[1] = + dnormdri[0][1][i] * delx + dnormdri[1][1][i] * dely + dnormdri[2][1][i] * delz; + dprodnorm1[2] = + dnormdri[0][2][i] * delx + dnormdri[1][2][i] * dely + dnormdri[2][2][i] * delz; + fp1[0] = prodnorm1 * normal[i][0] * fpair1; + fp1[1] = prodnorm1 * normal[i][1] * fpair1; + fp1[2] = prodnorm1 * normal[i][2] * fpair1; + fprod1[0] = prodnorm1 * dprodnorm1[0] * fpair1; + fprod1[1] = prodnorm1 * dprodnorm1[1] * fpair1; + fprod1[2] = prodnorm1 * dprodnorm1[2] * fpair1; + + fkcx = (delx * fsum - fp1[0]) * Tap - Vilp * dTap * delx / r; + fkcy = (dely * fsum - fp1[1]) * Tap - Vilp * dTap * dely / r; + fkcz = (delz * fsum - fp1[2]) * Tap - Vilp * dTap * delz / r; + + f[i][0] += fkcx - fprod1[0] * Tap; + f[i][1] += fkcy - fprod1[1] * Tap; + f[i][2] += fkcz - fprod1[2] * Tap; + f[j][0] -= fkcx; + f[j][1] -= fkcy; + f[j][2] -= fkcz; + + // calculate the forces acted on the neighbors of atom i from atom j + ILP_neighs_i = ILP_firstneigh[i]; + for (kk = 0; kk < ILP_numneigh[i]; kk++) { + k = ILP_neighs_i[kk]; + if (k == i) continue; + // derivatives of the product of rij and ni respect to rk, k=0,1,2, where atom k is the neighbors of atom i + dprodnorm1[0] = dnormal[0][0][kk][i] * delx + dnormal[1][0][kk][i] * dely + + dnormal[2][0][kk][i] * delz; + dprodnorm1[1] = dnormal[0][1][kk][i] * delx + dnormal[1][1][kk][i] * dely + + dnormal[2][1][kk][i] * delz; + dprodnorm1[2] = dnormal[0][2][kk][i] * delx + dnormal[1][2][kk][i] * dely + + dnormal[2][2][kk][i] * delz; + fk[0] = (-prodnorm1 * dprodnorm1[0] * fpair1) * Tap; + fk[1] = (-prodnorm1 * dprodnorm1[1] * fpair1) * Tap; + fk[2] = (-prodnorm1 * dprodnorm1[2] * fpair1) * Tap; + f[k][0] += fk[0]; + f[k][1] += fk[1]; + f[k][2] += fk[2]; + delki[0] = x[k][0] - x[i][0]; + delki[1] = x[k][1] - x[i][1]; + delki[2] = x[k][2] - x[i][2]; + if (evflag) + ev_tally_xyz(k, j, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delki[0], + delki[1], delki[2]); + } + + if (eflag) pvector[1] += evdwl = Tap * Vilp; + if (evflag) + ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0.0, fkcx, fkcy, fkcz, delx, dely, delz); + } // end of speration atoms for bulk materials + } // end of rsq < cutoff + } // loop over jj + } // loop over ii +} diff --git a/src/INTERLAYER/pair_saip_metal.h b/src/INTERLAYER/pair_saip_metal.h new file mode 100644 index 0000000000..7675b3cce5 --- /dev/null +++ b/src/INTERLAYER/pair_saip_metal.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(saip/metal,PairSAIPMETAL); +// clang-format on +#else + +#ifndef LMP_PAIR_SAIP_METAL_H +#define LMP_PAIR_SAIP_METAL_H + +#include "pair_ilp_graphene_hbn.h" + +namespace LAMMPS_NS { + +class PairSAIPMETAL : public PairILPGrapheneHBN { + public: + PairSAIPMETAL(class LAMMPS *); + + protected: + void settings(int, char **) override; + void calc_FRep(int, int) override; +}; + +} // namespace LAMMPS_NS + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 266f280003..d1817ceda1 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -71,8 +71,8 @@ namespace LAMMPS_NS { class FixStoreKIM : public Fix { public: FixStoreKIM(class LAMMPS *, int, char **); - ~FixStoreKIM(); - int setmask(); + ~FixStoreKIM() override; + int setmask() override; void setptr(const std::string &, void *); void *getptr(const std::string &); diff --git a/src/KIM/kim_command.h b/src/KIM/kim_command.h index 98a9420c31..25611d4b50 100644 --- a/src/KIM/kim_command.h +++ b/src/KIM/kim_command.h @@ -69,7 +69,7 @@ namespace LAMMPS_NS { class KimCommand : public Command { public: KimCommand(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/KIM/pair_kim.h b/src/KIM/pair_kim.h index dab9dfdb4c..8c7bcbb0ef 100644 --- a/src/KIM/pair_kim.h +++ b/src/KIM/pair_kim.h @@ -75,18 +75,18 @@ namespace LAMMPS_NS { class PairKIM : public Pair { public: PairKIM(class LAMMPS *); - ~PairKIM(); + ~PairKIM() override; // LAMMPS Pair class virtual function prototypes - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual void init_list(int id, NeighList *ptr); - virtual double init_one(int, int); - virtual int pack_reverse_comm(int, int, double *); - virtual void unpack_reverse_comm(int, int *, double *); - virtual double memory_usage(); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int id, NeighList *ptr) override; + double init_one(int, int) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; // Get the KIM_Model object KIM_Model *get_kim_model(); diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index 45fa0654a9..6da318c2d5 100755 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -108,6 +108,8 @@ action dihedral_opls_kokkos.cpp dihedral_opls.cpp action dihedral_opls_kokkos.h dihedral_opls.h action domain_kokkos.cpp action domain_kokkos.h +action dynamical_matrix_kokkos.cpp dynamical_matrix.cpp +action dynamical_matrix_kokkos.h dynamical_matrix.h action fftdata_kokkos.h fft3d.h action fft3d_kokkos.cpp fft3d.cpp action fft3d_kokkos.h fft3d.h @@ -312,6 +314,8 @@ action remap_kokkos.cpp remap.cpp action remap_kokkos.h remap.h action sna_kokkos.h sna.h action sna_kokkos_impl.h sna.cpp +action third_order_kokkos.cpp dynamical_matrix.cpp +action third_order_kokkos.h dynamical_matrix.h action verlet_kokkos.cpp action verlet_kokkos.h diff --git a/src/KOKKOS/angle_charmm_kokkos.h b/src/KOKKOS/angle_charmm_kokkos.h index 73f2e7447c..10ef9efaa4 100644 --- a/src/KOKKOS/angle_charmm_kokkos.h +++ b/src/KOKKOS/angle_charmm_kokkos.h @@ -38,10 +38,10 @@ class AngleCharmmKokkos : public AngleCharmm { typedef EV_FLOAT value_type; AngleCharmmKokkos(class LAMMPS *); - virtual ~AngleCharmmKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~AngleCharmmKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -65,14 +65,14 @@ class AngleCharmmKokkos : public AngleCharmm { typedef ArrayTypes AT; typename AT::t_x_array_randomread x; - typedef typename KKDevice::value KKDeviceType; + using KKDeviceType = typename KKDevice::value; typename Kokkos::View > f; typename AT::t_int_2d anglelist; Kokkos::DualView k_eatom; Kokkos::DualView k_vatom; - Kokkos::View::value,Kokkos::MemoryTraits > d_eatom; - Kokkos::View::value,Kokkos::MemoryTraits > d_vatom; + Kokkos::View> d_eatom; + Kokkos::View> d_vatom; int nlocal,newton_bond; int eflag,vflag; @@ -82,7 +82,7 @@ class AngleCharmmKokkos : public AngleCharmm { typename AT::t_ffloat_1d d_k_ub; typename AT::t_ffloat_1d d_r_ub; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/angle_class2_kokkos.h b/src/KOKKOS/angle_class2_kokkos.h index 26b147e1b1..e708b0ebad 100644 --- a/src/KOKKOS/angle_class2_kokkos.h +++ b/src/KOKKOS/angle_class2_kokkos.h @@ -40,10 +40,10 @@ class AngleClass2Kokkos : public AngleClass2 { typedef EV_FLOAT value_type; AngleClass2Kokkos(class LAMMPS *); - virtual ~AngleClass2Kokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~AngleClass2Kokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/angle_cosine_kokkos.h b/src/KOKKOS/angle_cosine_kokkos.h index e23fe622a7..0235c087b0 100644 --- a/src/KOKKOS/angle_cosine_kokkos.h +++ b/src/KOKKOS/angle_cosine_kokkos.h @@ -39,10 +39,10 @@ class AngleCosineKokkos : public AngleCosine { typedef EV_FLOAT value_type; AngleCosineKokkos(class LAMMPS *); - virtual ~AngleCosineKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~AngleCosineKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -78,7 +78,7 @@ class AngleCosineKokkos : public AngleCosine { typename ArrayTypes::tdual_ffloat_1d k_k; typename ArrayTypes::t_ffloat_1d d_k; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/angle_harmonic_kokkos.h b/src/KOKKOS/angle_harmonic_kokkos.h index f32aca6044..1c1f0b1830 100644 --- a/src/KOKKOS/angle_harmonic_kokkos.h +++ b/src/KOKKOS/angle_harmonic_kokkos.h @@ -39,10 +39,10 @@ class AngleHarmonicKokkos : public AngleHarmonic { typedef EV_FLOAT value_type; AngleHarmonicKokkos(class LAMMPS *); - virtual ~AngleHarmonicKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~AngleHarmonicKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -81,7 +81,7 @@ class AngleHarmonicKokkos : public AngleHarmonic { typename ArrayTypes::t_ffloat_1d d_k; typename ArrayTypes::t_ffloat_1d d_theta0; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/atom_kokkos.h b/src/KOKKOS/atom_kokkos.h index d3d73a6a90..624e6c05ff 100644 --- a/src/KOKKOS/atom_kokkos.h +++ b/src/KOKKOS/atom_kokkos.h @@ -67,11 +67,11 @@ class AtomKokkos : public Atom { AtomKokkos(class LAMMPS *); - virtual ~AtomKokkos(); + ~AtomKokkos() override; - void map_init(int check = 1); - void map_set(); - void map_delete(); + void map_init(int check = 1) override; + void map_set() override; + void map_delete() override; DAT::tdual_int_1d k_sametag; DAT::tdual_int_1d k_map_array; @@ -105,18 +105,18 @@ class AtomKokkos : public Atom { return local; } - virtual void allocate_type_arrays(); + void allocate_type_arrays() override; void sync(const ExecutionSpace space, unsigned int mask); void modified(const ExecutionSpace space, unsigned int mask); void sync_overlapping_device(const ExecutionSpace space, unsigned int mask); - virtual void sort(); + void sort() override; virtual void grow(unsigned int mask); - int add_custom(const char *, int, int); - void remove_custom(int, int, int); + int add_custom(const char *, int, int) override; + void remove_custom(int, int, int) override; virtual void deallocate_topology(); - void sync_modify(ExecutionSpace, unsigned int, unsigned int); + void sync_modify(ExecutionSpace, unsigned int, unsigned int) override; private: - class AtomVec *new_avec(const std::string &, int, int &); + class AtomVec *new_avec(const std::string &, int, int &) override; }; template diff --git a/src/KOKKOS/atom_vec_angle_kokkos.h b/src/KOKKOS/atom_vec_angle_kokkos.h index 9bc7753889..8a315d666c 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.h +++ b/src/KOKKOS/atom_vec_angle_kokkos.h @@ -30,63 +30,63 @@ namespace LAMMPS_NS { class AtomVecAngleKokkos : public AtomVecKokkos { public: AtomVecAngleKokkos(class LAMMPS *); - virtual ~AtomVecAngleKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_comm(int, int *, double *, int, int *); - int pack_comm_vel(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); - void unpack_comm_vel(int, int, double *); - int pack_reverse(int, int, double *); - void unpack_reverse(int, int *, double *); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_comm(int, int *, double *, int, int *) override; + int pack_comm_vel(int, int *, double *, int, int *) override; + void unpack_comm(int, int, double *) override; + void unpack_comm_vel(int, int, double *) override; + int pack_reverse(int, int, double *) override; + void unpack_reverse(int, int *, double *) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; + + void grow_pointers() override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; void unpack_comm_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf); + const DAT::tdual_xfloat_2d &buf) override; int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.h b/src/KOKKOS/atom_vec_atomic_kokkos.h index 1197bc04e7..e0134f8952 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.h +++ b/src/KOKKOS/atom_vec_atomic_kokkos.h @@ -31,43 +31,43 @@ namespace LAMMPS_NS { class AtomVecAtomicKokkos : public AtomVecKokkos { public: AtomVecAtomicKokkos(class LAMMPS *); - virtual ~AtomVecAtomicKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - void pack_data(double **); - void write_data(FILE *, int, double **); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + void pack_data(double **) override; + void write_data(FILE *, int, double **) override; + double memory_usage() override; + + void grow_pointers() override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: tagint *tag; diff --git a/src/KOKKOS/atom_vec_bond_kokkos.h b/src/KOKKOS/atom_vec_bond_kokkos.h index a9bc5a1092..3daef1dbbe 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.h +++ b/src/KOKKOS/atom_vec_bond_kokkos.h @@ -30,48 +30,48 @@ namespace LAMMPS_NS { class AtomVecBondKokkos : public AtomVecKokkos { public: AtomVecBondKokkos(class LAMMPS *); - virtual ~AtomVecBondKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; + + void grow_pointers() override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: diff --git a/src/KOKKOS/atom_vec_charge_kokkos.h b/src/KOKKOS/atom_vec_charge_kokkos.h index 866b836350..c2d85e4bd6 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.h +++ b/src/KOKKOS/atom_vec_charge_kokkos.h @@ -31,48 +31,48 @@ namespace LAMMPS_NS { class AtomVecChargeKokkos : public AtomVecKokkos { public: AtomVecChargeKokkos(class LAMMPS *); - virtual ~AtomVecChargeKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int , const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int , const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; + + void grow_pointers() override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: tagint *tag; diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.h b/src/KOKKOS/atom_vec_dpd_kokkos.h index 2168fa630c..4dfa2bfbe0 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.h +++ b/src/KOKKOS/atom_vec_dpd_kokkos.h @@ -31,65 +31,65 @@ namespace LAMMPS_NS { class AtomVecDPDKokkos : public AtomVecKokkos { public: AtomVecDPDKokkos(class LAMMPS *); - virtual ~AtomVecDPDKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_comm(int, int *, double *, int, int *); - int pack_comm_vel(int, int *, double *, int, int *); - int pack_comm_hybrid(int, int *, double *); - void unpack_comm(int, int, double *); - void unpack_comm_vel(int, int, double *); - int unpack_comm_hybrid(int, int, double *); - int pack_reverse(int, int, double *); - void unpack_reverse(int, int *, double *); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_comm(int, int *, double *, int, int *) override; + int pack_comm_vel(int, int *, double *, int, int *) override; + int pack_comm_hybrid(int, int *, double *) override; + void unpack_comm(int, int, double *) override; + void unpack_comm_vel(int, int, double *) override; + int unpack_comm_hybrid(int, int, double *) override; + int pack_reverse(int, int, double *) override; + void unpack_reverse(int, int *, double *) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; + + void grow_pointers() override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; void unpack_comm_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf); + const DAT::tdual_xfloat_2d &buf) override; int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; double *uCond,*uMech,*uChem,*uCG,*uCGnew,*rho,*dpdTheta; double *duChem; diff --git a/src/KOKKOS/atom_vec_full_kokkos.h b/src/KOKKOS/atom_vec_full_kokkos.h index b5ce032c4f..54671e47e3 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.h +++ b/src/KOKKOS/atom_vec_full_kokkos.h @@ -30,48 +30,48 @@ namespace LAMMPS_NS { class AtomVecFullKokkos : public AtomVecKokkos { public: AtomVecFullKokkos(class LAMMPS *); - virtual ~AtomVecFullKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; + + void grow_pointers() override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.h b/src/KOKKOS/atom_vec_hybrid_kokkos.h index 567b98695f..29417f1e05 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.h +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.h @@ -33,68 +33,68 @@ class AtomVecHybridKokkos : public AtomVecKokkos { char **keywords; AtomVecHybridKokkos(class LAMMPS *); - ~AtomVecHybridKokkos(); - void process_args(int, char **); - void init(); - void grow(int); - void grow_pointers(); - void copy(int, int, int); - void clear_bonus(); - void force_clear(int, size_t); - int pack_comm(int, int *, double *, int, int *); - int pack_comm_vel(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); - void unpack_comm_vel(int, int, double *); - int pack_reverse(int, int, double *); - void unpack_reverse(int, int *, double *); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int) {return 0;} - void data_vel(int, const std::vector &); - void pack_data(double **); - void write_data(FILE *, int, double **); - void pack_vel(double **); - void write_vel(FILE *, int, double **); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); - double memory_usage(); + ~AtomVecHybridKokkos() override; + void process_args(int, char **) override; + void init() override; + void grow(int) override; + void grow_pointers() override; + void copy(int, int, int) override; + void clear_bonus() override; + void force_clear(int, size_t) override; + int pack_comm(int, int *, double *, int, int *) override; + int pack_comm_vel(int, int *, double *, int, int *) override; + void unpack_comm(int, int, double *) override; + void unpack_comm_vel(int, int, double *) override; + int pack_reverse(int, int, double *) override; + void unpack_reverse(int, int *, double *) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override {return 0;} + void data_vel(int, const std::vector &) override; + void pack_data(double **) override; + void write_data(FILE *, int, double **) override; + void pack_vel(double **) override; + void write_vel(FILE *, int, double **) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; + double memory_usage() override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; void unpack_comm_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf); + const DAT::tdual_xfloat_2d &buf) override; int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; private: tagint *tag; diff --git a/src/KOKKOS/atom_vec_kokkos.h b/src/KOKKOS/atom_vec_kokkos.h index 20dd41dd75..53a1b7ec30 100644 --- a/src/KOKKOS/atom_vec_kokkos.h +++ b/src/KOKKOS/atom_vec_kokkos.h @@ -36,17 +36,17 @@ union d_ubuf { class AtomVecKokkos : public AtomVec { public: AtomVecKokkos(class LAMMPS *); - virtual ~AtomVecKokkos() {} - bigint roundup(bigint); - virtual int pack_comm(int, int *, double *, int, int *); - virtual int pack_comm_vel(int, int *, double *, int, int *); - virtual void unpack_comm(int, int, double *); - virtual void unpack_comm_vel(int, int, double *); - virtual int pack_reverse(int, int, double *); - virtual void unpack_reverse(int, int *, double *); - virtual void data_vel(int, const std::vector &); - virtual void pack_vel(double **); - virtual void write_vel(FILE *, int, double **); + + bigint roundup(bigint) override; + int pack_comm(int, int *, double *, int, int *) override; + int pack_comm_vel(int, int *, double *, int, int *) override; + void unpack_comm(int, int, double *) override; + void unpack_comm_vel(int, int, double *) override; + int pack_reverse(int, int, double *) override; + void unpack_reverse(int, int *, double *) override; + void data_vel(int, const std::vector &) override; + void pack_vel(double **) override; + void write_vel(FILE *, int, double **) override; virtual void sync(ExecutionSpace space, unsigned int mask) = 0; virtual void modified(ExecutionSpace space, unsigned int mask) = 0; diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.h b/src/KOKKOS/atom_vec_molecular_kokkos.h index abd04f905b..82ad490abc 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.h +++ b/src/KOKKOS/atom_vec_molecular_kokkos.h @@ -30,63 +30,63 @@ namespace LAMMPS_NS { class AtomVecMolecularKokkos : public AtomVecKokkos { public: AtomVecMolecularKokkos(class LAMMPS *); - virtual ~AtomVecMolecularKokkos() {} - void grow(int); - void copy(int, int, int); - int pack_comm(int, int *, double *, int, int *); - int pack_comm_vel(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); - void unpack_comm_vel(int, int, double *); - int pack_reverse(int, int, double *); - void unpack_reverse(int, int *, double *); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); - void grow_pointers(); + void grow(int) override; + void copy(int, int, int) override; + int pack_comm(int, int *, double *, int, int *) override; + int pack_comm_vel(int, int *, double *, int, int *) override; + void unpack_comm(int, int, double *) override; + void unpack_comm_vel(int, int, double *) override; + int pack_reverse(int, int, double *) override; + void unpack_reverse(int, int *, double *) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; + + void grow_pointers() override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; void unpack_comm_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf); + const DAT::tdual_xfloat_2d &buf) override; int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.h b/src/KOKKOS/atom_vec_sphere_kokkos.h index a9ba4baa24..26664484dc 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.h +++ b/src/KOKKOS/atom_vec_sphere_kokkos.h @@ -31,86 +31,86 @@ namespace LAMMPS_NS { class AtomVecSphereKokkos : public AtomVecKokkos { public: AtomVecSphereKokkos(class LAMMPS *); - ~AtomVecSphereKokkos() {} - void init(); - void grow(int); - void grow_pointers(); - void copy(int, int, int); - int pack_comm(int, int *, double *, int, int *); - int pack_comm_vel(int, int *, double *, int, int *); - int pack_comm_hybrid(int, int *, double *); - void unpack_comm(int, int, double *); - void unpack_comm_vel(int, int, double *); - int unpack_comm_hybrid(int, int, double *); - int pack_reverse(int, int, double *); - int pack_reverse_hybrid(int, int, double *); - void unpack_reverse(int, int *, double *); - int unpack_reverse_hybrid(int, int *, double *); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void data_vel(int, const std::vector &); - int data_vel_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - void pack_vel(double **); - int pack_vel_hybrid(int, double *); - void write_vel(FILE *, int, double **); - int write_vel_hybrid(FILE *, double *); - double memory_usage(); + + void init() override; + void grow(int) override; + void grow_pointers() override; + void copy(int, int, int) override; + int pack_comm(int, int *, double *, int, int *) override; + int pack_comm_vel(int, int *, double *, int, int *) override; + int pack_comm_hybrid(int, int *, double *) override; + void unpack_comm(int, int, double *) override; + void unpack_comm_vel(int, int, double *) override; + int unpack_comm_hybrid(int, int, double *) override; + int pack_reverse(int, int, double *) override; + int pack_reverse_hybrid(int, int, double *) override; + void unpack_reverse(int, int *, double *) override; + int unpack_reverse_hybrid(int, int *, double *) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void data_vel(int, const std::vector &) override; + int data_vel_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + void pack_vel(double **) override; + int pack_vel_hybrid(int, double *) override; + void write_vel(FILE *, int, double **) override; + int write_vel_hybrid(FILE *, double *) override; + double memory_usage() override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; void unpack_comm_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf); + const DAT::tdual_xfloat_2d &buf) override; int pack_comm_vel_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; void unpack_comm_vel_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf); + const DAT::tdual_xfloat_2d &buf) override; int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, - const int &pbc_flag, const int pbc[]); + const int &pbc_flag, const int pbc[]) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_border_vel_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_vel_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; private: tagint *tag; diff --git a/src/KOKKOS/atom_vec_spin_kokkos.h b/src/KOKKOS/atom_vec_spin_kokkos.h index 38d206c007..329e2bf9e6 100644 --- a/src/KOKKOS/atom_vec_spin_kokkos.h +++ b/src/KOKKOS/atom_vec_spin_kokkos.h @@ -31,52 +31,52 @@ namespace LAMMPS_NS { class AtomVecSpinKokkos : public AtomVecKokkos { public: AtomVecSpinKokkos(class LAMMPS *); - void grow(int); - void copy(int, int, int); - int pack_border(int, int *, double *, int, int *); - int pack_border_vel(int, int *, double *, int, int *); - int pack_border_hybrid(int, int *, double *); - void unpack_border(int, int, double *); - void unpack_border_vel(int, int, double *); - int unpack_border_hybrid(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(double *); - int size_restart(); - int pack_restart(int, double *); - int unpack_restart(double *); - void create_atom(int, double *); - void data_atom(double *, imageint, const std::vector &); - int data_atom_hybrid(int, const std::vector &, int); - void pack_data(double **); - int pack_data_hybrid(int, double *); - void write_data(FILE *, int, double **); - int write_data_hybrid(FILE *, double *); - double memory_usage(); + void grow(int) override; + void copy(int, int, int) override; + int pack_border(int, int *, double *, int, int *) override; + int pack_border_vel(int, int *, double *, int, int *) override; + int pack_border_hybrid(int, int *, double *) override; + void unpack_border(int, int, double *) override; + void unpack_border_vel(int, int, double *) override; + int unpack_border_hybrid(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(double *) override; + int size_restart() override; + int pack_restart(int, double *) override; + int unpack_restart(double *) override; + void create_atom(int, double *) override; + void data_atom(double *, imageint, const std::vector &) override; + int data_atom_hybrid(int, const std::vector &, int) override; + void pack_data(double **) override; + int pack_data_hybrid(int, double *) override; + void write_data(FILE *, int, double **) override; + int write_data_hybrid(FILE *, double *) override; + double memory_usage() override; // clear magnetic and mechanic forces - void force_clear(int, size_t); + void force_clear(int, size_t) override; - void grow_pointers(); + void grow_pointers() override; // input lists to be checked int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, - int pbc_flag, int *pbc, ExecutionSpace space); + int pbc_flag, int *pbc, ExecutionSpace space) override; void unpack_border_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf, - ExecutionSpace space); + ExecutionSpace space) override; int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, - X_FLOAT lo, X_FLOAT hi); + X_FLOAT lo, X_FLOAT hi) override; int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, - ExecutionSpace space); + ExecutionSpace space) override; - void sync(ExecutionSpace space, unsigned int mask); - void modified(ExecutionSpace space, unsigned int mask); - void sync_overlapping_device(ExecutionSpace space, unsigned int mask); + void sync(ExecutionSpace space, unsigned int mask) override; + void modified(ExecutionSpace space, unsigned int mask) override; + void sync_overlapping_device(ExecutionSpace space, unsigned int mask) override; protected: tagint *tag; diff --git a/src/KOKKOS/bond_class2_kokkos.h b/src/KOKKOS/bond_class2_kokkos.h index 529046845f..8a4222ee0b 100644 --- a/src/KOKKOS/bond_class2_kokkos.h +++ b/src/KOKKOS/bond_class2_kokkos.h @@ -40,10 +40,10 @@ class BondClass2Kokkos : public BondClass2 { typedef EV_FLOAT value_type; BondClass2Kokkos(class LAMMPS *); - virtual ~BondClass2Kokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~BondClass2Kokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/bond_fene_kokkos.h b/src/KOKKOS/bond_fene_kokkos.h index d52289990c..fbf1459dae 100644 --- a/src/KOKKOS/bond_fene_kokkos.h +++ b/src/KOKKOS/bond_fene_kokkos.h @@ -39,10 +39,10 @@ class BondFENEKokkos : public BondFENE { typedef ArrayTypes AT; BondFENEKokkos(class LAMMPS *); - virtual ~BondFENEKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~BondFENEKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -92,7 +92,7 @@ class BondFENEKokkos : public BondFENE { typename AT::t_ffloat_1d d_epsilon; typename AT::t_ffloat_1d d_sigma; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/bond_harmonic_kokkos.h b/src/KOKKOS/bond_harmonic_kokkos.h index 8bd6dc4477..301adf69d0 100644 --- a/src/KOKKOS/bond_harmonic_kokkos.h +++ b/src/KOKKOS/bond_harmonic_kokkos.h @@ -39,10 +39,10 @@ class BondHarmonicKokkos : public BondHarmonic { typedef EV_FLOAT value_type; BondHarmonicKokkos(class LAMMPS *); - virtual ~BondHarmonicKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~BondHarmonicKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -79,7 +79,7 @@ class BondHarmonicKokkos : public BondHarmonic { typename AT::t_ffloat_1d d_k; typename AT::t_ffloat_1d d_r0; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/comm_kokkos.h b/src/KOKKOS/comm_kokkos.h index aeacdb71cd..91d0c9de0b 100644 --- a/src/KOKKOS/comm_kokkos.h +++ b/src/KOKKOS/comm_kokkos.h @@ -34,24 +34,24 @@ class CommKokkos : public CommBrick { bool reverse_comm_on_host; CommKokkos(class LAMMPS *); - ~CommKokkos(); - void init(); + ~CommKokkos() override; + void init() override; - void forward_comm(int dummy = 0); // forward comm of atom coords - void reverse_comm(); // reverse comm of atom coords - void exchange(); // move atoms to new procs - void borders(); // setup list of atoms to comm + void forward_comm(int dummy = 0) override; // forward comm of atom coords + void reverse_comm() override; // reverse comm of atom coords + void exchange() override; // move atoms to new procs + void borders() override; // setup list of atoms to comm - void forward_comm_pair(class Pair *); // forward comm from a Pair - void reverse_comm_pair(class Pair *); // reverse comm from a Pair - void forward_comm_fix(class Fix *, int size=0); // forward comm from a Fix - void reverse_comm_fix(class Fix *, int size=0); // reverse comm from a Fix - void forward_comm_compute(class Compute *); // forward from a Compute - void reverse_comm_compute(class Compute *); // reverse from a Compute - void forward_comm_dump(class Dump *); // forward comm from a Dump - void reverse_comm_dump(class Dump *); // reverse comm from a Dump + void forward_comm_pair(class Pair *) override; // forward comm from a Pair + void reverse_comm_pair(class Pair *) override; // reverse comm from a Pair + void forward_comm_fix(class Fix *, int size=0) override; // forward comm from a Fix + void reverse_comm_fix(class Fix *, int size=0) override; // reverse comm from a Fix + void forward_comm_compute(class Compute *) override; // forward from a Compute + void reverse_comm_compute(class Compute *) override; // reverse from a Compute + void forward_comm_dump(class Dump *) override; // forward comm from a Dump + void reverse_comm_dump(class Dump *) override; // reverse comm from a Dump - void forward_comm_array(int, double **); // forward comm of array + void forward_comm_array(int, double **) override; // forward comm of array template void forward_comm_device(int dummy); template void reverse_comm_device(); @@ -85,12 +85,12 @@ class CommKokkos : public CommBrick { void grow_buf_pair(int); void grow_buf_fix(int); - void grow_send(int, int); - void grow_recv(int); + void grow_send(int, int) override; + void grow_recv(int) override; void grow_send_kokkos(int, int, ExecutionSpace space = Host); void grow_recv_kokkos(int, ExecutionSpace space = Host); - void grow_list(int, int); - void grow_swap(int); + void grow_list(int, int) override; + void grow_swap(int) override; void copy_swap_info(); }; diff --git a/src/KOKKOS/comm_tiled_kokkos.h b/src/KOKKOS/comm_tiled_kokkos.h index 8877feec75..90d508ec4b 100644 --- a/src/KOKKOS/comm_tiled_kokkos.h +++ b/src/KOKKOS/comm_tiled_kokkos.h @@ -24,28 +24,28 @@ class CommTiledKokkos : public CommTiled { public: CommTiledKokkos(class LAMMPS *); CommTiledKokkos(class LAMMPS *, class Comm *); - virtual ~CommTiledKokkos(); + ~CommTiledKokkos() override; - void forward_comm(int dummy = 0); // forward comm of atom coords - void reverse_comm(); // reverse comm of forces - void exchange(); // move atoms to new procs - void borders(); // setup list of atoms to comm + void forward_comm(int dummy = 0) override; // forward comm of atom coords + void reverse_comm() override; // reverse comm of forces + void exchange() override; // move atoms to new procs + void borders() override; // setup list of atoms to comm - void forward_comm_pair(class Pair *); // forward comm from a Pair - void reverse_comm_pair(class Pair *); // reverse comm from a Pair - void forward_comm_fix(class Fix *, int size=0); + void forward_comm_pair(class Pair *) override; // forward comm from a Pair + void reverse_comm_pair(class Pair *) override; // reverse comm from a Pair + void forward_comm_fix(class Fix *, int size=0) override; // forward comm from a Fix - void reverse_comm_fix(class Fix *, int size=0); + void reverse_comm_fix(class Fix *, int size=0) override; // reverse comm from a Fix - void reverse_comm_fix_variable(class Fix *); + void reverse_comm_fix_variable(class Fix *) override; // variable size reverse comm from a Fix - void forward_comm_compute(class Compute *); // forward from a Compute - void reverse_comm_compute(class Compute *); // reverse from a Compute - void forward_comm_dump(class Dump *); // forward comm from a Dump - void reverse_comm_dump(class Dump *); // reverse comm from a Dump + void forward_comm_compute(class Compute *) override; // forward from a Compute + void reverse_comm_compute(class Compute *) override; // reverse from a Compute + void forward_comm_dump(class Dump *) override; // forward comm from a Dump + void reverse_comm_dump(class Dump *) override; // reverse comm from a Dump - void forward_comm_array(int, double **); // forward comm of array - int exchange_variable(int, double *, double *&); // exchange on neigh stencil + void forward_comm_array(int, double **) override; // forward comm of array + int exchange_variable(int, double *, double *&) override; // exchange on neigh stencil private: diff --git a/src/KOKKOS/compute_ave_sphere_atom_kokkos.h b/src/KOKKOS/compute_ave_sphere_atom_kokkos.h index 42607e5239..e935dc6a94 100644 --- a/src/KOKKOS/compute_ave_sphere_atom_kokkos.h +++ b/src/KOKKOS/compute_ave_sphere_atom_kokkos.h @@ -36,9 +36,9 @@ class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom { typedef ArrayTypes AT; ComputeAveSphereAtomKokkos(class LAMMPS *, int, char **); - virtual ~ComputeAveSphereAtomKokkos(); - void init(); - void compute_peratom(); + ~ComputeAveSphereAtomKokkos() override; + void init() override; + void compute_peratom() override; KOKKOS_INLINE_FUNCTION void operator()(TagComputeAveSphereAtom, const int&) const; diff --git a/src/KOKKOS/compute_coord_atom_kokkos.h b/src/KOKKOS/compute_coord_atom_kokkos.h index f67b52564c..1835bb6550 100644 --- a/src/KOKKOS/compute_coord_atom_kokkos.h +++ b/src/KOKKOS/compute_coord_atom_kokkos.h @@ -38,9 +38,9 @@ class ComputeCoordAtomKokkos : public ComputeCoordAtom { typedef ArrayTypes AT; ComputeCoordAtomKokkos(class LAMMPS *, int, char **); - virtual ~ComputeCoordAtomKokkos(); - void init(); - void compute_peratom(); + ~ComputeCoordAtomKokkos() override; + void init() override; + void compute_peratom() override; enum {NONE,CUTOFF,ORIENT}; template diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.h b/src/KOKKOS/compute_orientorder_atom_kokkos.h index 56d06b7936..f5ff8b2af7 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.h +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.h @@ -67,9 +67,9 @@ class ComputeOrientOrderAtomKokkos : public ComputeOrientOrderAtom { typedef int value_type; ComputeOrientOrderAtomKokkos(class LAMMPS *, int, char **); - ~ComputeOrientOrderAtomKokkos(); - void init(); - void compute_peratom(); + ~ComputeOrientOrderAtomKokkos() override; + void init() override; + void compute_peratom() override; t_sna_1i d_qlist; template @@ -127,7 +127,7 @@ class ComputeOrientOrderAtomKokkos : public ComputeOrientOrderAtom { KOKKOS_INLINE_FUNCTION double associated_legendre(int, int, double) const; - void init_clebsch_gordan(); + void init_clebsch_gordan() override; t_sna_1d d_cglist; // Clebsch-Gordan coeffs }; diff --git a/src/KOKKOS/compute_temp_deform_kokkos.h b/src/KOKKOS/compute_temp_deform_kokkos.h index 0292c6776d..e4ccecfe4b 100644 --- a/src/KOKKOS/compute_temp_deform_kokkos.h +++ b/src/KOKKOS/compute_temp_deform_kokkos.h @@ -76,11 +76,11 @@ class ComputeTempDeformKokkos: public ComputeTempDeform { typedef ArrayTypes AT; ComputeTempDeformKokkos(class LAMMPS *, int, char **); - ~ComputeTempDeformKokkos(); - double compute_scalar(); - void compute_vector(); - void remove_bias_all(); - void restore_bias_all(); + ~ComputeTempDeformKokkos() override; + double compute_scalar() override; + void compute_vector() override; + void remove_bias_all() override; + void restore_bias_all() override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/compute_temp_kokkos.h b/src/KOKKOS/compute_temp_kokkos.h index d882ebc8f4..42954a360c 100644 --- a/src/KOKKOS/compute_temp_kokkos.h +++ b/src/KOKKOS/compute_temp_kokkos.h @@ -72,9 +72,9 @@ class ComputeTempKokkos : public ComputeTemp { typedef ArrayTypes AT; ComputeTempKokkos(class LAMMPS *, int, char **); - virtual ~ComputeTempKokkos() {} - double compute_scalar(); - void compute_vector(); + + double compute_scalar() override; + void compute_vector() override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/dihedral_charmm_kokkos.h b/src/KOKKOS/dihedral_charmm_kokkos.h index bea6cb9995..09b979d02d 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.h +++ b/src/KOKKOS/dihedral_charmm_kokkos.h @@ -96,11 +96,11 @@ class DihedralCharmmKokkos : public DihedralCharmm { typedef ArrayTypes AT; DihedralCharmmKokkos(class LAMMPS *); - virtual ~DihedralCharmmKokkos(); - void compute(int, int); - void coeff(int, char **); - void init_style(); - void read_restart(FILE *); + ~DihedralCharmmKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -164,7 +164,7 @@ class DihedralCharmmKokkos : public DihedralCharmm { typename AT::t_ffloat_1d d_cos_shift; typename AT::t_ffloat_1d d_weight; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/dihedral_class2_kokkos.h b/src/KOKKOS/dihedral_class2_kokkos.h index 8f4fbc2c8a..0b7251edf5 100644 --- a/src/KOKKOS/dihedral_class2_kokkos.h +++ b/src/KOKKOS/dihedral_class2_kokkos.h @@ -39,10 +39,10 @@ class DihedralClass2Kokkos : public DihedralClass2 { typedef ArrayTypes AT; DihedralClass2Kokkos(class LAMMPS *); - virtual ~DihedralClass2Kokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~DihedralClass2Kokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/dihedral_harmonic_kokkos.h b/src/KOKKOS/dihedral_harmonic_kokkos.h index 874a517402..8e66f82add 100644 --- a/src/KOKKOS/dihedral_harmonic_kokkos.h +++ b/src/KOKKOS/dihedral_harmonic_kokkos.h @@ -39,10 +39,10 @@ class DihedralHarmonicKokkos : public DihedralHarmonic { typedef ArrayTypes AT; DihedralHarmonicKokkos(class LAMMPS *); - virtual ~DihedralHarmonicKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~DihedralHarmonicKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -92,7 +92,7 @@ class DihedralHarmonicKokkos : public DihedralHarmonic { typename AT::t_int_1d d_sign; typename AT::t_int_1d d_multiplicity; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/dihedral_opls_kokkos.h b/src/KOKKOS/dihedral_opls_kokkos.h index b0e468f993..6f01359650 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.h +++ b/src/KOKKOS/dihedral_opls_kokkos.h @@ -39,10 +39,10 @@ class DihedralOPLSKokkos : public DihedralOPLS { typedef ArrayTypes AT; DihedralOPLSKokkos(class LAMMPS *); - virtual ~DihedralOPLSKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~DihedralOPLSKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -90,7 +90,7 @@ class DihedralOPLSKokkos : public DihedralOPLS { typename AT::t_ffloat_1d d_k3; typename AT::t_ffloat_1d d_k4; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/domain_kokkos.h b/src/KOKKOS/domain_kokkos.h index 50c7542e82..60e7c1c550 100644 --- a/src/KOKKOS/domain_kokkos.h +++ b/src/KOKKOS/domain_kokkos.h @@ -29,16 +29,16 @@ struct TagDomain_x2lamda{}; class DomainKokkos : public Domain { public: DomainKokkos(class LAMMPS *); - ~DomainKokkos() {} - void reset_box(); - void pbc(); + ~DomainKokkos() override = default; + void reset_box() override; + void pbc() override; void remap_all(); void image_flip(int, int, int); - void x2lamda(int); - void lamda2x(int); + void x2lamda(int) override; + void lamda2x(int) override; // forward remaining x2lamda() and lambda2x() variants to parent class - void x2lamda(double *a, double *b) { Domain::x2lamda(a,b); } - void lamda2x(double *a, double *b) { Domain::lamda2x(a,b); } + void x2lamda(double *a, double *b) override { Domain::x2lamda(a,b); } + void lamda2x(double *a, double *b) override { Domain::lamda2x(a,b); } void x2lamda(double *a, double *b, double *c, double *d) { Domain::x2lamda(a,b,c,d); } diff --git a/src/KOKKOS/dynamical_matrix_kokkos.cpp b/src/KOKKOS/dynamical_matrix_kokkos.cpp new file mode 100644 index 0000000000..dc180a1743 --- /dev/null +++ b/src/KOKKOS/dynamical_matrix_kokkos.cpp @@ -0,0 +1,353 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Charlie Sievers (UC Davis), charliesievers at cox.net +------------------------------------------------------------------------- */ + +#include "dynamical_matrix_kokkos.h" + +#include "angle.h" +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "bond.h" +#include "comm.h" +#include "compute.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "force.h" +#include "group.h" +#include "improper.h" +#include "kokkos.h" +#include "kspace.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "pair.h" +#include "timer.h" +#include "update.h" + +#include +#include +#include + +using namespace LAMMPS_NS; +enum{REGULAR,ESKM}; + +template +struct ForceAdder { + ViewA a; + ViewB b; + ForceAdder(const ViewA& a_, const ViewB& b_):a(a_),b(b_) {} + KOKKOS_INLINE_FUNCTION + void operator() (const int& i) const { + a(i,0) += b(i,0); + a(i,1) += b(i,1); + a(i,2) += b(i,2); + } +}; + +/* ---------------------------------------------------------------------- */ + +template +struct Zero { + View v; + Zero(const View &v_):v(v_) {} + KOKKOS_INLINE_FUNCTION + void operator()(const int &i) const { + v(i,0) = 0; + v(i,1) = 0; + v(i,2) = 0; + } +}; + +/* ---------------------------------------------------------------------- */ + +DynamicalMatrixKokkos::DynamicalMatrixKokkos(LAMMPS *lmp) : DynamicalMatrix(lmp) +{ + atomKK = (AtomKokkos *) atom; +} + +/* ---------------------------------------------------------------------- */ + +DynamicalMatrixKokkos::~DynamicalMatrixKokkos() +{ + +} + +/* ---------------------------------------------------------------------- */ + +void DynamicalMatrixKokkos::command(int narg, char **arg) +{ + atomKK->sync(Host, X_MASK|RMASS_MASK|TYPE_MASK); + DynamicalMatrix::command(narg, arg); +} + +/* ---------------------------------------------------------------------- + setup without output or one-time post-init setup + flag = 0 = just force calculation + flag = 1 = reneighbor and force calculation +------------------------------------------------------------------------- */ + +void DynamicalMatrixKokkos::setup() +{ + lmp->kokkos->auto_sync = 1; + + // setup domain, communication and neighboring + // acquire ghosts + // build neighbor lists + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + if (neighbor->style) neighbor->setup_bins(); + comm->exchange(); + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + domain->image_check(); + domain->box_too_small_check(); + neighbor->build(1); + + // compute all forces + eflag=0; + vflag=0; + if (force->kspace) { + force->kspace->setup(); + } + update_force(); + + if (pair_compute_flag) { + atomKK->sync(force->pair->execution_space,force->pair->datamask_read); + force->pair->compute(eflag,vflag); + atomKK->modified(force->pair->execution_space,force->pair->datamask_modify); + } + else if (force->pair) force->pair->compute_dummy(eflag,vflag); + update->setupflag = 0; + + lmp->kokkos->auto_sync = 0; + + //if all then skip communication groupmap population + if (gcount == atom->natoms) + for (bigint i=0; inatoms; i++) + groupmap[i] = i; + else + create_groupmap(); +} + +/* ---------------------------------------------------------------------- + evaluate potential energy and forces + may migrate atoms due to reneighboring + return new energy, which should include nextra_global dof + return negative gradient stored in atom->f + return negative gradient for nextra_global dof in fextra +------------------------------------------------------------------------- */ + +void DynamicalMatrixKokkos::update_force() +{ + int n_pre_force = modify->n_pre_force; + int n_pre_reverse = modify->n_pre_reverse; + int n_post_force = modify->n_post_force; + + lmp->kokkos->auto_sync = 0; + + f_merge_copy = DAT::t_f_array("DynamicalMatrixKokkos::f_merge_copy",atomKK->k_f.extent(0)); + + atomKK->modified(Host,X_MASK); + atomKK->sync(Device,X_MASK); + + force_clear(); + + neighbor->ago = 0; + if ((modify->get_fix_by_id("package_intel")) ? true : false) + neighbor->decide(); + + + if (n_pre_force) { + modify->pre_force(vflag); + timer->stamp(Timer::MODIFY); + } + + bool execute_on_host = false; + unsigned int datamask_read_device = 0; + unsigned int datamask_modify_device = 0; + unsigned int datamask_read_host = 0; + + if (pair_compute_flag) { + if (force->pair->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->pair->datamask_read; + datamask_modify_device |= force->pair->datamask_modify; + } else { + datamask_read_device |= force->pair->datamask_read; + datamask_modify_device |= force->pair->datamask_modify; + } + } + if (atomKK->molecular && force->bond) { + if (force->bond->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->bond->datamask_read; + datamask_modify_device |= force->bond->datamask_modify; + } else { + datamask_read_device |= force->bond->datamask_read; + datamask_modify_device |= force->bond->datamask_modify; + } + } + if (atomKK->molecular && force->angle) { + if (force->angle->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->angle->datamask_read; + datamask_modify_device |= force->angle->datamask_modify; + } else { + datamask_read_device |= force->angle->datamask_read; + datamask_modify_device |= force->angle->datamask_modify; + } + } + if (atomKK->molecular && force->dihedral) { + if (force->dihedral->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->dihedral->datamask_read; + datamask_modify_device |= force->dihedral->datamask_modify; + } else { + datamask_read_device |= force->dihedral->datamask_read; + datamask_modify_device |= force->dihedral->datamask_modify; + } + } + if (atomKK->molecular && force->improper) { + if (force->improper->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->improper->datamask_read; + datamask_modify_device |= force->improper->datamask_modify; + } else { + datamask_read_device |= force->improper->datamask_read; + datamask_modify_device |= force->improper->datamask_modify; + } + } + if (kspace_compute_flag) { + if (force->kspace->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->kspace->datamask_read; + datamask_modify_device |= force->kspace->datamask_modify; + } else { + datamask_read_device |= force->kspace->datamask_read; + datamask_modify_device |= force->kspace->datamask_modify; + } + } + + + if (pair_compute_flag) { + atomKK->sync(force->pair->execution_space,force->pair->datamask_read); + atomKK->sync(force->pair->execution_space,~(~force->pair->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + Kokkos::Timer ktimer; + force->pair->compute(eflag,vflag); + atomKK->modified(force->pair->execution_space,force->pair->datamask_modify); + atomKK->modified(force->pair->execution_space,~(~force->pair->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + timer->stamp(Timer::PAIR); + } + + if (execute_on_host) { + if (pair_compute_flag && force->pair->datamask_modify!=(F_MASK | ENERGY_MASK | VIRIAL_MASK)) + Kokkos::fence(); + atomKK->sync_overlapping_device(Host,~(~datamask_read_host|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + if (pair_compute_flag && force->pair->execution_space!=Host) { + Kokkos::deep_copy(LMPHostType(),atomKK->k_f.h_view,0.0); + } + } + + if (atomKK->molecular) { + if (force->bond) { + atomKK->sync(force->bond->execution_space,~(~force->bond->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->bond->compute(eflag,vflag); + atomKK->modified(force->bond->execution_space,~(~force->bond->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + if (force->angle) { + atomKK->sync(force->angle->execution_space,~(~force->angle->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->angle->compute(eflag,vflag); + atomKK->modified(force->angle->execution_space,~(~force->angle->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + if (force->dihedral) { + atomKK->sync(force->dihedral->execution_space,~(~force->dihedral->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->dihedral->compute(eflag,vflag); + atomKK->modified(force->dihedral->execution_space,~(~force->dihedral->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + if (force->improper) { + atomKK->sync(force->improper->execution_space,~(~force->improper->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->improper->compute(eflag,vflag); + atomKK->modified(force->improper->execution_space,~(~force->improper->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + timer->stamp(Timer::BOND); + } + + if (kspace_compute_flag) { + atomKK->sync(force->kspace->execution_space,~(~force->kspace->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->kspace->compute(eflag,vflag); + atomKK->modified(force->kspace->execution_space,~(~force->kspace->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + timer->stamp(Timer::KSPACE); + } + + if (execute_on_host && !std::is_same::value) { + if (f_merge_copy.extent(0)k_f.extent(0)) { + f_merge_copy = DAT::t_f_array("DynamicalMatrixKokkos::f_merge_copy",atomKK->k_f.extent(0)); + } + f = atomKK->k_f.d_view; + Kokkos::deep_copy(LMPHostType(),f_merge_copy,atomKK->k_f.h_view); + Kokkos::parallel_for(atomKK->k_f.extent(0), + ForceAdder(atomKK->k_f.d_view,f_merge_copy)); + atomKK->k_f.clear_sync_state(); // special case + atomKK->k_f.modify(); + } + if (n_pre_reverse) { + modify->pre_reverse(eflag,vflag); + timer->stamp(Timer::MODIFY); + } + if (force->newton) { + comm->reverse_comm(); + timer->stamp(Timer::COMM); + } + // force modifications + + if (n_post_force) { + modify->post_force(vflag); + timer->stamp(Timer::MODIFY); + } + + atomKK->sync(Host,F_MASK); + lmp->kokkos->auto_sync = 1; + + ++ update->nsteps; +} + +/* ---------------------------------------------------------------------- + clear force on own & ghost atoms + clear other arrays as needed +------------------------------------------------------------------------- */ + +void DynamicalMatrixKokkos::force_clear() +{ + if (external_force_clear) return; + + atomKK->k_f.clear_sync_state(); // ignore host forces/torques since device views + + // clear force on all particles + // if either newton flag is set, also include ghosts + // when using threads always clear all forces. + + int nall = atomKK->nlocal; + if (force->newton) nall += atomKK->nghost; + + Kokkos::parallel_for(nall, Zero::t_f_array>(atomKK->k_f.view())); + atomKK->modified(Device,F_MASK); + +} diff --git a/src/KOKKOS/dynamical_matrix_kokkos.h b/src/KOKKOS/dynamical_matrix_kokkos.h new file mode 100644 index 0000000000..02b93e2112 --- /dev/null +++ b/src/KOKKOS/dynamical_matrix_kokkos.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMMAND_CLASS +// clang-format off +CommandStyle(dynamical_matrix/kk,DynamicalMatrixKokkos); +CommandStyle(dynamical_matrix/kk/device,DynamicalMatrixKokkos); +CommandStyle(dynamical_matrix/kk/host,DynamicalMatrixKokkos); +// clang-format on +#else + +#ifndef LMP_DYNAMICAL_MATRIX_KOKKOS_H +#define LMP_DYNAMICAL_MATRIX_KOKKOS_H + +#include "dynamical_matrix.h" +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +class DynamicalMatrixKokkos : public DynamicalMatrix { + public: + DynamicalMatrixKokkos(class LAMMPS *); + ~DynamicalMatrixKokkos() override; + void command(int, char **) override; + void setup(); + + KOKKOS_INLINE_FUNCTION + void operator() (const int& i) const { + f(i,0) += f_merge_copy(i,0); + f(i,1) += f_merge_copy(i,1); + f(i,2) += f_merge_copy(i,2); + } + + protected: + void update_force(); + void force_clear(); + DAT::t_f_array f_merge_copy,f; + + +}; +} // namespace LAMMPS_NS + +#endif //LMP_DYNAMICAL_MATRIX_KOKKOS_H +#endif diff --git a/src/KOKKOS/fft3d_kokkos.h b/src/KOKKOS/fft3d_kokkos.h index 387574b198..1cd6e9ced2 100644 --- a/src/KOKKOS/fft3d_kokkos.h +++ b/src/KOKKOS/fft3d_kokkos.h @@ -80,7 +80,7 @@ class FFT3dKokkos : protected Pointers { FFT3dKokkos(class LAMMPS *, MPI_Comm, int,int,int,int,int,int,int,int,int,int,int,int,int,int,int, int,int,int *,int,int); - ~FFT3dKokkos(); + ~FFT3dKokkos() override; void compute(typename FFT_AT::t_FFT_SCALAR_1d, typename FFT_AT::t_FFT_SCALAR_1d, int); void timing1d(typename FFT_AT::t_FFT_SCALAR_1d, int, int); diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp index 8379dc8f46..9d228020c3 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp @@ -633,6 +633,7 @@ void FixACKS2ReaxFFKokkos::compute_h_item(int ii, int &m_fill, const template template +KOKKOS_INLINE_FUNCTION void FixACKS2ReaxFFKokkos::compute_h_team( const typename Kokkos::TeamPolicy::member_type &team, int atoms_per_team, int vector_length) const { @@ -863,8 +864,8 @@ KOKKOS_INLINE_FUNCTION void FixACKS2ReaxFFKokkos::compute_x_item(int ii, int &m_fill, const bool &final) const { // The X_diag array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_X_diag = ScatterViewHelper::value,decltype(dup_X_diag),decltype(ndup_X_diag)>::get(dup_X_diag,ndup_X_diag); - auto a_X_diag = v_X_diag.template access::value>(); + auto v_X_diag = ScatterViewHelper,decltype(dup_X_diag),decltype(ndup_X_diag)>::get(dup_X_diag,ndup_X_diag); + auto a_X_diag = v_X_diag.template access>(); const int i = d_ilist[ii]; int j,jj,jtype; @@ -935,13 +936,14 @@ void FixACKS2ReaxFFKokkos::compute_x_item(int ii, int &m_fill, const template template +KOKKOS_INLINE_FUNCTION void FixACKS2ReaxFFKokkos::compute_x_team( const typename Kokkos::TeamPolicy::member_type &team, int atoms_per_team, int vector_length) const { // The X_diag array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_X_diag = ScatterViewHelper::value,decltype(dup_X_diag),decltype(ndup_X_diag)>::get(dup_X_diag,ndup_X_diag); - auto a_X_diag = v_X_diag.template access::value>(); + auto v_X_diag = ScatterViewHelper,decltype(dup_X_diag),decltype(ndup_X_diag)>::get(dup_X_diag,ndup_X_diag); + auto a_X_diag = v_X_diag.template access>(); // scratch space setup Kokkos::View, @@ -1458,8 +1460,8 @@ KOKKOS_INLINE_FUNCTION void FixACKS2ReaxFFKokkos::operator() (TagACKS2SparseMatvec3_Half, const int &ii) const { // The bb array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_bb = ScatterViewHelper::value,decltype(dup_bb),decltype(ndup_bb)>::get(dup_bb,ndup_bb); - auto a_bb = v_bb.template access::value>(); + auto v_bb = ScatterViewHelper,decltype(dup_bb),decltype(ndup_bb)>::get(dup_bb,ndup_bb); + auto a_bb = v_bb.template access>(); const int i = d_ilist[ii]; if (mask[i] & groupbit) { diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.h b/src/KOKKOS/fix_acks2_reaxff_kokkos.h index bce90e97a3..735b478f1b 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.h +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.h @@ -183,16 +183,16 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF { Kokkos::DualView k_params; typename Kokkos::DualView::t_dev_const params; - typename ArrayTypes::t_x_array x; - typename ArrayTypes::t_v_array v; - typename ArrayTypes::t_f_array_const f; - typename ArrayTypes::t_ffloat_1d_randomread mass; - typename ArrayTypes::t_ffloat_1d q; - typename ArrayTypes::t_int_1d type, mask; - typename ArrayTypes::t_tagint_1d tag; + typename AT::t_x_array x; + typename AT::t_v_array v; + typename AT::t_f_array_const f; + typename AT::t_ffloat_1d_randomread mass; + typename AT::t_ffloat_1d q; + typename AT::t_int_1d type, mask; + typename AT::t_tagint_1d tag; - typename ArrayTypes::t_neighbors_2d d_neighbors; - typename ArrayTypes::t_int_1d_randomread d_ilist, d_numneigh; + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d_randomread d_ilist, d_numneigh; DAT::tdual_ffloat_1d k_tap; typename AT::t_ffloat_1d d_tap; @@ -222,11 +222,19 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF { typename AT::t_ffloat_2d d_shield, d_s_hist, d_s_hist_X, d_s_hist_last; typename AT::t_ffloat_2d_randomread r_s_hist, r_s_hist_X, r_s_hist_last; - Kokkos::Experimental::ScatterView::value, Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterDuplicated> dup_X_diag; - Kokkos::Experimental::ScatterView::value, Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterNonDuplicated> ndup_X_diag; + using KKDeviceType = typename KKDevice::value; - Kokkos::Experimental::ScatterView::value, Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterDuplicated> dup_bb; - Kokkos::Experimental::ScatterView::value, Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterNonDuplicated> ndup_bb; + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_X_diag; + NonDupScatterView ndup_X_diag; + + DupScatterView dup_bb; + NonDupScatterView ndup_bb; void init_shielding_k(); void init_hist(); diff --git a/src/KOKKOS/fix_deform_kokkos.cpp b/src/KOKKOS/fix_deform_kokkos.cpp index 576e34503c..104ac41188 100644 --- a/src/KOKKOS/fix_deform_kokkos.cpp +++ b/src/KOKKOS/fix_deform_kokkos.cpp @@ -319,7 +319,7 @@ void FixDeformKokkos::end_of_step() // if (mask[i] & groupbit) // domain->x2lamda(x[i],x[i]); - if (nrigid) + if (rfix.size() > 0) error->all(FLERR,"Cannot (yet) use rigid bodies with fix deform and Kokkos"); //for (i = 0; i < nrigid; i++) // modify->fix[rfix[i]]->deform(0); diff --git a/src/KOKKOS/fix_deform_kokkos.h b/src/KOKKOS/fix_deform_kokkos.h index e0835b5e0a..c57c493cb0 100644 --- a/src/KOKKOS/fix_deform_kokkos.h +++ b/src/KOKKOS/fix_deform_kokkos.h @@ -29,11 +29,10 @@ namespace LAMMPS_NS { class FixDeformKokkos : public FixDeform { public: - FixDeformKokkos(class LAMMPS *, int, char **); - virtual ~FixDeformKokkos() {} - void pre_exchange(); - void end_of_step(); + + void pre_exchange() override; + void end_of_step() override; private: class DomainKokkos *domainKK; diff --git a/src/KOKKOS/fix_dpd_energy_kokkos.h b/src/KOKKOS/fix_dpd_energy_kokkos.h index 2986b9707c..700089770a 100644 --- a/src/KOKKOS/fix_dpd_energy_kokkos.h +++ b/src/KOKKOS/fix_dpd_energy_kokkos.h @@ -32,9 +32,9 @@ template class FixDPDenergyKokkos : public FixDPDenergy { public: FixDPDenergyKokkos(class LAMMPS *, int, char **); - virtual ~FixDPDenergyKokkos() {} - virtual void initial_integrate(int); - virtual void final_integrate(); + + void initial_integrate(int) override; + void final_integrate() override; void take_half_step(); protected: diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index 9edd332e91..195cc48974 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -33,8 +33,8 @@ class FixEnforce2DKokkos : public FixEnforce2D { public: FixEnforce2DKokkos(class LAMMPS *, int, char **); // ~FixEnforce2DKokkos() {} - void setup(int); - void post_force(int); + void setup(int) override; + void post_force(int) override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/fix_eos_table_rx_kokkos.h b/src/KOKKOS/fix_eos_table_rx_kokkos.h index 66d9a70390..68a854619b 100644 --- a/src/KOKKOS/fix_eos_table_rx_kokkos.h +++ b/src/KOKKOS/fix_eos_table_rx_kokkos.h @@ -41,11 +41,11 @@ class FixEOStableRXKokkos : public FixEOStableRX { typedef EV_FLOAT value_type; FixEOStableRXKokkos(class LAMMPS *, int, char **); - virtual ~FixEOStableRXKokkos(); - void setup(int); - void init(); - void post_integrate(); - void end_of_step(); + ~FixEOStableRXKokkos() override; + void setup(int) override; + void init() override; + void post_integrate() override; + void end_of_step() override; KOKKOS_INLINE_FUNCTION void operator()(TagFixEOStableRXInit, const int&) const; @@ -123,10 +123,10 @@ class FixEOStableRXKokkos : public FixEOStableRX { DAT::tdual_int_scalar k_error_flag; DAT::tdual_int_scalar k_warning_flag; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int , int *, double *, int, int *); - void unpack_forward_comm(int , int , double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int , int *, double *, int, int *) override; + void unpack_forward_comm(int , int , double *) override; }; } diff --git a/src/KOKKOS/fix_freeze_kokkos.h b/src/KOKKOS/fix_freeze_kokkos.h index 67d4f3272c..28438d5f91 100644 --- a/src/KOKKOS/fix_freeze_kokkos.h +++ b/src/KOKKOS/fix_freeze_kokkos.h @@ -59,7 +59,7 @@ class FixFreezeKokkos : public FixFreeze { }; FixFreezeKokkos(class LAMMPS *, int, char **); - void post_force(int); + void post_force(int) override; KOKKOS_INLINE_FUNCTION void operator()(const int i, OriginalForce &original) const; diff --git a/src/KOKKOS/fix_gravity_kokkos.h b/src/KOKKOS/fix_gravity_kokkos.h index 3526b94d4c..779da5a8b0 100644 --- a/src/KOKKOS/fix_gravity_kokkos.h +++ b/src/KOKKOS/fix_gravity_kokkos.h @@ -35,8 +35,8 @@ template class FixGravityKokkos : public FixGravity { public: FixGravityKokkos(class LAMMPS *, int, char **); - virtual ~FixGravityKokkos() {} - void post_force(int); + + void post_force(int) override; KOKKOS_INLINE_FUNCTION void operator()(TagFixGravityRMass, const int, double &) const; diff --git a/src/KOKKOS/fix_langevin_kokkos.h b/src/KOKKOS/fix_langevin_kokkos.h index ffd5a17da5..96b61532e6 100644 --- a/src/KOKKOS/fix_langevin_kokkos.h +++ b/src/KOKKOS/fix_langevin_kokkos.h @@ -45,11 +45,10 @@ namespace LAMMPS_NS { } KOKKOS_INLINE_FUNCTION - volatile s_FSUM& operator+=(const volatile s_FSUM &rhs) volatile { + void operator+=(const volatile s_FSUM &rhs) volatile { fx += rhs.fx; fy += rhs.fy; fz += rhs.fz; - return *this; } }; typedef s_FSUM FSUM; @@ -72,17 +71,17 @@ namespace LAMMPS_NS { class FixLangevinKokkos : public FixLangevin { public: FixLangevinKokkos(class LAMMPS *, int, char **); - ~FixLangevinKokkos(); + ~FixLangevinKokkos() override; void cleanup_copy(); - void init(); - void initial_integrate(int); - void post_force(int); - void reset_dt(); - void grow_arrays(int); - void copy_arrays(int i, int j, int delflag); - double compute_scalar(); - void end_of_step(); + void init() override; + void initial_integrate(int) override; + void post_force(int) override; + void reset_dt() override; + void grow_arrays(int) override; + void copy_arrays(int i, int j, int delflag) override; + double compute_scalar() override; + void end_of_step() override; KOKKOS_INLINE_FUNCTION void initial_integrate_item(int) const; diff --git a/src/KOKKOS/fix_minimize_kokkos.h b/src/KOKKOS/fix_minimize_kokkos.h index a86788cc02..00d37d5b80 100644 --- a/src/KOKKOS/fix_minimize_kokkos.h +++ b/src/KOKKOS/fix_minimize_kokkos.h @@ -33,13 +33,13 @@ class FixMinimizeKokkos : public FixMinimize { public: FixMinimizeKokkos(class LAMMPS *, int, char **); - virtual ~FixMinimizeKokkos(); - void init() {} + ~FixMinimizeKokkos() override; + void init() override {} - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; void add_vector_kokkos(); DAT::t_float_1d request_vector_kokkos(int); diff --git a/src/KOKKOS/fix_momentum_kokkos.h b/src/KOKKOS/fix_momentum_kokkos.h index 8dc3053acf..eaf93e9756 100644 --- a/src/KOKKOS/fix_momentum_kokkos.h +++ b/src/KOKKOS/fix_momentum_kokkos.h @@ -34,7 +34,7 @@ class FixMomentumKokkos : public FixMomentum { typedef ArrayTypes AT; FixMomentumKokkos(class LAMMPS *, int, char **); - void end_of_step(); + void end_of_step() override; }; } diff --git a/src/KOKKOS/fix_neigh_history_kokkos.h b/src/KOKKOS/fix_neigh_history_kokkos.h index 0442b46cbd..e27d92bee8 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.h +++ b/src/KOKKOS/fix_neigh_history_kokkos.h @@ -31,17 +31,17 @@ template class FixNeighHistoryKokkos : public FixNeighHistory { public: FixNeighHistoryKokkos(class LAMMPS *, int, char **); - ~FixNeighHistoryKokkos(); + ~FixNeighHistoryKokkos() override; - void init(); - void pre_exchange(); - void setup_post_neighbor(); - virtual void post_neighbor(); - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + void init() override; + void pre_exchange() override; + void setup_post_neighbor() override; + void post_neighbor() override; + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; KOKKOS_INLINE_FUNCTION void zero_partner_count_item(const int &i) const; diff --git a/src/KOKKOS/fix_nh_kokkos.h b/src/KOKKOS/fix_nh_kokkos.h index 00f0b1f769..6155ba2dd3 100644 --- a/src/KOKKOS/fix_nh_kokkos.h +++ b/src/KOKKOS/fix_nh_kokkos.h @@ -36,12 +36,12 @@ class FixNHKokkos : public FixNH { typedef DeviceType device_type; FixNHKokkos(class LAMMPS *, int, char **); - virtual ~FixNHKokkos(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void pre_exchange(); + ~FixNHKokkos() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void pre_exchange() override; template KOKKOS_INLINE_FUNCTION @@ -58,12 +58,12 @@ class FixNHKokkos : public FixNH { void operator()(TagFixNH_nh_v_temp, const int&) const; protected: - virtual void remap(); + void remap() override; - virtual void nve_x(); // may be overwritten by child classes - virtual void nve_v(); - virtual void nh_v_press(); - virtual void nh_v_temp(); + void nve_x() override; // may be overwritten by child classes + void nve_v() override; + void nh_v_press() override; + void nh_v_temp() override; F_FLOAT factor[3]; diff --git a/src/KOKKOS/fix_nph_kokkos.h b/src/KOKKOS/fix_nph_kokkos.h index 8d91930c32..06e689e3c8 100644 --- a/src/KOKKOS/fix_nph_kokkos.h +++ b/src/KOKKOS/fix_nph_kokkos.h @@ -31,7 +31,6 @@ template class FixNPHKokkos : public FixNHKokkos { public: FixNPHKokkos(class LAMMPS *, int, char **); - ~FixNPHKokkos() {} }; } diff --git a/src/KOKKOS/fix_npt_kokkos.h b/src/KOKKOS/fix_npt_kokkos.h index b70e130c35..8cd50b8a54 100644 --- a/src/KOKKOS/fix_npt_kokkos.h +++ b/src/KOKKOS/fix_npt_kokkos.h @@ -31,7 +31,6 @@ template class FixNPTKokkos : public FixNHKokkos { public: FixNPTKokkos(class LAMMPS *, int, char **); - ~FixNPTKokkos() {} }; } diff --git a/src/KOKKOS/fix_nve_kokkos.h b/src/KOKKOS/fix_nve_kokkos.h index 8d2aefb694..fddfcd2bba 100644 --- a/src/KOKKOS/fix_nve_kokkos.h +++ b/src/KOKKOS/fix_nve_kokkos.h @@ -41,11 +41,11 @@ template class FixNVEKokkos : public FixNVE { public: FixNVEKokkos(class LAMMPS *, int, char **); - ~FixNVEKokkos() {} + void cleanup_copy(); - void init(); - void initial_integrate(int); - void final_integrate(); + void init() override; + void initial_integrate(int) override; + void final_integrate() override; KOKKOS_INLINE_FUNCTION void initial_integrate_item(int) const; diff --git a/src/KOKKOS/fix_nve_sphere_kokkos.h b/src/KOKKOS/fix_nve_sphere_kokkos.h index f3e3df13d4..2f85fea1b9 100644 --- a/src/KOKKOS/fix_nve_sphere_kokkos.h +++ b/src/KOKKOS/fix_nve_sphere_kokkos.h @@ -32,11 +32,11 @@ template class FixNVESphereKokkos : public FixNVESphere { public: FixNVESphereKokkos(class LAMMPS *, int, char **); - virtual ~FixNVESphereKokkos() {} + void cleanup_copy(); - void init(); - void initial_integrate(int); - void final_integrate(); + void init() override; + void initial_integrate(int) override; + void final_integrate() override; KOKKOS_INLINE_FUNCTION void initial_integrate_item(const int i) const; diff --git a/src/KOKKOS/fix_nvt_kokkos.h b/src/KOKKOS/fix_nvt_kokkos.h index 054a083034..72e12ea42f 100644 --- a/src/KOKKOS/fix_nvt_kokkos.h +++ b/src/KOKKOS/fix_nvt_kokkos.h @@ -31,7 +31,6 @@ template class FixNVTKokkos : public FixNHKokkos { public: FixNVTKokkos(class LAMMPS *, int, char **); - ~FixNVTKokkos() {} }; } diff --git a/src/KOKKOS/fix_nvt_sllod_kokkos.h b/src/KOKKOS/fix_nvt_sllod_kokkos.h index 84e57ab2c3..ebac7b1563 100644 --- a/src/KOKKOS/fix_nvt_sllod_kokkos.h +++ b/src/KOKKOS/fix_nvt_sllod_kokkos.h @@ -39,8 +39,8 @@ class FixNVTSllodKokkos : public FixNHKokkos { typedef ArrayTypes AT; FixNVTSllodKokkos(class LAMMPS *, int, char **); - ~FixNVTSllodKokkos() {} - void init(); + + void init() override; KOKKOS_INLINE_FUNCTION void operator()(TagFixNVTSllod_temp1, const int& i) const; @@ -51,7 +51,7 @@ class FixNVTSllodKokkos : public FixNHKokkos { private: int nondeformbias; - void nh_v_temp(); + void nh_v_temp() override; protected: typename AT::t_x_array x; diff --git a/src/KOKKOS/fix_property_atom_kokkos.h b/src/KOKKOS/fix_property_atom_kokkos.h index 7f3e5758b1..a90f672c8f 100644 --- a/src/KOKKOS/fix_property_atom_kokkos.h +++ b/src/KOKKOS/fix_property_atom_kokkos.h @@ -28,9 +28,8 @@ namespace LAMMPS_NS { class FixPropertyAtomKokkos : public FixPropertyAtom { public: FixPropertyAtomKokkos(class LAMMPS *, int, char **); - virtual ~FixPropertyAtomKokkos() {} - void grow_arrays(int); + void grow_arrays(int) override; }; } diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp index b35bbc46ee..52212c09ed 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp @@ -1041,8 +1041,8 @@ KOKKOS_INLINE_FUNCTION void FixQEqReaxFFKokkos::sparse13_item(int ii) const { // The q array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_o = ScatterViewHelper::value,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); - auto a_o = v_o.template access::value>(); + auto v_o = ScatterViewHelper,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); + auto a_o = v_o.template access>(); const int i = d_ilist[ii]; if (mask[i] & groupbit) { @@ -1094,8 +1094,8 @@ KOKKOS_INLINE_FUNCTION void FixQEqReaxFFKokkos::sparse23_item(int ii) const { // The q array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_o = ScatterViewHelper::value,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); - auto a_o = v_o.template access::value>(); + auto v_o = ScatterViewHelper,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); + auto a_o = v_o.template access>(); const int i = d_ilist[ii]; if (mask[i] & groupbit) { @@ -1154,8 +1154,8 @@ KOKKOS_INLINE_FUNCTION void FixQEqReaxFFKokkos::sparse33_item(int ii) const { // The q array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_o = ScatterViewHelper::value,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); - auto a_o = v_o.template access::value>(); + auto v_o = ScatterViewHelper,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); + auto a_o = v_o.template access>(); const int i = d_ilist[ii]; if (mask[i] & groupbit) { diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.h b/src/KOKKOS/fix_qeq_reaxff_kokkos.h index 3256e56aef..28ffc34a3d 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.h +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.h @@ -47,12 +47,12 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { typedef DeviceType device_type; typedef ArrayTypes AT; FixQEqReaxFFKokkos(class LAMMPS *, int, char **); - ~FixQEqReaxFFKokkos(); + ~FixQEqReaxFFKokkos() override; void cleanup_copy(); - void init(); - void setup_pre_force(int); - void pre_force(int); + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; KOKKOS_INLINE_FUNCTION void num_neigh_item(int, int&) const; @@ -158,13 +158,13 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { }; int pack_forward_comm_fix_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - void unpack_forward_comm_fix_kokkos(int, int, DAT::tdual_xfloat_1d&); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int, int *) override; + void unpack_forward_comm_fix_kokkos(int, int, DAT::tdual_xfloat_1d&) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int inum,ignum; @@ -177,21 +177,21 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { Kokkos::DualView k_params; typename Kokkos::DualView::t_dev_const params; - typename ArrayTypes::t_x_array x; - typename ArrayTypes::t_v_array v; - typename ArrayTypes::t_f_array_const f; - //typename ArrayTypes::t_float_1d_randomread mass, q; - typename ArrayTypes::t_float_1d_randomread mass; - typename ArrayTypes::t_float_1d q; - typename ArrayTypes::t_int_1d type, mask; - typename ArrayTypes::t_tagint_1d tag; + typename AT::t_x_array x; + typename AT::t_v_array v; + typename AT::t_f_array_const f; + //typename AT::t_float_1d_randomread mass, q; + typename AT::t_float_1d_randomread mass; + typename AT::t_float_1d q; + typename AT::t_int_1d type, mask; + typename AT::t_tagint_1d tag; DAT::tdual_float_1d k_q; typename AT::t_float_1d d_q; HAT::t_float_1d h_q; - typename ArrayTypes::t_neighbors_2d d_neighbors; - typename ArrayTypes::t_int_1d_randomread d_ilist, d_numneigh; + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d_randomread d_ilist, d_numneigh; DAT::tdual_ffloat_1d k_tap; typename AT::t_ffloat_1d d_tap; @@ -216,8 +216,16 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { HAT::t_ffloat_2d h_s_hist, h_t_hist; typename AT::t_ffloat_2d_randomread r_s_hist, r_t_hist; - Kokkos::Experimental::ScatterView::value, Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterDuplicated> dup_o; - Kokkos::Experimental::ScatterView::value, Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterNonDuplicated> ndup_o; + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_o; + NonDupScatterView ndup_o; int iswap; int first; @@ -226,7 +234,7 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { void init_shielding_k(); void init_hist(); - void allocate_matrix(); + void allocate_matrix() override; void allocate_array(); int cg_solve1(); int cg_solve2(); @@ -237,11 +245,11 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { int count, isuccess; double alpha, beta, delta, cutsq; - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void get_chi_field(); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void get_chi_field() override; }; template diff --git a/src/KOKKOS/fix_reaxff_bonds_kokkos.h b/src/KOKKOS/fix_reaxff_bonds_kokkos.h index b161f67ced..b104bceeef 100644 --- a/src/KOKKOS/fix_reaxff_bonds_kokkos.h +++ b/src/KOKKOS/fix_reaxff_bonds_kokkos.h @@ -34,13 +34,14 @@ namespace LAMMPS_NS { class FixReaxFFBondsKokkos : public FixReaxFFBonds { public: FixReaxFFBondsKokkos(class LAMMPS *, int, char **); - virtual ~FixReaxFFBondsKokkos(); - void init(); + ~FixReaxFFBondsKokkos() override; + + void init() override; private: int nbuf; - void Output_ReaxFF_Bonds(); - double memory_usage(); + void Output_ReaxFF_Bonds() override; + double memory_usage() override; }; } diff --git a/src/KOKKOS/fix_reaxff_species_kokkos.h b/src/KOKKOS/fix_reaxff_species_kokkos.h index 2f7d94cdad..741365fd5f 100644 --- a/src/KOKKOS/fix_reaxff_species_kokkos.h +++ b/src/KOKKOS/fix_reaxff_species_kokkos.h @@ -35,11 +35,12 @@ namespace LAMMPS_NS { class FixReaxFFSpeciesKokkos : public FixReaxFFSpecies { public: FixReaxFFSpeciesKokkos(class LAMMPS *, int, char **); - virtual ~FixReaxFFSpeciesKokkos(); - void init(); + ~FixReaxFFSpeciesKokkos() override; + + void init() override; private: - void FindMolecule(); + void FindMolecule() override; }; } diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index 61e4a05946..3440de9885 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -61,13 +61,12 @@ struct s_CounterType } KOKKOS_INLINE_FUNCTION - volatile s_CounterType& operator+=(const volatile s_CounterType &rhs) volatile + void operator+=(const volatile s_CounterType &rhs) volatile { nSteps += rhs.nSteps; nIters += rhs.nIters; nFuncs += rhs.nFuncs; nFails += rhs.nFails; - return *this; } }; typedef struct s_CounterType CounterType; @@ -78,12 +77,12 @@ class FixRxKokkos : public FixRX { typedef ArrayTypes AT; FixRxKokkos(class LAMMPS *, int, char **); - virtual ~FixRxKokkos(); - virtual void init(); - void init_list(int, class NeighList *); - void post_constructor(); - virtual void setup_pre_force(int); - virtual void pre_force(int); + ~FixRxKokkos() override; + void init() override; + void init_list(int, class NeighList *) override; + void post_constructor() override; + void setup_pre_force(int) override; + void pre_force(int) override; // Define a value_type here for the reduction operator on CounterType. typedef CounterType value_type; @@ -239,22 +238,22 @@ class FixRxKokkos : public FixRX { typename AT::t_efloat_1d d_dpdThetaLocal, d_sumWeights; HAT::t_efloat_1d h_dpdThetaLocal, h_sumWeights; - typename ArrayTypes::t_x_array_randomread d_x ; - typename ArrayTypes::t_int_1d_randomread d_type ; - typename ArrayTypes::t_efloat_1d d_dpdTheta; + typename AT::t_x_array_randomread d_x; + typename AT::t_int_1d_randomread d_type; + typename AT::t_efloat_1d d_dpdTheta; - typename ArrayTypes::tdual_ffloat_2d k_cutsq; - typename ArrayTypes::t_ffloat_2d d_cutsq; + typename AT::tdual_ffloat_2d k_cutsq; + typename AT::t_ffloat_2d d_cutsq; //double **h_cutsq; - typename ArrayTypes::t_neighbors_2d d_neighbors; - typename ArrayTypes::t_int_1d d_ilist ; - typename ArrayTypes::t_int_1d d_numneigh ; + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d d_ilist; + typename AT::t_int_1d d_numneigh; - typename ArrayTypes::t_float_2d d_dvector; - typename ArrayTypes::t_int_1d d_mask ; + typename AT::t_float_2d d_dvector; + typename AT::t_int_1d d_mask; - typename ArrayTypes::t_double_1d d_scratchSpace; + typename AT::t_double_1d d_scratchSpace; size_t scratchSpaceSize; // Error flag for any failures. @@ -263,10 +262,10 @@ class FixRxKokkos : public FixRX { template void computeLocalTemperature(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int , int *, double *, int, int *); - void unpack_forward_comm(int , int , double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int , int *, double *, int, int *) override; + void unpack_forward_comm(int , int , double *) override; //private: // replicate a few from FixRX int my_restartFlag; diff --git a/src/KOKKOS/fix_setforce_kokkos.h b/src/KOKKOS/fix_setforce_kokkos.h index e39ef82325..5260ae3421 100644 --- a/src/KOKKOS/fix_setforce_kokkos.h +++ b/src/KOKKOS/fix_setforce_kokkos.h @@ -63,9 +63,9 @@ class FixSetForceKokkos : public FixSetForce { typedef ArrayTypes AT; FixSetForceKokkos(class LAMMPS *, int, char **); - ~FixSetForceKokkos(); - void init(); - void post_force(int); + ~FixSetForceKokkos() override; + void init() override; + void post_force(int) override; KOKKOS_INLINE_FUNCTION void operator()(TagFixSetForceConstant, const int&, double_3&) const; diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index 91d8458d21..3fef8030a1 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -590,8 +590,8 @@ void FixShakeKokkos::shake(int m, EV_FLOAT& ev) const // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); int nlist,list[2]; double v[6]; @@ -701,8 +701,8 @@ void FixShakeKokkos::shake3(int m, EV_FLOAT& ev) const // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); int nlist,list[3]; double v[6]; @@ -884,8 +884,8 @@ void FixShakeKokkos::shake4(int m, EV_FLOAT& ev) const // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); int nlist,list[4]; double v[6]; @@ -1146,8 +1146,8 @@ void FixShakeKokkos::shake3angle(int m, EV_FLOAT& ev) const // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); int nlist,list[3]; double v[6]; @@ -1744,8 +1744,8 @@ void FixShakeKokkos::v_tally(EV_FLOAT &ev, int n, int *list, double if (vflag_atom) { double fraction = 1.0/total; for (int i = 0; i < n; i++) { - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); m = list[i]; a_vatom(m,0) += fraction*v[0]; a_vatom(m,1) += fraction*v[1]; diff --git a/src/KOKKOS/fix_shake_kokkos.h b/src/KOKKOS/fix_shake_kokkos.h index a9967f22ec..11a94f0d2c 100644 --- a/src/KOKKOS/fix_shake_kokkos.h +++ b/src/KOKKOS/fix_shake_kokkos.h @@ -49,31 +49,31 @@ class FixShakeKokkos : public FixShake, public KokkosBase { typedef ArrayTypes AT; FixShakeKokkos(class LAMMPS *, int, char **); - virtual ~FixShakeKokkos(); - void init(); - void pre_neighbor(); - void post_force(int); + ~FixShakeKokkos() override; + void init() override; + void pre_neighbor() override; + void post_force(int) override; - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - void update_arrays(int, int); - void set_molecule(int, tagint, int, double *, double *, double *); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + void update_arrays(int, int) override; + void set_molecule(int, tagint, int, double *, double *, double *) override; - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; int pack_forward_comm_fix_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - void unpack_forward_comm_fix_kokkos(int, int, DAT::tdual_xfloat_1d&); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int, int *) override; + void unpack_forward_comm_fix_kokkos(int, int, DAT::tdual_xfloat_1d&) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; - void shake_end_of_step(int vflag); - void correct_coordinates(int vflag); + void shake_end_of_step(int vflag) override; + void correct_coordinates(int vflag) override; - int dof(int); + int dof(int) override; - void unconstrained_update(); + void unconstrained_update() override; template KOKKOS_INLINE_FUNCTION @@ -151,14 +151,21 @@ class FixShakeKokkos : public FixShake, public KokkosBase { KOKKOS_INLINE_FUNCTION void shake3angle(int, EV_FLOAT&) const; - typedef typename KKDevice::value KKDeviceType; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; + using KKDeviceType = typename KKDevice::value; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; int neighflag,need_dup; diff --git a/src/KOKKOS/fix_wall_lj93_kokkos.h b/src/KOKKOS/fix_wall_lj93_kokkos.h index e07789f378..b4b10a1e13 100644 --- a/src/KOKKOS/fix_wall_lj93_kokkos.h +++ b/src/KOKKOS/fix_wall_lj93_kokkos.h @@ -36,7 +36,7 @@ class FixWallLJ93Kokkos : public FixWallLJ93 { typedef double value_type[]; FixWallLJ93Kokkos(class LAMMPS *, int, char **); - void wall_particle(int, int, double); + void wall_particle(int, int, double) override; int m; diff --git a/src/KOKKOS/fix_wall_reflect_kokkos.h b/src/KOKKOS/fix_wall_reflect_kokkos.h index 3e068c06df..f4e6eee684 100644 --- a/src/KOKKOS/fix_wall_reflect_kokkos.h +++ b/src/KOKKOS/fix_wall_reflect_kokkos.h @@ -36,7 +36,7 @@ class FixWallReflectKokkos : public FixWallReflect { typedef DeviceType device_type; typedef ArrayTypes AT; FixWallReflectKokkos(class LAMMPS *, int, char **); - void post_integrate(); + void post_integrate() override; KOKKOS_INLINE_FUNCTION void operator()(TagFixWallReflectPostIntegrate, const int&) const; diff --git a/src/KOKKOS/gridcomm_kokkos.h b/src/KOKKOS/gridcomm_kokkos.h index d1f4ccb5e9..e067dd27e5 100644 --- a/src/KOKKOS/gridcomm_kokkos.h +++ b/src/KOKKOS/gridcomm_kokkos.h @@ -34,7 +34,7 @@ class GridCommKokkos : public GridComm { int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); - virtual ~GridCommKokkos(); + ~GridCommKokkos() override; void forward_comm_kspace(class KSpace *, int, int, FFT_DAT::tdual_FFT_SCALAR_1d &, FFT_DAT::tdual_FFT_SCALAR_1d &, MPI_Datatype); void reverse_comm_kspace(class KSpace *, int, int, @@ -55,8 +55,8 @@ class GridCommKokkos : public GridComm { // internal methods // ------------------------------------------- - void setup_regular(int &, int &); - void setup_tiled(int &, int &); + void setup_regular(int &, int &) override; + void setup_tiled(int &, int &) override; void forward_comm_kspace_regular(class KSpace *, int, int, FFT_DAT::tdual_FFT_SCALAR_1d &, FFT_DAT::tdual_FFT_SCALAR_1d &, MPI_Datatype); @@ -67,7 +67,7 @@ class GridCommKokkos : public GridComm { void reverse_comm_kspace_tiled(class KSpace *, int, int, FFT_DAT::tdual_FFT_SCALAR_1d &, FFT_DAT::tdual_FFT_SCALAR_1d &, MPI_Datatype); - void grow_swap(); + void grow_swap() override; int indices(DAT::tdual_int_2d &, int, int, int, int, int, int, int); }; diff --git a/src/KOKKOS/improper_class2_kokkos.h b/src/KOKKOS/improper_class2_kokkos.h index 9656526e49..179a7b61a9 100644 --- a/src/KOKKOS/improper_class2_kokkos.h +++ b/src/KOKKOS/improper_class2_kokkos.h @@ -42,10 +42,10 @@ class ImproperClass2Kokkos : public ImproperClass2 { typedef ArrayTypes AT; ImproperClass2Kokkos(class LAMMPS *); - virtual ~ImproperClass2Kokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~ImproperClass2Kokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/improper_harmonic_kokkos.h b/src/KOKKOS/improper_harmonic_kokkos.h index ad683f314d..02cbb9d15a 100644 --- a/src/KOKKOS/improper_harmonic_kokkos.h +++ b/src/KOKKOS/improper_harmonic_kokkos.h @@ -39,10 +39,10 @@ class ImproperHarmonicKokkos : public ImproperHarmonic { typedef ArrayTypes AT; ImproperHarmonicKokkos(class LAMMPS *); - virtual ~ImproperHarmonicKokkos(); - void compute(int, int); - void coeff(int, char **); - void read_restart(FILE *); + ~ImproperHarmonicKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void read_restart(FILE *) override; template KOKKOS_INLINE_FUNCTION @@ -87,7 +87,7 @@ class ImproperHarmonicKokkos : public ImproperHarmonic { typename Kokkos::DualView::t_dev d_k; typename Kokkos::DualView::t_dev d_chi; - void allocate(); + void allocate() override; }; } diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index e26513a122..dc8a1173f3 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -207,6 +207,11 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) error->all(FLERR,"Kokkos has been compiled with GPU-enabled backend but no GPUs are requested"); #endif +#if !defined(KOKKOS_ENABLE_OPENMP) && !defined(KOKKOS_ENABLE_THREADS) + if (nthreads > 1) + error->all(FLERR,"Multiple CPU threads are requested but Kokkos has not been compiled using a threading-enabled backend"); +#endif + #ifndef KOKKOS_ENABLE_SERIAL if (nthreads == 1 && me == 0) error->warning(FLERR,"When using a single thread, the Kokkos Serial backend " @@ -600,7 +605,8 @@ void KokkosLMP::my_signal_handler(int sig) { if (sig == SIGSEGV) { #if defined(_WIN32) - kill(_getpid(),SIGABRT); + // there is no kill() function on Windows + exit(1); #else kill(getpid(),SIGABRT); #endif diff --git a/src/KOKKOS/kokkos.h b/src/KOKKOS/kokkos.h index af35d95b9e..be4990d0a4 100644 --- a/src/KOKKOS/kokkos.h +++ b/src/KOKKOS/kokkos.h @@ -54,7 +54,7 @@ class KokkosLMP : protected Pointers { static int init_ngpus; KokkosLMP(class LAMMPS *, int, char **); - ~KokkosLMP(); + ~KokkosLMP() override; static void initialize(Kokkos::InitArguments, Error *); static void finalize(); void accelerator(int, char **); @@ -104,6 +104,15 @@ E: Kokkos has been compiled with GPU-enabled backend but no GPUs are requested One or more GPUs must be used when Kokkos is compiled for CUDA/HIP/SYCL/OpenMPTarget. +E: Multiple CPU threads are requested but Kokkos has not been compiled using a threading-enabled backend + +Must use the Kokkos OpenMP or Threads backend for multiple threads. + +W: When using a single thread, the Kokkos Serial backend (i.e. Makefile.kokkos_mpi_only) +gives better performance than the OpenMP backend + +Self-expanatory. + W: Kokkos package already initalized, cannot reinitialize with different parameters Self-explanatory. diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index f0dc026df8..23145cb7fd 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -197,6 +197,15 @@ public: #endif }; +// Helpers for readability + +using KKScatterSum = Kokkos::Experimental::ScatterSum; +using KKScatterDuplicated = Kokkos::Experimental::ScatterDuplicated; +using KKScatterNonDuplicated = Kokkos::Experimental::ScatterNonDuplicated; + +template +using KKScatterView = Kokkos::Experimental::ScatterView; + // set ExecutionSpace stuct with variable "space" @@ -274,6 +283,9 @@ struct AtomicDup { using value = Kokkos::Experimental::ScatterNonAtomic; }; +template +using AtomicDup_v = typename AtomicDup::value; + #ifdef KOKKOS_ENABLE_CUDA template<> struct AtomicDup { @@ -322,6 +334,9 @@ struct NeedDup { using value = Kokkos::Experimental::ScatterNonDuplicated; }; +template +using NeedDup_v = typename NeedDup::value; + #ifndef LMP_KOKKOS_USE_ATOMICS #ifdef KOKKOS_ENABLE_OPENMP diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 58c3c08e2a..1134e627ca 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -172,13 +172,11 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type **) smalloc(nbytes,name); - bigint n = 0; for (int i = 0; i < n1; i++) { if (n2==0) array[i] = nullptr; else array[i] = &data.h_view(i,0); - n += n2; } return data; } @@ -193,13 +191,11 @@ template bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type **) smalloc(nbytes,name); - bigint n = 0; for (int i = 0; i < n1; i++) { if (n2==0) array[i] = nullptr; else array[i] = &h_data(i,0); - n += n2; } return data; } diff --git a/src/KOKKOS/min_cg_kokkos.h b/src/KOKKOS/min_cg_kokkos.h index 3947693a9b..4eded98003 100644 --- a/src/KOKKOS/min_cg_kokkos.h +++ b/src/KOKKOS/min_cg_kokkos.h @@ -30,7 +30,7 @@ namespace LAMMPS_NS { class MinCGKokkos : public MinLineSearchKokkos { public: MinCGKokkos(class LAMMPS *); - int iterate(int); + int iterate(int) override; }; } diff --git a/src/KOKKOS/min_kokkos.h b/src/KOKKOS/min_kokkos.h index 3d06010517..53e9e8c198 100644 --- a/src/KOKKOS/min_kokkos.h +++ b/src/KOKKOS/min_kokkos.h @@ -23,19 +23,19 @@ namespace LAMMPS_NS { class MinKokkos : public Min { public: MinKokkos(class LAMMPS *); - virtual ~MinKokkos(); - void init(); - void setup(int flag=1); - void setup_minimal(int); - void run(int); - double fnorm_sqr(); - double fnorm_inf(); - double fnorm_max(); + ~MinKokkos() override; + void init() override; + void setup(int flag=1) override; + void setup_minimal(int) override; + void run(int) override; + double fnorm_sqr() override; + double fnorm_inf() override; + double fnorm_max() override; - virtual void init_style() {} - virtual void setup_style() = 0; - virtual void reset_vectors() = 0; - virtual int iterate(int) = 0; + void init_style() override {} + void setup_style() override = 0; + void reset_vectors() override = 0; + int iterate(int) override = 0; // possible return values of iterate() method enum{MAXITER,MAXEVAL,ETOL,FTOL,DOWNHILL,ZEROALPHA,ZEROFORCE, @@ -47,8 +47,8 @@ class MinKokkos : public Min { DAT::t_ffloat_1d xvec; // variables for atomic dof, as 1d vector DAT::t_ffloat_1d fvec; // force vector for atomic dof, as 1d vector - double energy_force(int); - void force_clear(); + double energy_force(int) override; + void force_clear() override; }; } diff --git a/src/KOKKOS/min_linesearch_kokkos.h b/src/KOKKOS/min_linesearch_kokkos.h index 852d6cdaa8..67cfe9bcd1 100644 --- a/src/KOKKOS/min_linesearch_kokkos.h +++ b/src/KOKKOS/min_linesearch_kokkos.h @@ -43,10 +43,10 @@ namespace LAMMPS_NS { class MinLineSearchKokkos : public MinKokkos { public: MinLineSearchKokkos(class LAMMPS *); - ~MinLineSearchKokkos(); - void init(); - void setup_style(); - void reset_vectors(); + ~MinLineSearchKokkos() override; + void init() override; + void setup_style() override; + void reset_vectors() override; //protected: // won't compile with CUDA // vectors needed by linesearch minimizers diff --git a/src/KOKKOS/modify_kokkos.h b/src/KOKKOS/modify_kokkos.h index 25911743b2..c8f6ec567c 100644 --- a/src/KOKKOS/modify_kokkos.h +++ b/src/KOKKOS/modify_kokkos.h @@ -22,52 +22,52 @@ namespace LAMMPS_NS { class ModifyKokkos : public Modify { public: ModifyKokkos(class LAMMPS *); - ~ModifyKokkos() {} - void setup(int); - void setup_pre_exchange(); - void setup_pre_neighbor(); - void setup_post_neighbor(); - void setup_pre_force(int); - void setup_pre_reverse(int, int); - void initial_integrate(int); - void post_integrate(); + + void setup(int) override; + void setup_pre_exchange() override; + void setup_pre_neighbor() override; + void setup_post_neighbor() override; + void setup_pre_force(int) override; + void setup_pre_reverse(int, int) override; + void initial_integrate(int) override; + void post_integrate() override; void pre_decide(); - void pre_exchange(); - void pre_neighbor(); - void post_neighbor(); - void pre_force(int); - void pre_reverse(int,int); - void post_force(int); - void final_integrate(); - void end_of_step(); - double energy_couple(); - double energy_global(); - void energy_atom(int, double *); - void post_run(); + void pre_exchange() override; + void pre_neighbor() override; + void post_neighbor() override; + void pre_force(int) override; + void pre_reverse(int,int) override; + void post_force(int) override; + void final_integrate() override; + void end_of_step() override; + double energy_couple() override; + double energy_global() override; + void energy_atom(int, double *) override; + void post_run() override; - void setup_pre_force_respa(int, int); - void initial_integrate_respa(int, int, int); - void post_integrate_respa(int, int); - void pre_force_respa(int, int, int); - void post_force_respa(int, int, int); - void final_integrate_respa(int, int); + void setup_pre_force_respa(int, int) override; + void initial_integrate_respa(int, int, int) override; + void post_integrate_respa(int, int) override; + void pre_force_respa(int, int, int) override; + void post_force_respa(int, int, int) override; + void final_integrate_respa(int, int) override; - void min_pre_exchange(); - void min_pre_neighbor(); - void min_post_neighbor(); - void min_pre_force(int); - void min_pre_reverse(int,int); - void min_post_force(int); + void min_pre_exchange() override; + void min_pre_neighbor() override; + void min_post_neighbor() override; + void min_pre_force(int) override; + void min_pre_reverse(int,int) override; + void min_post_force(int) override; - double min_energy(double *); - void min_store(); - void min_step(double, double *); - void min_clearstore(); - void min_pushstore(); - void min_popstore(); - double max_alpha(double *); - int min_dof(); - int min_reset_ref(); + double min_energy(double *) override; + void min_store() override; + void min_step(double, double *) override; + void min_clearstore() override; + void min_pushstore() override; + void min_popstore() override; + double max_alpha(double *) override; + int min_dof() override; + int min_reset_ref() override; protected: diff --git a/src/KOKKOS/nbin_kokkos.h b/src/KOKKOS/nbin_kokkos.h index 1f6569177c..35bf50f48a 100644 --- a/src/KOKKOS/nbin_kokkos.h +++ b/src/KOKKOS/nbin_kokkos.h @@ -38,9 +38,9 @@ class NBinKokkos : public NBinStandard { typedef ArrayTypes AT; NBinKokkos(class LAMMPS *); - ~NBinKokkos() {} - void bin_atoms_setup(int); - void bin_atoms(); + + void bin_atoms_setup(int) override; + void bin_atoms() override; int atoms_per_bin; DAT::tdual_int_1d k_bincount; diff --git a/src/KOKKOS/nbin_ssa_kokkos.cpp b/src/KOKKOS/nbin_ssa_kokkos.cpp index b91ff7bd41..d6ad5ade0c 100644 --- a/src/KOKKOS/nbin_ssa_kokkos.cpp +++ b/src/KOKKOS/nbin_ssa_kokkos.cpp @@ -142,7 +142,7 @@ void NBinSSAKokkos::bin_atoms() k_gbincount.sync(); ghosts_per_gbin = 0; NPairSSAKokkosBinIDGhostsFunctor f(*this); - Kokkos::parallel_reduce(Kokkos::RangePolicy(nlocal,nall), f, ghosts_per_gbin); + Kokkos::parallel_reduce(Kokkos::RangePolicy(nlocal,nall), f, ghosts_per_gbin); } // actually bin the ghost atoms diff --git a/src/KOKKOS/nbin_ssa_kokkos.h b/src/KOKKOS/nbin_ssa_kokkos.h index eb5ade3e48..a31c57d67c 100644 --- a/src/KOKKOS/nbin_ssa_kokkos.h +++ b/src/KOKKOS/nbin_ssa_kokkos.h @@ -38,9 +38,9 @@ class NBinSSAKokkos : public NBinStandard { typedef ArrayTypes AT; NBinSSAKokkos(class LAMMPS *); - ~NBinSSAKokkos() {} - void bin_atoms_setup(int); - void bin_atoms(); + + void bin_atoms_setup(int) override; + void bin_atoms() override; // temporary array to hold the binID for each atom DAT::tdual_int_1d k_binID; diff --git a/src/KOKKOS/neigh_bond_kokkos.h b/src/KOKKOS/neigh_bond_kokkos.h index d2e5d0fc62..17c87dd5dc 100644 --- a/src/KOKKOS/neigh_bond_kokkos.h +++ b/src/KOKKOS/neigh_bond_kokkos.h @@ -42,7 +42,7 @@ class NeighBondKokkos : protected Pointers { typedef int value_type; NeighBondKokkos(class LAMMPS *); - ~NeighBondKokkos() {} + ~NeighBondKokkos() override = default; void init_topology_kk(); void build_topology_kk(); diff --git a/src/KOKKOS/neighbor_kokkos.h b/src/KOKKOS/neighbor_kokkos.h index ef885535ed..16c0c5369a 100644 --- a/src/KOKKOS/neighbor_kokkos.h +++ b/src/KOKKOS/neighbor_kokkos.h @@ -33,10 +33,10 @@ class NeighborKokkos : public Neighbor { typedef int value_type; NeighborKokkos(class LAMMPS *); - ~NeighborKokkos(); - void init(); - void init_topology(); - void build_topology(); + ~NeighborKokkos() override; + void init() override; + void init_topology() override; + void build_topology() override; template KOKKOS_INLINE_FUNCTION @@ -73,22 +73,22 @@ class NeighborKokkos : public Neighbor { X_FLOAT deltasq; - void init_cutneighsq_kokkos(int); - void create_kokkos_list(int); - void init_ex_type_kokkos(int); - void init_ex_bit_kokkos(); - void init_ex_mol_bit_kokkos(); - void grow_ex_mol_intra_kokkos(); - virtual int check_distance(); + void init_cutneighsq_kokkos(int) override; + void create_kokkos_list(int) override; + void init_ex_type_kokkos(int) override; + void init_ex_bit_kokkos() override; + void init_ex_mol_bit_kokkos() override; + void grow_ex_mol_intra_kokkos() override; + int check_distance() override; template int check_distance_kokkos(); - virtual void build(int); + void build(int) override; template void build_kokkos(int); void setup_bins_kokkos(int); void modify_ex_type_grow_kokkos(); void modify_ex_group_grow_kokkos(); void modify_mol_group_grow_kokkos(); void modify_mol_intra_grow_kokkos(); - void set_binsize_kokkos(); + void set_binsize_kokkos() override; }; } diff --git a/src/KOKKOS/npair_copy_kokkos.h b/src/KOKKOS/npair_copy_kokkos.h index b272275650..af8e1962d8 100644 --- a/src/KOKKOS/npair_copy_kokkos.h +++ b/src/KOKKOS/npair_copy_kokkos.h @@ -35,8 +35,7 @@ template class NPairCopyKokkos : public NPair { public: NPairCopyKokkos(class LAMMPS *); - ~NPairCopyKokkos() {} - void build(class NeighList *); + void build(class NeighList *) override; private: void copy_to_kokkos(class NeighList *); void copy_to_cpu(class NeighList *); diff --git a/src/KOKKOS/npair_halffull_kokkos.h b/src/KOKKOS/npair_halffull_kokkos.h index f6b1fbf08e..2bd3daf365 100644 --- a/src/KOKKOS/npair_halffull_kokkos.h +++ b/src/KOKKOS/npair_halffull_kokkos.h @@ -139,8 +139,7 @@ class NPairHalffullKokkos : public NPair { typedef ArrayTypes AT; NPairHalffullKokkos(class LAMMPS *); - ~NPairHalffullKokkos() {} - void build(class NeighList *); + void build(class NeighList *) override; KOKKOS_INLINE_FUNCTION void operator()(TagNPairHalffullCompute, const int&) const; diff --git a/src/KOKKOS/npair_kokkos.h b/src/KOKKOS/npair_kokkos.h index 339d7e425d..e78a0f6a85 100644 --- a/src/KOKKOS/npair_kokkos.h +++ b/src/KOKKOS/npair_kokkos.h @@ -100,11 +100,10 @@ class NPairKokkos : public NPair { public: NPairKokkos(class LAMMPS *); - ~NPairKokkos() {} - void copy_neighbor_info(); - void copy_bin_info(); - void copy_stencil_info(); - void build(class NeighList *); + void copy_neighbor_info() override; + void copy_bin_info() override; + void copy_stencil_info() override; + void build(class NeighList *) override; private: int newton_pair; diff --git a/src/KOKKOS/npair_skip_kokkos.h b/src/KOKKOS/npair_skip_kokkos.h index 2024a1e214..695641a8d6 100644 --- a/src/KOKKOS/npair_skip_kokkos.h +++ b/src/KOKKOS/npair_skip_kokkos.h @@ -63,8 +63,7 @@ class NPairSkipKokkos : public NPair { typedef ArrayTypes AT; NPairSkipKokkos(class LAMMPS *); - ~NPairSkipKokkos() {} - void build(class NeighList *); + void build(class NeighList *) override; KOKKOS_INLINE_FUNCTION void operator()(TagNPairSkipCompute, const int&, int&, const bool&) const; diff --git a/src/KOKKOS/npair_ssa_kokkos.h b/src/KOKKOS/npair_ssa_kokkos.h index ed99f54e1e..4b17ae881a 100644 --- a/src/KOKKOS/npair_ssa_kokkos.h +++ b/src/KOKKOS/npair_ssa_kokkos.h @@ -59,11 +59,10 @@ class NPairSSAKokkos : public NPair { typename AT::t_int_2d ssa_gitemLen; NPairSSAKokkos(class LAMMPS *); - ~NPairSSAKokkos() {} - void copy_neighbor_info(); - void copy_bin_info(); - void copy_stencil_info(); - void build(class NeighList *); + void copy_neighbor_info() override; + void copy_bin_info() override; + void copy_stencil_info() override; + void build(class NeighList *) override; private: // data from Neighbor class diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.h b/src/KOKKOS/pair_buck_coul_cut_kokkos.h index 265d625a65..482ee8adf0 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.h @@ -37,13 +37,13 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut { typedef DeviceType device_type; typedef ArrayTypes AT; PairBuckCoulCutKokkos(class LAMMPS *); - ~PairBuckCoulCutKokkos(); + ~PairBuckCoulCutKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_buck_coul{ KOKKOS_INLINE_FUNCTION @@ -110,7 +110,7 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut { double special_lj[4], special_coul[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.h b/src/KOKKOS/pair_buck_coul_long_kokkos.h index 3a1a8ad9ab..d3119a48bb 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.h @@ -37,14 +37,14 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong { typedef DeviceType device_type; typedef ArrayTypes AT; PairBuckCoulLongKokkos(class LAMMPS *); - ~PairBuckCoulLongKokkos(); + ~PairBuckCoulLongKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; struct params_buck_coul{ KOKKOS_INLINE_FUNCTION @@ -113,7 +113,7 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong { double special_lj[4], special_coul[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_buck_kokkos.h b/src/KOKKOS/pair_buck_kokkos.h index 7f5f63df3c..a5b056978d 100644 --- a/src/KOKKOS/pair_buck_kokkos.h +++ b/src/KOKKOS/pair_buck_kokkos.h @@ -37,12 +37,12 @@ class PairBuckKokkos : public PairBuck { typedef DeviceType device_type; typedef ArrayTypes AT; PairBuckKokkos(class LAMMPS *); - ~PairBuckKokkos(); + ~PairBuckKokkos() override; - void compute(int, int); + void compute(int, int) override; - void init_style(); - double init_one(int, int); + void init_style() override; + double init_one(int, int) override; struct params_buck{ KOKKOS_INLINE_FUNCTION @@ -91,7 +91,7 @@ class PairBuckKokkos : public PairBuck { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_coul_cut_kokkos.h b/src/KOKKOS/pair_coul_cut_kokkos.h index 434abb81c7..8f8da02db6 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_coul_cut_kokkos.h @@ -37,13 +37,13 @@ class PairCoulCutKokkos : public PairCoulCut { typedef DeviceType device_type; typedef ArrayTypes AT; PairCoulCutKokkos(class LAMMPS *); - ~PairCoulCutKokkos(); + ~PairCoulCutKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_coul{ KOKKOS_INLINE_FUNCTION @@ -111,7 +111,7 @@ class PairCoulCutKokkos : public PairCoulCut { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_coul_debye_kokkos.h b/src/KOKKOS/pair_coul_debye_kokkos.h index 87f45c01da..963c42858d 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_coul_debye_kokkos.h @@ -37,13 +37,13 @@ class PairCoulDebyeKokkos : public PairCoulDebye { typedef DeviceType device_type; typedef ArrayTypes AT; PairCoulDebyeKokkos(class LAMMPS *); - ~PairCoulDebyeKokkos(); + ~PairCoulDebyeKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_coul{ KOKKOS_INLINE_FUNCTION @@ -111,7 +111,7 @@ class PairCoulDebyeKokkos : public PairCoulDebye { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.h b/src/KOKKOS/pair_coul_dsf_kokkos.h index 74c3ed2bb7..fdd8556a0d 100644 --- a/src/KOKKOS/pair_coul_dsf_kokkos.h +++ b/src/KOKKOS/pair_coul_dsf_kokkos.h @@ -41,10 +41,10 @@ class PairCoulDSFKokkos : public PairCoulDSF { typedef ArrayTypes AT; typedef EV_FLOAT value_type; PairCoulDSFKokkos(class LAMMPS *); - ~PairCoulDSFKokkos(); + ~PairCoulDSFKokkos() override; - void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_coul_long_kokkos.h b/src/KOKKOS/pair_coul_long_kokkos.h index 37e2734f35..5768bfb9bf 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.h +++ b/src/KOKKOS/pair_coul_long_kokkos.h @@ -37,14 +37,14 @@ class PairCoulLongKokkos : public PairCoulLong { typedef DeviceType device_type; typedef ArrayTypes AT; PairCoulLongKokkos(class LAMMPS *); - ~PairCoulLongKokkos(); + ~PairCoulLongKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; struct params_coul{ KOKKOS_INLINE_FUNCTION @@ -112,7 +112,7 @@ class PairCoulLongKokkos : public PairCoulLong { double special_lj[4], special_coul[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.h b/src/KOKKOS/pair_coul_wolf_kokkos.h index afcda38733..dc30a8e08e 100644 --- a/src/KOKKOS/pair_coul_wolf_kokkos.h +++ b/src/KOKKOS/pair_coul_wolf_kokkos.h @@ -41,10 +41,10 @@ class PairCoulWolfKokkos : public PairCoulWolf { typedef ArrayTypes AT; typedef EV_FLOAT value_type; PairCoulWolfKokkos(class LAMMPS *); - ~PairCoulWolfKokkos(); + ~PairCoulWolfKokkos() override; - void compute(int, int); - void init_style(); + void compute(int, int) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h index db471cbd5f..f89c6cfaad 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h @@ -54,10 +54,10 @@ class PairDPDfdtEnergyKokkos : public PairDPDfdtEnergy { typedef EV_FLOAT value_type; PairDPDfdtEnergyKokkos(class LAMMPS *); - virtual ~PairDPDfdtEnergyKokkos(); - virtual void compute(int, int); - void init_style(); - double init_one(int, int); + ~PairDPDfdtEnergyKokkos() override; + void compute(int, int) override; + void init_style() override; + double init_one(int, int) override; KOKKOS_INLINE_FUNCTION void operator()(TagPairDPDfdtEnergyZero, const int&) const; @@ -118,7 +118,7 @@ class PairDPDfdtEnergyKokkos : public PairDPDfdtEnergy { double boltz,ftm2v; double special_lj[4]; - virtual void allocate(); + void allocate() override; Kokkos::DualView k_params; typename Kokkos::DualView::operator()(TagPairEAMAlloyKernelA::value,decltype(dup_rho),decltype(ndup_rho)>::get(dup_rho,ndup_rho); - auto a_rho = v_rho.template access::value>(); + auto v_rho = ScatterViewHelper,decltype(dup_rho),decltype(ndup_rho)>::get(dup_rho,ndup_rho); + auto a_rho = v_rho.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -718,8 +718,8 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -832,11 +832,11 @@ void PairEAMAlloyKokkos::ev_tally(EV_FLOAT &ev, const int &i, const // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (EFLAG) { if (eflag_atom) { diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index 4f10cc8f27..0015a71448 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -58,11 +58,11 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { typedef EV_FLOAT value_type; PairEAMAlloyKokkos(class LAMMPS *); - virtual ~PairEAMAlloyKokkos(); - void compute(int, int); - void init_style(); - void *extract(const char *, int &) { return nullptr; } - void coeff(int, char **); + ~PairEAMAlloyKokkos() override; + void compute(int, int) override; + void init_style() override; + void *extract(const char *, int &) override { return nullptr; } + void coeff(int, char **) override; KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyPackForwardComm, const int&) const; @@ -108,12 +108,12 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { const F_FLOAT &dely, const F_FLOAT &delz) const; int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int, int *) override; + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; protected: typename AT::t_x_array x; @@ -123,18 +123,28 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; - typename ArrayTypes::t_efloat_1d d_eatom; - typename ArrayTypes::t_virial_array d_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_rho; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_rho; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_rho; + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + + NonDupScatterView ndup_rho; + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; DAT::tdual_ffloat_1d k_rho; DAT::tdual_ffloat_1d k_fp; @@ -155,11 +165,11 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - void file2array(); + void file2array() override; void file2array_alloy(); - void array2spline(); + void array2spline() override; void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); - void read_file(char *); + void read_file(char *) override; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 5fbd14d8b3..f9ae3b420c 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -553,8 +553,8 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelA::value,decltype(dup_rho),decltype(ndup_rho)>::get(dup_rho,ndup_rho); - auto a_rho = v_rho.template access::value>(); + auto v_rho = ScatterViewHelper,decltype(dup_rho),decltype(ndup_rho)>::get(dup_rho,ndup_rho); + auto a_rho = v_rho.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -719,8 +719,8 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -833,11 +833,11 @@ void PairEAMFSKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (EFLAG) { if (eflag_atom) { diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 34b924e6e8..1edbbb91dd 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -58,11 +58,11 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { typedef EV_FLOAT value_type; PairEAMFSKokkos(class LAMMPS *); - virtual ~PairEAMFSKokkos(); - void compute(int, int); - void init_style(); - void *extract(const char *, int &) { return nullptr; } - void coeff(int, char **); + ~PairEAMFSKokkos() override; + void compute(int, int) override; + void init_style() override; + void *extract(const char *, int &) override { return nullptr; } + void coeff(int, char **) override; KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSPackForwardComm, const int&) const; @@ -108,12 +108,12 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { const F_FLOAT &dely, const F_FLOAT &delz) const; int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int, int *) override; + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; protected: typename AT::t_x_array x; @@ -123,18 +123,28 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; - typename ArrayTypes::t_efloat_1d d_eatom; - typename ArrayTypes::t_virial_array d_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_rho; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_rho; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_rho; + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + + NonDupScatterView ndup_rho; + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; DAT::tdual_ffloat_1d k_rho; DAT::tdual_ffloat_1d k_fp; @@ -155,11 +165,11 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - void file2array(); + void file2array() override; void file2array_fs(); - void array2spline(); + void array2spline() override; void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); - void read_file(char *); + void read_file(char *) override; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 417efc3f7d..5aa36299d7 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -548,8 +548,8 @@ void PairEAMKokkos::operator()(TagPairEAMKernelA::value,decltype(dup_rho),decltype(ndup_rho)>::get(dup_rho,ndup_rho); - auto a_rho = v_rho.template access::value>(); + auto v_rho = ScatterViewHelper,decltype(dup_rho),decltype(ndup_rho)>::get(dup_rho,ndup_rho); + auto a_rho = v_rho.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -713,8 +713,8 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -827,11 +827,11 @@ void PairEAMKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int & // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (EFLAG) { if (eflag_atom) { diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 02eded90e3..9949c3071c 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -56,10 +56,10 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typedef EV_FLOAT value_type; PairEAMKokkos(class LAMMPS *); - virtual ~PairEAMKokkos(); - void compute(int, int); - void init_style(); - void *extract(const char *, int &) { return nullptr; } + ~PairEAMKokkos() override; + void compute(int, int) override; + void init_style() override; + void *extract(const char *, int &) override { return nullptr; } KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; @@ -105,12 +105,12 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { const F_FLOAT &dely, const F_FLOAT &delz) const; int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int, int *) override; + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; protected: typename AT::t_x_array x; @@ -120,18 +120,27 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; - typename ArrayTypes::t_efloat_1d d_eatom; - typename ArrayTypes::t_virial_array d_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_rho; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_rho; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_rho; + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + NonDupScatterView ndup_rho; + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; DAT::tdual_ffloat_1d k_rho; DAT::tdual_ffloat_1d k_fp; @@ -153,8 +162,8 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_z2r_spline; void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); - void file2array(); - void array2spline(); + void file2array() override; + void array2spline() override; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 0988cb4910..d96e9f3f65 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -17,9 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_exp6_rx_kokkos.h" -#include -#include #include "atom.h" #include "comm.h" #include "force.h" @@ -28,12 +26,14 @@ #include "memory_kokkos.h" #include "error.h" #include "fix.h" -#include #include "atom_masks.h" #include "neigh_request.h" #include "atom_kokkos.h" #include "kokkos.h" +#include +#include +#include #ifdef _OPENMP #include @@ -57,22 +57,6 @@ using namespace MathSpecialKokkos; #define exp6PotentialType (1) #define isExp6PotentialType(_type) ( (_type) == exp6PotentialType ) -namespace /* anonymous */ -{ - -//typedef double TimerType; -//TimerType getTimeStamp(void) { return platform::walltime(); } -//double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; } - -typedef struct timespec TimerType; -TimerType getTimeStamp(void) { TimerType tick; clock_gettime( CLOCK_MONOTONIC, &tick); return tick; } -double getElapsedTime( const TimerType &t0, const TimerType &t1) -{ - return (t1.tv_sec - t0.tv_sec) + 1e-9*(t1.tv_nsec - t0.tv_nsec); -} - -} // end namespace - /* ---------------------------------------------------------------------- */ template @@ -142,8 +126,6 @@ void PairExp6rxKokkos::init_style() template void PairExp6rxKokkos::compute(int eflag_in, int vflag_in) { - //TimerType t_start = getTimeStamp(); - copymode = 1; eflag = eflag_in; @@ -187,7 +169,6 @@ void PairExp6rxKokkos::compute(int eflag_in, int vflag_in) // and ghost atoms. Make the parameter data persistent // and exchange like any other atom property later. - //TimerType t_mix_start = getTimeStamp(); { const int np_total = nlocal + atom->nghost; @@ -260,7 +241,6 @@ void PairExp6rxKokkos::compute(int eflag_in, int vflag_in) error->all(FLERR,"Computed fraction less than -10*DBL_EPSILON"); #endif } - //TimerType t_mix_stop = getTimeStamp(); k_error_flag.template modify(); k_error_flag.template sync(); @@ -377,9 +357,6 @@ void PairExp6rxKokkos::compute(int eflag_in, int vflag_in) } copymode = 0; - - //TimerType t_stop = getTimeStamp(); - //printf("PairExp6rxKokkos::compute %f %f\n", getElapsedTime(t_start, t_stop), getElapsedTime(t_mix_start, t_mix_stop)); } template diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.h b/src/KOKKOS/pair_exp6_rx_kokkos.h index 40917d832e..66e4fb0e57 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.h +++ b/src/KOKKOS/pair_exp6_rx_kokkos.h @@ -87,10 +87,10 @@ class PairExp6rxKokkos : public PairExp6rx { typedef EV_FLOAT value_type; PairExp6rxKokkos(class LAMMPS *); - virtual ~PairExp6rxKokkos(); - void compute(int, int); - void coeff(int, char **); - void init_style(); + ~PairExp6rxKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; KOKKOS_INLINE_FUNCTION void operator()(TagPairExp6rxZeroMixingWeights, const int&) const; @@ -165,7 +165,7 @@ class PairExp6rxKokkos : public PairExp6rx { PairExp6ParamDataTypeKokkos PairExp6ParamData; PairExp6ParamDataTypeKokkosVect PairExp6ParamDataVect; - void allocate(); + void allocate() override; DAT::tdual_int_1d k_mol2param; // mapping from molecule to parameters typename AT::t_int_1d_randomread d_mol2param; @@ -178,8 +178,8 @@ class PairExp6rxKokkos : public PairExp6rx { typename ArrayTypes::tdual_ffloat_2d k_cutsq; typename ArrayTypes::t_ffloat_2d d_cutsq; - void read_file(char *); - void setup(); + void read_file(char *) override; + void setup() override; KOKKOS_INLINE_FUNCTION void getMixingWeights(int, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &, double &) const; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.h b/src/KOKKOS/pair_gran_hooke_history_kokkos.h index 37fb208a70..80693b33ac 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.h +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.h @@ -45,9 +45,9 @@ class PairGranHookeHistoryKokkos : public PairGranHookeHistory { typedef EV_FLOAT value_type; PairGranHookeHistoryKokkos(class LAMMPS *); - virtual ~PairGranHookeHistoryKokkos(); - virtual void compute(int, int); - void init_style(); + ~PairGranHookeHistoryKokkos() override; + void compute(int, int) override; + void init_style() override; KOKKOS_INLINE_FUNCTION void operator()(TagPairGranHookeHistoryReduce, const int ii) const; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index b1d3e0259f..00abc36768 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -1,4 +1,5 @@ // clang-format off + /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -52,10 +53,10 @@ PairHybridKokkos::~PairHybridKokkos() /* ---------------------------------------------------------------------- call each sub-style's compute() or compute_outer() function accumulate sub-style global/peratom energy/virial in hybrid - for global vflag = 1: + for global vflag = VIRIAL_PAIR: each sub-style computes own virial[6] sum sub-style virial[6] to hybrid's virial[6] - for global vflag = 2: + for global vflag = VIRIAL_FDOTR: call sub-style with adjusted vflag to prevent it calling virial_fdotr_compute() hybrid calls virial_fdotr_compute() on final accumulated f @@ -65,24 +66,25 @@ void PairHybridKokkos::compute(int eflag, int vflag) { int i,j,m,n; - // if no_virial_fdotr_compute is set and global component of - // incoming vflag = VIRIAL_FDOTR, then - // reset vflag as if global component were VIRIAL_PAIR + // check if no_virial_fdotr_compute is set and global component of + // incoming vflag = VIRIAL_FDOTR + // if so, reset vflag as if global component were VIRIAL_PAIR // necessary since one or more sub-styles cannot compute virial as F dot r int neighflag = lmp->kokkos->neighflag; if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (no_virial_fdotr_compute && vflag & VIRIAL_FDOTR) vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR); + if (no_virial_fdotr_compute && (vflag & VIRIAL_FDOTR)) + vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR); ev_init(eflag,vflag); // check if global component of incoming vflag = VIRIAL_FDOTR - // if so, reset vflag passed to substyle as if it were VIRIAL_NONE + // if so, reset vflag passed to substyle so VIRIAL_FDOTR is turned off // necessary so substyle will not invoke virial_fdotr_compute() int vflag_substyle; - if (vflag & VIRIAL_FDOTR) vflag_substyle = VIRIAL_NONE | (vflag & ~VIRIAL_FDOTR); + if (vflag & VIRIAL_FDOTR) vflag_substyle = vflag & ~VIRIAL_FDOTR; else vflag_substyle = vflag; double *saved_special = save_special(); @@ -140,6 +142,30 @@ void PairHybridKokkos::compute(int eflag, int vflag) for (j = 0; j < 6; j++) vatom[i][j] += vatom_substyle[i][j]; } + + // substyles may be CENTROID_SAME or CENTROID_AVAIL + + if (cvflag_atom) { + n = atom->nlocal; + if (force->newton_pair) n += atom->nghost; + if (styles[m]->centroidstressflag == CENTROID_AVAIL) { + double **cvatom_substyle = styles[m]->cvatom; + for (i = 0; i < n; i++) + for (j = 0; j < 9; j++) + cvatom[i][j] += cvatom_substyle[i][j]; + } else { + double **vatom_substyle = styles[m]->vatom; + for (i = 0; i < n; i++) { + for (j = 0; j < 6; j++) { + cvatom[i][j] += vatom_substyle[i][j]; + } + for (j = 6; j < 9; j++) { + cvatom[i][j] += vatom_substyle[i][j-3]; + } + } + } + } + } delete [] saved_special; diff --git a/src/KOKKOS/pair_hybrid_kokkos.h b/src/KOKKOS/pair_hybrid_kokkos.h index fbabe4162c..9086f20fcc 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.h +++ b/src/KOKKOS/pair_hybrid_kokkos.h @@ -38,8 +38,8 @@ class PairHybridKokkos : public PairHybrid { typedef LMPDeviceType device_type; PairHybridKokkos(class LAMMPS *); - virtual ~PairHybridKokkos(); - void compute(int, int); + ~PairHybridKokkos() override; + void compute(int, int) override; private: DAT::t_x_array_randomread x; diff --git a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp index c815e2ad72..7b0e79075d 100644 --- a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp @@ -13,12 +13,11 @@ ------------------------------------------------------------------------- */ #include "pair_hybrid_overlay_kokkos.h" -#include -#include + #include "atom.h" -#include "force.h" #include "error.h" +#include using namespace LAMMPS_NS; @@ -43,7 +42,7 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) // 4th arg = pair sub-style index if name used multiple times // allow for "none" as valid sub-style name - int multflag; + int multflag = 0; int m; for (m = 0; m < nstyles; m++) { @@ -52,10 +51,7 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) if (multiple[m]) { multflag = 1; if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); - if (!isdigit(arg[3][0])) - error->all(FLERR,"Incorrect args for pair coefficients"); - int index = utils::inumeric(FLERR,arg[3],false,lmp); - if (index == multiple[m]) break; + if (multiple[m] == utils::inumeric(FLERR,arg[3],false,lmp)) break; else continue; } else break; } @@ -74,9 +70,15 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) arg[2+multflag] = arg[1]; arg[1+multflag] = arg[0]; + // ensure that one_coeff flag is honored + + if (!none && styles[m]->one_coeff) + if ((strcmp(arg[0],"*") != 0) || (strcmp(arg[1],"*") != 0)) + error->all(FLERR,"Incorrect args for pair coefficients"); + // invoke sub-style coeff() starting with 1st remaining arg - if (!none) styles[m]->coeff(narg-1-multflag,&arg[1+multflag]); + if (!none) styles[m]->coeff(narg-1-multflag,arg+1+multflag); // set setflag and which type pairs map to which sub-style // if sub-style is none: set hybrid subflag, wipe out map @@ -104,3 +106,52 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } + + +/* ---------------------------------------------------------------------- + we need to handle Pair::svector special for hybrid/overlay +------------------------------------------------------------------------- */ + +void PairHybridOverlayKokkos::init_svector() +{ + // single_extra = list all sub-style single_extra + // allocate svector + + single_extra = 0; + for (int m = 0; m < nstyles; m++) + single_extra += styles[m]->single_extra; + + if (single_extra) { + delete [] svector; + svector = new double[single_extra]; + } +} + +/* ---------------------------------------------------------------------- + we need to handle Pair::svector special for hybrid/overlay +------------------------------------------------------------------------- */ + +void PairHybridOverlayKokkos::copy_svector(int itype, int jtype) +{ + int n=0; + Pair *this_style = nullptr; + + // fill svector array. + // copy data from active styles and use 0.0 for inactive ones + for (int m = 0; m < nstyles; m++) { + for (int k = 0; k < nmap[itype][jtype]; ++k) { + if (m == map[itype][jtype][k]) { + this_style = styles[m]; + } else { + this_style = nullptr; + } + } + for (int l = 0; l < styles[m]->single_extra; ++l) { + if (this_style) { + svector[n++] = this_style->svector[l]; + } else { + svector[n++] = 0.0; + } + } + } +} diff --git a/src/KOKKOS/pair_hybrid_overlay_kokkos.h b/src/KOKKOS/pair_hybrid_overlay_kokkos.h index fc8efd038b..0b2ff38d4f 100644 --- a/src/KOKKOS/pair_hybrid_overlay_kokkos.h +++ b/src/KOKKOS/pair_hybrid_overlay_kokkos.h @@ -28,8 +28,10 @@ namespace LAMMPS_NS { class PairHybridOverlayKokkos : public PairHybridKokkos { public: PairHybridOverlayKokkos(class LAMMPS *); - virtual ~PairHybridOverlayKokkos() {} - void coeff(int, char **); + void coeff(int, char **) override; + + void init_svector() override; + void copy_svector(int, int) override; }; } diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 65fffd58ad..af959ad63a 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -65,19 +65,22 @@ struct PairComputeFunctor { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; + using KKDeviceType = typename KKDevice::value; + using DUP = typename NeedDup::value; + // The force array is atomic for Half/Thread neighbor style //Kokkos::View::value,Kokkos::MemoryTraits::value> > f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,typename NeedDup::value > dup_f; + KKScatterView dup_f; // The eatom and vatom arrays are atomic for Half/Thread neighbor style //Kokkos::View::value,Kokkos::MemoryTraits::value> > eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,typename NeedDup::value > dup_eatom; + KKScatterView dup_eatom; //Kokkos::View::value,Kokkos::MemoryTraits::value> > vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,typename NeedDup::value > dup_vatom; + KKScatterView dup_vatom; @@ -90,9 +93,9 @@ struct PairComputeFunctor { f = c.f; d_eatom = c.d_eatom; d_vatom = c.d_vatom; - dup_f = Kokkos::Experimental::create_scatter_view::value >(c.f); - dup_eatom = Kokkos::Experimental::create_scatter_view::value >(c.d_eatom); - dup_vatom = Kokkos::Experimental::create_scatter_view::value >(c.d_vatom); + dup_f = Kokkos::Experimental::create_scatter_view(c.f); + dup_eatom = Kokkos::Experimental::create_scatter_view(c.d_eatom); + dup_vatom = Kokkos::Experimental::create_scatter_view(c.d_vatom); }; // Set copymode = 1 so parent allocations aren't destructed by copies of the style @@ -263,7 +266,7 @@ struct PairComputeFunctor { // Loop over neighbors of one atom without coulomb interaction // This function is called in parallel KOKKOS_FUNCTION - void compute_item_team(Kokkos::TeamPolicy<>::member_type team, + void compute_item_team(typename Kokkos::TeamPolicy::member_type team, const NeighListKokkos &list, const NoCoulTag&) const { const int inum = team.league_size(); @@ -319,7 +322,7 @@ struct PairComputeFunctor { // Loop over neighbors of one atom with coulomb interaction // This function is called in parallel KOKKOS_FUNCTION - void compute_item_team(Kokkos::TeamPolicy<>::member_type team, + void compute_item_team(typename Kokkos::TeamPolicy::member_type team, const NeighListKokkos &list, const CoulTag& ) const { const int inum = team.league_size(); @@ -380,7 +383,7 @@ struct PairComputeFunctor { // Loop over neighbors of one atom without coulomb interaction // This function is called in parallel KOKKOS_FUNCTION - EV_FLOAT compute_item_team_ev(Kokkos::TeamPolicy<>::member_type team, + EV_FLOAT compute_item_team_ev(typename Kokkos::TeamPolicy::member_type team, const NeighListKokkos &list, const NoCoulTag&) const { EV_FLOAT ev; @@ -475,7 +478,7 @@ struct PairComputeFunctor { // Loop over neighbors of one atom with coulomb interaction // This function is called in parallel KOKKOS_FUNCTION - EV_FLOAT compute_item_team_ev(Kokkos::TeamPolicy<>::member_type team, + EV_FLOAT compute_item_team_ev(typename Kokkos::TeamPolicy::member_type team, const NeighListKokkos &list, const CoulTag& ) const { EV_FLOAT ev; @@ -684,12 +687,12 @@ struct PairComputeFunctor { } KOKKOS_INLINE_FUNCTION - void operator()(const typename Kokkos::TeamPolicy<>::member_type& team) const { + void operator()(const typename Kokkos::TeamPolicy::member_type& team) const { compute_item_team(team,list,typename DoCoul::type()); } KOKKOS_INLINE_FUNCTION - void operator()(const typename Kokkos::TeamPolicy<>::member_type& team, value_type &energy_virial) const { + void operator()(const typename Kokkos::TeamPolicy::member_type& team, value_type &energy_virial) const { energy_virial += compute_item_team_ev(team,list,typename DoCoul::type()); } }; @@ -711,7 +714,7 @@ EV_FLOAT pair_compute_neighlist (PairStyle* fpair, typename std::enable_if +template int GetTeamSize(FunctorStyle& KOKKOS_GPU_ARG(functor), int KOKKOS_GPU_ARG(inum), int KOKKOS_GPU_ARG(reduce_flag), int team_size, int KOKKOS_GPU_ARG(vector_length)) { @@ -719,9 +722,9 @@ int GetTeamSize(FunctorStyle& KOKKOS_GPU_ARG(functor), int KOKKOS_GPU_ARG(inum), int team_size_max; if (reduce_flag) - team_size_max = Kokkos::TeamPolicy<>(inum,Kokkos::AUTO).team_size_max(functor,Kokkos::ParallelReduceTag()); + team_size_max = Kokkos::TeamPolicy(inum,Kokkos::AUTO).team_size_max(functor,Kokkos::ParallelReduceTag()); else - team_size_max = Kokkos::TeamPolicy<>(inum,Kokkos::AUTO).team_size_max(functor,Kokkos::ParallelForTag()); + team_size_max = Kokkos::TeamPolicy(inum,Kokkos::AUTO).team_size_max(functor,Kokkos::ParallelForTag()); if (team_size*vector_length > team_size_max) team_size = team_size_max/vector_length; @@ -746,14 +749,14 @@ EV_FLOAT pair_compute_neighlist (PairStyle* fpair, typename std::enable_if<(NEIG if (fpair->atom->ntypes > MAX_TYPES_STACKPARAMS) { PairComputeFunctor ff(fpair,list); - atoms_per_team = GetTeamSize(ff, list->inum, (fpair->eflag || fpair->vflag), atoms_per_team, vector_length); - Kokkos::TeamPolicy > policy(list->inum,atoms_per_team,vector_length); + atoms_per_team = GetTeamSize(ff, list->inum, (fpair->eflag || fpair->vflag), atoms_per_team, vector_length); + Kokkos::TeamPolicy > policy(list->inum,atoms_per_team,vector_length); if (fpair->eflag || fpair->vflag) Kokkos::parallel_reduce(policy,ff,ev); else Kokkos::parallel_for(policy,ff); } else { PairComputeFunctor ff(fpair,list); - atoms_per_team = GetTeamSize(ff, list->inum, (fpair->eflag || fpair->vflag), atoms_per_team, vector_length); - Kokkos::TeamPolicy > policy(list->inum,atoms_per_team,vector_length); + atoms_per_team = GetTeamSize(ff, list->inum, (fpair->eflag || fpair->vflag), atoms_per_team, vector_length); + Kokkos::TeamPolicy > policy(list->inum,atoms_per_team,vector_length); if (fpair->eflag || fpair->vflag) Kokkos::parallel_reduce(policy,ff,ev); else Kokkos::parallel_for(policy,ff); } diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h index 6bd1b8e61b..e041afda7f 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h @@ -37,14 +37,14 @@ class PairLJCharmmCoulCharmmImplicitKokkos : public PairLJCharmmCoulCharmmImplic typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCharmmCoulCharmmImplicitKokkos(class LAMMPS *); - ~PairLJCharmmCoulCharmmImplicitKokkos(); + ~PairLJCharmmCoulCharmmImplicitKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; protected: @@ -108,7 +108,7 @@ class PairLJCharmmCoulCharmmImplicitKokkos : public PairLJCharmmCoulCharmmImplic double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h index 4fc65d596e..bc14070a07 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h @@ -37,14 +37,14 @@ class PairLJCharmmCoulCharmmKokkos : public PairLJCharmmCoulCharmm { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCharmmCoulCharmmKokkos(class LAMMPS *); - ~PairLJCharmmCoulCharmmKokkos(); + ~PairLJCharmmCoulCharmmKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; protected: @@ -106,7 +106,7 @@ class PairLJCharmmCoulCharmmKokkos : public PairLJCharmmCoulCharmm { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h index 01d9b73a53..615a1ef9d0 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h @@ -37,13 +37,13 @@ class PairLJCharmmCoulLongKokkos : public PairLJCharmmCoulLong { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCharmmCoulLongKokkos(class LAMMPS *); - ~PairLJCharmmCoulLongKokkos(); + ~PairLJCharmmCoulLongKokkos() override; - void compute(int, int); + void compute(int, int) override; - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; protected: template @@ -104,7 +104,7 @@ class PairLJCharmmCoulLongKokkos : public PairLJCharmmCoulLong { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h index 78d3b0c96e..c1d098b912 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h @@ -37,13 +37,13 @@ class PairLJClass2CoulCutKokkos : public PairLJClass2CoulCut { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJClass2CoulCutKokkos(class LAMMPS *); - ~PairLJClass2CoulCutKokkos(); + ~PairLJClass2CoulCutKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: @@ -103,7 +103,7 @@ class PairLJClass2CoulCutKokkos : public PairLJClass2CoulCut { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h index 7f21ec61dd..c8aa009c55 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h @@ -37,14 +37,14 @@ class PairLJClass2CoulLongKokkos : public PairLJClass2CoulLong { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJClass2CoulLongKokkos(class LAMMPS *); - ~PairLJClass2CoulLongKokkos(); + ~PairLJClass2CoulLongKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; protected: template @@ -106,7 +106,7 @@ class PairLJClass2CoulLongKokkos : public PairLJClass2CoulLong { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_class2_kokkos.h b/src/KOKKOS/pair_lj_class2_kokkos.h index cffaca174e..7e4438d5d6 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_kokkos.h @@ -37,13 +37,13 @@ class PairLJClass2Kokkos : public PairLJClass2 { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJClass2Kokkos(class LAMMPS *); - ~PairLJClass2Kokkos(); + ~PairLJClass2Kokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_lj{ KOKKOS_INLINE_FUNCTION @@ -96,7 +96,7 @@ class PairLJClass2Kokkos : public PairLJClass2 { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h index 9e87daf9bb..68365d8b86 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h @@ -37,13 +37,13 @@ class PairLJCutCoulCutKokkos : public PairLJCutCoulCut { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCutCoulCutKokkos(class LAMMPS *); - ~PairLJCutCoulCutKokkos(); + ~PairLJCutCoulCutKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: template @@ -103,7 +103,7 @@ class PairLJCutCoulCutKokkos : public PairLJCutCoulCut { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h index f93a70e9e3..c967601459 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h @@ -37,13 +37,13 @@ class PairLJCutCoulDebyeKokkos : public PairLJCutCoulDebye { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCutCoulDebyeKokkos(class LAMMPS *); - ~PairLJCutCoulDebyeKokkos(); + ~PairLJCutCoulDebyeKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: template @@ -103,7 +103,7 @@ class PairLJCutCoulDebyeKokkos : public PairLJCutCoulDebye { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h index 96518e6d29..2fd7024e91 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h @@ -37,12 +37,12 @@ class PairLJCutCoulDSFKokkos : public PairLJCutCoulDSF { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCutCoulDSFKokkos(class LAMMPS *); - ~PairLJCutCoulDSFKokkos(); + ~PairLJCutCoulDSFKokkos() override; - void compute(int, int); + void compute(int, int) override; - void init_style(); - double init_one(int, int); + void init_style() override; + double init_one(int, int) override; protected: template @@ -100,7 +100,7 @@ class PairLJCutCoulDSFKokkos : public PairLJCutCoulDSF { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h index dee1e352b0..c3010a108d 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h @@ -37,14 +37,14 @@ class PairLJCutCoulLongKokkos : public PairLJCutCoulLong { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCutCoulLongKokkos(class LAMMPS *); - ~PairLJCutCoulLongKokkos(); + ~PairLJCutCoulLongKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; protected: template @@ -106,7 +106,7 @@ class PairLJCutCoulLongKokkos : public PairLJCutCoulLong { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_kokkos.h index 28b6a33189..96e228011e 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_kokkos.h @@ -37,13 +37,13 @@ class PairLJCutKokkos : public PairLJCut { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJCutKokkos(class LAMMPS *); - ~PairLJCutKokkos(); + ~PairLJCutKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_lj{ KOKKOS_INLINE_FUNCTION @@ -92,7 +92,7 @@ class PairLJCutKokkos : public PairLJCut { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.h b/src/KOKKOS/pair_lj_expand_kokkos.h index 47941a9fa1..422ebd0a16 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.h +++ b/src/KOKKOS/pair_lj_expand_kokkos.h @@ -37,13 +37,13 @@ class PairLJExpandKokkos : public PairLJExpand { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJExpandKokkos(class LAMMPS *); - ~PairLJExpandKokkos(); + ~PairLJExpandKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_lj{ KOKKOS_INLINE_FUNCTION @@ -97,7 +97,7 @@ class PairLJExpandKokkos : public PairLJExpand { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h index 760dfc6d4c..4d474159ed 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h @@ -37,14 +37,14 @@ class PairLJGromacsCoulGromacsKokkos : public PairLJGromacsCoulGromacs { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJGromacsCoulGromacsKokkos(class LAMMPS *); - ~PairLJGromacsCoulGromacsKokkos(); + ~PairLJGromacsCoulGromacsKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_tables(double cut_coul, double *cut_respa); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_tables(double cut_coul, double *cut_respa) override; + void init_style() override; + double init_one(int, int) override; struct params_lj_coul_gromacs{ KOKKOS_INLINE_FUNCTION @@ -113,7 +113,7 @@ class PairLJGromacsCoulGromacsKokkos : public PairLJGromacsCoulGromacs { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index 0764a35fac..4647b14ade 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -61,6 +61,8 @@ PairLJGromacsKokkos::~PairLJGromacsKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->destroy_kokkos(k_cutsq,cutsq); + memoryKK->destroy_kokkos(k_cut_inner,cut_inner); + memoryKK->destroy_kokkos(k_cut_inner_sq,cut_inner_sq); } } diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_kokkos.h index a72bdf4b99..325931ba9c 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.h @@ -37,13 +37,13 @@ class PairLJGromacsKokkos : public PairLJGromacs { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJGromacsKokkos(class LAMMPS *); - ~PairLJGromacsKokkos(); + ~PairLJGromacsKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_lj{ KOKKOS_INLINE_FUNCTION @@ -113,7 +113,7 @@ class PairLJGromacsKokkos : public PairLJGromacs { double special_lj[4]; double qqrd2e; - void allocate(); + void allocate() override; friend struct PairComputeFunctor >; friend struct PairComputeFunctor >; diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.h b/src/KOKKOS/pair_lj_sdk_kokkos.h index 5b8717c387..95fd80326d 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.h +++ b/src/KOKKOS/pair_lj_sdk_kokkos.h @@ -37,13 +37,13 @@ class PairLJSDKKokkos : public PairLJSDK { typedef DeviceType device_type; typedef ArrayTypes AT; PairLJSDKKokkos(class LAMMPS *); - ~PairLJSDKKokkos(); + ~PairLJSDKKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_lj{ KOKKOS_INLINE_FUNCTION @@ -94,7 +94,7 @@ class PairLJSDKKokkos : public PairLJSDK { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_morse_kokkos.h b/src/KOKKOS/pair_morse_kokkos.h index f8f86d6127..32e057250b 100644 --- a/src/KOKKOS/pair_morse_kokkos.h +++ b/src/KOKKOS/pair_morse_kokkos.h @@ -36,13 +36,13 @@ class PairMorseKokkos : public PairMorse { enum {COUL_FLAG=0}; typedef DeviceType device_type; PairMorseKokkos(class LAMMPS *); - virtual ~PairMorseKokkos(); + ~PairMorseKokkos() override; - void compute(int, int); + void compute(int, int) override; - void settings(int, char **); - void init_style(); - double init_one(int, int); + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; struct params_morse{ KOKKOS_INLINE_FUNCTION @@ -92,7 +92,7 @@ class PairMorseKokkos : public PairMorse { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index 1107d39fe9..820e0e4924 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -669,7 +669,7 @@ int PairMultiLucyRXKokkos::pack_forward_comm_kokkos(int n, DAT::tdua d_sendlist = k_sendlist.view(); iswap = iswap_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); return n; } @@ -687,7 +687,7 @@ void PairMultiLucyRXKokkos::unpack_forward_comm_kokkos(int n, int fi { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); atomKK->modified(execution_space,DPDRHO_MASK); // needed for auto_sync } diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.h b/src/KOKKOS/pair_multi_lucy_rx_kokkos.h index 1ce752a2ac..b6d0ebd767 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.h +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.h @@ -52,22 +52,22 @@ class PairMultiLucyRXKokkos : public PairMultiLucyRX, public KokkosBase { typedef EV_FLOAT value_type; PairMultiLucyRXKokkos(class LAMMPS *); - virtual ~PairMultiLucyRXKokkos(); + ~PairMultiLucyRXKokkos() override; - void compute(int, int); - void settings(int, char **); + void compute(int, int) override; + void settings(int, char **) override; template void compute_style(int, int); - void init_style(); + void init_style() override; int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int, int *) override; + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void computeLocalDensity(); KOKKOS_INLINE_FUNCTION @@ -150,7 +150,7 @@ class PairMultiLucyRXKokkos : public PairMultiLucyRX, public KokkosBase { F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; - void allocate(); + void allocate() override; int update_table; void create_kokkos_tables(); diff --git a/src/KOKKOS/pair_reaxff_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp index 8d9c498005..3a19a3825d 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -843,12 +843,12 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) k_resize_bo.modify(); k_resize_bo.sync(); int resize_bo = k_resize_bo.h_view(); - if (resize_bo) maxbo++; + if (resize_bo) maxbo = MAX(maxbo+MAX(1,maxbo*0.1),resize_bo); k_resize_hb.modify(); k_resize_hb.sync(); int resize_hb = k_resize_hb.h_view(); - if (resize_hb) maxhb++; + if (resize_hb) maxhb = MAX(maxhb+MAX(1,maxhb*0.1),resize_hb); resize = resize_bo || resize_hb; if (resize) { @@ -1122,8 +1122,8 @@ void PairReaxFFKokkos::operator()(PairReaxFFComputeLJCoulomb::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); F_FLOAT powr_vdw, powgi_vdw, fn13, dfn13, exp1, exp2, etmp; F_FLOAT evdwl, fvdwl; @@ -1313,8 +1313,8 @@ void PairReaxFFKokkos::operator()(PairReaxFFComputeTabulatedLJCoulom // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -1711,14 +1711,11 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxBuildListsHalf, const int &ii) const { - if (d_resize_bo() || d_resize_hb()) - return; + auto v_dDeltap_self = ScatterViewHelper,decltype(dup_dDeltap_self),decltype(ndup_dDeltap_self)>::get(dup_dDeltap_self,ndup_dDeltap_self); + auto a_dDeltap_self = v_dDeltap_self.template access>(); - auto v_dDeltap_self = ScatterViewHelper::value,decltype(dup_dDeltap_self),decltype(ndup_dDeltap_self)>::get(dup_dDeltap_self,ndup_dDeltap_self); - auto a_dDeltap_self = v_dDeltap_self.template access::value>(); - - auto v_total_bo = ScatterViewHelper::value,decltype(dup_total_bo),decltype(ndup_total_bo)>::get(dup_total_bo,ndup_total_bo); - auto a_total_bo = v_total_bo.template access::value>(); + auto v_total_bo = ScatterViewHelper,decltype(dup_total_bo),decltype(ndup_total_bo)>::get(dup_total_bo,ndup_total_bo); + auto a_total_bo = v_total_bo.template access>(); const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); @@ -1777,12 +1774,10 @@ void PairReaxFFKokkos::operator()(PairReaxBuildListsHalf, const int jj_index = j_index - hb_first_i; - if (jj_index >= maxhb) { - d_resize_hb() = 1; - return; - } - - d_hb_list[j_index] = j; + if (jj_index >= maxhb) + d_resize_hb() = MAX(d_resize_hb(),jj_index+1); + else + d_hb_list[j_index] = j; } else if (j < nlocal && ihb == 2 && jhb == 1) { if (NEIGHFLAG == HALF) { i_index = d_hb_first[j] + d_hb_num[j]; @@ -1793,12 +1788,10 @@ void PairReaxFFKokkos::operator()(PairReaxBuildListsHalf, const int ii_index = i_index - d_hb_first[j]; - if (ii_index >= maxhb) { - d_resize_hb() = 1; - return; - } - - d_hb_list[i_index] = i; + if (ii_index >= maxhb) + d_resize_hb() = MAX(d_resize_hb(),ii_index+1); + else + d_hb_list[i_index] = i; } } @@ -1851,68 +1844,68 @@ void PairReaxFFKokkos::operator()(PairReaxBuildListsHalf, const int ii_index = i_index - d_bo_first[j]; if (jj_index >= maxbo || ii_index >= maxbo) { - d_resize_bo() = 1; - return; + const int max_val = MAX(ii_index+1,jj_index+1); + d_resize_bo() = MAX(d_resize_bo(),max_val); + } else { + d_bo_list[j_index] = j; + d_bo_list[i_index] = i; + + // from BondOrder1 + + d_BO(i,jj_index) = BO; + d_BO_s(i,jj_index) = BO_s; + d_BO_pi(i,jj_index) = BO_pi; + d_BO_pi2(i,jj_index) = BO_pi2; + + d_BO(j,ii_index) = BO; + d_BO_s(j,ii_index) = BO_s; + d_BO_pi(j,ii_index) = BO_pi; + d_BO_pi2(j,ii_index) = BO_pi2; + + F_FLOAT Cln_BOp_s = p_bo2 * C12 / rij / rij; + F_FLOAT Cln_BOp_pi = p_bo4 * C34 / rij / rij; + F_FLOAT Cln_BOp_pi2 = p_bo6 * C56 / rij / rij; + + if (nlocal == 0) + Cln_BOp_s = Cln_BOp_pi = Cln_BOp_pi2 = 0.0; + + for (int d = 0; d < 3; d++) dln_BOp_pi_i[d] = -(BO_pi*Cln_BOp_pi)*delij[d]; + for (int d = 0; d < 3; d++) dln_BOp_pi2_i[d] = -(BO_pi2*Cln_BOp_pi2)*delij[d]; + for (int d = 0; d < 3; d++) dBOp_i[d] = -(BO_s*Cln_BOp_s+BO_pi*Cln_BOp_pi+BO_pi2*Cln_BOp_pi2)*delij[d]; + for (int d = 0; d < 3; d++) a_dDeltap_self(i,d) += dBOp_i[d]; + for (int d = 0; d < 3; d++) a_dDeltap_self(j,d) += -dBOp_i[d]; + + d_dln_BOp_pix(i,jj_index) = dln_BOp_pi_i[0]; + d_dln_BOp_piy(i,jj_index) = dln_BOp_pi_i[1]; + d_dln_BOp_piz(i,jj_index) = dln_BOp_pi_i[2]; + + d_dln_BOp_pix(j,ii_index) = -dln_BOp_pi_i[0]; + d_dln_BOp_piy(j,ii_index) = -dln_BOp_pi_i[1]; + d_dln_BOp_piz(j,ii_index) = -dln_BOp_pi_i[2]; + + d_dln_BOp_pi2x(i,jj_index) = dln_BOp_pi2_i[0]; + d_dln_BOp_pi2y(i,jj_index) = dln_BOp_pi2_i[1]; + d_dln_BOp_pi2z(i,jj_index) = dln_BOp_pi2_i[2]; + + d_dln_BOp_pi2x(j,ii_index) = -dln_BOp_pi2_i[0]; + d_dln_BOp_pi2y(j,ii_index) = -dln_BOp_pi2_i[1]; + d_dln_BOp_pi2z(j,ii_index) = -dln_BOp_pi2_i[2]; + + d_dBOpx(i,jj_index) = dBOp_i[0]; + d_dBOpy(i,jj_index) = dBOp_i[1]; + d_dBOpz(i,jj_index) = dBOp_i[2]; + + d_dBOpx(j,ii_index) = -dBOp_i[0]; + d_dBOpy(j,ii_index) = -dBOp_i[1]; + d_dBOpz(j,ii_index) = -dBOp_i[2]; + + d_BO(i,jj_index) -= bo_cut; + d_BO(j,ii_index) -= bo_cut; + d_BO_s(i,jj_index) -= bo_cut; + d_BO_s(j,ii_index) -= bo_cut; + total_bo += d_BO(i,jj_index); + a_total_bo[j] += d_BO(j,ii_index); } - - d_bo_list[j_index] = j; - d_bo_list[i_index] = i; - - // from BondOrder1 - - d_BO(i,jj_index) = BO; - d_BO_s(i,jj_index) = BO_s; - d_BO_pi(i,jj_index) = BO_pi; - d_BO_pi2(i,jj_index) = BO_pi2; - - d_BO(j,ii_index) = BO; - d_BO_s(j,ii_index) = BO_s; - d_BO_pi(j,ii_index) = BO_pi; - d_BO_pi2(j,ii_index) = BO_pi2; - - F_FLOAT Cln_BOp_s = p_bo2 * C12 / rij / rij; - F_FLOAT Cln_BOp_pi = p_bo4 * C34 / rij / rij; - F_FLOAT Cln_BOp_pi2 = p_bo6 * C56 / rij / rij; - - if (nlocal == 0) - Cln_BOp_s = Cln_BOp_pi = Cln_BOp_pi2 = 0.0; - - for (int d = 0; d < 3; d++) dln_BOp_pi_i[d] = -(BO_pi*Cln_BOp_pi)*delij[d]; - for (int d = 0; d < 3; d++) dln_BOp_pi2_i[d] = -(BO_pi2*Cln_BOp_pi2)*delij[d]; - for (int d = 0; d < 3; d++) dBOp_i[d] = -(BO_s*Cln_BOp_s+BO_pi*Cln_BOp_pi+BO_pi2*Cln_BOp_pi2)*delij[d]; - for (int d = 0; d < 3; d++) a_dDeltap_self(i,d) += dBOp_i[d]; - for (int d = 0; d < 3; d++) a_dDeltap_self(j,d) += -dBOp_i[d]; - - d_dln_BOp_pix(i,jj_index) = dln_BOp_pi_i[0]; - d_dln_BOp_piy(i,jj_index) = dln_BOp_pi_i[1]; - d_dln_BOp_piz(i,jj_index) = dln_BOp_pi_i[2]; - - d_dln_BOp_pix(j,ii_index) = -dln_BOp_pi_i[0]; - d_dln_BOp_piy(j,ii_index) = -dln_BOp_pi_i[1]; - d_dln_BOp_piz(j,ii_index) = -dln_BOp_pi_i[2]; - - d_dln_BOp_pi2x(i,jj_index) = dln_BOp_pi2_i[0]; - d_dln_BOp_pi2y(i,jj_index) = dln_BOp_pi2_i[1]; - d_dln_BOp_pi2z(i,jj_index) = dln_BOp_pi2_i[2]; - - d_dln_BOp_pi2x(j,ii_index) = -dln_BOp_pi2_i[0]; - d_dln_BOp_pi2y(j,ii_index) = -dln_BOp_pi2_i[1]; - d_dln_BOp_pi2z(j,ii_index) = -dln_BOp_pi2_i[2]; - - d_dBOpx(i,jj_index) = dBOp_i[0]; - d_dBOpy(i,jj_index) = dBOp_i[1]; - d_dBOpz(i,jj_index) = dBOp_i[2]; - - d_dBOpx(j,ii_index) = -dBOp_i[0]; - d_dBOpy(j,ii_index) = -dBOp_i[1]; - d_dBOpz(j,ii_index) = -dBOp_i[2]; - - d_BO(i,jj_index) -= bo_cut; - d_BO(j,ii_index) -= bo_cut; - d_BO_s(i,jj_index) -= bo_cut; - d_BO_s(j,ii_index) -= bo_cut; - total_bo += d_BO(i,jj_index); - a_total_bo[j] += d_BO(j,ii_index); } a_total_bo[i] += total_bo; @@ -2142,8 +2135,8 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxFFComputeMulti2, const int &ii, EV_FLOAT_REAX& ev) const { - auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); - auto a_CdDelta = v_CdDelta.template access::value>(); + auto v_CdDelta = ScatterViewHelper,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); + auto a_CdDelta = v_CdDelta.template access>(); const int i = d_ilist[ii]; const int itype = type(i); @@ -2294,12 +2287,12 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxFFComputeAngular, const int &ii, EV_FLOAT_REAX& ev) const { - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbo = d_Cdbo; - auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); - auto a_CdDelta = v_CdDelta.template access::value>(); + auto v_CdDelta = ScatterViewHelper,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); + auto a_CdDelta = v_CdDelta.template access>(); const int i = d_ilist[ii]; const int itype = type(i); @@ -2606,13 +2599,13 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxFFComputeTorsion, const int &ii, EV_FLOAT_REAX& ev) const { - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); - auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); - auto a_CdDelta = v_CdDelta.template access::value>(); + auto v_CdDelta = ScatterViewHelper,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); + auto a_CdDelta = v_CdDelta.template access>(); Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbo = d_Cdbo; - //auto a_Cdbo = dup_Cdbo.template access::value>(); + //auto a_Cdbo = dup_Cdbo.template access>(); // in reaxff_torsion_angles: j = i, k = j, i = k; @@ -2981,8 +2974,8 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxFFComputeHydrogen, const int &ii, EV_FLOAT_REAX& ev) const { - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); int hblist[MAX_BONDS]; F_FLOAT theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; @@ -3131,9 +3124,9 @@ void PairReaxFFKokkos::operator()(PairReaxUpdateBond, con Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbo = d_Cdbo; Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbopi = d_Cdbopi; Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbopi2 = d_Cdbopi2; - //auto a_Cdbo = dup_Cdbo.template access::value>(); - //auto a_Cdbopi = dup_Cdbopi.template access::value>(); - //auto a_Cdbopi2 = dup_Cdbopi2.template access::value>(); + //auto a_Cdbo = dup_Cdbo.template access>(); + //auto a_Cdbopi = dup_Cdbopi.template access>(); + //auto a_Cdbopi2 = dup_Cdbopi2.template access>(); const int i = d_ilist[ii]; const tagint itag = tag(i); @@ -3180,10 +3173,10 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxFFComputeBond1, const int &ii, EV_FLOAT_REAX& ev) const { - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); - auto a_CdDelta = v_CdDelta.template access::value>(); + auto v_CdDelta = ScatterViewHelper,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); + auto a_CdDelta = v_CdDelta.template access>(); F_FLOAT p_be1, p_be2, De_s, De_p, De_pp, pow_BOs_be2, exp_be12, CEbo, ebond; @@ -3298,8 +3291,8 @@ template KOKKOS_INLINE_FUNCTION void PairReaxFFKokkos::operator()(PairReaxFFComputeBond2, const int &ii, EV_FLOAT_REAX& ev) const { - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); F_FLOAT delij[3], delik[3], deljk[3], tmpvec[3]; F_FLOAT dBOp_i[3], dBOp_k[3], dln_BOp_pi[3], dln_BOp_pi2[3]; @@ -3505,11 +3498,11 @@ void PairReaxFFKokkos::ev_tally(EV_FLOAT_REAX &ev, const int &i, con // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; @@ -3564,8 +3557,8 @@ void PairReaxFFKokkos::e_tally(EV_FLOAT_REAX & /*ev*/, const int &i, if (eflag_atom) { - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); const E_FLOAT epairhalf = 0.5 * epair; a_eatom[i] += epairhalf; @@ -3582,8 +3575,8 @@ void PairReaxFFKokkos::e_tally_single(EV_FLOAT_REAX & /*ev*/, const const F_FLOAT &epair) const { // The eatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); a_eatom[i] += epair; } @@ -3616,8 +3609,8 @@ void PairReaxFFKokkos::v_tally(EV_FLOAT_REAX &ev, const int &i, } if (vflag_atom) { - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; @@ -3634,8 +3627,8 @@ void PairReaxFFKokkos::v_tally3(EV_FLOAT_REAX &ev, const int &i, con { // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); F_FLOAT v[6]; @@ -3696,8 +3689,8 @@ void PairReaxFFKokkos::v_tally4(EV_FLOAT_REAX &ev, const int &i, con } if (vflag_atom) { - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); a_vatom(i,0) += 0.25 * v[0]; a_vatom(i,1) += 0.25 * v[1]; a_vatom(i,2) += 0.25 * v[2]; a_vatom(i,3) += 0.25 * v[3]; a_vatom(i,4) += 0.25 * v[4]; a_vatom(i,5) += 0.25 * v[5]; diff --git a/src/KOKKOS/pair_reaxff_kokkos.h b/src/KOKKOS/pair_reaxff_kokkos.h index a88248a717..c74a35fab9 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.h +++ b/src/KOKKOS/pair_reaxff_kokkos.h @@ -387,25 +387,33 @@ class PairReaxFFKokkos : public PairReaxFF { typename AT::t_ffloat_2d_dl d_C1dbopi2, d_C2dbopi2, d_C3dbopi2, d_C4dbopi2; typename AT::t_ffloat_2d_dl d_Cdbo, d_Cdbopi, d_Cdbopi2, d_dDeltap_self; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_total_bo; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_CdDelta; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_dDeltap_self; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_Cdbo; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_Cdbopi; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_Cdbopi2; + using KKDeviceType = typename KKDevice::value; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_total_bo; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_CdDelta; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_dDeltap_self; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_Cdbo; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_Cdbopi; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_Cdbopi2; + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_total_bo; + DupScatterView dup_CdDelta; + DupScatterView dup_eatom; + DupScatterView dup_f; + DupScatterView dup_vatom; + DupScatterView dup_dDeltap_self; + DupScatterView dup_Cdbo; + DupScatterView dup_Cdbopi; + DupScatterView dup_Cdbopi2; + + NonDupScatterView ndup_total_bo; + NonDupScatterView ndup_CdDelta; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_f; + NonDupScatterView ndup_vatom; + NonDupScatterView ndup_dDeltap_self; + NonDupScatterView ndup_Cdbo; + NonDupScatterView ndup_Cdbopi; + NonDupScatterView ndup_Cdbopi2; int need_dup; diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index bd56d87f59..bdad113c18 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -85,6 +85,19 @@ public: using complex = SNAComplex; // Static team/tile sizes for device offload + +#ifdef KOKKOS_ENABLE_HIP + static constexpr int team_size_compute_neigh = 2; + static constexpr int tile_size_compute_ck = 2; + static constexpr int tile_size_pre_ui = 2; + static constexpr int team_size_compute_ui = 2; + static constexpr int tile_size_transform_ui = 2; + static constexpr int tile_size_compute_zi = 2; + static constexpr int tile_size_compute_bi = 2; + static constexpr int tile_size_transform_bi = 2; + static constexpr int tile_size_compute_yi = 2; + static constexpr int team_size_compute_fused_deidrj = 2; +#else static constexpr int team_size_compute_neigh = 4; static constexpr int tile_size_compute_ck = 4; static constexpr int tile_size_pre_ui = 4; @@ -95,6 +108,7 @@ public: static constexpr int tile_size_transform_bi = 4; static constexpr int tile_size_compute_yi = 8; static constexpr int team_size_compute_fused_deidrj = sizeof(real_type) == 4 ? 4 : 2; +#endif // Custom MDRangePolicy, Rank3, to reduce verbosity of kernel launches // This hides the Kokkos::IndexType and Kokkos::Rank<3...> @@ -110,13 +124,13 @@ public: using SnapAoSoATeamPolicy = typename Kokkos::TeamPolicy, TagPairSNAP>; PairSNAPKokkos(class LAMMPS *); - ~PairSNAPKokkos(); + ~PairSNAPKokkos() override; - void coeff(int, char**); - void init_style(); - double init_one(int, int); - void compute(int, int); - double memory_usage(); + void coeff(int, char**) override; + void init_style() override; + double init_one(int, int) override; + void compute(int, int) override; + double memory_usage() override; template void check_team_size_for(int, int&); @@ -235,7 +249,7 @@ protected: int eflag,vflag; - void allocate(); + void allocate() override; //void read_files(char *, char *); /*template inline int equal(double* x,double* y); @@ -283,10 +297,20 @@ inline double dist2(double* x,double* y); typename AT::t_int_1d_randomread type; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_f; + DupScatterView dup_vatom; + + NonDupScatterView ndup_f; + NonDupScatterView ndup_vatom; friend void pair_virial_fdotr_compute(PairSNAPKokkos*); @@ -312,11 +336,11 @@ public: PairSNAPKokkosDevice(class LAMMPS *); - void coeff(int, char**); - void init_style(); - double init_one(int, int); - void compute(int, int); - double memory_usage(); + void coeff(int, char**) override; + void init_style() override; + double init_one(int, int) override; + void compute(int, int) override; + double memory_usage() override; }; diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index e66f490f8a..49c022105d 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -1257,8 +1257,8 @@ KOKKOS_INLINE_FUNCTION void PairSNAPKokkos::operator() (TagPairSNAPComputeForce, const int& ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii + chunk_offset]; @@ -1358,8 +1358,8 @@ void PairSNAPKokkos::v_tally_xyz(EV_FLOAT { // The vatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); const E_FLOAT v0 = delx*fx; const E_FLOAT v1 = dely*fy; diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 59949551f6..dec7d12ebb 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -246,8 +246,8 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); F_FLOAT delr1[3],delr2[3],fj[3],fk[3]; F_FLOAT evdwl = 0.0; @@ -339,7 +339,7 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf if (rsq2 >= d_params[ikparam].cutsq) continue; - threebody(d_params[ijparam],d_params[ikparam],d_params[ijkparam], + threebody_kk(d_params[ijparam],d_params[ikparam],d_params[ijkparam], rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl); fxtmpi -= fj[0] + fk[0]; @@ -457,7 +457,7 @@ void PairSWKokkos::operator()(TagPairSWComputeFullA= d_params[ikparam].cutsq) continue; - threebody(d_params[ijparam],d_params[ikparam],d_params[ijkparam], + threebody_kk(d_params[ijparam],d_params[ikparam],d_params[ijkparam], rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl); fxtmpi -= fj[0] + fk[0]; @@ -542,7 +542,7 @@ void PairSWKokkos::operator()(TagPairSWComputeFullB= d_params[jkparam].cutsq) continue; if (vflag_atom) - threebody(d_params[jiparam],d_params[jkparam],d_params[jikparam], + threebody_kk(d_params[jiparam],d_params[jkparam],d_params[jikparam], rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl); else threebodyj(d_params[jiparam],d_params[jkparam],d_params[jikparam], @@ -686,7 +686,7 @@ void PairSWKokkos::twobody(const Param& param, const F_FLOAT& rsq, F template KOKKOS_INLINE_FUNCTION -void PairSWKokkos::threebody(const Param& paramij, const Param& paramik, const Param& paramijk, +void PairSWKokkos::threebody_kk(const Param& paramij, const Param& paramik, const Param& paramijk, const F_FLOAT& rsq1, const F_FLOAT& rsq2, F_FLOAT *delr1, F_FLOAT *delr2, F_FLOAT *fj, F_FLOAT *fk, const int& eflag, F_FLOAT& eng) const @@ -800,11 +800,11 @@ void PairSWKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int &j // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; @@ -878,11 +878,11 @@ void PairSWKokkos::ev_tally3(EV_FLOAT &ev, const int &i, const int & // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (eflag_atom) { epairthird = THIRD * (evdwl + ecoul); diff --git a/src/KOKKOS/pair_sw_kokkos.h b/src/KOKKOS/pair_sw_kokkos.h index 2192740674..1259ddf71e 100644 --- a/src/KOKKOS/pair_sw_kokkos.h +++ b/src/KOKKOS/pair_sw_kokkos.h @@ -49,10 +49,10 @@ class PairSWKokkos : public PairSW { typedef EV_FLOAT value_type; PairSWKokkos(class LAMMPS *); - virtual ~PairSWKokkos(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void init_style(); + ~PairSWKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION @@ -112,14 +112,14 @@ class PairSWKokkos : public PairSW { t_param_1d d_params; - virtual void setup_params(); + void setup_params() override; KOKKOS_INLINE_FUNCTION void twobody(const Param&, const F_FLOAT&, F_FLOAT&, const int&, F_FLOAT&) const; KOKKOS_INLINE_FUNCTION - void threebody(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *, - F_FLOAT *, F_FLOAT *, const int&, F_FLOAT&) const; + void threebody_kk(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *, + F_FLOAT *, F_FLOAT *, const int&, F_FLOAT&) const; KOKKOS_INLINE_FUNCTION void threebodyj(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *, @@ -136,12 +136,22 @@ class PairSWKokkos : public PairSW { typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; typename AT::t_int_1d_randomread d_type2frho; typename AT::t_int_2d_randomread d_type2rhor; diff --git a/src/KOKKOS/pair_table_kokkos.h b/src/KOKKOS/pair_table_kokkos.h index accc763cc5..6574ce807f 100644 --- a/src/KOKKOS/pair_table_kokkos.h +++ b/src/KOKKOS/pair_table_kokkos.h @@ -48,17 +48,17 @@ class PairTableKokkos : public PairTable { typedef ArrayTypes AT; PairTableKokkos(class LAMMPS *); - virtual ~PairTableKokkos(); + ~PairTableKokkos() override; - virtual void compute(int, int); + void compute(int, int) override; template void compute_style(int, int); - void settings(int, char **); - double init_one(int, int); + void settings(int, char **) override; + double init_one(int, int) override; - void init_style(); + void init_style() override; protected: @@ -103,8 +103,8 @@ class PairTableKokkos : public PairTable { typename AT::t_ffloat_2d d_cutsq; - virtual void allocate(); - void compute_table(Table *); + void allocate() override; + void compute_table(Table *) override; typename AT::t_x_array_randomread x; typename AT::t_x_array_const c_x; diff --git a/src/KOKKOS/pair_table_rx_kokkos.h b/src/KOKKOS/pair_table_rx_kokkos.h index e8203445ca..16915eaae0 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.h +++ b/src/KOKKOS/pair_table_rx_kokkos.h @@ -35,19 +35,19 @@ class PairTableRXKokkos : public PairTable { typedef DeviceType device_type; PairTableRXKokkos(class LAMMPS *); - virtual ~PairTableRXKokkos(); + ~PairTableRXKokkos() override; - virtual void compute(int, int); + void compute(int, int) override; template void compute_style(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; - void init_style(); + void init_style() override; struct TableDeviceConst { typename ArrayTypes::t_ffloat_2d cutsq; @@ -81,8 +81,8 @@ class PairTableRXKokkos : public PairTable { typename ArrayTypes::t_ffloat_2d d_cutsq; - virtual void allocate(); - void compute_table(Table *); + void allocate() override; + void compute_table(Table *) override; typename ArrayTypes::t_x_array_randomread x; typename ArrayTypes::t_f_array f; diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 2aa58f2415..d98b690c9c 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -171,7 +171,7 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom"); d_eatom = k_eatom.view(); } - if (vflag_atom) { + if (vflag_either) { memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->create_kokkos(k_vatom,vatom,maxvatom,"pair:vatom"); d_vatom = k_vatom.view(); @@ -271,7 +271,7 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) k_eatom.template sync(); } - if (vflag_atom) { + if (vflag_either) { if (need_dup) Kokkos::Experimental::contribute(d_vatom, dup_vatom); k_vatom.template modify(); @@ -328,8 +328,8 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; if (i >= nlocal) return; @@ -480,7 +480,7 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf::operator()(TagPairTersoffComputeFullA::operator()(TagPairTersoffComputeFullB::ev_tally(EV_FLOAT &ev, const int &i, const i // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; @@ -1211,17 +1211,17 @@ void PairTersoffKokkos::v_tally3(EV_FLOAT &ev, const int &i, const i { // The vatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); F_FLOAT v[6]; - v[0] = THIRD * (drij[0]*fj[0] + drik[0]*fk[0]); - v[1] = THIRD * (drij[1]*fj[1] + drik[1]*fk[1]); - v[2] = THIRD * (drij[2]*fj[2] + drik[2]*fk[2]); - v[3] = THIRD * (drij[0]*fj[1] + drik[0]*fk[1]); - v[4] = THIRD * (drij[0]*fj[2] + drik[0]*fk[2]); - v[5] = THIRD * (drij[1]*fj[2] + drik[1]*fk[2]); + v[0] = (drij[0]*fj[0] + drik[0]*fk[0]); + v[1] = (drij[1]*fj[1] + drik[1]*fk[1]); + v[2] = (drij[2]*fj[2] + drik[2]*fk[2]); + v[3] = (drij[0]*fj[1] + drik[0]*fk[1]); + v[4] = (drij[0]*fj[2] + drik[0]*fk[2]); + v[5] = (drij[1]*fj[2] + drik[1]*fk[2]); if (vflag_global) { ev.v[0] += v[0]; @@ -1233,6 +1233,13 @@ void PairTersoffKokkos::v_tally3(EV_FLOAT &ev, const int &i, const i } if (vflag_atom) { + v[0] *= THIRD; + v[1] *= THIRD; + v[2] *= THIRD; + v[3] *= THIRD; + v[4] *= THIRD; + v[5] *= THIRD; + a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; if (NEIGHFLAG != FULL) { diff --git a/src/KOKKOS/pair_tersoff_kokkos.h b/src/KOKKOS/pair_tersoff_kokkos.h index e61791df39..2df74721d0 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.h +++ b/src/KOKKOS/pair_tersoff_kokkos.h @@ -50,9 +50,9 @@ class PairTersoffKokkos : public PairTersoff { typedef EV_FLOAT value_type; PairTersoffKokkos(class LAMMPS *); - virtual ~PairTersoffKokkos(); - virtual void compute(int, int); - void init_style(); + ~PairTersoffKokkos() override; + void compute(int, int) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION @@ -177,8 +177,8 @@ class PairTersoffKokkos : public PairTersoff { void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; - void allocate(); - void setup_params(); + void allocate() override; + void setup_params() override; protected: typedef Kokkos::DualView tdual_int_3d; @@ -196,16 +196,26 @@ class PairTersoffKokkos : public PairTersoff { DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; - typename ArrayTypes::t_efloat_1d d_eatom; - typename ArrayTypes::t_virial_array d_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; typedef Kokkos::DualView tdual_ffloat_2d_n7; typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread; diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 82d0fa4628..388e216a41 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -171,7 +171,7 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom"); d_eatom = k_eatom.view(); } - if (vflag_atom) { + if (vflag_either) { memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->create_kokkos(k_vatom,vatom,maxvatom,"pair:vatom"); d_vatom = k_vatom.view(); @@ -271,7 +271,7 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) k_eatom.template sync(); } - if (vflag_atom) { + if (vflag_either) { if (need_dup) Kokkos::Experimental::contribute(d_vatom, dup_vatom); k_vatom.template modify(); @@ -328,8 +328,8 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; if (i >= nlocal) return; @@ -480,7 +480,7 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf::operator()(TagPairTersoffMODComputeFullA< f_y += fi[1]; f_z += fi[2]; - if (vflag_atom) { + if (vflag_either) { F_FLOAT delrij[3], delrik[3]; delrij[0] = -delx1; delrij[1] = -dely1; delrij[2] = -delz1; delrik[0] = -delx2; delrik[1] = -dely2; delrik[2] = -delz2; @@ -764,7 +764,7 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeFullB< f_y += fj[1]; f_z += fj[2]; - if (vflag_atom) { + if (vflag_either) { F_FLOAT delrji[3], delrjk[3]; delrji[0] = -delx1; delrji[1] = -dely1; delrji[2] = -delz1; delrjk[0] = -delx2; delrjk[1] = -dely2; delrjk[2] = -delz2; @@ -1146,11 +1146,11 @@ void PairTersoffMODKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; @@ -1214,17 +1214,17 @@ void PairTersoffMODKokkos::v_tally3(EV_FLOAT &ev, const int &i, cons { // The vatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); F_FLOAT v[6]; - v[0] = THIRD * (drij[0]*fj[0] + drik[0]*fk[0]); - v[1] = THIRD * (drij[1]*fj[1] + drik[1]*fk[1]); - v[2] = THIRD * (drij[2]*fj[2] + drik[2]*fk[2]); - v[3] = THIRD * (drij[0]*fj[1] + drik[0]*fk[1]); - v[4] = THIRD * (drij[0]*fj[2] + drik[0]*fk[2]); - v[5] = THIRD * (drij[1]*fj[2] + drik[1]*fk[2]); + v[0] = (drij[0]*fj[0] + drik[0]*fk[0]); + v[1] = (drij[1]*fj[1] + drik[1]*fk[1]); + v[2] = (drij[2]*fj[2] + drik[2]*fk[2]); + v[3] = (drij[0]*fj[1] + drik[0]*fk[1]); + v[4] = (drij[0]*fj[2] + drik[0]*fk[2]); + v[5] = (drij[1]*fj[2] + drik[1]*fk[2]); if (vflag_global) { ev.v[0] += v[0]; @@ -1236,6 +1236,13 @@ void PairTersoffMODKokkos::v_tally3(EV_FLOAT &ev, const int &i, cons } if (vflag_atom) { + v[0] *= THIRD; + v[1] *= THIRD; + v[2] *= THIRD; + v[3] *= THIRD; + v[4] *= THIRD; + v[5] *= THIRD; + a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; if (NEIGHFLAG != FULL) { diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.h b/src/KOKKOS/pair_tersoff_mod_kokkos.h index ee589c62cd..dc5204bdbe 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.h +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.h @@ -50,9 +50,9 @@ class PairTersoffMODKokkos : public PairTersoffMOD { typedef EV_FLOAT value_type; PairTersoffMODKokkos(class LAMMPS *); - virtual ~PairTersoffMODKokkos(); - virtual void compute(int, int); - void init_style(); + ~PairTersoffMODKokkos() override; + void compute(int, int) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION @@ -177,10 +177,12 @@ class PairTersoffMODKokkos : public PairTersoffMOD { void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; - void allocate(); - void setup_params(); + void allocate() override; + void setup_params() override; protected: + using KKDeviceType = typename KKDevice::value; + typedef Kokkos::DualView tdual_int_3d; Kokkos::DualView k_params; typename Kokkos::DualView::t_efloat_1d d_eatom; - typename ArrayTypes::t_virial_array d_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; typedef Kokkos::DualView tdual_ffloat_2d_n7; typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread; diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index f2e6752f07..d718e2a785 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -31,6 +31,7 @@ #include "memory_kokkos.h" #include "error.h" #include "atom_masks.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -44,6 +45,7 @@ template PairTersoffZBLKokkos::PairTersoffZBLKokkos(LAMMPS *lmp) : PairTersoffZBL(lmp) { respa_enable = 0; + suffix_flag |= Suffix::KOKKOS; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -185,7 +187,7 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom"); d_eatom = k_eatom.view(); } - if (vflag_atom) { + if (vflag_either) { memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->create_kokkos(k_vatom,vatom,maxvatom,"pair:vatom"); d_vatom = k_vatom.view(); @@ -285,7 +287,7 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) k_eatom.template sync(); } - if (vflag_atom) { + if (vflag_either) { if (need_dup) Kokkos::Experimental::contribute(d_vatom, dup_vatom); k_vatom.template modify(); @@ -342,8 +344,8 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); const int i = d_ilist[ii]; if (i >= nlocal) return; @@ -524,7 +526,7 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf::operator()(TagPairTersoffZBLComputeFullA< f_y += fi[1]; f_z += fi[2]; - if (vflag_atom) { + if (vflag_either) { F_FLOAT delrij[3], delrik[3]; delrij[0] = -delx1; delrij[1] = -dely1; delrij[2] = -delz1; delrik[0] = -delx2; delrik[1] = -dely2; delrik[2] = -delz2; @@ -838,7 +840,7 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeFullB< f_y += fj[1]; f_z += fj[2]; - if (vflag_atom) { + if (vflag_either) { F_FLOAT delrji[3], delrjk[3]; delrji[0] = -delx1; delrji[1] = -dely1; delrji[2] = -delz1; delrjk[0] = -delx2; delrjk[1] = -dely2; delrjk[2] = -delz2; @@ -1240,11 +1242,11 @@ void PairTersoffZBLKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_eatom = ScatterViewHelper::value,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); - auto a_eatom = v_eatom.template access::value>(); + auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); + auto a_eatom = v_eatom.template access>(); - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; @@ -1308,17 +1310,17 @@ void PairTersoffZBLKokkos::v_tally3(EV_FLOAT &ev, const int &i, cons { // The vatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_vatom = ScatterViewHelper::value,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); - auto a_vatom = v_vatom.template access::value>(); + auto v_vatom = ScatterViewHelper,decltype(dup_vatom),decltype(ndup_vatom)>::get(dup_vatom,ndup_vatom); + auto a_vatom = v_vatom.template access>(); F_FLOAT v[6]; - v[0] = THIRD * (drij[0]*fj[0] + drik[0]*fk[0]); - v[1] = THIRD * (drij[1]*fj[1] + drik[1]*fk[1]); - v[2] = THIRD * (drij[2]*fj[2] + drik[2]*fk[2]); - v[3] = THIRD * (drij[0]*fj[1] + drik[0]*fk[1]); - v[4] = THIRD * (drij[0]*fj[2] + drik[0]*fk[2]); - v[5] = THIRD * (drij[1]*fj[2] + drik[1]*fk[2]); + v[0] = (drij[0]*fj[0] + drik[0]*fk[0]); + v[1] = (drij[1]*fj[1] + drik[1]*fk[1]); + v[2] = (drij[2]*fj[2] + drik[2]*fk[2]); + v[3] = (drij[0]*fj[1] + drik[0]*fk[1]); + v[4] = (drij[0]*fj[2] + drik[0]*fk[2]); + v[5] = (drij[1]*fj[2] + drik[1]*fk[2]); if (vflag_global) { ev.v[0] += v[0]; @@ -1330,6 +1332,13 @@ void PairTersoffZBLKokkos::v_tally3(EV_FLOAT &ev, const int &i, cons } if (vflag_atom) { + v[0] *= THIRD; + v[1] *= THIRD; + v[2] *= THIRD; + v[3] *= THIRD; + v[4] *= THIRD; + v[5] *= THIRD; + a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; if (NEIGHFLAG != FULL) { diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.h b/src/KOKKOS/pair_tersoff_zbl_kokkos.h index 718932026d..57402fe683 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.h +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.h @@ -50,9 +50,9 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { typedef EV_FLOAT value_type; PairTersoffZBLKokkos(class LAMMPS *); - virtual ~PairTersoffZBLKokkos(); - virtual void compute(int, int); - void init_style(); + ~PairTersoffZBLKokkos() override; + void compute(int, int) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION @@ -176,8 +176,8 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; - void allocate(); - void setup_params(); + void allocate() override; + void setup_params() override; KOKKOS_INLINE_FUNCTION double fermi_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; @@ -201,24 +201,34 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; - typename ArrayTypes::t_efloat_1d d_eatom; - typename ArrayTypes::t_virial_array d_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; int need_dup; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_vatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_f; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_eatom; - Kokkos::Experimental::ScatterView::value,typename Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_vatom; + + using KKDeviceType = typename KKDevice::value; + + template + using DupScatterView = KKScatterView; + + template + using NonDupScatterView = KKScatterView; + + DupScatterView dup_f; + DupScatterView dup_eatom; + DupScatterView dup_vatom; + + NonDupScatterView ndup_f; + NonDupScatterView ndup_eatom; + NonDupScatterView ndup_vatom; typedef Kokkos::DualView tdual_ffloat_2d_n7; typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread; typedef typename tdual_ffloat_2d_n7::t_host t_host_ffloat_2d_n7; - typename ArrayTypes::t_neighbors_2d d_neighbors; - typename ArrayTypes::t_int_1d_randomread d_ilist; - typename ArrayTypes::t_int_1d_randomread d_numneigh; + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d_randomread d_ilist; + typename AT::t_int_1d_randomread d_numneigh; //NeighListKokkos k_list; int neighflag,newton_pair; diff --git a/src/KOKKOS/pair_vashishta_kokkos.h b/src/KOKKOS/pair_vashishta_kokkos.h index e7be57a3b6..e9f9a426c7 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.h +++ b/src/KOKKOS/pair_vashishta_kokkos.h @@ -49,10 +49,10 @@ class PairVashishtaKokkos : public PairVashishta { typedef EV_FLOAT value_type; PairVashishtaKokkos(class LAMMPS *); - virtual ~PairVashishtaKokkos(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void init_style(); + ~PairVashishtaKokkos() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; template KOKKOS_INLINE_FUNCTION @@ -112,7 +112,7 @@ class PairVashishtaKokkos : public PairVashishta { t_param_1d d_params; - virtual void setup_params(); + void setup_params() override; KOKKOS_INLINE_FUNCTION void twobody(const Param&, const F_FLOAT&, F_FLOAT&, const int&, F_FLOAT&) const; diff --git a/src/KOKKOS/pair_yukawa_kokkos.h b/src/KOKKOS/pair_yukawa_kokkos.h index 454c9a5eb7..1671a06f14 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.h +++ b/src/KOKKOS/pair_yukawa_kokkos.h @@ -38,11 +38,11 @@ class PairYukawaKokkos : public PairYukawa { typedef ArrayTypes AT; PairYukawaKokkos(class LAMMPS *); - virtual ~PairYukawaKokkos(); + ~PairYukawaKokkos() override; - void compute(int, int); - void init_style(); - double init_one(int,int); + void compute(int, int) override; + void init_style() override; + double init_one(int,int) override; struct params_yukawa { KOKKOS_INLINE_FUNCTION @@ -95,7 +95,7 @@ class PairYukawaKokkos : public PairYukawa { int neighflag; int nlocal,nall,eflag,vflag; - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pair_zbl_kokkos.h b/src/KOKKOS/pair_zbl_kokkos.h index ac8f150b7c..507df93fba 100644 --- a/src/KOKKOS/pair_zbl_kokkos.h +++ b/src/KOKKOS/pair_zbl_kokkos.h @@ -38,10 +38,10 @@ class PairZBLKokkos : public PairZBL { typedef ArrayTypes AT; PairZBLKokkos(class LAMMPS *); - virtual ~PairZBLKokkos(); - void compute(int, int); - void init_style(); - F_FLOAT init_one(int, int); + ~PairZBLKokkos() override; + void compute(int, int) override; + void init_style() override; + F_FLOAT init_one(int, int) override; private: DAT::tdual_ffloat_1d k_z; @@ -87,7 +87,7 @@ class PairZBLKokkos : public PairZBL { F_FLOAT compute_ecoul(const F_FLOAT& /*rsq*/, const int& /*i*/, const int& /*j*/, const int& /*itype*/, const int& /*jtype*/) const { return 0; } - void allocate(); + void allocate() override; friend struct PairComputeFunctor; friend struct PairComputeFunctor; diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index da18bba001..a5073129e8 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -2711,10 +2711,9 @@ void PPPMKokkos::compute_rho_coeff() { int j,k,l,m; FFT_SCALAR s; - - //FFT_SCALAR **a; - //memory->create2d_offset(a,order,-order,order,"pppm:a"); - FFT_SCALAR a[order][2*order+1]; + FFT_SCALAR **a = new FFT_SCALAR *[order]; + for (int i = 0; i < order; ++i) + a[i] = new FFT_SCALAR[2*order+1]; for (k = 0; k <= 2*order; k++) for (l = 0; l < order; l++) @@ -2744,7 +2743,9 @@ void PPPMKokkos::compute_rho_coeff() h_rho_coeff(l,m-(1-order)/2) = a[l][k+order]; m++; } - //memory->destroy2d_offset(a,-order); + for (int i = 0; i < order; ++i) + delete[] a[i]; + delete[] a; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pppm_kokkos.h b/src/KOKKOS/pppm_kokkos.h index 25f74f1b7d..1b9ec05535 100644 --- a/src/KOKKOS/pppm_kokkos.h +++ b/src/KOKKOS/pppm_kokkos.h @@ -121,15 +121,15 @@ class PPPMKokkos : public PPPM, public KokkosBaseFFT { typedef FFTArrayTypes FFT_AT; PPPMKokkos(class LAMMPS *); - virtual ~PPPMKokkos(); - virtual void init(); - virtual void setup(); - void setup_grid(); - virtual void settings(int, char **); - virtual void compute(int, int); - virtual int timing_1d(int, double &); - virtual int timing_3d(int, double &); - virtual double memory_usage(); + ~PPPMKokkos() override; + void init() override; + void setup() override; + void setup_grid() override; + void settings(int, char **) override; + void compute(int, int) override; + int timing_1d(int, double &) override; + int timing_3d(int, double &) override; + double memory_usage() override; KOKKOS_INLINE_FUNCTION void operator()(TagPPPM_setup1, const int&) const; @@ -398,49 +398,49 @@ class PPPMKokkos : public PPPM, public KokkosBaseFFT { //double *boxlo; double boxlo[3]; - void set_grid_global(); + void set_grid_global() override; void set_grid_local(); void adjust_gewald(); - double newton_raphson_f(); + double newton_raphson_f() override; double derivf(); double final_accuracy(); - virtual void allocate(); - virtual void allocate_peratom(); - virtual void deallocate(); - virtual void deallocate_peratom(); + void allocate() override; + void allocate_peratom() override; + void deallocate() override; + void deallocate_peratom() override; int factorable(int); double compute_df_kspace(); double estimate_ik_error(double, double, bigint); - virtual void compute_gf_denom(); - virtual void compute_gf_ik(); + void compute_gf_denom() override; + void compute_gf_ik() override; - virtual void particle_map(); - virtual void make_rho(); - virtual void brick2fft(); + void particle_map() override; + void make_rho() override; + void brick2fft() override; - virtual void poisson(); - virtual void poisson_ik(); + void poisson() override; + void poisson_ik() override; - virtual void fieldforce(); - virtual void fieldforce_ik(); + void fieldforce() override; + void fieldforce_ik() override; - virtual void poisson_peratom(); - virtual void fieldforce_peratom(); + void poisson_peratom() override; + void fieldforce_peratom() override; void procs2grid2d(int,int,int,int *, int*); KOKKOS_INLINE_FUNCTION void compute_rho1d(const int i, const FFT_SCALAR &, const FFT_SCALAR &, const FFT_SCALAR &) const; void compute_rho_coeff(); - void slabcorr(); + void slabcorr() override; // grid communication - void pack_forward_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, DAT::tdual_int_2d &, int); - void unpack_forward_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, int, DAT::tdual_int_2d &, int); - void pack_reverse_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, DAT::tdual_int_2d &, int); - void unpack_reverse_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, int, DAT::tdual_int_2d &, int); + void pack_forward_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, DAT::tdual_int_2d &, int) override; + void unpack_forward_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, int, DAT::tdual_int_2d &, int) override; + void pack_reverse_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, DAT::tdual_int_2d &, int) override; + void unpack_reverse_grid_kokkos(int, FFT_DAT::tdual_FFT_SCALAR_1d &, int, int, DAT::tdual_int_2d &, int) override; // triclinic diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.h b/src/KOKKOS/rand_pool_wrap_kokkos.h index 9a9d681c79..d2a37ed1bd 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.h +++ b/src/KOKKOS/rand_pool_wrap_kokkos.h @@ -44,7 +44,7 @@ struct RandWrap { class RandPoolWrap : protected Pointers { public: RandPoolWrap(int, class LAMMPS *); - ~RandPoolWrap(); + ~RandPoolWrap() override; void destroy(); void init(RanMars*, int); diff --git a/src/KOKKOS/region_block_kokkos.h b/src/KOKKOS/region_block_kokkos.h index dc57a09bda..720a266524 100644 --- a/src/KOKKOS/region_block_kokkos.h +++ b/src/KOKKOS/region_block_kokkos.h @@ -40,8 +40,8 @@ class RegBlockKokkos : public RegBlock, public KokkosBase { typedef ArrayTypes AT; RegBlockKokkos(class LAMMPS *, int, char **); - ~RegBlockKokkos(); - void match_all_kokkos(int, DAT::tdual_int_1d); + ~RegBlockKokkos() override; + void match_all_kokkos(int, DAT::tdual_int_1d) override; KOKKOS_INLINE_FUNCTION void operator()(TagRegBlockMatchAll, const int&) const; diff --git a/src/KOKKOS/remap_kokkos.h b/src/KOKKOS/remap_kokkos.h index 316c96e359..eff85f9ebd 100644 --- a/src/KOKKOS/remap_kokkos.h +++ b/src/KOKKOS/remap_kokkos.h @@ -65,7 +65,7 @@ class RemapKokkos : protected Pointers { RemapKokkos(class LAMMPS *); RemapKokkos(class LAMMPS *, MPI_Comm,int,int,int,int,int,int, int,int,int,int,int,int,int,int,int,int,int,int); - ~RemapKokkos(); + ~RemapKokkos() override; void perform(typename FFT_AT::t_FFT_SCALAR_1d, typename FFT_AT::t_FFT_SCALAR_1d, typename FFT_AT::t_FFT_SCALAR_1d); struct remap_plan_3d_kokkos *plan; diff --git a/src/KOKKOS/sna_kokkos.h b/src/KOKKOS/sna_kokkos.h index 0bcb07285c..c33f5e486e 100644 --- a/src/KOKKOS/sna_kokkos.h +++ b/src/KOKKOS/sna_kokkos.h @@ -69,9 +69,11 @@ public: using complex = SNAComplex; static constexpr int vector_length = vector_length_; + using KKDeviceType = typename KKDevice::value; + typedef Kokkos::View t_sna_1i; typedef Kokkos::View t_sna_1d; - typedef Kokkos::View::value, Kokkos::MemoryTraits > t_sna_1d_atomic; + typedef Kokkos::View> t_sna_1d_atomic; typedef Kokkos::View t_sna_2i; typedef Kokkos::View t_sna_2d; typedef Kokkos::View t_sna_2d_ll; @@ -83,7 +85,7 @@ public: typedef Kokkos::View t_sna_5d; typedef Kokkos::View t_sna_1c; - typedef Kokkos::View::value, Kokkos::MemoryTraits > t_sna_1c_atomic; + typedef Kokkos::View> t_sna_1c_atomic; typedef Kokkos::View t_sna_2c; typedef Kokkos::View t_sna_2c_ll; typedef Kokkos::View t_sna_2c_lr; diff --git a/src/KOKKOS/third_order_kokkos.cpp b/src/KOKKOS/third_order_kokkos.cpp new file mode 100644 index 0000000000..2aeb9152a1 --- /dev/null +++ b/src/KOKKOS/third_order_kokkos.cpp @@ -0,0 +1,353 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Charlie Sievers (UC Davis), charliesievers at cox.net +------------------------------------------------------------------------- */ + +#include "third_order_kokkos.h" + +#include "angle.h" +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "bond.h" +#include "comm.h" +#include "compute.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "force.h" +#include "group.h" +#include "improper.h" +#include "kokkos.h" +#include "kspace.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "pair.h" +#include "timer.h" +#include "update.h" + +#include +#include +#include + +using namespace LAMMPS_NS; +enum{REGULAR,ESKM}; + +template +struct ForceAdder { + ViewA a; + ViewB b; + ForceAdder(const ViewA& a_, const ViewB& b_):a(a_),b(b_) {} + KOKKOS_INLINE_FUNCTION + void operator() (const int& i) const { + a(i,0) += b(i,0); + a(i,1) += b(i,1); + a(i,2) += b(i,2); + } +}; + +/* ---------------------------------------------------------------------- */ + +template +struct Zero { + View v; + Zero(const View &v_):v(v_) {} + KOKKOS_INLINE_FUNCTION + void operator()(const int &i) const { + v(i,0) = 0; + v(i,1) = 0; + v(i,2) = 0; + } +}; + +/* ---------------------------------------------------------------------- */ + +ThirdOrderKokkos::ThirdOrderKokkos(LAMMPS *lmp) : ThirdOrder(lmp) +{ + atomKK = (AtomKokkos *) atom; +} + +/* ---------------------------------------------------------------------- */ + +ThirdOrderKokkos::~ThirdOrderKokkos() +{ + +} + +/* ---------------------------------------------------------------------- */ + +void ThirdOrderKokkos::command(int narg, char **arg) +{ + atomKK->sync(Host, X_MASK|RMASS_MASK|TYPE_MASK); + ThirdOrder::command(narg, arg); +} + +/* ---------------------------------------------------------------------- + setup without output or one-time post-init setup + flag = 0 = just force calculation + flag = 1 = reneighbor and force calculation +------------------------------------------------------------------------- */ + +void ThirdOrderKokkos::setup() +{ + lmp->kokkos->auto_sync = 1; + + // setup domain, communication and neighboring + // acquire ghosts + // build neighbor lists + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + if (neighbor->style) neighbor->setup_bins(); + comm->exchange(); + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + domain->image_check(); + domain->box_too_small_check(); + neighbor->build(1); + + // compute all forces + eflag=0; + vflag=0; + if (force->kspace) { + force->kspace->setup(); + } + update_force(); + + if (pair_compute_flag) { + atomKK->sync(force->pair->execution_space,force->pair->datamask_read); + force->pair->compute(eflag,vflag); + atomKK->modified(force->pair->execution_space,force->pair->datamask_modify); + } + else if (force->pair) force->pair->compute_dummy(eflag,vflag); + update->setupflag = 0; + + lmp->kokkos->auto_sync = 0; + + //if all then skip communication groupmap population + if (gcount == atom->natoms) + for (bigint i=0; inatoms; i++) + groupmap[i] = i; + else + create_groupmap(); + +} + +/* ---------------------------------------------------------------------- + evaluate potential energy and forces + may migrate atoms due to reneighboring + return new energy, which should include nextra_global dof + return negative gradient stored in atom->f + return negative gradient for nextra_global dof in fextra +------------------------------------------------------------------------- */ + +void ThirdOrderKokkos::update_force() +{ + int n_pre_force = modify->n_pre_force; + int n_pre_reverse = modify->n_pre_reverse; + int n_post_force = modify->n_post_force; + + lmp->kokkos->auto_sync = 0; + + f_merge_copy = DAT::t_f_array("ThirdOrderKokkos::f_merge_copy",atomKK->k_f.extent(0)); + + atomKK->modified(Host,X_MASK); + atomKK->sync(Device,X_MASK); + + force_clear(); + + neighbor->ago = 0; + if ((modify->get_fix_by_id("package_intel")) ? true : false) + neighbor->decide(); + + if (n_pre_force) { + modify->pre_force(vflag); + timer->stamp(Timer::MODIFY); + } + + bool execute_on_host = false; + unsigned int datamask_read_device = 0; + unsigned int datamask_modify_device = 0; + unsigned int datamask_read_host = 0; + + if (pair_compute_flag) { + if (force->pair->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->pair->datamask_read; + datamask_modify_device |= force->pair->datamask_modify; + } else { + datamask_read_device |= force->pair->datamask_read; + datamask_modify_device |= force->pair->datamask_modify; + } + } + if (atomKK->molecular && force->bond) { + if (force->bond->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->bond->datamask_read; + datamask_modify_device |= force->bond->datamask_modify; + } else { + datamask_read_device |= force->bond->datamask_read; + datamask_modify_device |= force->bond->datamask_modify; + } + } + if (atomKK->molecular && force->angle) { + if (force->angle->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->angle->datamask_read; + datamask_modify_device |= force->angle->datamask_modify; + } else { + datamask_read_device |= force->angle->datamask_read; + datamask_modify_device |= force->angle->datamask_modify; + } + } + if (atomKK->molecular && force->dihedral) { + if (force->dihedral->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->dihedral->datamask_read; + datamask_modify_device |= force->dihedral->datamask_modify; + } else { + datamask_read_device |= force->dihedral->datamask_read; + datamask_modify_device |= force->dihedral->datamask_modify; + } + } + if (atomKK->molecular && force->improper) { + if (force->improper->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->improper->datamask_read; + datamask_modify_device |= force->improper->datamask_modify; + } else { + datamask_read_device |= force->improper->datamask_read; + datamask_modify_device |= force->improper->datamask_modify; + } + } + if (kspace_compute_flag) { + if (force->kspace->execution_space==Host) { + execute_on_host = true; + datamask_read_host |= force->kspace->datamask_read; + datamask_modify_device |= force->kspace->datamask_modify; + } else { + datamask_read_device |= force->kspace->datamask_read; + datamask_modify_device |= force->kspace->datamask_modify; + } + } + + + if (pair_compute_flag) { + atomKK->sync(force->pair->execution_space,force->pair->datamask_read); + atomKK->sync(force->pair->execution_space,~(~force->pair->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + Kokkos::Timer ktimer; + force->pair->compute(eflag,vflag); + atomKK->modified(force->pair->execution_space,force->pair->datamask_modify); + atomKK->modified(force->pair->execution_space,~(~force->pair->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + timer->stamp(Timer::PAIR); + } + + if (execute_on_host) { + if (pair_compute_flag && force->pair->datamask_modify!=(F_MASK | ENERGY_MASK | VIRIAL_MASK)) + Kokkos::fence(); + atomKK->sync_overlapping_device(Host,~(~datamask_read_host|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + if (pair_compute_flag && force->pair->execution_space!=Host) { + Kokkos::deep_copy(LMPHostType(),atomKK->k_f.h_view,0.0); + } + } + + if (atomKK->molecular) { + if (force->bond) { + atomKK->sync(force->bond->execution_space,~(~force->bond->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->bond->compute(eflag,vflag); + atomKK->modified(force->bond->execution_space,~(~force->bond->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + if (force->angle) { + atomKK->sync(force->angle->execution_space,~(~force->angle->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->angle->compute(eflag,vflag); + atomKK->modified(force->angle->execution_space,~(~force->angle->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + if (force->dihedral) { + atomKK->sync(force->dihedral->execution_space,~(~force->dihedral->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->dihedral->compute(eflag,vflag); + atomKK->modified(force->dihedral->execution_space,~(~force->dihedral->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + if (force->improper) { + atomKK->sync(force->improper->execution_space,~(~force->improper->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->improper->compute(eflag,vflag); + atomKK->modified(force->improper->execution_space,~(~force->improper->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + } + timer->stamp(Timer::BOND); + } + + if (kspace_compute_flag) { + atomKK->sync(force->kspace->execution_space,~(~force->kspace->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + force->kspace->compute(eflag,vflag); + atomKK->modified(force->kspace->execution_space,~(~force->kspace->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); + timer->stamp(Timer::KSPACE); + } + + if (execute_on_host && !std::is_same::value) { + if (f_merge_copy.extent(0)k_f.extent(0)) { + f_merge_copy = DAT::t_f_array("ThirdOrderKokkos::f_merge_copy",atomKK->k_f.extent(0)); + } + f = atomKK->k_f.d_view; + Kokkos::deep_copy(LMPHostType(),f_merge_copy,atomKK->k_f.h_view); + Kokkos::parallel_for(atomKK->k_f.extent(0), + ForceAdder(atomKK->k_f.d_view,f_merge_copy)); + atomKK->k_f.clear_sync_state(); // special case + atomKK->k_f.modify(); + } + if (n_pre_reverse) { + modify->pre_reverse(eflag,vflag); + timer->stamp(Timer::MODIFY); + } + if (force->newton) { + comm->reverse_comm(); + timer->stamp(Timer::COMM); + } + // force modifications + + if (n_post_force) { + modify->post_force(vflag); + timer->stamp(Timer::MODIFY); + } + + atomKK->sync(Host,F_MASK); + lmp->kokkos->auto_sync = 1; + + ++ update->nsteps; +} + +/* ---------------------------------------------------------------------- + clear force on own & ghost atoms + clear other arrays as needed +------------------------------------------------------------------------- */ + +void ThirdOrderKokkos::force_clear() +{ + if (external_force_clear) return; + + atomKK->k_f.clear_sync_state(); // ignore host forces/torques since device views + + // clear force on all particles + // if either newton flag is set, also include ghosts + // when using threads always clear all forces. + + int nall = atomKK->nlocal; + if (force->newton) nall += atomKK->nghost; + + Kokkos::parallel_for(nall, Zero::t_f_array>(atomKK->k_f.view())); + atomKK->modified(Device,F_MASK); + +} diff --git a/src/KOKKOS/third_order_kokkos.h b/src/KOKKOS/third_order_kokkos.h new file mode 100644 index 0000000000..5392c825c5 --- /dev/null +++ b/src/KOKKOS/third_order_kokkos.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMMAND_CLASS +// clang-format off +CommandStyle(third_order/kk,ThirdOrderKokkos); +CommandStyle(third_order/kk/device,ThirdOrderKokkos); +CommandStyle(third_order/kk/host,ThirdOrderKokkos); +// clang-format on +#else + +#ifndef LMP_THIRD_ORDER_KOKKOS_H +#define LMP_THIRD_ORDER_KOKKOS_H + +#include "third_order.h" +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +class ThirdOrderKokkos : public ThirdOrder { + public: + ThirdOrderKokkos(class LAMMPS *); + ~ThirdOrderKokkos() override; + void command(int, char **) override; + void setup(); + + KOKKOS_INLINE_FUNCTION + void operator() (const int& i) const { + f(i,0) += f_merge_copy(i,0); + f(i,1) += f_merge_copy(i,1); + f(i,2) += f_merge_copy(i,2); + } + + protected: + void update_force(); + void force_clear(); + DAT::t_f_array f_merge_copy,f; + + +}; +} // namespace LAMMPS_NS + +#endif //LMP_THIRD_ORDER_KOKKOS_H +#endif diff --git a/src/KOKKOS/verlet_kokkos.h b/src/KOKKOS/verlet_kokkos.h index b90a114370..5159ef00ef 100644 --- a/src/KOKKOS/verlet_kokkos.h +++ b/src/KOKKOS/verlet_kokkos.h @@ -31,10 +31,10 @@ namespace LAMMPS_NS { class VerletKokkos : public Verlet { public: VerletKokkos(class LAMMPS *, int, char **); - ~VerletKokkos() {} - void setup(int); - void setup_minimal(int); - void run(int); + + void setup(int) override; + void setup_minimal(int) override; + void run(int) override; KOKKOS_INLINE_FUNCTION void operator() (const int& i) const { @@ -47,7 +47,7 @@ class VerletKokkos : public Verlet { protected: DAT::t_f_array f_merge_copy,f; - void force_clear(); + void force_clear() override; }; } diff --git a/src/KSPACE/ewald.h b/src/KSPACE/ewald.h index b429d18729..9d4b555939 100644 --- a/src/KSPACE/ewald.h +++ b/src/KSPACE/ewald.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class Ewald : public KSpace { public: Ewald(class LAMMPS *); - virtual ~Ewald(); - void init(); - void setup(); - virtual void settings(int, char **); - virtual void compute(int, int); - double memory_usage(); + ~Ewald() override; + void init() override; + void setup() override; + void settings(int, char **) override; + void compute(int, int) override; + double memory_usage() override; - void compute_group_group(int, int, int); + void compute_group_group(int, int, int) override; protected: int kxmax, kymax, kzmax; diff --git a/src/KSPACE/ewald_dipole.h b/src/KSPACE/ewald_dipole.h index f1cb619442..7bf75eaf5b 100644 --- a/src/KSPACE/ewald_dipole.h +++ b/src/KSPACE/ewald_dipole.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class EwaldDipole : public Ewald { public: EwaldDipole(class LAMMPS *); - virtual ~EwaldDipole(); - void init(); - void setup(); - virtual void compute(int, int); + ~EwaldDipole() override; + void init() override; + void setup() override; + void compute(int, int) override; protected: double musum, musqsum, mu2; @@ -39,7 +39,7 @@ class EwaldDipole : public Ewald { void musum_musq(); double rms_dipole(int, double, bigint); - virtual void eik_dot_r(); + void eik_dot_r() override; void slabcorr(); double NewtonSolve(double, double, bigint, double, double); double f(double, double, bigint, double, double); diff --git a/src/KSPACE/ewald_dipole_spin.h b/src/KSPACE/ewald_dipole_spin.h index 4660dde987..61b24b9eb8 100644 --- a/src/KSPACE/ewald_dipole_spin.h +++ b/src/KSPACE/ewald_dipole_spin.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class EwaldDipoleSpin : public EwaldDipole { public: EwaldDipoleSpin(class LAMMPS *); - virtual ~EwaldDipoleSpin() = default; - void init(); - void setup(); - void compute(int, int); + + void init() override; + void setup() override; + void compute(int, int) override; protected: double hbar; // reduced Planck's constant @@ -40,7 +40,7 @@ class EwaldDipoleSpin : public EwaldDipole { double mub2mu0hbinv; // prefactor for mag force void spsum_musq(); - virtual void eik_dot_r(); + void eik_dot_r() override; void slabcorr(); }; diff --git a/src/KSPACE/ewald_disp.h b/src/KSPACE/ewald_disp.h index 760baa726d..04d76c0b94 100644 --- a/src/KSPACE/ewald_disp.h +++ b/src/KSPACE/ewald_disp.h @@ -36,12 +36,12 @@ namespace LAMMPS_NS { class EwaldDisp : public KSpace { public: EwaldDisp(class LAMMPS *); - ~EwaldDisp(); - void init(); - void setup(); - void settings(int, char **); - void compute(int, int); - double memory_usage() { return bytes; } + ~EwaldDisp() override; + void init() override; + void setup() override; + void settings(int, char **) override; + void compute(int, int) override; + double memory_usage() override { return bytes; } private: double unit[6]; diff --git a/src/KSPACE/fft3d_wrap.h b/src/KSPACE/fft3d_wrap.h index 1deccc801b..351bf5713d 100644 --- a/src/KSPACE/fft3d_wrap.h +++ b/src/KSPACE/fft3d_wrap.h @@ -25,7 +25,7 @@ class FFT3d : protected Pointers { FFT3d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int *, int); - ~FFT3d(); + ~FFT3d() override; void compute(FFT_SCALAR *, FFT_SCALAR *, int); void timing1d(FFT_SCALAR *, int, int); diff --git a/src/KSPACE/fix_tune_kspace.h b/src/KSPACE/fix_tune_kspace.h index 7affe49684..1acf4fcc80 100644 --- a/src/KSPACE/fix_tune_kspace.h +++ b/src/KSPACE/fix_tune_kspace.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixTuneKspace : public Fix { public: FixTuneKspace(class LAMMPS *, int, char **); - ~FixTuneKspace() {} - int setmask(); - void init(); - void pre_exchange(); + + int setmask() override; + void init() override; + void pre_exchange() override; double get_timing_info(); void store_old_kspace_settings(); void update_pair_style(const std::string &, double); diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 2259d2f829..a6bfba3e6f 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -67,33 +67,7 @@ MSM::MSM(LAMMPS *lmp) factors[0] = 2; MPI_Comm_rank(world,&me); - - phi1d = dphi1d = nullptr; - nmax = 0; - part2grid = nullptr; - - g_direct = nullptr; - g_direct_top = nullptr; - - v0_direct = v1_direct = v2_direct = nullptr; - v3_direct = v4_direct = v5_direct = nullptr; - - v0_direct_top = v1_direct_top = v2_direct_top = nullptr; - v3_direct_top = v4_direct_top = v5_direct_top = nullptr; - - ngrid = nullptr; - - alpha = betax = betay = betaz = nullptr; - nx_msm = ny_msm = nz_msm = nullptr; - nxlo_in = nylo_in = nzlo_in = nullptr; - nxhi_in = nyhi_in = nzhi_in = nullptr; - nxlo_out = nylo_out = nzlo_out = nullptr; - nxhi_out = nyhi_out = nzhi_out = nullptr; - delxinv = delyinv = delzinv = nullptr; - qgrid = nullptr; - egrid = nullptr; - v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = nullptr; peratom_allocate_flag = 0; scalar_pressure_flag = 1; @@ -116,7 +90,7 @@ void MSM::settings(int narg, char **arg) MSM::~MSM() { - delete [] factors; + delete[] factors; deallocate(); if (peratom_allocate_flag) deallocate_peratom(); deallocate_levels(); @@ -311,6 +285,11 @@ double MSM::estimate_total_error() void MSM::setup() { + // change_box may trigger MSM::setup() before MSM::init() was called + // error out and request full initialization. + + if (!delxinv) error->all(FLERR, "MSM must be fully initialized for this operation"); + double *prd; double a = cutoff; @@ -626,15 +605,19 @@ void MSM::allocate() gcall->setup(ngcall_buf1,ngcall_buf2); npergrid = 1; + memory->destroy(gcall_buf1); + memory->destroy(gcall_buf2); memory->create(gcall_buf1,npergrid*ngcall_buf1,"msm:gcall_buf1"); memory->create(gcall_buf2,npergrid*ngcall_buf2,"msm:gcall_buf2"); // allocate memory for each grid level for (int n=0; ndestroy3d_offset(qgrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); memory->create3d_offset(qgrid[n],nzlo_out[n],nzhi_out[n], nylo_out[n],nyhi_out[n],nxlo_out[n],nxhi_out[n],"msm:qgrid"); + memory->destroy3d_offset(egrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); memory->create3d_offset(egrid[n],nzlo_out[n],nzhi_out[n], nylo_out[n],nyhi_out[n],nxlo_out[n],nxhi_out[n],"msm:egrid"); @@ -654,6 +637,8 @@ void MSM::allocate() gc[n]->setup(ngc_buf1[n],ngc_buf2[n]); npergrid = 1; + memory->destroy(gc_buf1[n]); + memory->destroy(gc_buf2[n]); memory->create(gc_buf1[n],npergrid*ngc_buf1[n],"msm:gc_buf1"); memory->create(gc_buf2[n],npergrid*ngc_buf2[n],"msm:gc_buf2"); } else { @@ -835,11 +820,8 @@ void MSM::deallocate_levels() { if (world_levels) { for (int n=0; n < levels; ++n) { - if (qgrid[n]) - memory->destroy3d_offset(qgrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); - - if (egrid[n]) - memory->destroy3d_offset(egrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); + memory->destroy3d_offset(qgrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); + memory->destroy3d_offset(egrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); if (gc) { if (gc[n]) { @@ -857,57 +839,57 @@ void MSM::deallocate_levels() } } - delete [] ngrid; + delete[] ngrid; ngrid = nullptr; memory->destroy(procneigh_levels); - delete [] world_levels; - delete [] active_flag; + delete[] world_levels; + delete[] active_flag; - delete [] gc; - delete [] gc_buf1; - delete [] gc_buf2; - delete [] ngc_buf1; - delete [] ngc_buf2; + delete[] gc; + delete[] gc_buf1; + delete[] gc_buf2; + delete[] ngc_buf1; + delete[] ngc_buf2; - delete [] alpha; - delete [] betax; - delete [] betay; - delete [] betaz; + delete[] alpha; + delete[] betax; + delete[] betay; + delete[] betaz; - delete [] nx_msm; - delete [] ny_msm; - delete [] nz_msm; + delete[] nx_msm; + delete[] ny_msm; + delete[] nz_msm; - delete [] nxlo_in; - delete [] nylo_in; - delete [] nzlo_in; + delete[] nxlo_in; + delete[] nylo_in; + delete[] nzlo_in; - delete [] nxhi_in; - delete [] nyhi_in; - delete [] nzhi_in; + delete[] nxhi_in; + delete[] nyhi_in; + delete[] nzhi_in; - delete [] nxlo_out; - delete [] nylo_out; - delete [] nzlo_out; + delete[] nxlo_out; + delete[] nylo_out; + delete[] nzlo_out; - delete [] nxhi_out; - delete [] nyhi_out; - delete [] nzhi_out; + delete[] nxhi_out; + delete[] nyhi_out; + delete[] nzhi_out; - delete [] delxinv; - delete [] delyinv; - delete [] delzinv; + delete[] delxinv; + delete[] delyinv; + delete[] delzinv; - delete [] qgrid; - delete [] egrid; + delete[] qgrid; + delete[] egrid; - delete [] v0grid; - delete [] v1grid; - delete [] v2grid; - delete [] v3grid; - delete [] v4grid; - delete [] v5grid; + delete[] v0grid; + delete[] v1grid; + delete[] v2grid; + delete[] v3grid; + delete[] v4grid; + delete[] v5grid; world_levels = nullptr; active_flag = nullptr; @@ -1060,8 +1042,7 @@ void MSM::set_grid_global() } if (flag && gridflag && me == 0) - error->warning(FLERR, - "Number of MSM mesh points changed to be a multiple of 2"); + error->warning(FLERR, "Number of MSM mesh points changed to be a multiple of 2"); // adjust Coulombic cutoff to give desired error (if requested) @@ -1087,8 +1068,7 @@ void MSM::set_grid_global() *p_cutoff = cutoff; if (me == 0) - error->warning(FLERR,"Adjusting Coulombic cutoff for " - "MSM, new cutoff = {:.8}", cutoff); + error->warning(FLERR,"Adjusting Coulombic cutoff for MSM, new cutoff = {:.8}", cutoff); } if (triclinic == 0) { @@ -1106,6 +1086,8 @@ void MSM::set_grid_global() h_z = 1.0/tmp[2]; } + deallocate_levels(); + // find maximum number of levels levels = MAX(xlevels,ylevels); @@ -1119,15 +1101,13 @@ void MSM::set_grid_global() levels = xlevels = ylevels = zlevels = 2; nx_max = ny_max = nz_max = 2; if (gridflag) - error->warning(FLERR, - "MSM mesh too small, increasing to 2 points in each direction"); + error->warning(FLERR,"MSM mesh too small, increasing to 2 points in each direction"); } // omit top grid level for periodic systems if (!domain->nonperiodic) levels -= 1; - deallocate_levels(); allocate_levels(); // find number of grid levels in each direction @@ -1154,33 +1134,19 @@ void MSM::set_grid_global() error->all(FLERR,"MSM grid is too large"); // compute number of extra grid points needed for non-periodic boundary conditions + // need to always do this, so we can handle the case of switching from periodic + // to non-periodic. - if (domain->nonperiodic) { - alpha[0] = -(order/2 - 1); - betax[0] = nx_msm[0] + (order/2 - 1); - betay[0] = ny_msm[0] + (order/2 - 1); - betaz[0] = nz_msm[0] + (order/2 - 1); - for (int n = 1; n < levels; n++) { - alpha[n] = -((-alpha[n-1]+1)/2) - (order/2 - 1); - betax[n] = ((betax[n-1]+1)/2) + (order/2 - 1); - betay[n] = ((betay[n-1]+1)/2) + (order/2 - 1); - betaz[n] = ((betaz[n-1]+1)/2) + (order/2 - 1); - } + alpha[0] = -(order/2 - 1); + betax[0] = nx_msm[0] + (order/2 - 1); + betay[0] = ny_msm[0] + (order/2 - 1); + betaz[0] = nz_msm[0] + (order/2 - 1); + for (int n = 1; n < levels; n++) { + alpha[n] = -((-alpha[n-1]+1)/2) - (order/2 - 1); + betax[n] = ((betax[n-1]+1)/2) + (order/2 - 1); + betay[n] = ((betay[n-1]+1)/2) + (order/2 - 1); + betaz[n] = ((betaz[n-1]+1)/2) + (order/2 - 1); } - - if (domain->nonperiodic) { - alpha[0] = -(order/2 - 1); - betax[0] = nx_msm[0] + (order/2 - 1); - betay[0] = ny_msm[0] + (order/2 - 1); - betaz[0] = nz_msm[0] + (order/2 - 1); - for (int n = 1; n < levels; n++) { - alpha[n] = -((-alpha[n-1]+1)/2) - (order/2 - 1); - betax[n] = ((betax[n-1]+1)/2) + (order/2 - 1); - betay[n] = ((betay[n-1]+1)/2) + (order/2 - 1); - betaz[n] = ((betaz[n-1]+1)/2) + (order/2 - 1); - } - } - } /* ---------------------------------------------------------------------- @@ -1195,6 +1161,10 @@ void MSM::set_grid_local() for (int n=0; ndestroy3d_offset(qgrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); + memory->destroy3d_offset(egrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]); + // partition global grid across procs // n xyz lo/hi in[] = lower/upper bounds of global grid this proc owns // indices range from 0 to N-1 inclusive in each dim @@ -3280,7 +3250,7 @@ void MSM::get_g_direct_top(int n) int nmax_top = 8*(nx+1)*(ny*1)*(nz+1); - if (g_direct_top) memory->destroy(g_direct_top); + memory->destroy(g_direct_top); memory->create(g_direct_top,nmax_top,"msm:g_direct_top"); double a = cutoff; diff --git a/src/KSPACE/msm.h b/src/KSPACE/msm.h index ac44dd2894..980d8182f8 100644 --- a/src/KSPACE/msm.h +++ b/src/KSPACE/msm.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class MSM : public KSpace { public: MSM(class LAMMPS *); - virtual ~MSM(); - void init(); - void setup(); - virtual void settings(int, char **); - virtual void compute(int, int); - virtual double memory_usage(); + ~MSM() override; + void init() override; + void setup() override; + void settings(int, char **) override; + void compute(int, int) override; + double memory_usage() override; protected: int me, nprocs; @@ -100,7 +100,7 @@ class MSM : public KSpace { void set_grid_global(); void set_proc_grid(int); void set_grid_local(); - void setup_grid(); + void setup_grid() override; double estimate_1d_error(double, double); double estimate_3d_error(); double estimate_total_error(); @@ -111,8 +111,8 @@ class MSM : public KSpace { void allocate_levels(); void deallocate_levels(); int factorable(int, int &, int &); - void particle_map(); - void make_rho(); + virtual void particle_map(); + virtual void make_rho(); virtual void direct(int); void direct_peratom(int); void direct_top(int); @@ -121,8 +121,8 @@ class MSM : public KSpace { void prolongation(int); void grid_swap_forward(int, double ***&); void grid_swap_reverse(int, double ***&); - void fieldforce(); - void fieldforce_peratom(); + virtual void fieldforce(); + virtual void fieldforce_peratom(); void compute_phis(const double &, const double &, const double &); void compute_phis_and_dphis(const double &, const double &, const double &); inline double compute_phi(const double &); @@ -134,10 +134,10 @@ class MSM : public KSpace { // grid communication - void pack_forward_grid(int, void *, int, int *); - void unpack_forward_grid(int, void *, int, int *); - void pack_reverse_grid(int, void *, int, int *); - void unpack_reverse_grid(int, void *, int, int *); + void pack_forward_grid(int, void *, int, int *) override; + void unpack_forward_grid(int, void *, int, int *) override; + void pack_reverse_grid(int, void *, int, int *) override; + void unpack_reverse_grid(int, void *, int, int *) override; }; } // namespace LAMMPS_NS diff --git a/src/KSPACE/msm_cg.h b/src/KSPACE/msm_cg.h index 67a77ec622..9ab78ba65d 100644 --- a/src/KSPACE/msm_cg.h +++ b/src/KSPACE/msm_cg.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class MSMCG : public MSM { public: MSMCG(class LAMMPS *); - virtual ~MSMCG(); - virtual void settings(int, char **); - virtual void compute(int, int); - virtual double memory_usage(); + ~MSMCG() override; + void settings(int, char **) override; + void compute(int, int) override; + double memory_usage() override; protected: int num_charged; @@ -38,10 +38,10 @@ class MSMCG : public MSM { double smallq; protected: - virtual void particle_map(); - virtual void make_rho(); - virtual void fieldforce(); - virtual void fieldforce_peratom(); + void particle_map() override; + void make_rho() override; + void fieldforce() override; + void fieldforce_peratom() override; }; } // namespace LAMMPS_NS diff --git a/src/KSPACE/pair_born_coul_long.h b/src/KSPACE/pair_born_coul_long.h index 11dd84c202..f7f8b5db3e 100644 --- a/src/KSPACE/pair_born_coul_long.h +++ b/src/KSPACE/pair_born_coul_long.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairBornCoulLong : public Pair { public: PairBornCoulLong(class LAMMPS *); - virtual ~PairBornCoulLong(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairBornCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/KSPACE/pair_born_coul_msm.h b/src/KSPACE/pair_born_coul_msm.h index c5a2255bcd..8338286a65 100644 --- a/src/KSPACE/pair_born_coul_msm.h +++ b/src/KSPACE/pair_born_coul_msm.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairBornCoulMSM : public PairBornCoulLong { public: PairBornCoulMSM(class LAMMPS *); - virtual ~PairBornCoulMSM(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairBornCoulMSM() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: int nmax; diff --git a/src/KSPACE/pair_buck_coul_long.h b/src/KSPACE/pair_buck_coul_long.h index 89a23558ae..62d2619d09 100644 --- a/src/KSPACE/pair_buck_coul_long.h +++ b/src/KSPACE/pair_buck_coul_long.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairBuckCoulLong : public Pair { public: PairBuckCoulLong(class LAMMPS *); - virtual ~PairBuckCoulLong(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairBuckCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/KSPACE/pair_buck_coul_msm.h b/src/KSPACE/pair_buck_coul_msm.h index ee52d2235b..006c9032c0 100644 --- a/src/KSPACE/pair_buck_coul_msm.h +++ b/src/KSPACE/pair_buck_coul_msm.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairBuckCoulMSM : public PairBuckCoulLong { public: PairBuckCoulMSM(class LAMMPS *); - virtual ~PairBuckCoulMSM(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairBuckCoulMSM() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: int nmax; diff --git a/src/KSPACE/pair_buck_long_coul_long.h b/src/KSPACE/pair_buck_long_coul_long.h index 1dab289c20..3bb1723b3d 100644 --- a/src/KSPACE/pair_buck_long_coul_long.h +++ b/src/KSPACE/pair_buck_long_coul_long.h @@ -29,25 +29,25 @@ class PairBuckLongCoulLong : public Pair { double cut_coul; PairBuckLongCoulLong(class LAMMPS *); - ~PairBuckLongCoulLong(); - virtual void compute(int, int); + ~PairBuckLongCoulLong() override; + void compute(int, int) override; - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - virtual void compute_inner(); - virtual void compute_middle(); - virtual void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_buck_global; diff --git a/src/KSPACE/pair_coul_long.h b/src/KSPACE/pair_coul_long.h index e553c8cb56..b196c5c662 100644 --- a/src/KSPACE/pair_coul_long.h +++ b/src/KSPACE/pair_coul_long.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairCoulLong : public Pair { public: PairCoulLong(class LAMMPS *); - ~PairCoulLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_coul, cut_coulsq, qdist; diff --git a/src/KSPACE/pair_coul_msm.h b/src/KSPACE/pair_coul_msm.h index d52830183a..734c852f65 100644 --- a/src/KSPACE/pair_coul_msm.h +++ b/src/KSPACE/pair_coul_msm.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairCoulMSM : public PairCoulLong { public: PairCoulMSM(class LAMMPS *); - virtual ~PairCoulMSM(){}; - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; }; } // namespace LAMMPS_NS diff --git a/src/KSPACE/pair_coul_streitz.cpp b/src/KSPACE/pair_coul_streitz.cpp index 0affa39799..27a8f87107 100644 --- a/src/KSPACE/pair_coul_streitz.cpp +++ b/src/KSPACE/pair_coul_streitz.cpp @@ -29,7 +29,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/KSPACE/pair_coul_streitz.h b/src/KSPACE/pair_coul_streitz.h index 011c4a6b7a..6d5036e83c 100644 --- a/src/KSPACE/pair_coul_streitz.h +++ b/src/KSPACE/pair_coul_streitz.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class PairCoulStreitz : public Pair { public: PairCoulStreitz(class LAMMPS *); - virtual ~PairCoulStreitz(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); - virtual void *extract(const char *, int &); + ~PairCoulStreitz() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; + void *extract(const char *, int &) override; static constexpr int NPARAMS_PER_LINE = 6; diff --git a/src/KSPACE/pair_lj_charmm_coul_long.h b/src/KSPACE/pair_lj_charmm_coul_long.h index 6925a635bf..463e537f56 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.h +++ b/src/KSPACE/pair_lj_charmm_coul_long.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class PairLJCharmmCoulLong : public Pair { public: PairLJCharmmCoulLong(class LAMMPS *); - virtual ~PairLJCharmmCoulLong(); + ~PairLJCharmmCoulLong() override; - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: int implicit; diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.h b/src/KSPACE/pair_lj_charmm_coul_msm.h index 90425c4daf..d90f58aa7e 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.h +++ b/src/KSPACE/pair_lj_charmm_coul_msm.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCharmmCoulMSM : public PairLJCharmmCoulLong { public: PairLJCharmmCoulMSM(class LAMMPS *); - virtual ~PairLJCharmmCoulMSM(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + ~PairLJCharmmCoulMSM() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: int nmax; diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.h b/src/KSPACE/pair_lj_charmmfsw_coul_long.h index e254092c43..dd72027334 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.h +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class PairLJCharmmfswCoulLong : public Pair { public: PairLJCharmmfswCoulLong(class LAMMPS *); - virtual ~PairLJCharmmfswCoulLong(); + ~PairLJCharmmfswCoulLong() override; - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: int implicit; diff --git a/src/KSPACE/pair_lj_cut_coul_long.h b/src/KSPACE/pair_lj_cut_coul_long.h index 23d8d26f93..d5e3e6f7e0 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.h +++ b/src/KSPACE/pair_lj_cut_coul_long.h @@ -28,24 +28,24 @@ class PairLJCutCoulLong : public Pair { public: PairLJCutCoulLong(class LAMMPS *); - virtual ~PairLJCutCoulLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairLJCutCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void compute_inner(); - void compute_middle(); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/KSPACE/pair_lj_cut_coul_msm.h b/src/KSPACE/pair_lj_cut_coul_msm.h index c84fc5688c..2b5b7e1a85 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.h +++ b/src/KSPACE/pair_lj_cut_coul_msm.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairLJCutCoulMSM : public PairLJCutCoulLong { public: PairLJCutCoulMSM(class LAMMPS *); - virtual ~PairLJCutCoulMSM(); - virtual void compute(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void compute_outer(int, int); - virtual void *extract(const char *, int &); + ~PairLJCutCoulMSM() override; + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; protected: int nmax; diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.h b/src/KSPACE/pair_lj_cut_tip4p_long.h index 20066e71e2..091cd42ab5 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.h +++ b/src/KSPACE/pair_lj_cut_tip4p_long.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairLJCutTIP4PLong : public PairLJCutCoulLong { public: PairLJCutTIP4PLong(class LAMMPS *); - ~PairLJCutTIP4PLong(); - virtual void compute(int, int); - void settings(int, char **); - void init_style(); - double init_one(int, int); - void write_restart_settings(FILE *fp); - void read_restart_settings(FILE *fp); - void *extract(const char *, int &); - double memory_usage(); + ~PairLJCutTIP4PLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *fp) override; + void read_restart_settings(FILE *fp) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int typeH, typeO; // atom types of TIP4P water H and O atoms diff --git a/src/KSPACE/pair_lj_long_coul_long.h b/src/KSPACE/pair_lj_long_coul_long.h index 926c098052..5b66a949a9 100644 --- a/src/KSPACE/pair_lj_long_coul_long.h +++ b/src/KSPACE/pair_lj_long_coul_long.h @@ -29,24 +29,24 @@ class PairLJLongCoulLong : public Pair { double cut_coul; PairLJLongCoulLong(class LAMMPS *); - virtual ~PairLJLongCoulLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJLongCoulLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - virtual void compute_inner(); - virtual void compute_middle(); - virtual void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_lj_global; diff --git a/src/KSPACE/pair_lj_long_tip4p_long.h b/src/KSPACE/pair_lj_long_tip4p_long.h index 15150a4e23..c8e0265c41 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.h +++ b/src/KSPACE/pair_lj_long_tip4p_long.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairLJLongTIP4PLong : public PairLJLongCoulLong { public: PairLJLongTIP4PLong(class LAMMPS *); - ~PairLJLongTIP4PLong(); - virtual void compute(int, int); - virtual void compute_inner(); - virtual void compute_middle(); - virtual void compute_outer(int, int); - void settings(int, char **); - void init_style(); - double init_one(int, int); - void write_restart_settings(FILE *fp); - void read_restart_settings(FILE *fp); - void *extract(const char *, int &); - double memory_usage(); + ~PairLJLongTIP4PLong() override; + void compute(int, int) override; + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *fp) override; + void read_restart_settings(FILE *fp) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int typeH, typeO; // atom types of TIP4P water H and O atoms diff --git a/src/KSPACE/pair_tip4p_long.h b/src/KSPACE/pair_tip4p_long.h index c4a2e0b623..8272ec8428 100644 --- a/src/KSPACE/pair_tip4p_long.h +++ b/src/KSPACE/pair_tip4p_long.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairTIP4PLong : public PairCoulLong { public: PairTIP4PLong(class LAMMPS *); - ~PairTIP4PLong(); - virtual void compute(int, int); - void settings(int, char **); - void init_style(); - double init_one(int, int); - void write_restart_settings(FILE *fp); - void read_restart_settings(FILE *fp); - void *extract(const char *, int &); - double memory_usage(); + ~PairTIP4PLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *fp) override; + void read_restart_settings(FILE *fp) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int typeH, typeO; // atom types of TIP4P water H and O atoms diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 06d90e5d0e..d531233a3a 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -197,11 +197,9 @@ void PPPM::init() error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); if (domain->triclinic && differentiation_flag == 1) - error->all(FLERR,"Cannot (yet) use PPPM with triclinic box " - "and kspace_modify diff ad"); + error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and kspace_modify diff ad"); if (domain->triclinic && slabflag) - error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and " - "slab correction"); + error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and slab correction"); if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPM with 2d simulation"); diff --git a/src/KSPACE/pppm.h b/src/KSPACE/pppm.h index 4fa41fa311..88fc58f286 100644 --- a/src/KSPACE/pppm.h +++ b/src/KSPACE/pppm.h @@ -48,17 +48,17 @@ namespace LAMMPS_NS { class PPPM : public KSpace { public: PPPM(class LAMMPS *); - virtual ~PPPM(); - virtual void settings(int, char **); - virtual void init(); - virtual void setup(); - virtual void setup_grid(); - virtual void compute(int, int); - virtual int timing_1d(int, double &); - virtual int timing_3d(int, double &); - virtual double memory_usage(); + ~PPPM() override; + void settings(int, char **) override; + void init() override; + void setup() override; + void setup_grid() override; + void compute(int, int) override; + int timing_1d(int, double &) override; + int timing_3d(int, double &) override; + double memory_usage() override; - virtual void compute_group_group(int, int, int); + void compute_group_group(int, int, int) override; protected: int me, nprocs; @@ -162,10 +162,10 @@ class PPPM : public KSpace { // grid communication - virtual void pack_forward_grid(int, void *, int, int *); - virtual void unpack_forward_grid(int, void *, int, int *); - virtual void pack_reverse_grid(int, void *, int, int *); - virtual void unpack_reverse_grid(int, void *, int, int *); + void pack_forward_grid(int, void *, int, int *) override; + void unpack_forward_grid(int, void *, int, int *) override; + void pack_reverse_grid(int, void *, int, int *) override; + void unpack_reverse_grid(int, void *, int, int *) override; // triclinic diff --git a/src/KSPACE/pppm_cg.h b/src/KSPACE/pppm_cg.h index 83c75b5f53..83cd19536c 100644 --- a/src/KSPACE/pppm_cg.h +++ b/src/KSPACE/pppm_cg.h @@ -27,23 +27,23 @@ namespace LAMMPS_NS { class PPPMCG : public PPPM { public: PPPMCG(class LAMMPS *); - virtual ~PPPMCG(); - virtual void settings(int, char **); - virtual void compute(int, int); - virtual double memory_usage(); + ~PPPMCG() override; + void settings(int, char **) override; + void compute(int, int) override; + double memory_usage() override; protected: int num_charged; int *is_charged; double smallq; - virtual void particle_map(); - virtual void make_rho(); - virtual void fieldforce_ik(); - virtual void fieldforce_ad(); - virtual void fieldforce_peratom(); - virtual void slabcorr(); - virtual void make_rho_groups(int, int, int); + void particle_map() override; + void make_rho() override; + void fieldforce_ik() override; + void fieldforce_ad() override; + void fieldforce_peratom() override; + void slabcorr() override; + void make_rho_groups(int, int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/KSPACE/pppm_dipole.h b/src/KSPACE/pppm_dipole.h index 7ae2e9a7ef..ae16047194 100644 --- a/src/KSPACE/pppm_dipole.h +++ b/src/KSPACE/pppm_dipole.h @@ -27,33 +27,33 @@ namespace LAMMPS_NS { class PPPMDipole : public PPPM { public: PPPMDipole(class LAMMPS *); - virtual ~PPPMDipole(); - void init(); - void setup(); - void setup_grid(); - void compute(int, int); - int timing_1d(int, double &); - int timing_3d(int, double &); - double memory_usage(); + ~PPPMDipole() override; + void init() override; + void setup() override; + void setup_grid() override; + void compute(int, int) override; + int timing_1d(int, double &) override; + int timing_3d(int, double &) override; + double memory_usage() override; protected: - void set_grid_global(); - double newton_raphson_f(); + void set_grid_global() override; + double newton_raphson_f() override; - void allocate(); - void allocate_peratom(); - void deallocate(); - void deallocate_peratom(); - void compute_gf_denom(); + void allocate() override; + void allocate_peratom() override; + void deallocate() override; + void deallocate_peratom() override; + void compute_gf_denom() override; - void slabcorr(); + void slabcorr() override; // grid communication - void pack_forward_grid(int, void *, int, int *); - void unpack_forward_grid(int, void *, int, int *); - void pack_reverse_grid(int, void *, int, int *); - void unpack_reverse_grid(int, void *, int, int *); + void pack_forward_grid(int, void *, int, int *) override; + void unpack_forward_grid(int, void *, int, int *) override; + void pack_reverse_grid(int, void *, int, int *) override; + void unpack_reverse_grid(int, void *, int, int *) override; // dipole diff --git a/src/KSPACE/pppm_dipole_spin.h b/src/KSPACE/pppm_dipole_spin.h index eea43db15d..c0b0a635be 100644 --- a/src/KSPACE/pppm_dipole_spin.h +++ b/src/KSPACE/pppm_dipole_spin.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class PPPMDipoleSpin : public PPPMDipole { public: PPPMDipoleSpin(class LAMMPS *); - virtual ~PPPMDipoleSpin(); - void init(); - void compute(int, int); + ~PPPMDipoleSpin() override; + void init() override; + void compute(int, int) override; protected: double hbar; // reduced Planck's constant @@ -38,7 +38,7 @@ class PPPMDipoleSpin : public PPPMDipole { double mub2mu0; // prefactor for mech force double mub2mu0hbinv; // prefactor for mag force - void slabcorr(); + void slabcorr() override; // spin diff --git a/src/KSPACE/pppm_disp.h b/src/KSPACE/pppm_disp.h index 985ca5e0b2..de05a2f551 100644 --- a/src/KSPACE/pppm_disp.h +++ b/src/KSPACE/pppm_disp.h @@ -48,15 +48,15 @@ namespace LAMMPS_NS { class PPPMDisp : public KSpace { public: PPPMDisp(class LAMMPS *); - virtual ~PPPMDisp(); - virtual void init(); - virtual void setup(); - void setup_grid(); - virtual void settings(int, char **); - virtual void compute(int, int); - virtual int timing_1d(int, double &); - virtual int timing_3d(int, double &); - virtual double memory_usage(); + ~PPPMDisp() override; + void init() override; + void setup() override; + void setup_grid() override; + void settings(int, char **) override; + void compute(int, int) override; + int timing_1d(int, double &) override; + int timing_3d(int, double &) override; + double memory_usage() override; protected: int me, nprocs; @@ -341,10 +341,10 @@ class PPPMDisp : public KSpace { // grid communication - void pack_forward_grid(int, void *, int, int *); - void unpack_forward_grid(int, void *, int, int *); - void pack_reverse_grid(int, void *, int, int *); - void unpack_reverse_grid(int, void *, int, int *); + void pack_forward_grid(int, void *, int, int *) override; + void unpack_forward_grid(int, void *, int, int *) override; + void pack_reverse_grid(int, void *, int, int *) override; + void unpack_reverse_grid(int, void *, int, int *) override; }; } // namespace LAMMPS_NS diff --git a/src/KSPACE/pppm_disp_tip4p.h b/src/KSPACE/pppm_disp_tip4p.h index a8bb90ca54..dbc3fb98aa 100644 --- a/src/KSPACE/pppm_disp_tip4p.h +++ b/src/KSPACE/pppm_disp_tip4p.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PPPMDispTIP4P : public PPPMDisp { public: PPPMDispTIP4P(class LAMMPS *); - virtual ~PPPMDispTIP4P(){}; - void init(); + + void init() override; protected: - virtual void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, - int, int); - virtual void make_rho_c(); - virtual void fieldforce_c_ik(); - virtual void fieldforce_c_ad(); - virtual void fieldforce_c_peratom(); + void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, + int, int) override; + void make_rho_c() override; + void fieldforce_c_ik() override; + void fieldforce_c_ad() override; + void fieldforce_c_peratom() override; private: void find_M(int, int &, int &, double *); diff --git a/src/KSPACE/pppm_stagger.h b/src/KSPACE/pppm_stagger.h index 2467b1a161..77b7478d42 100644 --- a/src/KSPACE/pppm_stagger.h +++ b/src/KSPACE/pppm_stagger.h @@ -27,28 +27,28 @@ namespace LAMMPS_NS { class PPPMStagger : public PPPM { public: PPPMStagger(class LAMMPS *); - virtual ~PPPMStagger(); - virtual void init(); - virtual void compute(int, int); - virtual int timing_1d(int, double &); - virtual int timing_3d(int, double &); + ~PPPMStagger() override; + void init() override; + void compute(int, int) override; + int timing_1d(int, double &) override; + int timing_3d(int, double &) override; protected: int nstagger; double stagger; double **gf_b2; - virtual double compute_qopt(); + double compute_qopt() override; double compute_qopt_ad(); - virtual void compute_gf_denom(); - virtual void compute_gf_ik(); - virtual void compute_gf_ad(); + void compute_gf_denom() override; + void compute_gf_ik() override; + void compute_gf_ad() override; - virtual void particle_map(); - virtual void make_rho(); - virtual void fieldforce_ik(); - virtual void fieldforce_ad(); - virtual void fieldforce_peratom(); + void particle_map() override; + void make_rho() override; + void fieldforce_ik() override; + void fieldforce_ad() override; + void fieldforce_peratom() override; inline double gf_denom2(const double &x, const double &y, const double &z) const { diff --git a/src/KSPACE/pppm_tip4p.h b/src/KSPACE/pppm_tip4p.h index 9d3d70c0c6..3087f895dd 100644 --- a/src/KSPACE/pppm_tip4p.h +++ b/src/KSPACE/pppm_tip4p.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class PPPMTIP4P : public PPPM { public: PPPMTIP4P(class LAMMPS *); - virtual ~PPPMTIP4P(){}; - void init(); + void init() override; protected: - virtual void particle_map(); - virtual void make_rho(); - virtual void fieldforce_ik(); - virtual void fieldforce_ad(); - virtual void fieldforce_peratom(); + void particle_map() override; + void make_rho() override; + void fieldforce_ik() override; + void fieldforce_ad() override; + void fieldforce_peratom() override; private: void find_M(int, int &, int &, double *); diff --git a/src/KSPACE/remap_wrap.h b/src/KSPACE/remap_wrap.h index d42c8d4c5e..d5846bae76 100644 --- a/src/KSPACE/remap_wrap.h +++ b/src/KSPACE/remap_wrap.h @@ -23,7 +23,7 @@ class Remap : protected Pointers { public: Remap(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); - ~Remap(); + ~Remap() override; void perform(FFT_SCALAR *, FFT_SCALAR *, FFT_SCALAR *); private: diff --git a/src/LATBOLTZ/fix_lb_fluid.h b/src/LATBOLTZ/fix_lb_fluid.h index 98d3e2c792..c389e0e529 100644 --- a/src/LATBOLTZ/fix_lb_fluid.h +++ b/src/LATBOLTZ/fix_lb_fluid.h @@ -36,18 +36,18 @@ class FixLbFluid : public Fix { public: FixLbFluid(class LAMMPS *, int, char **); - ~FixLbFluid(); - int setmask(); - void init(); - void initial_integrate(int); - void setup(int); - void post_force(int); - void end_of_step(); + ~FixLbFluid() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void setup(int) override; + void post_force(int) override; + void end_of_step() override; - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: double viscosity, densityinit_real, a_0_real, T; diff --git a/src/LATBOLTZ/fix_lb_momentum.h b/src/LATBOLTZ/fix_lb_momentum.h index 145ba78f05..3dd839bb5d 100644 --- a/src/LATBOLTZ/fix_lb_momentum.h +++ b/src/LATBOLTZ/fix_lb_momentum.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixLbMomentum : public Fix { public: FixLbMomentum(class LAMMPS *, int, char **); - int setmask(); - void init(); - void end_of_step(); + int setmask() override; + void init() override; + void end_of_step() override; private: int linear; diff --git a/src/LATBOLTZ/fix_lb_pc.h b/src/LATBOLTZ/fix_lb_pc.h index d218f22ebd..b015250404 100644 --- a/src/LATBOLTZ/fix_lb_pc.h +++ b/src/LATBOLTZ/fix_lb_pc.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixLbPC : public Fix { public: FixLbPC(class LAMMPS *, int, char **); - ~FixLbPC(); - int setmask(); - void init(); - void initial_integrate(int); - void final_integrate(); + ~FixLbPC() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; - void grow_arrays(int); - void copy_arrays(int, int, int); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; // void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: double dtv, dtf; diff --git a/src/LATBOLTZ/fix_lb_rigid_pc_sphere.h b/src/LATBOLTZ/fix_lb_rigid_pc_sphere.h index 5964c7d142..d9a6762a69 100644 --- a/src/LATBOLTZ/fix_lb_rigid_pc_sphere.h +++ b/src/LATBOLTZ/fix_lb_rigid_pc_sphere.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class FixLbRigidPCSphere : public Fix { public: FixLbRigidPCSphere(class LAMMPS *, int, char **); - virtual ~FixLbRigidPCSphere(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual double compute_scalar(); + ~FixLbRigidPCSphere() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + double compute_scalar() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; - void pre_neighbor(); - int dof(int); - void reset_dt(); - double compute_array(int, int); + void pre_neighbor() override; + int dof(int) override; + void reset_dt() override; + double compute_array(int, int) override; private: double **up; diff --git a/src/LATBOLTZ/fix_lb_viscous.h b/src/LATBOLTZ/fix_lb_viscous.h index 8c86e47553..d4891369af 100644 --- a/src/LATBOLTZ/fix_lb_viscous.h +++ b/src/LATBOLTZ/fix_lb_viscous.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixLbViscous : public Fix { public: FixLbViscous(class LAMMPS *, int, char **); - virtual ~FixLbViscous() = default; - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); + + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; protected: int nlevels_respa; diff --git a/src/LATTE/fix_latte.h b/src/LATTE/fix_latte.h index 2797da3599..30a07c42a4 100644 --- a/src/LATTE/fix_latte.h +++ b/src/LATTE/fix_latte.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class FixLatte : public Fix { public: FixLatte(class LAMMPS *, int, char **); - virtual ~FixLatte(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void min_setup(int); - void setup_pre_reverse(int, int); - void initial_integrate(int); - void pre_reverse(int, int); - void post_force(int); - void min_post_force(int); - void final_integrate(); - void reset_dt(); - double compute_scalar(); - double memory_usage(); + ~FixLatte() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void min_setup(int) override; + void setup_pre_reverse(int, int) override; + void initial_integrate(int) override; + void pre_reverse(int, int) override; + void post_force(int) override; + void min_post_force(int) override; + void final_integrate() override; + void reset_dt() override; + double compute_scalar() override; + double memory_usage() override; protected: char *id_pe; diff --git a/src/MACHDYN/atom_vec_smd.h b/src/MACHDYN/atom_vec_smd.h index ada2c2c936..a1ed384f1d 100644 --- a/src/MACHDYN/atom_vec_smd.h +++ b/src/MACHDYN/atom_vec_smd.h @@ -39,10 +39,10 @@ class AtomVecSMD : public AtomVec { public: AtomVecSMD(class LAMMPS *); - void grow_pointers(); - void force_clear(int, size_t); - void create_atom_post(int); - void data_atom_post(int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void create_atom_post(int) override; + void data_atom_post(int) override; private: tagint *molecule; diff --git a/src/MACHDYN/compute_smd_contact_radius.h b/src/MACHDYN/compute_smd_contact_radius.h index 87f3208dd3..3891bc8800 100644 --- a/src/MACHDYN/compute_smd_contact_radius.h +++ b/src/MACHDYN/compute_smd_contact_radius.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDContactRadius : public Compute { public: ComputeSMDContactRadius(class LAMMPS *, int, char **); - ~ComputeSMDContactRadius(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDContactRadius() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_damage.h b/src/MACHDYN/compute_smd_damage.h index ac1fcb1bb4..0200c2a3e3 100644 --- a/src/MACHDYN/compute_smd_damage.h +++ b/src/MACHDYN/compute_smd_damage.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDDamage : public Compute { public: ComputeSMDDamage(class LAMMPS *, int, char **); - ~ComputeSMDDamage(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDDamage() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_hourglass_error.h b/src/MACHDYN/compute_smd_hourglass_error.h index 32b5b90d56..8654028636 100644 --- a/src/MACHDYN/compute_smd_hourglass_error.h +++ b/src/MACHDYN/compute_smd_hourglass_error.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDHourglassError : public Compute { public: ComputeSMDHourglassError(class LAMMPS *, int, char **); - ~ComputeSMDHourglassError(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDHourglassError() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_internal_energy.h b/src/MACHDYN/compute_smd_internal_energy.h index b4aaaf6b40..774e8f16e3 100644 --- a/src/MACHDYN/compute_smd_internal_energy.h +++ b/src/MACHDYN/compute_smd_internal_energy.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDInternalEnergy : public Compute { public: ComputeSMDInternalEnergy(class LAMMPS *, int, char **); - ~ComputeSMDInternalEnergy(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDInternalEnergy() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_plastic_strain.h b/src/MACHDYN/compute_smd_plastic_strain.h index 7e319610a3..2315b2fcfe 100644 --- a/src/MACHDYN/compute_smd_plastic_strain.h +++ b/src/MACHDYN/compute_smd_plastic_strain.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDPlasticStrain : public Compute { public: ComputeSMDPlasticStrain(class LAMMPS *, int, char **); - ~ComputeSMDPlasticStrain(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDPlasticStrain() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_plastic_strain_rate.h b/src/MACHDYN/compute_smd_plastic_strain_rate.h index d0ea09af26..29fb8b5669 100644 --- a/src/MACHDYN/compute_smd_plastic_strain_rate.h +++ b/src/MACHDYN/compute_smd_plastic_strain_rate.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDPlasticStrainRate : public Compute { public: ComputeSMDPlasticStrainRate(class LAMMPS *, int, char **); - ~ComputeSMDPlasticStrainRate(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDPlasticStrainRate() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_rho.h b/src/MACHDYN/compute_smd_rho.h index 954caade5d..b4d41f1ee7 100644 --- a/src/MACHDYN/compute_smd_rho.h +++ b/src/MACHDYN/compute_smd_rho.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDRho : public Compute { public: ComputeSMDRho(class LAMMPS *, int, char **); - ~ComputeSMDRho(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDRho() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_defgrad.h b/src/MACHDYN/compute_smd_tlsph_defgrad.h index eed4066867..61ce69bc9d 100644 --- a/src/MACHDYN/compute_smd_tlsph_defgrad.h +++ b/src/MACHDYN/compute_smd_tlsph_defgrad.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTLSPHDefgrad : public Compute { public: ComputeSMDTLSPHDefgrad(class LAMMPS *, int, char **); - ~ComputeSMDTLSPHDefgrad(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTLSPHDefgrad() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_dt.h b/src/MACHDYN/compute_smd_tlsph_dt.h index e57db2dd74..7a4154da9a 100644 --- a/src/MACHDYN/compute_smd_tlsph_dt.h +++ b/src/MACHDYN/compute_smd_tlsph_dt.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTlsphDt : public Compute { public: ComputeSMDTlsphDt(class LAMMPS *, int, char **); - ~ComputeSMDTlsphDt(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTlsphDt() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_num_neighs.h b/src/MACHDYN/compute_smd_tlsph_num_neighs.h index e3531a47ea..53efa059b6 100644 --- a/src/MACHDYN/compute_smd_tlsph_num_neighs.h +++ b/src/MACHDYN/compute_smd_tlsph_num_neighs.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTLSPHNumNeighs : public Compute { public: ComputeSMDTLSPHNumNeighs(class LAMMPS *, int, char **); - ~ComputeSMDTLSPHNumNeighs(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTLSPHNumNeighs() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_shape.h b/src/MACHDYN/compute_smd_tlsph_shape.h index 76298cf30c..e8d9080326 100644 --- a/src/MACHDYN/compute_smd_tlsph_shape.h +++ b/src/MACHDYN/compute_smd_tlsph_shape.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSmdTlsphShape : public Compute { public: ComputeSmdTlsphShape(class LAMMPS *, int, char **); - ~ComputeSmdTlsphShape(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSmdTlsphShape() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_strain.h b/src/MACHDYN/compute_smd_tlsph_strain.h index 426cb6dea9..f1e3f43855 100644 --- a/src/MACHDYN/compute_smd_tlsph_strain.h +++ b/src/MACHDYN/compute_smd_tlsph_strain.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTLSPHstrain : public Compute { public: ComputeSMDTLSPHstrain(class LAMMPS *, int, char **); - ~ComputeSMDTLSPHstrain(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTLSPHstrain() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_strain_rate.h b/src/MACHDYN/compute_smd_tlsph_strain_rate.h index 7fd851725c..73a16d3ac3 100644 --- a/src/MACHDYN/compute_smd_tlsph_strain_rate.h +++ b/src/MACHDYN/compute_smd_tlsph_strain_rate.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTLSPHStrainRate : public Compute { public: ComputeSMDTLSPHStrainRate(class LAMMPS *, int, char **); - ~ComputeSMDTLSPHStrainRate(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTLSPHStrainRate() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_tlsph_stress.h b/src/MACHDYN/compute_smd_tlsph_stress.h index 4ef4199e48..8be9ff44c9 100644 --- a/src/MACHDYN/compute_smd_tlsph_stress.h +++ b/src/MACHDYN/compute_smd_tlsph_stress.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTLSPHStress : public Compute { public: ComputeSMDTLSPHStress(class LAMMPS *, int, char **); - ~ComputeSMDTLSPHStress(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTLSPHStress() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_triangle_vertices.h b/src/MACHDYN/compute_smd_triangle_vertices.h index 06be1a4e1a..b7fa2e4fc2 100644 --- a/src/MACHDYN/compute_smd_triangle_vertices.h +++ b/src/MACHDYN/compute_smd_triangle_vertices.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDTriangleVertices : public Compute { public: ComputeSMDTriangleVertices(class LAMMPS *, int, char **); - ~ComputeSMDTriangleVertices(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDTriangleVertices() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_ulsph_effm.h b/src/MACHDYN/compute_smd_ulsph_effm.h index 836a3d2a74..5a653b48cd 100644 --- a/src/MACHDYN/compute_smd_ulsph_effm.h +++ b/src/MACHDYN/compute_smd_ulsph_effm.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMD_Ulsph_Effm : public Compute { public: ComputeSMD_Ulsph_Effm(class LAMMPS *, int, char **); - ~ComputeSMD_Ulsph_Effm(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMD_Ulsph_Effm() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_ulsph_num_neighs.h b/src/MACHDYN/compute_smd_ulsph_num_neighs.h index 527ba17737..29f98eac53 100644 --- a/src/MACHDYN/compute_smd_ulsph_num_neighs.h +++ b/src/MACHDYN/compute_smd_ulsph_num_neighs.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDULSPHNumNeighs : public Compute { public: ComputeSMDULSPHNumNeighs(class LAMMPS *, int, char **); - ~ComputeSMDULSPHNumNeighs(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDULSPHNumNeighs() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_ulsph_strain.h b/src/MACHDYN/compute_smd_ulsph_strain.h index 54f53f6782..b958c036fd 100644 --- a/src/MACHDYN/compute_smd_ulsph_strain.h +++ b/src/MACHDYN/compute_smd_ulsph_strain.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDULSPHstrain : public Compute { public: ComputeSMDULSPHstrain(class LAMMPS *, int, char **); - ~ComputeSMDULSPHstrain(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDULSPHstrain() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_ulsph_strain_rate.h b/src/MACHDYN/compute_smd_ulsph_strain_rate.h index ab97d7a924..2d3e5e3157 100644 --- a/src/MACHDYN/compute_smd_ulsph_strain_rate.h +++ b/src/MACHDYN/compute_smd_ulsph_strain_rate.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDULSPHStrainRate : public Compute { public: ComputeSMDULSPHStrainRate(class LAMMPS *, int, char **); - ~ComputeSMDULSPHStrainRate(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDULSPHStrainRate() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_ulsph_stress.h b/src/MACHDYN/compute_smd_ulsph_stress.h index 6f3182f5f4..dc553beec8 100644 --- a/src/MACHDYN/compute_smd_ulsph_stress.h +++ b/src/MACHDYN/compute_smd_ulsph_stress.h @@ -38,10 +38,10 @@ namespace LAMMPS_NS { class ComputeSMDULSPHStress : public Compute { public: ComputeSMDULSPHStress(class LAMMPS *, int, char **); - ~ComputeSMDULSPHStress(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSMDULSPHStress() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/compute_smd_vol.h b/src/MACHDYN/compute_smd_vol.h index c0fd4550b4..e368633fba 100644 --- a/src/MACHDYN/compute_smd_vol.h +++ b/src/MACHDYN/compute_smd_vol.h @@ -38,11 +38,11 @@ namespace LAMMPS_NS { class ComputeSMDVol : public Compute { public: ComputeSMDVol(class LAMMPS *, int, char **); - ~ComputeSMDVol(); - void init(); - void compute_peratom(); - double compute_scalar(); - double memory_usage(); + ~ComputeSMDVol() override; + void init() override; + void compute_peratom() override; + double compute_scalar() override; + double memory_usage() override; private: int nmax; diff --git a/src/MACHDYN/fix_smd_adjust_dt.h b/src/MACHDYN/fix_smd_adjust_dt.h index 41203cf472..24b642e603 100644 --- a/src/MACHDYN/fix_smd_adjust_dt.h +++ b/src/MACHDYN/fix_smd_adjust_dt.h @@ -38,15 +38,15 @@ namespace LAMMPS_NS { class FixSMDTlsphDtReset : public Fix { public: FixSMDTlsphDtReset(class LAMMPS *, int, char **); - ~FixSMDTlsphDtReset() {} - int setmask(); - void init(); - void setup(int); - void initial_integrate(int); - void end_of_step(); - double compute_scalar(); - void write_restart(FILE *); - void restart(char *); + + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void end_of_step() override; + double compute_scalar() override; + void write_restart(FILE *) override; + void restart(char *) override; private: double safety_factor; diff --git a/src/MACHDYN/fix_smd_integrate_tlsph.h b/src/MACHDYN/fix_smd_integrate_tlsph.h index 582b4588a4..c2037ee606 100644 --- a/src/MACHDYN/fix_smd_integrate_tlsph.h +++ b/src/MACHDYN/fix_smd_integrate_tlsph.h @@ -41,12 +41,12 @@ class FixSMDIntegrateTlsph : public Fix { public: FixSMDIntegrateTlsph(class LAMMPS *, int, char **); - virtual ~FixSMDIntegrateTlsph() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void reset_dt(); + + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; protected: double dtv, dtf, vlimit, vlimitsq; diff --git a/src/MACHDYN/fix_smd_integrate_ulsph.h b/src/MACHDYN/fix_smd_integrate_ulsph.h index af75685a4b..cbba1f5135 100644 --- a/src/MACHDYN/fix_smd_integrate_ulsph.h +++ b/src/MACHDYN/fix_smd_integrate_ulsph.h @@ -38,11 +38,12 @@ namespace LAMMPS_NS { class FixSMDIntegrateUlsph : public Fix { public: FixSMDIntegrateUlsph(class LAMMPS *, int, char **); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - void reset_dt(); + + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; private: class NeighList *list; diff --git a/src/MACHDYN/fix_smd_move_triangulated_surface.h b/src/MACHDYN/fix_smd_move_triangulated_surface.h index e64d2fc409..4ffc3dcc0f 100644 --- a/src/MACHDYN/fix_smd_move_triangulated_surface.h +++ b/src/MACHDYN/fix_smd_move_triangulated_surface.h @@ -39,13 +39,13 @@ namespace LAMMPS_NS { class FixSMDMoveTriSurf : public Fix { public: FixSMDMoveTriSurf(class LAMMPS *, int, char **); - ~FixSMDMoveTriSurf() = default; - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - void reset_dt(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + + int setmask() override; + void init() override; + void initial_integrate(int) override; + void reset_dt() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: double dtv; diff --git a/src/MACHDYN/fix_smd_setvel.h b/src/MACHDYN/fix_smd_setvel.h index 1e91a8d602..30071d0875 100644 --- a/src/MACHDYN/fix_smd_setvel.h +++ b/src/MACHDYN/fix_smd_setvel.h @@ -38,15 +38,15 @@ namespace LAMMPS_NS { class FixSMDSetVel : public Fix { public: FixSMDSetVel(class LAMMPS *, int, char **); - ~FixSMDSetVel(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); + ~FixSMDSetVel() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; //void initial_integrate(int); - void post_force(int); - double compute_vector(int); - double memory_usage(); + void post_force(int) override; + double compute_vector(int) override; + double memory_usage() override; private: double xvalue, yvalue, zvalue; diff --git a/src/MACHDYN/fix_smd_tlsph_reference_configuration.h b/src/MACHDYN/fix_smd_tlsph_reference_configuration.h index 98108b8ffd..45ec11b6b5 100644 --- a/src/MACHDYN/fix_smd_tlsph_reference_configuration.h +++ b/src/MACHDYN/fix_smd_tlsph_reference_configuration.h @@ -43,23 +43,24 @@ class FixSMD_TLSPH_ReferenceConfiguration : public Fix { public: FixSMD_TLSPH_ReferenceConfiguration(class LAMMPS *, int, char **); - ~FixSMD_TLSPH_ReferenceConfiguration(); - int setmask(); - void init(); - void setup(int); - void pre_exchange(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~FixSMD_TLSPH_ReferenceConfiguration() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + int setmask() override; + void init() override; + void setup(int) override; + void pre_exchange() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; bool crack_exclude(int i, int j); bool get_line_intersection(int i, int j); diff --git a/src/MACHDYN/fix_smd_wall_surface.h b/src/MACHDYN/fix_smd_wall_surface.h index 74d7784eee..07d0436417 100644 --- a/src/MACHDYN/fix_smd_wall_surface.h +++ b/src/MACHDYN/fix_smd_wall_surface.h @@ -28,11 +28,12 @@ class FixSMDWallSurface : public Fix { public: FixSMDWallSurface(class LAMMPS *, int, char **); - virtual ~FixSMDWallSurface(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); + ~FixSMDWallSurface() override; + + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; void read_triangles(int pass); diff --git a/src/MACHDYN/pair_smd_hertz.h b/src/MACHDYN/pair_smd_hertz.h index b736764de3..75bcfa9dca 100644 --- a/src/MACHDYN/pair_smd_hertz.h +++ b/src/MACHDYN/pair_smd_hertz.h @@ -38,15 +38,15 @@ namespace LAMMPS_NS { class PairHertz : public Pair { public: PairHertz(class LAMMPS *); - virtual ~PairHertz(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); - void init_list(int, class NeighList *); - virtual double memory_usage(); - void *extract(const char *, int &); + ~PairHertz() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double memory_usage() override; + void *extract(const char *, int &) override; protected: double **bulkmodulus; diff --git a/src/MACHDYN/pair_smd_tlsph.h b/src/MACHDYN/pair_smd_tlsph.h index 0950430ca0..e58f51fe76 100644 --- a/src/MACHDYN/pair_smd_tlsph.h +++ b/src/MACHDYN/pair_smd_tlsph.h @@ -39,21 +39,21 @@ namespace LAMMPS_NS { class PairTlsph : public Pair { public: PairTlsph(class LAMMPS *); - virtual ~PairTlsph(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); - void init_list(int, class NeighList *); - void write_restart_settings(FILE *) {} - void read_restart_settings(FILE *) {} - virtual double memory_usage(); + ~PairTlsph() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void init_list(int, class NeighList *) override; + void write_restart_settings(FILE *) override {} + void read_restart_settings(FILE *) override {} + double memory_usage() override; void compute_shape_matrix(); void material_model(); - void *extract(const char *, int &); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + void *extract(const char *, int &) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; void AssembleStress(); void PreCompute(); diff --git a/src/MACHDYN/pair_smd_triangulated_surface.h b/src/MACHDYN/pair_smd_triangulated_surface.h index 57865e7983..ebb04870b8 100644 --- a/src/MACHDYN/pair_smd_triangulated_surface.h +++ b/src/MACHDYN/pair_smd_triangulated_surface.h @@ -39,19 +39,19 @@ namespace LAMMPS_NS { class PairTriSurf : public Pair { public: PairTriSurf(class LAMMPS *); - virtual ~PairTriSurf(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); - void init_list(int, class NeighList *); - virtual double memory_usage(); + ~PairTriSurf() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double memory_usage() override; void PointTriangleDistance(const Eigen::Vector3d P, const Eigen::Vector3d TRI1, const Eigen::Vector3d TRI2, const Eigen::Vector3d TRI3, Eigen::Vector3d &CP, double &dist); double clamp(const double a, const double min, const double max); - void *extract(const char *, int &); + void *extract(const char *, int &) override; protected: double **bulkmodulus; diff --git a/src/MACHDYN/pair_smd_ulsph.h b/src/MACHDYN/pair_smd_ulsph.h index 6d58168b5a..12fd018738 100644 --- a/src/MACHDYN/pair_smd_ulsph.h +++ b/src/MACHDYN/pair_smd_ulsph.h @@ -39,18 +39,18 @@ namespace LAMMPS_NS { class PairULSPH : public Pair { public: PairULSPH(class LAMMPS *); - virtual ~PairULSPH(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); - void init_list(int, class NeighList *); - virtual double memory_usage(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~PairULSPH() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double memory_usage() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; void AssembleStressTensor(); - void *extract(const char *, int &); + void *extract(const char *, int &) override; void PreCompute(); void PreCompute_DensitySummation(); double effective_shear_modulus(const Eigen::Matrix3d d_dev, const Eigen::Matrix3d deltaStressDev, diff --git a/src/MAKE/MACHINES/Makefile.white b/src/MAKE/MACHINES/Makefile.crusher_kokkos similarity index 85% rename from src/MAKE/MACHINES/Makefile.white rename to src/MAKE/MACHINES/Makefile.crusher_kokkos index cb101998b3..7dc1447d4e 100644 --- a/src/MAKE/MACHINES/Makefile.white +++ b/src/MAKE/MACHINES/Makefile.crusher_kokkos @@ -1,4 +1,4 @@ -# white = KOKKOS/CUDA package, OpenMPI with nvcc compiler, Pascal GPU, Power8 CPU +# crusher_kokkos = KOKKOS/HIP, AMD MI250X GPU and AMD EPYC 7A53 "Optimized 3rd Gen EPYC" CPU, Cray MPICH, hipcc compiler SHELL = /bin/sh @@ -7,13 +7,13 @@ SHELL = /bin/sh # specify flags and libraries needed for your compiler KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) -export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper -CC = mpicxx -CCFLAGS = -g -O3 + +CC = hipcc +CCFLAGS = -g -O3 -munsafe-fp-atomics -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M -LINK = mpicxx +LINK = hipcc LINKFLAGS = -g -O3 LIB = SIZE = size @@ -21,8 +21,8 @@ SIZE = size ARCHIVE = ar ARFLAGS = -rc SHLIBFLAGS = -shared -KOKKOS_DEVICES = Cuda -KOKKOS_ARCH = Pascal60,Power8 +KOKKOS_DEVICES = HIP +KOKKOS_ARCH = Zen3,Vega90A # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL @@ -43,9 +43,9 @@ LMP_INC = -DLAMMPS_GZIP # PATH = path for MPI library # LIB = name of MPI library -MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 +MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I${MPICH_DIR}/include MPI_PATH = -MPI_LIB = +MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa # FFT library # see discussion in Section 3.5.2 of manual @@ -69,11 +69,6 @@ JPG_INC = JPG_PATH = JPG_LIB = -# library for loading shared objects (defaults to -ldl, should be empty on Windows) -# uncomment to change the default - -# override DYN_LIB = - # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -83,7 +78,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) @@ -123,6 +118,6 @@ depend : fastdep.exe $(SRC) @./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1 fastdep.exe: ../DEPEND/fastdep.c - gcc -O -o $@ $< + cc -O -o $@ $< sinclude .depend diff --git a/src/MAKE/MACHINES/Makefile.spock_kokkos b/src/MAKE/MACHINES/Makefile.spock_kokkos new file mode 100644 index 0000000000..a85ebb3039 --- /dev/null +++ b/src/MAKE/MACHINES/Makefile.spock_kokkos @@ -0,0 +1,123 @@ +# spock_kokkos = KOKKOS/HIP, AMD MI100 GPU and AMD EPYC 7662 "Rome" CPU, Cray MPICH, hipcc compiler + +SHELL = /bin/sh + +# --------------------------------------------------------------------- +# compiler/linker settings +# specify flags and libraries needed for your compiler + +KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) + +CC = hipcc +CCFLAGS = -g -O3 -DNDEBUG +SHFLAGS = -fPIC +DEPFLAGS = -M + +LINK = hipcc +LINKFLAGS = -g -O3 +LIB = +SIZE = size + +ARCHIVE = ar +ARFLAGS = -rc +SHLIBFLAGS = -shared +KOKKOS_DEVICES = HIP +KOKKOS_ARCH = Zen2,Vega908 + +# --------------------------------------------------------------------- +# LAMMPS-specific settings, all OPTIONAL +# specify settings for LAMMPS features you will use +# if you change any -D setting, do full re-compile after "make clean" + +# LAMMPS ifdef settings +# see possible settings in Section 3.5 of the manual + +LMP_INC = -DLAMMPS_GZIP + +# MPI library +# see discussion in Section 3.4 of the manual +# MPI wrapper compiler/linker can provide this info +# can point to dummy MPI library in src/STUBS as in Makefile.serial +# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts +# INC = path for mpi.h, MPI compiler settings +# PATH = path for MPI library +# LIB = name of MPI library + +MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I${MPICH_DIR}/include +MPI_PATH = +MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa + +# FFT library +# see discussion in Section 3.5.2 of manual +# can be left blank to use provided KISS FFT library +# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings +# PATH = path for FFT library +# LIB = name of FFT library + +FFT_INC = +FFT_PATH = +FFT_LIB = + +# JPEG and/or PNG library +# see discussion in Section 3.5.4 of manual +# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC +# INC = path(s) for jpeglib.h and/or png.h +# PATH = path(s) for JPEG library and/or PNG library +# LIB = name(s) of JPEG library and/or PNG library + +JPG_INC = +JPG_PATH = +JPG_LIB = + +# --------------------------------------------------------------------- +# build rules and dependencies +# do not edit this section + +include Makefile.package.settings +include Makefile.package + +EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) +EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) +EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) + +# Path to src files + +vpath %.cpp .. +vpath %.h .. + +# Link target + +$(EXE): main.o $(LMPLIB) $(EXTRA_LINK_DEPENDS) + $(LINK) $(LINKFLAGS) main.o $(EXTRA_PATH) $(LMPLINK) $(EXTRA_LIB) $(LIB) -o $@ + $(SIZE) $@ + +# Library targets + +$(ARLIB): $(OBJ) $(EXTRA_LINK_DEPENDS) + @rm -f ../$(ARLIB) + $(ARCHIVE) $(ARFLAGS) ../$(ARLIB) $(OBJ) + @rm -f $(ARLIB) + @ln -s ../$(ARLIB) $(ARLIB) + +$(SHLIB): $(OBJ) $(EXTRA_LINK_DEPENDS) + $(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o ../$(SHLIB) \ + $(OBJ) $(EXTRA_LIB) $(LIB) + @rm -f $(SHLIB) + @ln -s ../$(SHLIB) $(SHLIB) + +# Compilation rules + +%.o:%.cpp + $(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $< + +# Individual dependencies + +depend : fastdep.exe $(SRC) + @./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1 + +fastdep.exe: ../DEPEND/fastdep.c + cc -O -o $@ $< + +sinclude .depend diff --git a/src/MAKE/MACHINES/Makefile.summit_kokkos b/src/MAKE/MACHINES/Makefile.summit_kokkos index 87f8c75da2..f22b27cc74 100644 --- a/src/MAKE/MACHINES/Makefile.summit_kokkos +++ b/src/MAKE/MACHINES/Makefile.summit_kokkos @@ -9,7 +9,7 @@ SHELL = /bin/sh KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) CC = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper -CCFLAGS = -g -O3 +CCFLAGS = -g -O3 -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi index cb3ef0e442..42a8236c7c 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi +++ b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi @@ -10,7 +10,7 @@ KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) export MPICH_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper CC = mpicxx -CCFLAGS = -g -O3 +CCFLAGS = -g -O3 -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only b/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only index 6d5e8d779e..0adb53eef0 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only +++ b/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only @@ -7,7 +7,7 @@ SHELL = /bin/sh # specify flags and libraries needed for your compiler CC = mpicxx -CCFLAGS = -g -O3 +CCFLAGS = -g -O3 -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_omp b/src/MAKE/OPTIONS/Makefile.kokkos_omp index e505da8ae2..82144652dd 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_omp +++ b/src/MAKE/OPTIONS/Makefile.kokkos_omp @@ -7,7 +7,7 @@ SHELL = /bin/sh # specify flags and libraries needed for your compiler CC = mpicxx -CCFLAGS = -g -O3 +CCFLAGS = -g -O3 -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_phi b/src/MAKE/OPTIONS/Makefile.kokkos_phi index b825ad691a..9d5691251c 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_phi +++ b/src/MAKE/OPTIONS/Makefile.kokkos_phi @@ -7,7 +7,7 @@ SHELL = /bin/sh # specify flags and libraries needed for your compiler CC = mpicxx -CCFLAGS = -g -O3 +CCFLAGS = -g -O3 -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M diff --git a/src/MANIFOLD/fix_manifoldforce.h b/src/MANIFOLD/fix_manifoldforce.h index d58fe6001b..58822614a9 100644 --- a/src/MANIFOLD/fix_manifoldforce.h +++ b/src/MANIFOLD/fix_manifoldforce.h @@ -52,13 +52,13 @@ namespace user_manifold { class FixManifoldForce : public Fix { public: FixManifoldForce(class LAMMPS *, int, char **); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; private: user_manifold::manifold *ptr_m; diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.h b/src/MANIFOLD/fix_nve_manifold_rattle.h index e2bf6b5639..91fb17aec1 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.h +++ b/src/MANIFOLD/fix_nve_manifold_rattle.h @@ -66,18 +66,18 @@ class FixNVEManifoldRattle : public Fix { }; FixNVEManifoldRattle(LAMMPS *, int &, char **, int = 1); - virtual ~FixNVEManifoldRattle(); + ~FixNVEManifoldRattle() override; // All this stuff is interface, so you DO need to implement them. // Just delegate them to the workhorse classes. - virtual int setmask(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void init(); - virtual void reset_dt(); - virtual void end_of_step(); - virtual int dof(int); - virtual void setup(int) {} // Not needed for fixNVE but is for fixNVT - virtual double memory_usage(); + int setmask() override; + void initial_integrate(int) override; + void final_integrate() override; + void init() override; + void reset_dt() override; + void end_of_step() override; + int dof(int) override; + void setup(int) override {} // Not needed for fixNVE but is for fixNVT + double memory_usage() override; protected: int nevery, next_output; diff --git a/src/MANIFOLD/fix_nvt_manifold_rattle.h b/src/MANIFOLD/fix_nvt_manifold_rattle.h index d8439b1ad0..6a4d9d7b33 100644 --- a/src/MANIFOLD/fix_nvt_manifold_rattle.h +++ b/src/MANIFOLD/fix_nvt_manifold_rattle.h @@ -53,15 +53,15 @@ namespace LAMMPS_NS { class FixNVTManifoldRattle : public FixNVEManifoldRattle { public: FixNVTManifoldRattle(LAMMPS *, int, char **, int = 1); - virtual ~FixNVTManifoldRattle(); + ~FixNVTManifoldRattle() override; - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void init(); - virtual void reset_dt(); - virtual int setmask(); - virtual void setup(int); // Not needed for fixNVE but is for fixNVT - virtual double memory_usage(); + void initial_integrate(int) override; + void final_integrate() override; + void init() override; + void reset_dt() override; + int setmask() override; + void setup(int) override; // Not needed for fixNVE but is for fixNVT + double memory_usage() override; protected: void compute_temp_target(); diff --git a/src/MANIFOLD/manifold.h b/src/MANIFOLD/manifold.h index 92a5a02222..5cabe459b2 100644 --- a/src/MANIFOLD/manifold.h +++ b/src/MANIFOLD/manifold.h @@ -47,7 +47,7 @@ namespace user_manifold { class manifold : protected Pointers { public: manifold(class LAMMPS *lmp) : Pointers(lmp), params(nullptr) {} - virtual ~manifold() { delete[] params; } + ~manifold() override { delete[] params; } virtual double g(const double *) = 0; virtual void n(const double *, double *) = 0; diff --git a/src/MANIFOLD/manifold_cylinder.h b/src/MANIFOLD/manifold_cylinder.h index a8393a9768..cff6dab4ce 100644 --- a/src/MANIFOLD/manifold_cylinder.h +++ b/src/MANIFOLD/manifold_cylinder.h @@ -26,13 +26,12 @@ namespace user_manifold { public: enum { NPARAMS = 1 }; // Number of parameters. manifold_cylinder(LAMMPS *lmp, int, char **); - virtual ~manifold_cylinder() {} - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "cylinder"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_cylinder_dent.h b/src/MANIFOLD/manifold_cylinder_dent.h index f6ec6dfea9..4f0251455c 100644 --- a/src/MANIFOLD/manifold_cylinder_dent.h +++ b/src/MANIFOLD/manifold_cylinder_dent.h @@ -24,13 +24,12 @@ namespace user_manifold { public: manifold_cylinder_dent(LAMMPS *lmp, int, char **); enum { NPARAMS = 3 }; // Number of parameters. - virtual ~manifold_cylinder_dent() {} - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "cylinder/dent"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_dumbbell.h b/src/MANIFOLD/manifold_dumbbell.h index 47a4961fd3..69ccbda875 100644 --- a/src/MANIFOLD/manifold_dumbbell.h +++ b/src/MANIFOLD/manifold_dumbbell.h @@ -25,15 +25,14 @@ namespace user_manifold { public: enum { NPARAMS = 4 }; // Number of parameters. manifold_dumbbell(LAMMPS *lmp, int, char **); - virtual ~manifold_dumbbell() {} - virtual double g(const double *x); - virtual void n(const double *x, double *nn); + double g(const double *x) override; + void n(const double *x, double *nn) override; static const char *type() { return "dumbbell"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_ellipsoid.h b/src/MANIFOLD/manifold_ellipsoid.h index 6bc9d97690..791b409074 100644 --- a/src/MANIFOLD/manifold_ellipsoid.h +++ b/src/MANIFOLD/manifold_ellipsoid.h @@ -24,14 +24,13 @@ namespace user_manifold { public: enum { NPARAMS = 3 }; manifold_ellipsoid(LAMMPS *lmp, int, char **); - virtual ~manifold_ellipsoid() {} - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "ellipsoid"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_gaussian_bump.h b/src/MANIFOLD/manifold_gaussian_bump.h index 4671b189df..854a94f1a1 100644 --- a/src/MANIFOLD/manifold_gaussian_bump.h +++ b/src/MANIFOLD/manifold_gaussian_bump.h @@ -51,19 +51,19 @@ namespace user_manifold { public: enum { NPARAMS = 4 }; manifold_gaussian_bump(class LAMMPS *, int, char **); - virtual ~manifold_gaussian_bump(); + ~manifold_gaussian_bump() override; - virtual double g(const double *); - virtual void n(const double *, double *); + double g(const double *) override; + void n(const double *, double *) override; // Variant of g that computes n at the same time. - virtual double g_and_n(const double *x, double *nn); + double g_and_n(const double *x, double *nn) override; static const char *type() { return "gaussian_bump"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } - virtual int nparams() { return NPARAMS; } - virtual void post_param_init(); + int nparams() override { return NPARAMS; } + void post_param_init() override; private: // Some private constants: diff --git a/src/MANIFOLD/manifold_plane.h b/src/MANIFOLD/manifold_plane.h index 3ee70186fd..fc4dfa0514 100644 --- a/src/MANIFOLD/manifold_plane.h +++ b/src/MANIFOLD/manifold_plane.h @@ -25,13 +25,12 @@ namespace user_manifold { public: enum { NPARAMS = 6 }; // Number of parameters. manifold_plane(LAMMPS *lmp, int, char **); - virtual ~manifold_plane() {} - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "plane"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_plane_wiggle.h b/src/MANIFOLD/manifold_plane_wiggle.h index 895dd54e90..4d1ab2845d 100644 --- a/src/MANIFOLD/manifold_plane_wiggle.h +++ b/src/MANIFOLD/manifold_plane_wiggle.h @@ -25,13 +25,12 @@ namespace user_manifold { public: enum { NPARAMS = 2 }; // Number of parameters. manifold_plane_wiggle(LAMMPS *lmp, int, char **); - virtual ~manifold_plane_wiggle() {} - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "plane/wiggle"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_sphere.h b/src/MANIFOLD/manifold_sphere.h index 18ca828c92..e8ba801476 100644 --- a/src/MANIFOLD/manifold_sphere.h +++ b/src/MANIFOLD/manifold_sphere.h @@ -26,15 +26,14 @@ namespace user_manifold { enum { NPARAMS = 1 }; manifold_sphere(LAMMPS *lmp, int, char **) : manifold(lmp) {} - virtual ~manifold_sphere() {} - virtual double g(const double *x) + double g(const double *x) override { double R = params[0]; double r2 = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]; return r2 - R * R; } - virtual double g_and_n(const double *x, double *nn) + double g_and_n(const double *x, double *nn) override { double R = params[0]; double r2 = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]; @@ -45,7 +44,7 @@ namespace user_manifold { return r2 - R * R; } - virtual void n(const double *x, double *nn) + void n(const double *x, double *nn) override { nn[0] = 2 * x[0]; nn[1] = 2 * x[1]; @@ -59,9 +58,9 @@ namespace user_manifold { } static const char *type() { return "sphere"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_spine.h b/src/MANIFOLD/manifold_spine.h index 3fb0640185..2ea9f5b051 100644 --- a/src/MANIFOLD/manifold_spine.h +++ b/src/MANIFOLD/manifold_spine.h @@ -25,16 +25,15 @@ namespace user_manifold { public: enum { NPARAMS = 5 }; // Number of parameters. manifold_spine(LAMMPS *lmp, int, char **); - virtual ~manifold_spine() {} - virtual double g(const double *x); - virtual void n(const double *x, double *nn); - virtual double g_and_n(const double *x, double *nn); + double g(const double *x) override; + void n(const double *x, double *nn) override; + double g_and_n(const double *x, double *nn) override; static const char *type() { return "spine"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } protected: int power; @@ -45,7 +44,7 @@ namespace user_manifold { manifold_spine_two(LAMMPS *lmp, int, char **); static const char *type() { return "spine/two"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_supersphere.h b/src/MANIFOLD/manifold_supersphere.h index 9949def311..11c0a3fd1e 100644 --- a/src/MANIFOLD/manifold_supersphere.h +++ b/src/MANIFOLD/manifold_supersphere.h @@ -26,11 +26,9 @@ namespace user_manifold { enum { NPARAMS = 2 }; manifold_supersphere(LAMMPS *lmp, int, char **) : manifold(lmp) {} - virtual ~manifold_supersphere() {} - double my_sign(double a) { return (a > 0) - (a < 0); } - virtual double g(const double *x) + double g(const double *x) override { double R = params[0]; double q = params[1]; @@ -43,7 +41,7 @@ namespace user_manifold { return rr - pow(R, q); } - virtual void n(const double *x, double *nn) + void n(const double *x, double *nn) override { double q = params[1]; double xx = fabs(x[0]); @@ -56,9 +54,9 @@ namespace user_manifold { } static const char *type() { return "supersphere"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANIFOLD/manifold_thylakoid.h b/src/MANIFOLD/manifold_thylakoid.h index 0236c3bf54..01b54ed108 100644 --- a/src/MANIFOLD/manifold_thylakoid.h +++ b/src/MANIFOLD/manifold_thylakoid.h @@ -26,17 +26,17 @@ namespace user_manifold { public: enum { NPARAMS = 3 }; manifold_thylakoid(LAMMPS *lmp, int, char **); - virtual ~manifold_thylakoid(); + ~manifold_thylakoid() override; - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "thylakoid"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } - virtual void post_param_init(); + void post_param_init() override; private: void init_domains(); diff --git a/src/MANIFOLD/manifold_torus.h b/src/MANIFOLD/manifold_torus.h index b706038bc8..8155d79b27 100644 --- a/src/MANIFOLD/manifold_torus.h +++ b/src/MANIFOLD/manifold_torus.h @@ -24,14 +24,13 @@ namespace user_manifold { public: enum { NPARAMS = 2 }; manifold_torus(LAMMPS *, int, char **); - ~manifold_torus() {} - virtual double g(const double *x); - virtual void n(const double *x, double *n); + double g(const double *x) override; + void n(const double *x, double *n) override; static const char *type() { return "torus"; } - virtual const char *id() { return type(); } + const char *id() override { return type(); } static int expected_argc() { return NPARAMS; } - virtual int nparams() { return NPARAMS; } + int nparams() override { return NPARAMS; } }; } // namespace user_manifold diff --git a/src/MANYBODY/fix_qeq_comb.h b/src/MANYBODY/fix_qeq_comb.h index 320691b7b0..554d5c847b 100644 --- a/src/MANYBODY/fix_qeq_comb.h +++ b/src/MANYBODY/fix_qeq_comb.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixQEQComb : public Fix { public: FixQEQComb(class LAMMPS *, int, char **); - virtual ~FixQEQComb(); - int setmask(); - virtual void init(); - void setup(int); - virtual void post_force(int); - void post_force_respa(int, int, int); - double memory_usage(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~FixQEQComb() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double memory_usage() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; - void min_post_force(int); + void min_post_force(int) override; protected: int me, firstflag; diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index aed241554b..9cec1f0460 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -19,20 +19,18 @@ #include "pair_adp.h" -#include - -#include #include "atom.h" -#include "force.h" #include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neighbor.h" #include "neigh_list.h" -#include "memory.h" -#include "error.h" - -#include "tokenizer.h" #include "potential_file_reader.h" +#include +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_adp.h b/src/MANYBODY/pair_adp.h index 3740b214ed..06db6ed5a3 100644 --- a/src/MANYBODY/pair_adp.h +++ b/src/MANYBODY/pair_adp.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairADP : public Pair { public: PairADP(class LAMMPS *); - virtual ~PairADP(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairADP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; protected: int nmax; // allocated size of per-atom arrays diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index fc511b7bb0..2063cf75c1 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -29,13 +29,13 @@ namespace LAMMPS_NS { class PairAIREBO : public Pair { public: PairAIREBO(class LAMMPS *); - virtual ~PairAIREBO(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + ~PairAIREBO() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code diff --git a/src/MANYBODY/pair_airebo_morse.h b/src/MANYBODY/pair_airebo_morse.h index fe2e61440a..d5662d8aa4 100644 --- a/src/MANYBODY/pair_airebo_morse.h +++ b/src/MANYBODY/pair_airebo_morse.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairAIREBOMorse : public PairAIREBO { public: PairAIREBOMorse(class LAMMPS *); - void settings(int, char **); + void settings(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_atm.h b/src/MANYBODY/pair_atm.h index 8370e08aec..20836751b6 100644 --- a/src/MANYBODY/pair_atm.h +++ b/src/MANYBODY/pair_atm.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PairATM : public Pair { public: PairATM(class LAMMPS *); - virtual ~PairATM(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + ~PairATM() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; protected: double cut_global, cut_triple; diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 397259ee21..ebb576dcc9 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -50,7 +50,6 @@ #include "neighbor.h" #include "potential_file_reader.h" #include "tabular_function.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_bop.h b/src/MANYBODY/pair_bop.h index 53ad7ceace..baffe74846 100644 --- a/src/MANYBODY/pair_bop.h +++ b/src/MANYBODY/pair_bop.h @@ -34,13 +34,13 @@ class PairBOP : public Pair { public: PairBOP(class LAMMPS *); - virtual ~PairBOP(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + ~PairBOP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; private: struct PairParameters { diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 75906cd7df..9db55ec158 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -35,7 +35,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_comb.h b/src/MANYBODY/pair_comb.h index 580a737b9a..6a456f6eb0 100644 --- a/src/MANYBODY/pair_comb.h +++ b/src/MANYBODY/pair_comb.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class PairComb : public Pair { public: PairComb(class LAMMPS *); - virtual ~PairComb(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + ~PairComb() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; virtual double yasu_char(double *, int &); double enegtot; @@ -137,10 +137,10 @@ class PairComb : public Pair { void qfo_field(Param *, double, double, double, double &, double &); void qsolve(double *); void Over_cor(Param *, double, int, double &, double &); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; void Short_neigh(); }; diff --git a/src/MANYBODY/pair_comb3.h b/src/MANYBODY/pair_comb3.h index 946b6c5b0e..f7a8f1abac 100644 --- a/src/MANYBODY/pair_comb3.h +++ b/src/MANYBODY/pair_comb3.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class PairComb3 : public Pair { public: PairComb3(class LAMMPS *); - virtual ~PairComb3(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + ~PairComb3() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; virtual double combqeq(double *, int &); double enegtot; @@ -221,10 +221,10 @@ class PairComb3 : public Pair { double, double, double, double, int, int, double &, double &, double *); // communication functions - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 7dae6c1571..470fed6257 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -18,20 +18,18 @@ #include "pair_eam.h" -#include - -#include #include "atom.h" -#include "force.h" #include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neighbor.h" #include "neigh_list.h" -#include "memory.h" -#include "error.h" +#include "potential_file_reader.h" #include "update.h" -#include "tokenizer.h" -#include "potential_file_reader.h" +#include +#include using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_eam.h b/src/MANYBODY/pair_eam.h index 2b206689d6..a3f5708273 100644 --- a/src/MANYBODY/pair_eam.h +++ b/src/MANYBODY/pair_eam.h @@ -45,21 +45,21 @@ class PairEAM : public Pair { double ***rhor_spline, ***frho_spline, ***z2r_spline; PairEAM(class LAMMPS *); - virtual ~PairEAM(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairEAM() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); - void swap_eam(double *, double **); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; + void swap_eam(double *, double **) override; protected: int nmax; // allocated size of per-atom arrays diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index 7fc9b2c7b1..48ea955be1 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -23,7 +23,6 @@ #include "error.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include diff --git a/src/MANYBODY/pair_eam_alloy.h b/src/MANYBODY/pair_eam_alloy.h index d3b7880a4d..b8d53aac00 100644 --- a/src/MANYBODY/pair_eam_alloy.h +++ b/src/MANYBODY/pair_eam_alloy.h @@ -29,12 +29,11 @@ namespace LAMMPS_NS { class PairEAMAlloy : virtual public PairEAM { public: PairEAMAlloy(class LAMMPS *); - virtual ~PairEAMAlloy() {} - void coeff(int, char **); + void coeff(int, char **) override; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index 46d439b879..4cbb3fd1d1 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -29,7 +29,6 @@ #include "tokenizer.h" #include -#include using namespace LAMMPS_NS; @@ -499,11 +498,16 @@ void PairEAMCD::read_h_coeff(char *filename) // Seek to end of file, read last part into a buffer and // then skip over lines in buffer until reaching the end. - platform::fseek(fptr, platform::END_OF_FILE); - platform::fseek(fptr, platform::ftell(fptr) - MAXLINE); + if ( (platform::fseek(fptr, platform::END_OF_FILE) < 0) + || (platform::fseek(fptr, platform::ftell(fptr) - MAXLINE) < 0)) + error->one(FLERR,"Failure to seek to end-of-file for reading h(x) coeffs: {}", + utils::getsyserror()); + char *buf = new char[MAXLINE+1]; - fread(buf, 1, MAXLINE, fptr); - buf[MAXLINE] = '\0'; // must 0-terminate buffer for string processing + auto rv = fread(buf,1,MAXLINE,fptr); + if (rv == 0) error->one(FLERR,"Failure to read h(x) coeffs: {}", utils::getsyserror()); + buf[rv] = '\0'; // must 0-terminate buffer for string processing + Tokenizer lines(buf, "\n"); delete[] buf; diff --git a/src/MANYBODY/pair_eam_cd.h b/src/MANYBODY/pair_eam_cd.h index 6846a6cd76..f7967d7fb6 100644 --- a/src/MANYBODY/pair_eam_cd.h +++ b/src/MANYBODY/pair_eam_cd.h @@ -31,24 +31,24 @@ class PairEAMCD : public PairEAMAlloy { PairEAMCD(class LAMMPS *, int cdeamVersion); /// Destructor. - virtual ~PairEAMCD(); + ~PairEAMCD() override; /// Calculates the energies and forces for all atoms in the system. - virtual void compute(int, int); + void compute(int, int) override; /// Parses the pair_coeff command parameters for this pair style. - void coeff(int, char **); + void coeff(int, char **) override; /// This is for MPI communication with neighbor nodes. - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; /// Reports the memory usage of this pair style to LAMMPS. - double memory_usage(); + double memory_usage() override; - void *extract(const char *, int &) { return nullptr; } + void *extract(const char *, int &) override { return nullptr; } /// Parses the coefficients of the h polynomial from the end of the EAM file. void read_h_coeff(char *filename); diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index cf552995d0..b449b20f7e 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -23,7 +23,6 @@ #include "error.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include diff --git a/src/MANYBODY/pair_eam_fs.h b/src/MANYBODY/pair_eam_fs.h index 7683b92bc3..6b6fcb1905 100644 --- a/src/MANYBODY/pair_eam_fs.h +++ b/src/MANYBODY/pair_eam_fs.h @@ -29,12 +29,12 @@ namespace LAMMPS_NS { class PairEAMFS : virtual public PairEAM { public: PairEAMFS(class LAMMPS *); - virtual ~PairEAMFS() {} - void coeff(int, char **); + + void coeff(int, char **) override; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; int he_flag; }; diff --git a/src/MANYBODY/pair_eam_he.h b/src/MANYBODY/pair_eam_he.h index eaa86d8e8f..38f7fc3dbd 100644 --- a/src/MANYBODY/pair_eam_he.h +++ b/src/MANYBODY/pair_eam_he.h @@ -27,10 +27,9 @@ namespace LAMMPS_NS { class PairEAMHE : public PairEAMFS { public: PairEAMHE(class LAMMPS *); - virtual ~PairEAMHE() {} protected: - void compute(int, int); + void compute(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_edip.cpp b/src/MANYBODY/pair_edip.cpp index af2314b8b9..24a7391c92 100644 --- a/src/MANYBODY/pair_edip.cpp +++ b/src/MANYBODY/pair_edip.cpp @@ -31,9 +31,11 @@ #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" +#include "potential_file_reader.h" #include #include +#include #include using namespace LAMMPS_NS; @@ -368,7 +370,7 @@ void PairEDIP::compute(int eflag, int vflag) directorCos_ik_z = invR_ik * dr_ik[2]; cosTeta = directorCos_ij_x * directorCos_ik_x + directorCos_ij_y * directorCos_ik_y + - directorCos_ij_z * directorCos_ik_z; + directorCos_ij_z * directorCos_ik_z; cosTetaDiff = cosTeta + tauFunction; cosTetaDiffCosTetaDiff = cosTetaDiff * cosTetaDiff; @@ -376,33 +378,33 @@ void PairEDIP::compute(int eflag, int vflag) expMinusQFunctionCosTetaDiffCosTetaDiff = exp(-qFunctionCosTetaDiffCosTetaDiff); potentia3B_factor = lambda * - ((1.0 - expMinusQFunctionCosTetaDiffCosTetaDiff) + - eta * qFunctionCosTetaDiffCosTetaDiff); + ((1.0 - expMinusQFunctionCosTetaDiffCosTetaDiff) + + eta * qFunctionCosTetaDiffCosTetaDiff); exp3B_ik = preExp3B_ij[neighbor_k]; exp3BDerived_ik = preExp3BDerived_ij[neighbor_k]; forceMod3B_factor1_ij = -exp3BDerived_ij * exp3B_ik * potentia3B_factor; forceMod3B_factor2 = 2.0 * lambda * exp3B_ij * exp3B_ik * qFunction * cosTetaDiff * - (eta + expMinusQFunctionCosTetaDiffCosTetaDiff); + (eta + expMinusQFunctionCosTetaDiffCosTetaDiff); forceMod3B_factor2_ij = forceMod3B_factor2 * invR_ij; f_ij[0] = forceMod3B_factor1_ij * directorCos_ij_x + - forceMod3B_factor2_ij * (cosTeta * directorCos_ij_x - directorCos_ik_x); + forceMod3B_factor2_ij * (cosTeta * directorCos_ij_x - directorCos_ik_x); f_ij[1] = forceMod3B_factor1_ij * directorCos_ij_y + - forceMod3B_factor2_ij * (cosTeta * directorCos_ij_y - directorCos_ik_y); + forceMod3B_factor2_ij * (cosTeta * directorCos_ij_y - directorCos_ik_y); f_ij[2] = forceMod3B_factor1_ij * directorCos_ij_z + - forceMod3B_factor2_ij * (cosTeta * directorCos_ij_z - directorCos_ik_z); + forceMod3B_factor2_ij * (cosTeta * directorCos_ij_z - directorCos_ik_z); forceMod3B_factor1_ik = -exp3BDerived_ik * exp3B_ij * potentia3B_factor; forceMod3B_factor2_ik = forceMod3B_factor2 * invR_ik; f_ik[0] = forceMod3B_factor1_ik * directorCos_ik_x + - forceMod3B_factor2_ik * (cosTeta * directorCos_ik_x - directorCos_ij_x); + forceMod3B_factor2_ik * (cosTeta * directorCos_ik_x - directorCos_ij_x); f_ik[1] = forceMod3B_factor1_ik * directorCos_ik_y + - forceMod3B_factor2_ik * (cosTeta * directorCos_ik_y - directorCos_ij_y); + forceMod3B_factor2_ik * (cosTeta * directorCos_ik_y - directorCos_ij_y); f_ik[2] = forceMod3B_factor1_ik * directorCos_ik_z + - forceMod3B_factor2_ik * (cosTeta * directorCos_ik_z - directorCos_ij_z); + forceMod3B_factor2_ik * (cosTeta * directorCos_ik_z - directorCos_ij_z); forceModCoord += (forceMod3B_factor2 * (tauFunctionDerived - 0.5 * mu * cosTetaDiff)); @@ -765,136 +767,92 @@ double PairEDIP::init_one(int i, int j) void PairEDIP::read_file(char *file) { - int params_per_line = 20; - char **words = new char *[params_per_line + 1]; - memory->sfree(params); params = nullptr; nparams = maxparam = 0; // open file on proc 0 - FILE *fp; if (comm->me == 0) { - fp = utils::open_potential(file, lmp, nullptr); - if (fp == nullptr) - error->one(FLERR, "Cannot open EDIP potential file {}: {}", file, utils::getsyserror()); - } + PotentialFileReader reader(lmp, file, "edip"); + char *line; - // read each set of params from potential file - // one set of params can span multiple lines - // store params if all 3 element tags are in element list + while ((line = reader.next_line(NPARAMS_PER_LINE))) { + try { + ValueTokenizer values(line); + std::string iname = values.next_string(); + std::string jname = values.next_string(); + std::string kname = values.next_string(); - int n, nwords, ielement, jelement, kelement; - char line[MAXLINE], *ptr; - int eof = 0; + // ielement,jelement,kelement = 1st args + // if all 3 args are in element list, then parse this line + // else skip to next entry in file + int ielement, jelement, kelement; - while (true) { - if (comm->me == 0) { - ptr = fgets(line, MAXLINE, fp); - if (ptr == nullptr) { - eof = 1; - fclose(fp); - } else - n = strlen(line) + 1; - } - MPI_Bcast(&eof, 1, MPI_INT, 0, world); - if (eof) break; - MPI_Bcast(&n, 1, MPI_INT, 0, world); - MPI_Bcast(line, n, MPI_CHAR, 0, world); + for (ielement = 0; ielement < nelements; ielement++) + if (iname == elements[ielement]) break; + if (ielement == nelements) continue; + for (jelement = 0; jelement < nelements; jelement++) + if (jname == elements[jelement]) break; + if (jelement == nelements) continue; + for (kelement = 0; kelement < nelements; kelement++) + if (kname == elements[kelement]) break; + if (kelement == nelements) continue; - // strip comment, skip line if blank + // load up parameter settings and error check their values - if ((ptr = strchr(line, '#'))) *ptr = '\0'; - nwords = utils::count_words(line); - if (nwords == 0) continue; + if (nparams == maxparam) { + maxparam += DELTA; + params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), + "pair:params"); - // concatenate additional lines until have params_per_line words + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind - while (nwords < params_per_line) { - n = strlen(line); - if (comm->me == 0) { - ptr = fgets(&line[n], MAXLINE - n, fp); - if (ptr == nullptr) { - eof = 1; - fclose(fp); - } else - n = strlen(line) + 1; + memset(params + nparams, 0, DELTA*sizeof(Param)); + } + + params[nparams].ielement = ielement; + params[nparams].jelement = jelement; + params[nparams].kelement = kelement; + params[nparams].A = values.next_double(); + params[nparams].B = values.next_double(); + params[nparams].cutoffA = values.next_double(); + params[nparams].cutoffC = values.next_double(); + params[nparams].alpha = values.next_double(); + params[nparams].beta = values.next_double(); + params[nparams].eta = values.next_double(); + params[nparams].gamma = values.next_double(); + params[nparams].lambda = values.next_double(); + params[nparams].mu = values.next_double(); + params[nparams].rho = values.next_double(); + params[nparams].sigma = values.next_double(); + params[nparams].Q0 = values.next_double(); + params[nparams].u1 = values.next_double(); + params[nparams].u2 = values.next_double(); + params[nparams].u3 = values.next_double(); + params[nparams].u4 = values.next_double(); + } catch (std::exception &e) { + error->one(FLERR, "Error reading EDIP potential file: {}", e.what()); } - MPI_Bcast(&eof, 1, MPI_INT, 0, world); - if (eof) break; - MPI_Bcast(&n, 1, MPI_INT, 0, world); - MPI_Bcast(line, n, MPI_CHAR, 0, world); - if ((ptr = strchr(line, '#'))) *ptr = '\0'; - nwords = utils::count_words(line); + + if (params[nparams].A < 0.0 || params[nparams].B < 0.0 || params[nparams].cutoffA < 0.0 || + params[nparams].cutoffC < 0.0 || params[nparams].alpha < 0.0 || + params[nparams].beta < 0.0 || params[nparams].eta < 0.0 || params[nparams].gamma < 0.0 || + params[nparams].lambda < 0.0 || params[nparams].mu < 0.0 || params[nparams].rho < 0.0 || + params[nparams].sigma < 0.0) + error->all(FLERR, "Illegal EDIP parameter"); + + nparams++; } - - if (nwords != params_per_line) error->all(FLERR, "Incorrect format in EDIP potential file"); - - // words = ptrs to all words in line - - nwords = 0; - words[nwords++] = strtok(line, " \t\n\r\f"); - while ((words[nwords++] = strtok(nullptr, " \t\n\r\f"))) continue; - - // ielement,jelement,kelement = 1st args - // if all 3 args are in element list, then parse this line - // else skip to next entry in file - - for (ielement = 0; ielement < nelements; ielement++) - if (strcmp(words[0], elements[ielement]) == 0) break; - if (ielement == nelements) continue; - for (jelement = 0; jelement < nelements; jelement++) - if (strcmp(words[1], elements[jelement]) == 0) break; - if (jelement == nelements) continue; - for (kelement = 0; kelement < nelements; kelement++) - if (strcmp(words[2], elements[kelement]) == 0) break; - if (kelement == nelements) continue; - - // load up parameter settings and error check their values - - if (nparams == maxparam) { - maxparam += DELTA; - params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); - - // make certain all addional allocated storage is initialized - // to avoid false positives when checking with valgrind - - memset(params + nparams, 0, DELTA * sizeof(Param)); - } - - params[nparams].ielement = ielement; - params[nparams].jelement = jelement; - params[nparams].kelement = kelement; - params[nparams].A = atof(words[3]); - params[nparams].B = atof(words[4]); - params[nparams].cutoffA = atof(words[5]); - params[nparams].cutoffC = atof(words[6]); - params[nparams].alpha = atof(words[7]); - params[nparams].beta = atof(words[8]); - params[nparams].eta = atof(words[9]); - params[nparams].gamm = atof(words[10]); - params[nparams].lambda = atof(words[11]); - params[nparams].mu = atof(words[12]); - params[nparams].rho = atof(words[13]); - params[nparams].sigma = atof(words[14]); - params[nparams].Q0 = atof(words[15]); - params[nparams].u1 = atof(words[16]); - params[nparams].u2 = atof(words[17]); - params[nparams].u3 = atof(words[18]); - params[nparams].u4 = atof(words[19]); - - if (params[nparams].A < 0.0 || params[nparams].B < 0.0 || params[nparams].cutoffA < 0.0 || - params[nparams].cutoffC < 0.0 || params[nparams].alpha < 0.0 || - params[nparams].beta < 0.0 || params[nparams].eta < 0.0 || params[nparams].gamm < 0.0 || - params[nparams].lambda < 0.0 || params[nparams].mu < 0.0 || params[nparams].rho < 0.0 || - params[nparams].sigma < 0.0) - error->all(FLERR, "Illegal EDIP parameter"); - - nparams++; } + MPI_Bcast(&nparams, 1, MPI_INT, 0, world); + MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - delete[] words; + if (comm->me != 0) + params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world); } /* ---------------------------------------------------------------------- */ @@ -946,7 +904,7 @@ void PairEDIP::setup_params() cutoffC = params[0].cutoffC; sigma = params[0].sigma; lambda = params[0].lambda; - gamm = params[0].gamm; + gamm = params[0].gamma; eta = params[0].eta; Q0 = params[0].Q0; mu = params[0].mu; diff --git a/src/MANYBODY/pair_edip.h b/src/MANYBODY/pair_edip.h index 5812768d55..741f428c93 100644 --- a/src/MANYBODY/pair_edip.h +++ b/src/MANYBODY/pair_edip.h @@ -27,21 +27,30 @@ namespace LAMMPS_NS { class PairEDIP : public Pair { public: PairEDIP(class LAMMPS *); - virtual ~PairEDIP(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); + ~PairEDIP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + + static constexpr int NPARAMS_PER_LINE = 20; protected: struct Param { - double A, B; - double cutoffA, cutoffC, cutsq; - double alpha, beta; - double eta, gamm, lambda, mu, rho, sigma, Q0; - double u1, u2, u3, u4; - int ielement, jelement, kelement; + double A, B; // coefficients for pair interaction I-J + double cutoffA; // cut-off distance for pair interaction I-J + double cutoffC; // lower cut-off distance for calculating Z_I + double alpha; // coefficient for calculating Z_I + double beta; // attractive term for pair I-J + double sigma; // cut-off coefficient for pair I-J + double rho; // pair I-J + double gamma; // coefficient for three-body interaction I-J-K + double eta, lambda; // coefficients for function h(l,Z) + double mu, Q0; // coefficients for function Q(Z) + double u1, u2, u3, u4; // coefficients for function tau(Z) + double cutsq; + int ielement, jelement, kelement, dummy; // dummy added for better alignment }; double *preInvR_ij; diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index 8017fa4f8e..cdfe120fc4 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -30,9 +30,11 @@ #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" +#include "potential_file_reader.h" #include #include +#include using namespace LAMMPS_NS; using namespace MathExtra; @@ -118,8 +120,8 @@ void PairEDIPMulti::compute(int eflag, int vflag) double costheta; double dpairZ,dtripleZ; - // eflag != 0 means compute energy contributions in this step - // vflag != 0 means compute virial contributions in this step + // eflag != 0 means compute energy contributions in this step + // vflag != 0 means compute virial contributions in this step evdwl = 0.0; ev_init(eflag,vflag); @@ -155,39 +157,40 @@ void PairEDIPMulti::compute(int eflag, int vflag) // pre-loop to compute environment coordination f(Z) for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; + j = jlist[jj]; + j &= NEIGHMASK; - double delx, dely, delz, r_ij; + double delx, dely, delz, r_ij; - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; - r_ij = delx * delx + dely * dely + delz * delz; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + r_ij = delx * delx + dely * dely + delz * delz; - jtype = map[type[j]]; - ijparam = elem3param[itype][jtype][jtype]; - if (r_ij > params[ijparam].cutsq) continue; + jtype = map[type[j]]; + const Param ¶m = params[elem3param[itype][jtype][jtype]]; - r_ij = sqrt(r_ij); + if (r_ij > param.cutsq) continue; - // zeta and its derivative dZ/dr + r_ij = sqrt(r_ij); - if (r_ij < params[ijparam].cutoffC) zeta_i += 1.0; - else { - double f, fdr; - edip_fc(r_ij, ¶ms[ijparam], f, fdr); - zeta_i += f; - dzetair = -fdr / r_ij; + // zeta and its derivative dZ/dr - preForceCoord_counter=numForceCoordPairs*5; - preForceCoord[preForceCoord_counter+0]=dzetair; - preForceCoord[preForceCoord_counter+1]=delx; - preForceCoord[preForceCoord_counter+2]=dely; - preForceCoord[preForceCoord_counter+3]=delz; - preForceCoord[preForceCoord_counter+4]=j; - numForceCoordPairs++; - } + if (r_ij < param.cutoffC) zeta_i += 1.0; + else { + double f, fdr; + edip_fc(r_ij, param, f, fdr); + zeta_i += f; + dzetair = -fdr / r_ij; + + preForceCoord_counter=numForceCoordPairs*5; + preForceCoord[preForceCoord_counter+0]=dzetair; + preForceCoord[preForceCoord_counter+1]=delx; + preForceCoord[preForceCoord_counter+2]=dely; + preForceCoord[preForceCoord_counter+3]=delz; + preForceCoord[preForceCoord_counter+4]=j; + numForceCoordPairs++; + } } // two-body interactions @@ -217,7 +220,7 @@ void PairEDIPMulti::compute(int eflag, int vflag) // already considered in constructing the potential double fdr, fdZ; - edip_pair(r_ij, zeta_i, ¶ms[ijparam], evdwl, fdr, fdZ); + edip_pair(r_ij, zeta_i, params[ijparam], evdwl, fdr, fdZ); fpair = -fdr / r_ij; dpairZ += fdZ; @@ -234,102 +237,102 @@ void PairEDIPMulti::compute(int eflag, int vflag) // three-body Forces for (kk = jj + 1; kk < jnum; kk++) { - double dr_ik[3], r_ik, f_ik[3]; + double dr_ik[3], r_ik, f_ik[3]; - k = jlist[kk]; - k &= NEIGHMASK; - ktype = map[type[k]]; - ikparam = elem3param[itype][ktype][ktype]; - ijkparam = elem3param[itype][jtype][ktype]; + k = jlist[kk]; + k &= NEIGHMASK; + ktype = map[type[k]]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; - dr_ik[0] = x[k][0] - xtmp; - dr_ik[1] = x[k][1] - ytmp; - dr_ik[2] = x[k][2] - ztmp; - r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; + dr_ik[0] = x[k][0] - xtmp; + dr_ik[1] = x[k][1] - ytmp; + dr_ik[2] = x[k][2] - ztmp; + r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; - if (r_ik > params[ikparam].cutsq) continue; + if (r_ik > params[ikparam].cutsq) continue; - r_ik = sqrt(r_ik); + r_ik = sqrt(r_ik); - costheta=dot3(dr_ij, dr_ik) / r_ij / r_ik; + costheta=dot3(dr_ij, dr_ik) / r_ij / r_ik; - double v1, v2, v3, v4, v5, v6, v7; + double v1, v2, v3, v4, v5, v6, v7; - edip_fcut3(r_ij, ¶ms[ijparam], v1, v2); - edip_fcut3(r_ik, ¶ms[ikparam], v3, v4); - edip_h(costheta, zeta_i, ¶ms[ijkparam], v5, v6, v7); + edip_fcut3(r_ij, params[ijparam], v1, v2); + edip_fcut3(r_ik, params[ikparam], v3, v4); + edip_h(costheta, zeta_i, params[ijkparam], v5, v6, v7); - // potential energy and forces - evdwl = v1 * v3 * v5; - dtripleZ += v1 * v3 * v7; + // potential energy and forces + evdwl = v1 * v3 * v5; + dtripleZ += v1 * v3 * v7; - double dri[3], drj[3], drk[3]; - double dhl, dfr; + double dri[3], drj[3], drk[3]; + double dhl, dfr; - dhl = v1 * v3 * v6; + dhl = v1 * v3 * v6; - costheta_d(dr_ij, r_ij, dr_ik, r_ik, dri, drj, drk); + costheta_d(dr_ij, r_ij, dr_ik, r_ik, dri, drj, drk); - f_ij[0] = -dhl * drj[0]; - f_ij[1] = -dhl * drj[1]; - f_ij[2] = -dhl * drj[2]; - f_ik[0] = -dhl * drk[0]; - f_ik[1] = -dhl * drk[1]; - f_ik[2] = -dhl * drk[2]; + f_ij[0] = -dhl * drj[0]; + f_ij[1] = -dhl * drj[1]; + f_ij[2] = -dhl * drj[2]; + f_ik[0] = -dhl * drk[0]; + f_ik[1] = -dhl * drk[1]; + f_ik[2] = -dhl * drk[2]; - dfr = v2 * v3 * v5; - fpair = -dfr / r_ij; + dfr = v2 * v3 * v5; + fpair = -dfr / r_ij; - f_ij[0] += fpair * dr_ij[0]; - f_ij[1] += fpair * dr_ij[1]; - f_ij[2] += fpair * dr_ij[2]; + f_ij[0] += fpair * dr_ij[0]; + f_ij[1] += fpair * dr_ij[1]; + f_ij[2] += fpair * dr_ij[2]; - dfr = v1 * v4 * v5; - fpair = -dfr / r_ik; + dfr = v1 * v4 * v5; + fpair = -dfr / r_ik; - f_ik[0] += fpair * dr_ik[0]; - f_ik[1] += fpair * dr_ik[1]; - f_ik[2] += fpair * dr_ik[2]; + f_ik[0] += fpair * dr_ik[0]; + f_ik[1] += fpair * dr_ik[1]; + f_ik[2] += fpair * dr_ik[2]; - f[j][0] += f_ij[0]; - f[j][1] += f_ij[1]; - f[j][2] += f_ij[2]; + f[j][0] += f_ij[0]; + f[j][1] += f_ij[1]; + f[j][2] += f_ij[2]; - f[k][0] += f_ik[0]; - f[k][1] += f_ik[1]; - f[k][2] += f_ik[2]; + f[k][0] += f_ik[0]; + f[k][1] += f_ik[1]; + f[k][2] += f_ik[2]; - f[i][0] -= f_ij[0] + f_ik[0]; - f[i][1] -= f_ij[1] + f_ik[1]; - f[i][2] -= f_ij[2] + f_ik[2]; + f[i][0] -= f_ij[0] + f_ik[0]; + f[i][1] -= f_ij[1] + f_ik[1]; + f[i][2] -= f_ij[2] + f_ik[2]; - if (evflag) ev_tally3(i,j,k,evdwl,0.0,f_ij,f_ik,dr_ij,dr_ik); + if (evflag) ev_tally3(i,j,k,evdwl,0.0,f_ij,f_ik,dr_ij,dr_ik); } } // forces due to environment coordination f(Z) for (int idx = 0; idx < numForceCoordPairs; idx++) { - double delx, dely, delz; + double delx, dely, delz; - preForceCoord_counter = idx * 5; - dzetair = preForceCoord[preForceCoord_counter+0]; - delx = preForceCoord[preForceCoord_counter+1]; - dely = preForceCoord[preForceCoord_counter+2]; - delz = preForceCoord[preForceCoord_counter+3]; - j = static_cast (preForceCoord[preForceCoord_counter+4]); + preForceCoord_counter = idx * 5; + dzetair = preForceCoord[preForceCoord_counter+0]; + delx = preForceCoord[preForceCoord_counter+1]; + dely = preForceCoord[preForceCoord_counter+2]; + delz = preForceCoord[preForceCoord_counter+3]; + j = static_cast (preForceCoord[preForceCoord_counter+4]); - dzetair *= (dpairZ + dtripleZ); + dzetair *= (dpairZ + dtripleZ); - f[j][0] += dzetair * delx; - f[j][1] += dzetair * dely; - f[j][2] += dzetair * delz; + f[j][0] += dzetair * delx; + f[j][1] += dzetair * dely; + f[j][2] += dzetair * delz; - f[i][0] -= dzetair * delx; - f[i][1] -= dzetair * dely; - f[i][2] -= dzetair * delz; + f[i][0] -= dzetair * delx; + f[i][1] -= dzetair * dely; + f[i][2] -= dzetair * delz; - evdwl = 0.0; - if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, dzetair, -delx, -dely, -delz); + evdwl = 0.0; + if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, dzetair, -delx, -dely, -delz); } } @@ -342,13 +345,13 @@ double sqr(double x) } //pair Vij, partial derivatives dVij(r,Z)/dr and dVij(r,Z)/dZ -void PairEDIPMulti::edip_pair(double r, double z, Param *param, double &eng, +void PairEDIPMulti::edip_pair(double r, double z, const Param ¶m, double &eng, double &fdr, double &fZ) { - double A = param->A; - double B = param->B; - double rho = param->rho; - double beta = param->beta; + double A = param.A; + double B = param.B; + double rho = param.rho; + double beta = param.beta; double v1,v2,v3,v4; v1 = pow(B / r, rho); @@ -361,11 +364,11 @@ void PairEDIPMulti::edip_pair(double r, double z, Param *param, double &eng, } //function fc(r) in calculating coordination Z and derivative fc'(r) -void PairEDIPMulti::edip_fc(double r, Param *param, double &f, double &fdr) +void PairEDIPMulti::edip_fc(double r, const Param ¶m, double &f, double &fdr) { - double a = param->cutoffA; - double c = param->cutoffC; - double alpha = param->alpha; + double a = param.cutoffA; + double c = param.cutoffC; + double alpha = param.alpha; double x; double v1, v2; @@ -392,10 +395,10 @@ void PairEDIPMulti::edip_fc(double r, Param *param, double &f, double &fdr) } //cut-off function for Vij and its derivative fcut2'(r) -void PairEDIPMulti::edip_fcut2(double r, Param *param, double &f, double &fdr) +void PairEDIPMulti::edip_fcut2(double r, const Param ¶m, double &f, double &fdr) { - double sigma = param->sigma; - double a = param->cutoffA; + double sigma = param.sigma; + double a = param.cutoffA; double v1; if (r > a - 1E-6) @@ -411,12 +414,12 @@ void PairEDIPMulti::edip_fcut2(double r, Param *param, double &f, double &fdr) } //function tau(Z) and its derivative tau'(Z) -void PairEDIPMulti::edip_tau(double z, Param *param, double &f, double &fdZ) +void PairEDIPMulti::edip_tau(double z, const Param ¶m, double &f, double &fdZ) { - double u1 = param->u1; - double u2 = param->u2; - double u3 = param->u3; - double u4 = param->u4; + double u1 = param.u1; + double u2 = param.u2; + double u3 = param.u3; + double u4 = param.u4; double v1, v2; v1 = exp(-u4 * z); @@ -427,13 +430,13 @@ void PairEDIPMulti::edip_tau(double z, Param *param, double &f, double &fdZ) } //function h(l,Z) and its partial derivatives dh(l,Z)/dl and dh(l,Z)/dZ -void PairEDIPMulti::edip_h(double l, double z, Param *param, double &f, +void PairEDIPMulti::edip_h(double l, double z, const Param ¶m, double &f, double &fdl, double &fdZ) { - double lambda = param->lambda; - double eta = param->eta; - double Q0 = param->Q0; - double mu = param->mu; + double lambda = param.lambda; + double eta = param.eta; + double Q0 = param.Q0; + double mu = param.mu; double Q, QdZ, Tau, TaudZ; double u2, du2l, du2Z; double v1, v2, v3; @@ -464,10 +467,10 @@ void PairEDIPMulti::edip_h(double l, double z, Param *param, double &f, } //cut-off function for Vijk and its derivative fcut3'(r) -void PairEDIPMulti::edip_fcut3(double r, Param *param, double &f, double &fdr) +void PairEDIPMulti::edip_fcut3(double r, const Param ¶m, double &f, double &fdr) { - double gamma = param->gamma; - double a = param->cutoffA; + double gamma = param.gamma; + double a = param.cutoffA; double v1; if (r > a - 1E-6) @@ -578,137 +581,92 @@ double PairEDIPMulti::init_one(int i, int j) void PairEDIPMulti::read_file(char *file) { - int params_per_line = 20; - char **words = new char*[params_per_line+1]; - memory->sfree(params); params = nullptr; nparams = maxparam = 0; // open file on proc 0 - FILE *fp; if (comm->me == 0) { - fp = utils::open_potential(file,lmp,nullptr); - if (fp == nullptr) - error->one(FLERR,"Cannot open EDIP potential file {}: {}",file,utils::getsyserror()); - } + PotentialFileReader reader(lmp, file, "edip"); + char *line; - // read each set of params from potential file - // one set of params can span multiple lines - // store params if all 3 element tags are in element list + while ((line = reader.next_line(NPARAMS_PER_LINE))) { + try { + ValueTokenizer values(line); + std::string iname = values.next_string(); + std::string jname = values.next_string(); + std::string kname = values.next_string(); - int n,nwords,ielement,jelement,kelement; - char line[MAXLINE],*ptr; - int eof = 0; + // ielement,jelement,kelement = 1st args + // if all 3 args are in element list, then parse this line + // else skip to next entry in file + int ielement, jelement, kelement; - while (true) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fp); - if (ptr == nullptr) { - eof = 1; - fclose(fp); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); + for (ielement = 0; ielement < nelements; ielement++) + if (iname == elements[ielement]) break; + if (ielement == nelements) continue; + for (jelement = 0; jelement < nelements; jelement++) + if (jname == elements[jelement]) break; + if (jelement == nelements) continue; + for (kelement = 0; kelement < nelements; kelement++) + if (kname == elements[kelement]) break; + if (kelement == nelements) continue; - // strip comment, skip line if blank + // load up parameter settings and error check their values - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = utils::count_words(line); - if (nwords == 0) continue; + if (nparams == maxparam) { + maxparam += DELTA; + params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), + "pair:params"); - // concatenate additional lines until have params_per_line words + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind - while (nwords < params_per_line) { - n = strlen(line); - if (comm->me == 0) { - ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == nullptr) { - eof = 1; - fclose(fp); - } else n = strlen(line) + 1; + memset(params + nparams, 0, DELTA*sizeof(Param)); + } + + params[nparams].ielement = ielement; + params[nparams].jelement = jelement; + params[nparams].kelement = kelement; + params[nparams].A = values.next_double(); + params[nparams].B = values.next_double(); + params[nparams].cutoffA = values.next_double(); + params[nparams].cutoffC = values.next_double(); + params[nparams].alpha = values.next_double(); + params[nparams].beta = values.next_double(); + params[nparams].eta = values.next_double(); + params[nparams].gamma = values.next_double(); + params[nparams].lambda = values.next_double(); + params[nparams].mu = values.next_double(); + params[nparams].rho = values.next_double(); + params[nparams].sigma = values.next_double(); + params[nparams].Q0 = values.next_double(); + params[nparams].u1 = values.next_double(); + params[nparams].u2 = values.next_double(); + params[nparams].u3 = values.next_double(); + params[nparams].u4 = values.next_double(); + } catch (std::exception &e) { + error->one(FLERR, "Error reading EDIP potential file: {}", e.what()); } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = utils::count_words(line); + + if (params[nparams].A < 0.0 || params[nparams].B < 0.0 || params[nparams].cutoffA < 0.0 || + params[nparams].cutoffC < 0.0 || params[nparams].alpha < 0.0 || + params[nparams].beta < 0.0 || params[nparams].eta < 0.0 || params[nparams].gamma < 0.0 || + params[nparams].lambda < 0.0 || params[nparams].mu < 0.0 || params[nparams].rho < 0.0 || + params[nparams].sigma < 0.0) + error->all(FLERR, "Illegal EDIP parameter"); + + nparams++; } - - if (nwords != params_per_line) - error->all(FLERR,"Incorrect format in EDIP potential file"); - - // words = ptrs to all words in line - - nwords = 0; - words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; - - // ielement,jelement,kelement = 1st args - // if all 3 args are in element list, then parse this line - // else skip to next entry in file - - for (ielement = 0; ielement < nelements; ielement++) - if (strcmp(words[0],elements[ielement]) == 0) break; - if (ielement == nelements) continue; - for (jelement = 0; jelement < nelements; jelement++) - if (strcmp(words[1],elements[jelement]) == 0) break; - if (jelement == nelements) continue; - for (kelement = 0; kelement < nelements; kelement++) - if (strcmp(words[2],elements[kelement]) == 0) break; - if (kelement == nelements) continue; - - // load up parameter settings and error check their values - - if (nparams == maxparam) { - maxparam += DELTA; - params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), - "pair:params"); - - // make certain all addional allocated storage is initialized - // to avoid false positives when checking with valgrind - - memset(params + nparams, 0, DELTA*sizeof(Param)); - } - - params[nparams].ielement = ielement; - params[nparams].jelement = jelement; - params[nparams].kelement = kelement; - params[nparams].A = atof(words[3]); - params[nparams].B = atof(words[4]); - params[nparams].cutoffA = atof(words[5]); - params[nparams].cutoffC = atof(words[6]); - params[nparams].alpha = atof(words[7]); - params[nparams].beta = atof(words[8]); - params[nparams].eta = atof(words[9]); - params[nparams].gamma = atof(words[10]); - params[nparams].lambda = atof(words[11]); - params[nparams].mu = atof(words[12]); - params[nparams].rho = atof(words[13]); - params[nparams].sigma = atof(words[14]); - params[nparams].Q0 = atof(words[15]); - params[nparams].u1 = atof(words[16]); - params[nparams].u2 = atof(words[17]); - params[nparams].u3 = atof(words[18]); - params[nparams].u4 = atof(words[19]); - - if (params[nparams].A < 0.0 || params[nparams].B < 0.0 || - params[nparams].cutoffA < 0.0 || params[nparams].cutoffC < 0.0 || - params[nparams].alpha < 0.0 || params[nparams].beta < 0.0 || - params[nparams].eta < 0.0 || params[nparams].gamma < 0.0 || - params[nparams].lambda < 0.0 || params[nparams].mu < 0.0 || - params[nparams].rho < 0.0 || params[nparams].sigma < 0.0) - error->all(FLERR,"Illegal EDIP parameter"); - - nparams++; } + MPI_Bcast(&nparams, 1, MPI_INT, 0, world); + MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - delete [] words; + if (comm->me != 0) + params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world); } /* ---------------------------------------------------------------------- */ @@ -753,5 +711,4 @@ void PairEDIPMulti::setup() rtmp = sqrt(params[m].cutsq); if (rtmp > cutmax) cutmax = rtmp; } - } diff --git a/src/MANYBODY/pair_edip_multi.h b/src/MANYBODY/pair_edip_multi.h index 3ee7347a56..862c63dbec 100644 --- a/src/MANYBODY/pair_edip_multi.h +++ b/src/MANYBODY/pair_edip_multi.h @@ -27,12 +27,14 @@ namespace LAMMPS_NS { class PairEDIPMulti : public Pair { public: PairEDIPMulti(class LAMMPS *); - virtual ~PairEDIPMulti(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); + ~PairEDIPMulti() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; + + static constexpr int NPARAMS_PER_LINE = 20; protected: struct Param { @@ -48,7 +50,7 @@ class PairEDIPMulti : public Pair { double mu, Q0; // coefficients for function Q(Z) double u1, u2, u3, u4; // coefficients for function tau(Z) double cutsq; - int ielement, jelement, kelement; + int ielement, jelement, kelement, dummy; // dummy added for better alignment }; double *preForceCoord; @@ -61,14 +63,14 @@ class PairEDIPMulti : public Pair { void deallocatePreLoops(); void read_file(char *); - void setup(); + void setup() override; - void edip_pair(double, double, Param *, double &, double &, double &); - void edip_fc(double, Param *, double &, double &); - void edip_fcut2(double, Param *, double &, double &); - void edip_tau(double, Param *, double &, double &); - void edip_h(double, double, Param *, double &, double &, double &); - void edip_fcut3(double, Param *, double &, double &); + void edip_pair(double, double, const Param &, double &, double &, double &); + void edip_fc(double, const Param &, double &, double &); + void edip_fcut2(double, const Param &, double &, double &); + void edip_tau(double, const Param &, double &, double &); + void edip_h(double, double, const Param &, double &, double &, double &); + void edip_fcut3(double, const Param &, double &, double &); }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_eim.h b/src/MANYBODY/pair_eim.h index 7602474cb4..7c4931b7cf 100644 --- a/src/MANYBODY/pair_eim.h +++ b/src/MANYBODY/pair_eim.h @@ -30,18 +30,18 @@ namespace LAMMPS_NS { class PairEIM : public Pair { public: PairEIM(class LAMMPS *); - virtual ~PairEIM(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairEIM() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; struct Setfl { double division, rbig, rsmall; diff --git a/src/MANYBODY/pair_extep.h b/src/MANYBODY/pair_extep.h index 6b1c925226..b17fda6b7e 100644 --- a/src/MANYBODY/pair_extep.h +++ b/src/MANYBODY/pair_extep.h @@ -30,12 +30,12 @@ namespace LAMMPS_NS { class PairExTeP : public Pair { public: PairExTeP(class LAMMPS *); - virtual ~PairExTeP(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairExTeP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: struct Param { @@ -70,7 +70,7 @@ class PairExTeP : public Pair { void allocate(); void spline_init(); virtual void read_file(char *); - virtual void setup(); + void setup() override; virtual void repulsive(Param *, double, double &, int, double &); virtual double zeta(Param *, double, double, double *, double *); virtual void force_zeta(Param *, double, double, double &, double &, int, double &); diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 98826f98f6..6e76c9ea39 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -30,7 +30,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_gw.h b/src/MANYBODY/pair_gw.h index ffd8665c05..c5698d331a 100644 --- a/src/MANYBODY/pair_gw.h +++ b/src/MANYBODY/pair_gw.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairGW : public Pair { public: PairGW(class LAMMPS *); - virtual ~PairGW(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairGW() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; static constexpr int NPARAMS_PER_LINE = 17; diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index 8045852f5a..cb998abbb5 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -24,7 +24,6 @@ #include "math_const.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include "update.h" #include diff --git a/src/MANYBODY/pair_gw_zbl.h b/src/MANYBODY/pair_gw_zbl.h index 97a5d8ce8f..10c02c91f5 100644 --- a/src/MANYBODY/pair_gw_zbl.h +++ b/src/MANYBODY/pair_gw_zbl.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class PairGWZBL : public PairGW { public: PairGWZBL(class LAMMPS *); - ~PairGWZBL() {} static constexpr int NPARAMS_PER_LINE = 21; @@ -36,11 +35,11 @@ class PairGWZBL : public PairGW { double global_epsilon_0; // permittivity of vacuum for Coulomb repulsion double global_e; // proton charge (negative of electron charge) - void read_file(char *); - void repulsive(Param *, double, double &, int, double &); + void read_file(char *) override; + void repulsive(Param *, double, double &, int, double &) override; - double gw_fa(double, Param *); - double gw_fa_d(double, Param *); + double gw_fa(double, Param *) override; + double gw_fa_d(double, Param *) override; double F_fermi(double, Param *); double F_fermi_d(double, Param *); diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index 836e66e160..e27d44a5f6 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -29,13 +29,13 @@ namespace LAMMPS_NS { class PairLCBOP : public Pair { public: PairLCBOP(class LAMMPS *); - virtual ~PairLCBOP(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + ~PairLCBOP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; protected: int **pages; // neighbor list pages diff --git a/src/MANYBODY/pair_local_density.h b/src/MANYBODY/pair_local_density.h index ef67d2c084..dd466e622d 100644 --- a/src/MANYBODY/pair_local_density.h +++ b/src/MANYBODY/pair_local_density.h @@ -31,19 +31,19 @@ namespace LAMMPS_NS { class PairLocalDensity : public Pair { public: PairLocalDensity(class LAMMPS *); - virtual ~PairLocalDensity(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - double single(int, int, int, int, double, double, double, double &); + ~PairLocalDensity() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; protected: //------------------------------------------------------------------------ diff --git a/src/MANYBODY/pair_meam_spline.h b/src/MANYBODY/pair_meam_spline.h index c20077f2eb..34e2960726 100644 --- a/src/MANYBODY/pair_meam_spline.h +++ b/src/MANYBODY/pair_meam_spline.h @@ -40,16 +40,16 @@ namespace LAMMPS_NS { class PairMEAMSpline : public Pair { public: PairMEAMSpline(class LAMMPS *); - virtual ~PairMEAMSpline(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); + ~PairMEAMSpline() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; void get_coeff(double *, double *); double pair_density(int); double three_body_density(int); - void init_style(); - void init_list(int, class NeighList *); - double init_one(int, int); + void init_style() override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; // helper functions for compute() @@ -59,11 +59,11 @@ class PairMEAMSpline : public Pair { } int i_to_potl(const int itype) const { return itype - 1; } - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; protected: class SplineFunction { diff --git a/src/MANYBODY/pair_meam_sw_spline.h b/src/MANYBODY/pair_meam_sw_spline.h index 6f065f53f4..6129b164d5 100644 --- a/src/MANYBODY/pair_meam_sw_spline.h +++ b/src/MANYBODY/pair_meam_sw_spline.h @@ -38,19 +38,19 @@ namespace LAMMPS_NS { class PairMEAMSWSpline : public Pair { public: PairMEAMSWSpline(class LAMMPS *); - virtual ~PairMEAMSWSpline(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - void init_list(int, class NeighList *); - double init_one(int, int); + ~PairMEAMSWSpline() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; protected: class SplineFunction { diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 29895af774..2b86658468 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -19,21 +19,19 @@ #include "pair_nb3b_harmonic.h" -#include - -#include #include "atom.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "force.h" #include "comm.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" - -#include "tokenizer.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" #include "potential_file_reader.h" +#include +#include + using namespace LAMMPS_NS; #define DELTA 4 diff --git a/src/MANYBODY/pair_nb3b_harmonic.h b/src/MANYBODY/pair_nb3b_harmonic.h index 159e7f8433..48fe5cf3ca 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.h +++ b/src/MANYBODY/pair_nb3b_harmonic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairNb3bHarmonic : public Pair { public: PairNb3bHarmonic(class LAMMPS *); - virtual ~PairNb3bHarmonic(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); + ~PairNb3bHarmonic() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; static constexpr int NPARAMS_PER_LINE = 6; diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index ce476e1204..3d2bf9497e 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -33,7 +33,6 @@ #include "neighbor.h" #include "potential_file_reader.h" #include "tabular_function.h" -#include "tokenizer.h" #include diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index b57a9a2268..5841d3f580 100644 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -29,12 +29,12 @@ class TabularFunction; class PairPolymorphic : public Pair { public: PairPolymorphic(class LAMMPS *); - virtual ~PairPolymorphic(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairPolymorphic() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: struct PairParameters { diff --git a/src/MANYBODY/pair_rebo.h b/src/MANYBODY/pair_rebo.h index 94e5b9a228..b55ee87e76 100644 --- a/src/MANYBODY/pair_rebo.h +++ b/src/MANYBODY/pair_rebo.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairREBO : public PairAIREBO { public: PairREBO(class LAMMPS *); - void settings(int, char **); - void spline_init(); + void settings(int, char **) override; + void spline_init() override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 75ece1dc71..bac65a2464 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -27,7 +27,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_sw.h b/src/MANYBODY/pair_sw.h index 6509c460d6..02389020a3 100644 --- a/src/MANYBODY/pair_sw.h +++ b/src/MANYBODY/pair_sw.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairSW : public Pair { public: PairSW(class LAMMPS *); - virtual ~PairSW(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual double init_one(int, int); - virtual void init_style(); + ~PairSW() override; + void compute(int, int) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; static constexpr int NPARAMS_PER_LINE = 14; @@ -53,7 +53,7 @@ class PairSW : public Pair { int maxshort; // size of short neighbor list array int *neighshort; // short neighbor list array - virtual void settings(int, char **); + void settings(int, char **) override; virtual void allocate(); void read_file(char *); virtual void setup_params(); diff --git a/src/MANYBODY/pair_sw_mod.h b/src/MANYBODY/pair_sw_mod.h index 580f031e00..c8d306238b 100644 --- a/src/MANYBODY/pair_sw_mod.h +++ b/src/MANYBODY/pair_sw_mod.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class PairSWMOD : public PairSW { public: PairSWMOD(class LAMMPS *); - virtual ~PairSWMOD() {} protected: double delta1; double delta2; - void settings(int, char **); + void settings(int, char **) override; void threebody(Param *, Param *, Param *, double, double, double *, double *, double *, double *, - int, double &); + int, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index f21c3bffca..6ad0a37ba3 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -32,7 +32,6 @@ #include "neighbor.h" #include "potential_file_reader.h" #include "suffix.h" -#include "tokenizer.h" #include #include @@ -431,8 +430,7 @@ void PairTersoff::read_file(char *file) // transparently convert units for supported conversions int unit_convert = reader.get_unit_convert(); - double conversion_factor = utils::get_conversion_factor(utils::ENERGY, - unit_convert); + double conversion_factor = utils::get_conversion_factor(utils::ENERGY,unit_convert); while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_tersoff.h b/src/MANYBODY/pair_tersoff.h index f1ee2a1100..b246c8260d 100644 --- a/src/MANYBODY/pair_tersoff.h +++ b/src/MANYBODY/pair_tersoff.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairTersoff : public Pair { public: PairTersoff(class LAMMPS *); - virtual ~PairTersoff(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); + ~PairTersoff() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; template void eval(); diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index 939dcfddd6..bc34edfb75 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -26,7 +26,6 @@ #include "math_special.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_tersoff_mod.h b/src/MANYBODY/pair_tersoff_mod.h index 8ae2c56a89..bc14012e37 100644 --- a/src/MANYBODY/pair_tersoff_mod.h +++ b/src/MANYBODY/pair_tersoff_mod.h @@ -28,21 +28,20 @@ namespace LAMMPS_NS { class PairTersoffMOD : public PairTersoff { public: PairTersoffMOD(class LAMMPS *); - ~PairTersoffMOD() {} static constexpr int NPARAMS_PER_LINE = 20; protected: - virtual void read_file(char *); - virtual void setup_params(); - double zeta(Param *, double, double, double *, double *); + void read_file(char *) override; + void setup_params() override; + double zeta(Param *, double, double, double *, double *) override; - double ters_fc(double, Param *); - double ters_fc_d(double, Param *); - double ters_bij(double, Param *); - double ters_bij_d(double, Param *); + double ters_fc(double, Param *) override; + double ters_fc_d(double, Param *) override; + double ters_bij(double, Param *) override; + double ters_bij_d(double, Param *) override; void ters_zetaterm_d(double, double *, double, double, double *, double, double, double *, - double *, double *, Param *); + double *, double *, Param *) override; // inlined functions for efficiency // these replace but do not override versions in PairTersoff diff --git a/src/MANYBODY/pair_tersoff_mod_c.cpp b/src/MANYBODY/pair_tersoff_mod_c.cpp index 6dbf49efdf..b0cffbd8e2 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.cpp +++ b/src/MANYBODY/pair_tersoff_mod_c.cpp @@ -22,7 +22,6 @@ #include "error.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_tersoff_mod_c.h b/src/MANYBODY/pair_tersoff_mod_c.h index 09565fb9de..e39c8e4340 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.h +++ b/src/MANYBODY/pair_tersoff_mod_c.h @@ -27,13 +27,12 @@ namespace LAMMPS_NS { class PairTersoffMODC : public PairTersoffMOD { public: PairTersoffMODC(class LAMMPS *lmp) : PairTersoffMOD(lmp){}; - ~PairTersoffMODC() {} static constexpr int NPARAMS_PER_LINE = 21; protected: - void read_file(char *); - void repulsive(Param *, double, double &, int, double &); + void read_file(char *) override; + void repulsive(Param *, double, double &, int, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/MANYBODY/pair_tersoff_table.cpp b/src/MANYBODY/pair_tersoff_table.cpp index f6a3525f1e..0c11760737 100644 --- a/src/MANYBODY/pair_tersoff_table.cpp +++ b/src/MANYBODY/pair_tersoff_table.cpp @@ -32,7 +32,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MANYBODY/pair_tersoff_table.h b/src/MANYBODY/pair_tersoff_table.h index ab345d8af2..cb4dd7ce18 100644 --- a/src/MANYBODY/pair_tersoff_table.h +++ b/src/MANYBODY/pair_tersoff_table.h @@ -36,12 +36,12 @@ namespace LAMMPS_NS { class PairTersoffTable : public Pair { public: PairTersoffTable(class LAMMPS *); - virtual ~PairTersoffTable(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairTersoffTable() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; static constexpr int NPARAMS_PER_LINE = 17; diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index c1d420dabb..3478268161 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -25,7 +25,6 @@ #include "math_special.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include "update.h" #include diff --git a/src/MANYBODY/pair_tersoff_zbl.h b/src/MANYBODY/pair_tersoff_zbl.h index ea081cce77..f0b10e417a 100644 --- a/src/MANYBODY/pair_tersoff_zbl.h +++ b/src/MANYBODY/pair_tersoff_zbl.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class PairTersoffZBL : public PairTersoff { public: PairTersoffZBL(class LAMMPS *); - ~PairTersoffZBL() {} static constexpr int NPARAMS_PER_LINE = 21; @@ -36,11 +35,11 @@ class PairTersoffZBL : public PairTersoff { double global_epsilon_0; // permittivity of vacuum for Coulomb repulsion double global_e; // proton charge (negative of electron charge) - void read_file(char *); - void repulsive(Param *, double, double &, int, double &); + void read_file(char *) override; + void repulsive(Param *, double, double &, int, double &) override; - double ters_fa(double, Param *); - double ters_fa_d(double, Param *); + double ters_fa(double, Param *) override; + double ters_fa_d(double, Param *) override; double F_fermi(double, Param *); double F_fermi_d(double, Param *); diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 3ea3747467..40a42cd44b 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -19,9 +19,6 @@ #include "pair_vashishta.h" -#include - -#include #include "atom.h" #include "comm.h" #include "error.h" @@ -30,10 +27,11 @@ #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" - -#include "tokenizer.h" #include "potential_file_reader.h" +#include +#include + using namespace LAMMPS_NS; #define DELTA 4 diff --git a/src/MANYBODY/pair_vashishta.h b/src/MANYBODY/pair_vashishta.h index bfb527439c..e774e2165f 100644 --- a/src/MANYBODY/pair_vashishta.h +++ b/src/MANYBODY/pair_vashishta.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairVashishta : public Pair { public: PairVashishta(class LAMMPS *); - virtual ~PairVashishta(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void init_style(); + ~PairVashishta() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; static constexpr int NPARAMS_PER_LINE = 17; diff --git a/src/MANYBODY/pair_vashishta_table.h b/src/MANYBODY/pair_vashishta_table.h index 7033fdc163..646529da56 100644 --- a/src/MANYBODY/pair_vashishta_table.h +++ b/src/MANYBODY/pair_vashishta_table.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairVashishtaTable : public PairVashishta { public: PairVashishtaTable(class LAMMPS *); - ~PairVashishtaTable(); - void compute(int, int); - void settings(int, char **); - double memory_usage(); + ~PairVashishtaTable() override; + void compute(int, int) override; + void settings(int, char **) override; + double memory_usage() override; protected: int ntable; @@ -40,7 +40,7 @@ class PairVashishtaTable : public PairVashishta { double ***potentialTable; // table of potential energies void twobody_table(const Param &, double, double &, int, double &); - void setup_params(); + void setup_params() override; void create_tables(); }; diff --git a/src/MC/fix_atom_swap.h b/src/MC/fix_atom_swap.h index 2511fe6544..59145da84f 100644 --- a/src/MC/fix_atom_swap.h +++ b/src/MC/fix_atom_swap.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixAtomSwap : public Fix { public: FixAtomSwap(class LAMMPS *, int, char **); - ~FixAtomSwap(); - int setmask(); - void init(); - void pre_exchange(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double compute_vector(int); - double memory_usage(); - void write_restart(FILE *); - void restart(char *); + ~FixAtomSwap() override; + int setmask() override; + void init() override; + void pre_exchange() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double compute_vector(int) override; + double memory_usage() override; + void write_restart(FILE *) override; + void restart(char *) override; private: int nevery, seed; diff --git a/src/MC/fix_bond_break.h b/src/MC/fix_bond_break.h index d6fdd8850b..f470adcce0 100644 --- a/src/MC/fix_bond_break.h +++ b/src/MC/fix_bond_break.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class FixBondBreak : public Fix { public: FixBondBreak(class LAMMPS *, int, char **); - ~FixBondBreak(); - int setmask(); - void init(); - void post_integrate(); - void post_integrate_respa(int, int); + ~FixBondBreak() override; + int setmask() override; + void init() override; + void post_integrate() override; + void post_integrate_respa(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double compute_vector(int); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double compute_vector(int) override; + double memory_usage() override; private: int me, nprocs; diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 22cf5fc911..e245b2d738 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -412,6 +412,14 @@ void FixBondCreate::post_integrate() int *mask = atom->mask; int *type = atom->type; + if (constrainflag) { + // communicate partner and 1-2 special neighbors + // to correctly handle angle constraints + + commflag = 3; + comm->forward_comm_fix(this); + } + neighbor->build_one(list,1); inum = list->inum; ilist = list->ilist; diff --git a/src/MC/fix_bond_create.h b/src/MC/fix_bond_create.h index df29c91369..26505a5906 100644 --- a/src/MC/fix_bond_create.h +++ b/src/MC/fix_bond_create.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class FixBondCreate : public Fix { public: FixBondCreate(class LAMMPS *, int, char **); - virtual ~FixBondCreate(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void post_integrate(); - void post_integrate_respa(int, int); + ~FixBondCreate() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void post_integrate() override; + void post_integrate_respa(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - double compute_vector(int); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + double compute_vector(int) override; + double memory_usage() override; protected: int me; diff --git a/src/MC/fix_bond_create_angle.h b/src/MC/fix_bond_create_angle.h index d7563f1d78..6c74f0e6d7 100644 --- a/src/MC/fix_bond_create_angle.h +++ b/src/MC/fix_bond_create_angle.h @@ -29,7 +29,7 @@ class FixBondCreateAngle : public FixBondCreate { FixBondCreateAngle(class LAMMPS *, int, char **); private: - int constrain(int, int, double, double); + int constrain(int, int, double, double) override; }; } // namespace LAMMPS_NS diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index a3a09c180d..6f9557f1b7 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_fix_bond_swap[] = - "neighbor multi command:\n\n" + "fix bond/swap command:\n\n" "@Article{Auhl03,\n" " author = {R. Auhl, R. Everaers, G. S. Grest, K. Kremer, S. J. Plimpton},\n" " title = {Equilibration of long chain polymer melts in computer simulations},\n" diff --git a/src/MC/fix_bond_swap.h b/src/MC/fix_bond_swap.h index e0691233f5..526d35ae22 100644 --- a/src/MC/fix_bond_swap.h +++ b/src/MC/fix_bond_swap.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixBondSwap : public Fix { public: FixBondSwap(class LAMMPS *, int, char **); - ~FixBondSwap(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void post_integrate(); - int modify_param(int, char **); - double compute_vector(int); - double memory_usage(); + ~FixBondSwap() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void post_integrate() override; + int modify_param(int, char **) override; + double compute_vector(int) override; + double memory_usage() override; private: double fraction, cutsq; diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index e469c8442d..344e950847 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -22,6 +22,7 @@ #include "atom.h" #include "atom_vec.h" #include "bond.h" +#include "citeme.h" #include "comm.h" #include "compute.h" #include "dihedral.h" @@ -52,6 +53,16 @@ using namespace FixConst; using namespace MathConst; using namespace MathSpecial; +static const char cite_fix_charge_regulation[] = + "fix charge/regulation: \n\n" + "@Article{Curk22,\n" + " author = {T. Curk, J. Yuan, E. Luijten},\n" + " title = {Accelerated simulation method for charge regulation effects},\n" + " journal = {The Journal of Chemical Physics},\n" + " year = 2022,\n" + " volume = 156\n" + "}\n\n"; + enum{CONSTANT,EQUAL}; // parsing input variables // large energy value used to signal overlap @@ -68,6 +79,7 @@ FixChargeRegulation::FixChargeRegulation(LAMMPS *lmp, int narg, char **arg) : c_pe(nullptr), random_equal(nullptr), random_unequal(nullptr), idftemp(nullptr) { + if (lmp->citeme) lmp->citeme->add(cite_fix_charge_regulation); // Region restrictions not yet implemented .. @@ -646,6 +658,8 @@ void FixChargeRegulation::forward_ions() { m1 = insert_particle(cation_type, +1, 0, dummyp); m2 = insert_particle(anion_type, -1, 0, dummyp); + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); double energy_after = energy_full(); if (energy_after < MAXENERGYTEST && random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { diff --git a/src/MC/fix_charge_regulation.h b/src/MC/fix_charge_regulation.h index cf518baa03..f3856ed067 100644 --- a/src/MC/fix_charge_regulation.h +++ b/src/MC/fix_charge_regulation.h @@ -31,10 +31,10 @@ namespace LAMMPS_NS { class FixChargeRegulation : public Fix { public: FixChargeRegulation(class LAMMPS *, int, char **); - ~FixChargeRegulation(); - int setmask(); - void init(); - void pre_exchange(); + ~FixChargeRegulation() override; + int setmask() override; + void init() override; + void pre_exchange() override; void forward_acid(); void backward_acid(); void forward_base(); @@ -48,13 +48,13 @@ class FixChargeRegulation : public Fix { double energy_full(); int particle_number(int, double); int particle_number_xrd(int, double, double, double *); - double compute_vector(int n); + double compute_vector(int n) override; void assign_tags(); void options(int, char **); void setThermoTemperaturePointer(); - double memory_usage(); - void write_restart(FILE *); - void restart(char *); + double memory_usage() override; + void write_restart(FILE *) override; + void restart(char *) override; private: int exclusion_group, exclusion_group_bit; diff --git a/src/MC/fix_gcmc.h b/src/MC/fix_gcmc.h index 44b7f2078d..23e22e686a 100644 --- a/src/MC/fix_gcmc.h +++ b/src/MC/fix_gcmc.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixGCMC : public Fix { public: FixGCMC(class LAMMPS *, int, char **); - ~FixGCMC(); - int setmask(); - void init(); - void pre_exchange(); + ~FixGCMC() override; + int setmask() override; + void init() override; + void pre_exchange() override; void attempt_atomic_translation(); void attempt_atomic_deletion(); void attempt_atomic_insertion(); @@ -52,10 +52,10 @@ class FixGCMC : public Fix { tagint pick_random_gas_molecule(); void toggle_intramolecular(int); void update_gas_atoms_list(); - double compute_vector(int); - double memory_usage(); - void write_restart(FILE *); - void restart(char *); + double compute_vector(int) override; + double memory_usage() override; + void write_restart(FILE *) override; + void restart(char *) override; void grow_molecule_arrays(int); private: diff --git a/src/MC/fix_mol_swap.cpp b/src/MC/fix_mol_swap.cpp index 8d7c2bf367..399efb419b 100644 --- a/src/MC/fix_mol_swap.cpp +++ b/src/MC/fix_mol_swap.cpp @@ -32,6 +32,8 @@ #include "random_park.h" #include "update.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/MC/fix_mol_swap.h b/src/MC/fix_mol_swap.h index 3197cbd832..8962ea69a2 100644 --- a/src/MC/fix_mol_swap.h +++ b/src/MC/fix_mol_swap.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixMolSwap : public Fix { public: FixMolSwap(class LAMMPS *, int, char **); - ~FixMolSwap(); - int setmask(); - void init(); - void pre_exchange(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double compute_vector(int); - void write_restart(FILE *); - void restart(char *); + ~FixMolSwap() override; + int setmask() override; + void init() override; + void pre_exchange() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double compute_vector(int) override; + void write_restart(FILE *) override; + void restart(char *) override; private: int nevery, ncycles, seed; diff --git a/src/MC/fix_tfmc.h b/src/MC/fix_tfmc.h index ea68d4fc6a..974cf2b4bf 100644 --- a/src/MC/fix_tfmc.h +++ b/src/MC/fix_tfmc.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixTFMC : public Fix { public: FixTFMC(class LAMMPS *, int, char **); - ~FixTFMC(); - int setmask(); - void init(); - void initial_integrate(int); + ~FixTFMC() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; private: double d_max; diff --git a/src/MC/fix_widom.h b/src/MC/fix_widom.h index 222cb32b3f..d2240fd6c8 100644 --- a/src/MC/fix_widom.h +++ b/src/MC/fix_widom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixWidom : public Fix { public: FixWidom(class LAMMPS *, int, char **); - ~FixWidom(); - int setmask(); - void init(); - void pre_exchange(); + ~FixWidom() override; + int setmask() override; + void init() override; + void pre_exchange() override; void attempt_atomic_insertion(); void attempt_molecule_insertion(); @@ -41,10 +41,10 @@ class FixWidom : public Fix { double molecule_energy(tagint); double energy_full(); void update_gas_atoms_list(); - double compute_vector(int); - double memory_usage(); - void write_restart(FILE *); - void restart(char *); + double compute_vector(int) override; + double memory_usage() override; + void write_restart(FILE *) override; + void restart(char *) override; void grow_molecule_arrays(int); private: diff --git a/src/MC/pair_dsmc.h b/src/MC/pair_dsmc.h index 947c0dafb2..36ae8ea21b 100644 --- a/src/MC/pair_dsmc.h +++ b/src/MC/pair_dsmc.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class PairDSMC : public Pair { public: PairDSMC(class LAMMPS *); - virtual ~PairDSMC(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + ~PairDSMC() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; private: double cut_global; diff --git a/src/MDI/fix_mdi_engine.h b/src/MDI/fix_mdi_engine.h index bcba62c063..925292ae1f 100644 --- a/src/MDI/fix_mdi_engine.h +++ b/src/MDI/fix_mdi_engine.h @@ -28,20 +28,20 @@ namespace LAMMPS_NS { class FixMDIEngine : public Fix { public: FixMDIEngine(class LAMMPS *, int, char **); - ~FixMDIEngine(); - int setmask(); - void init(); + ~FixMDIEngine() override; + int setmask() override; + void init() override; int execute_command(const char *command, MDI_Comm driver_socket); char *engine_mode(const char *node); // receive and update forces - void min_setup(int); - void post_integrate(); - void post_force(int); - void min_pre_force(int); //@COORDS - void min_post_force(int); //@FORCES + void min_setup(int) override; + void post_integrate() override; + void post_force(int) override; + void min_pre_force(int) override; //@COORDS + void min_post_force(int) override; //@FORCES double *add_force; // stores forces added using +FORCE command double potential_energy; // stores potential energy diff --git a/src/MDI/mdi_engine.h b/src/MDI/mdi_engine.h index f282714097..5202b811d8 100644 --- a/src/MDI/mdi_engine.h +++ b/src/MDI/mdi_engine.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class MDIEngine : public Command { public: MDIEngine(LAMMPS *lmp) : Command(lmp) {} - virtual ~MDIEngine() {} - void command(int, char **); + + void command(int, char **) override; private: class FixMDIEngine *mdi_fix; diff --git a/src/MEAM/meam.h b/src/MEAM/meam.h index 5205e01ec8..237ffed8aa 100644 --- a/src/MEAM/meam.h +++ b/src/MEAM/meam.h @@ -14,8 +14,6 @@ #ifndef LMP_MEAM_H #define LMP_MEAM_H -#include "math_const.h" // IWYU pragma: export - #include #include diff --git a/src/MEAM/meam_setup_param.cpp b/src/MEAM/meam_setup_param.cpp index 081612f70e..b15b70e263 100644 --- a/src/MEAM/meam_setup_param.cpp +++ b/src/MEAM/meam_setup_param.cpp @@ -20,7 +20,7 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PI; // do a sanity check on index parameters void diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index e8c6c942a4..6c240fc40a 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -28,7 +28,6 @@ #include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include #include diff --git a/src/MEAM/pair_meam.h b/src/MEAM/pair_meam.h index 347869c293..e3e3767ba3 100644 --- a/src/MEAM/pair_meam.h +++ b/src/MEAM/pair_meam.h @@ -28,20 +28,20 @@ namespace LAMMPS_NS { class PairMEAM : public Pair { public: PairMEAM(class LAMMPS *); - ~PairMEAM(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - void init_list(int, class NeighList *); - double init_one(int, int); - virtual void *extract(const char *, int &); + ~PairMEAM() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: class MEAM *meam_inst; diff --git a/src/MESONT/compute_mesont.h b/src/MESONT/compute_mesont.h index ea8df7cf8c..b1ed890139 100644 --- a/src/MESONT/compute_mesont.h +++ b/src/MESONT/compute_mesont.h @@ -29,13 +29,13 @@ namespace LAMMPS_NS { class ComputeMesoNT : public Compute { public: ComputeMesoNT(class LAMMPS *, int, char **); - ~ComputeMesoNT(); - void init() {} - void compute_peratom(); - double compute_scalar(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeMesoNT() override; + void init() override {} + void compute_peratom() override; + double compute_scalar() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int nmax; diff --git a/src/MESONT/pair_mesocnt.h b/src/MESONT/pair_mesocnt.h index 3db576ad7d..559a260f3f 100644 --- a/src/MESONT/pair_mesocnt.h +++ b/src/MESONT/pair_mesocnt.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairMesoCNT : public Pair { public: PairMesoCNT(class LAMMPS *); - ~PairMesoCNT(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + ~PairMesoCNT() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: int uinf_points, gamma_points, phi_points, usemi_points; diff --git a/src/MESONT/pair_mesont_tpm.h b/src/MESONT/pair_mesont_tpm.h index ee8bd9ece6..edb5d320bf 100644 --- a/src/MESONT/pair_mesont_tpm.h +++ b/src/MESONT/pair_mesont_tpm.h @@ -29,18 +29,18 @@ namespace LAMMPS_NS { class PairMESONTTPM : public Pair { public: PairMESONTTPM(class LAMMPS *); - virtual ~PairMESONTTPM(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual void init_style(); + ~PairMESONTTPM() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void init_style() override; double energy_s; // accumulated energies for stretching double energy_b; // accumulated energies for bending @@ -57,7 +57,7 @@ class PairMESONTTPM : public Pair { int nmax; virtual void allocate(); - virtual void *extract(const char *, int &); + void *extract(const char *, int &) override; }; } // namespace LAMMPS_NS diff --git a/src/MESSAGE/fix_client_md.h b/src/MESSAGE/fix_client_md.h index a9f9b531f1..2a0106fd0e 100644 --- a/src/MESSAGE/fix_client_md.h +++ b/src/MESSAGE/fix_client_md.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixClientMD : public Fix { public: FixClientMD(class LAMMPS *, int, char **); - ~FixClientMD(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void min_post_force(int); - double compute_scalar(); + ~FixClientMD() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void min_post_force(int) override; + double compute_scalar() override; private: int maxatom, units, server_error; diff --git a/src/MESSAGE/message.h b/src/MESSAGE/message.h index cb86fa62e5..ff832f1145 100644 --- a/src/MESSAGE/message.h +++ b/src/MESSAGE/message.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Message : public Command { public: Message(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; private: void quit(); diff --git a/src/MESSAGE/server.h b/src/MESSAGE/server.h index c06aaa6f12..e82ac7e8b0 100644 --- a/src/MESSAGE/server.h +++ b/src/MESSAGE/server.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Server : public Command { public: Server(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/MESSAGE/server_md.h b/src/MESSAGE/server_md.h index e50027f0ea..bd227286b4 100644 --- a/src/MESSAGE/server_md.h +++ b/src/MESSAGE/server_md.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class ServerMD : protected Pointers { public: ServerMD(class LAMMPS *); - ~ServerMD(); + ~ServerMD() override; void loop(); private: diff --git a/src/MGPT/pair_mgpt.h b/src/MGPT/pair_mgpt.h index ed73ed1f35..355a17522b 100644 --- a/src/MGPT/pair_mgpt.h +++ b/src/MGPT/pair_mgpt.h @@ -259,13 +259,13 @@ public: public: PairMGPT(class LAMMPS *); - ~PairMGPT(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - void init_list(int, class NeighList *); - double init_one(int, int); + ~PairMGPT() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int, class NeighList *) override; + double init_one(int, int) override; private: diff --git a/src/MISC/bond_special.h b/src/MISC/bond_special.h index 80a32b7896..e510486271 100644 --- a/src/MISC/bond_special.h +++ b/src/MISC/bond_special.h @@ -29,15 +29,15 @@ namespace LAMMPS_NS { class BondSpecial : public Bond { public: BondSpecial(class LAMMPS *); - virtual ~BondSpecial(); - void init_style(); - void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondSpecial() override; + void init_style() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *factor_lj, *factor_coul; diff --git a/src/MISC/compute_viscosity_cos.h b/src/MISC/compute_viscosity_cos.h index e6a1894ce3..d30ff5c50a 100644 --- a/src/MISC/compute_viscosity_cos.h +++ b/src/MISC/compute_viscosity_cos.h @@ -31,18 +31,18 @@ namespace LAMMPS_NS { class ComputeViscosityCos : public Compute { public: ComputeViscosityCos(class LAMMPS *, int, char **); - virtual ~ComputeViscosityCos(); - void init() {} - void setup(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputeViscosityCos() override; + void init() override {} + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_thr(int, double *, double *); - void restore_bias_all(); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_thr(int, double *, double *) override; + void restore_bias_all() override; protected: double tfactor; diff --git a/src/MISC/fix_accelerate_cos.h b/src/MISC/fix_accelerate_cos.h index cad4a94e2a..48d992b1a2 100644 --- a/src/MISC/fix_accelerate_cos.h +++ b/src/MISC/fix_accelerate_cos.h @@ -31,11 +31,11 @@ namespace LAMMPS_NS { class FixAccelerateCos : public Fix { public: FixAccelerateCos(class LAMMPS *, int, char **); - virtual ~FixAccelerateCos(){}; - int setmask(); - virtual void init(){}; - void setup(int); - virtual void post_force(int); + + int setmask() override; + void init() override{}; + void setup(int) override; + void post_force(int) override; protected: double acceleration; diff --git a/src/MISC/fix_imd.h b/src/MISC/fix_imd.h index 3c4e66f50a..314b629ac1 100644 --- a/src/MISC/fix_imd.h +++ b/src/MISC/fix_imd.h @@ -64,13 +64,13 @@ namespace LAMMPS_NS { class FixIMD : public Fix { public: FixIMD(class LAMMPS *, int, char **); - ~FixIMD(); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double memory_usage(); + ~FixIMD() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double memory_usage() override; protected: int imd_port; diff --git a/src/MISC/fix_ipi.h b/src/MISC/fix_ipi.h index 443dbc8780..07d1c729a9 100644 --- a/src/MISC/fix_ipi.h +++ b/src/MISC/fix_ipi.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixIPI : public Fix { public: FixIPI(class LAMMPS *, int, char **); - virtual ~FixIPI(); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); + ~FixIPI() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; protected: char *host; diff --git a/src/MISC/fix_srp.h b/src/MISC/fix_srp.h index 2167a27340..e6049de893 100644 --- a/src/MISC/fix_srp.h +++ b/src/MISC/fix_srp.h @@ -27,30 +27,30 @@ namespace LAMMPS_NS { class FixSRP : public Fix { public: FixSRP(class LAMMPS *, int, char **); - ~FixSRP(); - int setmask(); - void init(); + ~FixSRP() override; + int setmask() override; + void init() override; - void pre_exchange(); - void setup_pre_force(int); + void pre_exchange() override; + void setup_pre_force(int) override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_border(int, int *, double *); - int unpack_border(int, int, double *); - void post_run(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_border(int, int *, double *) override; + int unpack_border(int, int, double *) override; + void post_run() override; - int pack_restart(int, double *); - void unpack_restart(int, int); - int maxsize_restart(); - int size_restart(int); - void write_restart(FILE *); - void restart(char *); - int modify_param(int, char **); + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int maxsize_restart() override; + int size_restart(int) override; + void write_restart(FILE *) override; + void restart(char *) override; + int modify_param(int, char **) override; double **array; diff --git a/src/MISC/pair_agni.cpp b/src/MISC/pair_agni.cpp index 46d782e899..f614dd9c36 100644 --- a/src/MISC/pair_agni.cpp +++ b/src/MISC/pair_agni.cpp @@ -29,7 +29,6 @@ #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" -#include "tokenizer.h" #include "potential_file_reader.h" #include diff --git a/src/MISC/pair_agni.h b/src/MISC/pair_agni.h index 2a1e700d29..b324b5a98a 100644 --- a/src/MISC/pair_agni.h +++ b/src/MISC/pair_agni.h @@ -28,12 +28,12 @@ class PairAGNI : public Pair { public: enum { AGNI_VERSION_UNKNOWN, AGNI_VERSION_1, AGNI_VERSION_2 }; PairAGNI(class LAMMPS *); - virtual ~PairAGNI(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - virtual double init_one(int, int); - virtual void init_style(); + ~PairAGNI() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void init_style() override; struct Param { double cut, cutsq; diff --git a/src/MISC/pair_list.cpp b/src/MISC/pair_list.cpp index d1051ecb11..d7d59e90d3 100644 --- a/src/MISC/pair_list.cpp +++ b/src/MISC/pair_list.cpp @@ -18,19 +18,27 @@ #include "pair_list.h" -#include -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "text_file_reader.h" +#include +#include +#include +#include using namespace LAMMPS_NS; -static const char * const stylename[] = { - "none", "harmonic", "morse", "lj126", nullptr +enum { NONE = 0, HARM, MORSE, LJ126 }; + +static std::map stylename = { + { "none", NONE }, + { "harmonic", HARM }, + { "morse", MORSE }, + { "lj126", LJ126 } }; // fast power function for integer exponent > 0 @@ -55,7 +63,6 @@ PairList::PairList(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; respa_enable = 0; cut_global = 0.0; - style = nullptr; params = nullptr; check_flag = 1; } @@ -66,7 +73,6 @@ PairList::~PairList() { memory->destroy(setflag); memory->destroy(cutsq); - memory->destroy(style); memory->destroy(params); } @@ -90,7 +96,7 @@ void PairList::compute(int eflag, int vflag) int pc = 0; for (int n=0; n < npairs; ++n) { - const list_parm_t &par = params[n]; + const list_param &par = params[n]; i = atom->map(par.id1); j = atom->map(par.id2); @@ -122,34 +128,34 @@ void PairList::compute(int eflag, int vflag) if (rsq < par.cutsq) { const double r2inv = 1.0/rsq; - if (style[n] == HARM) { + if (par.style == HARM) { const double r = sqrt(rsq); - const double dr = par.parm.harm.r0 - r; - fpair = 2.0*par.parm.harm.k*dr/r; + const double dr = par.param.harm.r0 - r; + fpair = 2.0*par.param.harm.k*dr/r; if (eflag_either) - epair = par.parm.harm.k*dr*dr - par.offset; + epair = par.param.harm.k*dr*dr - par.offset; - } else if (style[n] == MORSE) { + } else if (par.style == MORSE) { const double r = sqrt(rsq); - const double dr = par.parm.morse.r0 - r; - const double dexp = exp(par.parm.morse.alpha * dr); - fpair = 2.0*par.parm.morse.d0*par.parm.morse.alpha + const double dr = par.param.morse.r0 - r; + const double dexp = exp(par.param.morse.alpha * dr); + fpair = 2.0*par.param.morse.d0*par.param.morse.alpha * (dexp*dexp - dexp) / r; if (eflag_either) - epair = par.parm.morse.d0 * (dexp*dexp - 2.0*dexp) - par.offset; + epair = par.param.morse.d0 * (dexp*dexp - 2.0*dexp) - par.offset; - } else if (style[n] == LJ126) { + } else if (par.style == LJ126) { const double r6inv = r2inv*r2inv*r2inv; - const double sig6 = mypow(par.parm.lj126.sigma,6); - fpair = 24.0*par.parm.lj126.epsilon*r6inv + const double sig6 = mypow(par.param.lj126.sigma,6); + fpair = 24.0*par.param.lj126.epsilon*r6inv * (2.0*sig6*sig6*r6inv - sig6) * r2inv; if (eflag_either) - epair = 4.0*par.parm.lj126.epsilon*r6inv + epair = 4.0*par.param.lj126.epsilon*r6inv * (sig6*sig6*r6inv - sig6) - par.offset; } @@ -210,130 +216,74 @@ void PairList::settings(int narg, char **arg) if (strcmp(arg[2],"check") == 0) check_flag = 1; } - FILE *fp = utils::open_potential(arg[0],lmp,nullptr); - char line[1024]; - if (fp == nullptr) - error->all(FLERR,"Cannot open pair list file"); + std::vector mystyles; + std::vector myparams; - // count lines in file for upper limit of storage needed - int num = 1; - while (fgets(line,1024,fp)) ++num; - rewind(fp); - memory->create(style,num,"pair_list:style"); - memory->create(params,num,"pair_list:params"); - - // now read and parse pair list file for real - npairs = 0; - char *ptr; - tagint id1, id2; - int nharm=0, nmorse=0, nlj126=0; - - while (fgets(line,1024,fp)) { - ptr = strtok(line," \t\n\r\f"); - - // skip empty lines - if (!ptr) continue; - - // skip comment lines starting with # - if (*ptr == '#') continue; - - // get atom ids of pair - id1 = ATOTAGINT(ptr); - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted pair list file"); - id2 = ATOTAGINT(ptr); - - // get potential type - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted pair list file"); - - style[npairs] = NONE; - list_parm_t &par = params[npairs]; - par.id1 = id1; - par.id2 = id2; - - // harmonic potential - if (strcmp(ptr,stylename[HARM]) == 0) { - style[npairs] = HARM; - - ptr = strtok(nullptr," \t\n\r\f"); - if ((ptr == nullptr) || (*ptr == '#')) - error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); - par.parm.harm.k = utils::numeric(FLERR,ptr,false,lmp); - - ptr = strtok(nullptr," \t\n\r\f"); - if ((ptr == nullptr) || (*ptr == '#')) - error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); - par.parm.harm.r0 = utils::numeric(FLERR,ptr,false,lmp); - - ++nharm; - - // morse potential - } else if (strcmp(ptr,stylename[MORSE]) == 0) { - style[npairs] = MORSE; - - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted morse pair parameters"); - par.parm.morse.d0 = utils::numeric(FLERR,ptr,false,lmp); - - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted morse pair parameters"); - par.parm.morse.alpha = utils::numeric(FLERR,ptr,false,lmp); - - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted morse pair parameters"); - par.parm.morse.r0 = utils::numeric(FLERR,ptr,false,lmp); - - ++nmorse; - - } else if (strcmp(ptr,stylename[LJ126]) == 0) { - // 12-6 lj potential - style[npairs] = LJ126; - - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); - par.parm.lj126.epsilon = utils::numeric(FLERR,ptr,false,lmp); - - ptr = strtok(nullptr," \t\n\r\f"); - if (!ptr) - error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); - par.parm.lj126.sigma = utils::numeric(FLERR,ptr,false,lmp); - - ++nlj126; - - } else { - error->all(FLERR,"Unknown pair list potential style"); - } - - // optional cutoff parameter. if not specified use global value - ptr = strtok(nullptr," \t\n\r\f"); - if ((ptr != nullptr) && (*ptr != '#')) { - double cut = utils::numeric(FLERR,ptr,false,lmp); - par.cutsq = cut*cut; - } else { - par.cutsq = cut_global*cut_global; - } - - // count complete entry - ++npairs; - } - fclose(fp); - - // informative output + // read and parse potential file only on MPI rank 0. if (comm->me == 0) { - if (screen) - fprintf(screen,"Read %d (%d/%d/%d) interacting pairs from %s\n", - npairs, nharm, nmorse, nlj126, arg[0]); - if (logfile) - fprintf(logfile,"Read %d (%d/%d/%d) interacting pairs from %s\n", - npairs, nharm, nmorse, nlj126, arg[0]); + int nharm, nmorse, nlj126, nskipped; + FILE *fp = utils::open_potential(arg[0],lmp,nullptr); + TextFileReader reader(fp,"pair list coeffs"); + npairs = nharm = nmorse = nlj126 = nskipped = 0; + + try { + char *line; + while ((line = reader.next_line())) { + ValueTokenizer values(line); + list_param oneparam; + oneparam.offset = 0.0; + oneparam.id1 = values.next_tagint(); + oneparam.id2 = values.next_tagint(); + oneparam.style = stylename[values.next_string()]; + ++npairs; + + switch (oneparam.style) { + + case HARM: + oneparam.param.harm.k = values.next_double(); + oneparam.param.harm.r0 = values.next_double(); + ++nharm; + break; + + case MORSE: + oneparam.param.morse.d0 = values.next_double(); + oneparam.param.morse.alpha = values.next_double(); + oneparam.param.morse.r0 = values.next_double(); + ++nmorse; + break; + + case LJ126: + oneparam.param.lj126.epsilon = values.next_double(); + oneparam.param.lj126.sigma = values.next_double(); + ++nlj126; + break; + + case NONE: // fallthrough + error->warning(FLERR,"Skipping unrecognized pair list potential entry: {}", + utils::trim(line)); + ++nskipped; + break; + } + if (values.has_next()) + oneparam.cutsq = values.next_double(); + else + oneparam.cutsq = cut_global*cut_global; + + myparams.push_back(oneparam); + } + } catch (std::exception &e) { + error->one(FLERR,"Error reading pair list coeffs file: {}", e.what()); + } + utils::logmesg(lmp, "Read {} ({}/{}/{}) interacting pair lines from {}. " + "{} skipped entries.\n", npairs, nharm, nmorse, nlj126, arg[0], nskipped); + + memory->create(params,npairs,"pair_list:params"); + memcpy(params, myparams.data(),npairs*sizeof(list_param)); + fclose(fp); } + MPI_Bcast(&npairs, 1, MPI_INT, 0, world); + if (comm->me != 0) memory->create(params,npairs,"pair_list:params"); + MPI_Bcast(params, npairs*sizeof(list_param), MPI_BYTE, 0, world); } /* ---------------------------------------------------------------------- @@ -374,21 +324,21 @@ void PairList::init_style() if (offset_flag) { for (int n=0; n < npairs; ++n) { - list_parm_t &par = params[n]; + list_param &par = params[n]; - if (style[n] == HARM) { - const double dr = sqrt(par.cutsq) - par.parm.harm.r0; - par.offset = par.parm.harm.k*dr*dr; + if (par.style == HARM) { + const double dr = sqrt(par.cutsq) - par.param.harm.r0; + par.offset = par.param.harm.k*dr*dr; - } else if (style[n] == MORSE) { - const double dr = par.parm.morse.r0 - sqrt(par.cutsq); - const double dexp = exp(par.parm.morse.alpha * dr); - par.offset = par.parm.morse.d0 * (dexp*dexp - 2.0*dexp); + } else if (par.style == MORSE) { + const double dr = par.param.morse.r0 - sqrt(par.cutsq); + const double dexp = exp(par.param.morse.alpha * dr); + par.offset = par.param.morse.d0 * (dexp*dexp - 2.0*dexp); - } else if (style[n] == LJ126) { + } else if (par.style == LJ126) { const double r6inv = par.cutsq*par.cutsq*par.cutsq; - const double sig6 = mypow(par.parm.lj126.sigma,6); - par.offset = 4.0*par.parm.lj126.epsilon*r6inv * (sig6*sig6*r6inv - sig6); + const double sig6 = mypow(par.param.lj126.sigma,6); + par.offset = 4.0*par.param.lj126.epsilon*r6inv * (sig6*sig6*r6inv - sig6); } } } @@ -411,7 +361,7 @@ double PairList::init_one(int, int) double PairList::memory_usage() { double bytes = (double)npairs * sizeof(int); - bytes += (double)npairs * sizeof(list_parm_t); + bytes += (double)npairs * sizeof(list_param); const int n = atom->ntypes+1; bytes += (double)n*(n*sizeof(int) + sizeof(int *)); bytes += (double)n*(n*sizeof(double) + sizeof(double *)); diff --git a/src/MISC/pair_list.h b/src/MISC/pair_list.h index 60fd3a7a24..3528ad10f8 100644 --- a/src/MISC/pair_list.h +++ b/src/MISC/pair_list.h @@ -27,20 +27,18 @@ namespace LAMMPS_NS { class PairList : public Pair { public: PairList(class LAMMPS *); - virtual ~PairList(); + ~PairList() override; - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - virtual double memory_usage(); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; protected: void allocate(); - enum { NONE = 0, HARM, MORSE, LJ126 }; - // potential specific parameters struct harm_p { double k, r0; @@ -52,23 +50,23 @@ class PairList : public Pair { double epsilon, sigma; }; - union parm_u { - struct harm_p harm; - struct morse_p morse; - struct lj126_p lj126; + union param_u { + harm_p harm; + morse_p morse; + lj126_p lj126; }; - typedef struct { + struct list_param { + int style; // potential style indicator tagint id1, id2; // global atom ids double cutsq; // cutoff**2 for this pair double offset; // energy offset - union parm_u parm; // parameters for style - } list_parm_t; + union param_u param; // parameters for style + }; protected: double cut_global; // global cutoff distance - int *style; // list of styles for pair interactions - list_parm_t *params; // lisf of pair interaction parameters + list_param *params; // lisf of pair interaction parameters int npairs; // # of atom pairs in global list int check_flag; // 1 if checking for missing pairs }; diff --git a/src/MISC/pair_srp.h b/src/MISC/pair_srp.h index 4c56edaaf3..5c6816e695 100644 --- a/src/MISC/pair_srp.h +++ b/src/MISC/pair_srp.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairSRP : public Pair { public: PairSRP(class LAMMPS *); - virtual ~PairSRP(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); + ~PairSRP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; private: inline void onetwoexclude(int *&, int &, int *&, int *&, int **&); diff --git a/src/MISC/pair_tracker.h b/src/MISC/pair_tracker.h index 13a8709866..0a015d6ec7 100644 --- a/src/MISC/pair_tracker.h +++ b/src/MISC/pair_tracker.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairTracker : public Pair { public: PairTracker(class LAMMPS *); - virtual ~PairTracker(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - double atom2cut(int); - double radii2cut(double, double); - void transfer_history(double *, double *); + ~PairTracker() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + double atom2cut(int) override; + double radii2cut(double, double) override; + void transfer_history(double *, double *) override; protected: int sizeflag; @@ -58,6 +58,7 @@ class PairTracker : public Pair { char *id_fix_store_local; class FixDummy *fix_dummy; class FixNeighHistory *fix_history; +<<<<<<< HEAD class FixStoreLocal *fix_store_local; int **type_filter; @@ -80,6 +81,11 @@ class PairTracker : public Pair { void pack_rave(int, int, int, double *); void process_data(int, int, double *); +======= + class FixPairTracker *fix_pair_tracker; + + void transfer_history(double *, double *) override; +>>>>>>> develop void allocate(); }; diff --git a/src/ML-HDNNP/pair_hdnnp.h b/src/ML-HDNNP/pair_hdnnp.h index 3c42fa60be..e186e29785 100644 --- a/src/ML-HDNNP/pair_hdnnp.h +++ b/src/ML-HDNNP/pair_hdnnp.h @@ -39,12 +39,12 @@ class PairHDNNP : public Pair { public: PairHDNNP(class LAMMPS *); - virtual ~PairHDNNP(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); + ~PairHDNNP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; protected: virtual void allocate(); diff --git a/src/ML-IAP/compute_mliap.h b/src/ML-IAP/compute_mliap.h index 6afbc970cb..db1b6c0449 100644 --- a/src/ML-IAP/compute_mliap.h +++ b/src/ML-IAP/compute_mliap.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeMLIAP : public Compute { public: ComputeMLIAP(class LAMMPS *, int, char **); - ~ComputeMLIAP(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); + ~ComputeMLIAP() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_array() override; void generate_neigharrays(); void grow_neigharrays(); - double memory_usage(); + double memory_usage() override; private: double **mliaparray, **mliaparrayall; diff --git a/src/ML-IAP/mliap_data.h b/src/ML-IAP/mliap_data.h index 5f689c204c..258261fa1a 100644 --- a/src/ML-IAP/mliap_data.h +++ b/src/ML-IAP/mliap_data.h @@ -23,7 +23,7 @@ class MLIAPData : protected Pointers { public: MLIAPData(class LAMMPS *, int, int *, class MLIAPModel *, class MLIAPDescriptor *, class PairMLIAP * = nullptr); - ~MLIAPData(); + ~MLIAPData() override; void init(); void generate_neighdata(class NeighList *, int = 0, int = 0); diff --git a/src/ML-IAP/mliap_descriptor.h b/src/ML-IAP/mliap_descriptor.h index 1655cc4a82..156f8d1e92 100644 --- a/src/ML-IAP/mliap_descriptor.h +++ b/src/ML-IAP/mliap_descriptor.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class MLIAPDescriptor : protected Pointers { public: MLIAPDescriptor(LAMMPS *); - virtual ~MLIAPDescriptor(); + ~MLIAPDescriptor() override; virtual void compute_descriptors(class MLIAPData *) = 0; virtual void compute_forces(class MLIAPData *) = 0; virtual void compute_force_gradients(class MLIAPData *) = 0; diff --git a/src/ML-IAP/mliap_descriptor_snap.h b/src/ML-IAP/mliap_descriptor_snap.h index 7d8c3ea98c..9098015a4f 100644 --- a/src/ML-IAP/mliap_descriptor_snap.h +++ b/src/ML-IAP/mliap_descriptor_snap.h @@ -21,13 +21,13 @@ namespace LAMMPS_NS { class MLIAPDescriptorSNAP : public MLIAPDescriptor { public: MLIAPDescriptorSNAP(LAMMPS *, char *); - virtual ~MLIAPDescriptorSNAP(); - virtual void compute_descriptors(class MLIAPData *); - virtual void compute_forces(class MLIAPData *); - virtual void compute_force_gradients(class MLIAPData *); - virtual void compute_descriptor_gradients(class MLIAPData *); - virtual void init(); - virtual double memory_usage(); + ~MLIAPDescriptorSNAP() override; + void compute_descriptors(class MLIAPData *) override; + void compute_forces(class MLIAPData *) override; + void compute_force_gradients(class MLIAPData *) override; + void compute_descriptor_gradients(class MLIAPData *) override; + void init() override; + double memory_usage() override; double rcutfac; diff --git a/src/ML-IAP/mliap_descriptor_so3.h b/src/ML-IAP/mliap_descriptor_so3.h index ec19e91b75..40d88e4cfb 100644 --- a/src/ML-IAP/mliap_descriptor_so3.h +++ b/src/ML-IAP/mliap_descriptor_so3.h @@ -22,14 +22,14 @@ class MLIAPDescriptorSO3 : public MLIAPDescriptor { public: MLIAPDescriptorSO3(LAMMPS *, char *); - virtual ~MLIAPDescriptorSO3(); + ~MLIAPDescriptorSO3() override; - virtual void compute_descriptors(class MLIAPData *); - virtual void compute_forces(class MLIAPData *); - virtual void compute_force_gradients(class MLIAPData *){}; - virtual void compute_descriptor_gradients(class MLIAPData *){}; - virtual void init(); - virtual double memory_usage(); + void compute_descriptors(class MLIAPData *) override; + void compute_forces(class MLIAPData *) override; + void compute_force_gradients(class MLIAPData *) override{}; + void compute_descriptor_gradients(class MLIAPData *) override{}; + void init() override; + double memory_usage() override; double rcutfac; diff --git a/src/ML-IAP/mliap_model.h b/src/ML-IAP/mliap_model.h index 3a73065b04..bc38b8b58d 100644 --- a/src/ML-IAP/mliap_model.h +++ b/src/ML-IAP/mliap_model.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class MLIAPModel : protected Pointers { public: MLIAPModel(LAMMPS *, char *); - virtual ~MLIAPModel(); + ~MLIAPModel() override; void set_ndescriptors(int); void set_nelements(int); virtual int get_nparams() = 0; @@ -44,11 +44,11 @@ class MLIAPModel : protected Pointers { class MLIAPModelSimple : public MLIAPModel { public: MLIAPModelSimple(LAMMPS *, char *); - ~MLIAPModelSimple(){}; - virtual double memory_usage(); + + double memory_usage() override; protected: - virtual void read_coeffs(char *); + void read_coeffs(char *) override; }; } // namespace LAMMPS_NS diff --git a/src/ML-IAP/mliap_model_linear.cpp b/src/ML-IAP/mliap_model_linear.cpp index 08654783d8..066a19816f 100644 --- a/src/ML-IAP/mliap_model_linear.cpp +++ b/src/ML-IAP/mliap_model_linear.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "mliap_model_linear.h" -#include "pair_mliap.h" + #include "mliap_data.h" #include "error.h" diff --git a/src/ML-IAP/mliap_model_linear.h b/src/ML-IAP/mliap_model_linear.h index d2abaec31e..cd22ca8d7d 100644 --- a/src/ML-IAP/mliap_model_linear.h +++ b/src/ML-IAP/mliap_model_linear.h @@ -21,12 +21,12 @@ namespace LAMMPS_NS { class MLIAPModelLinear : public MLIAPModelSimple { public: MLIAPModelLinear(LAMMPS *, char * = nullptr); - ~MLIAPModelLinear() = default; - virtual int get_nparams(); - virtual int get_gamma_nnz(class MLIAPData *); - virtual void compute_gradients(class MLIAPData *); - virtual void compute_gradgrads(class MLIAPData *); - virtual void compute_force_gradients(class MLIAPData *); + + int get_nparams() override; + int get_gamma_nnz(class MLIAPData *) override; + void compute_gradients(class MLIAPData *) override; + void compute_gradgrads(class MLIAPData *) override; + void compute_force_gradients(class MLIAPData *) override; protected: }; diff --git a/src/ML-IAP/mliap_model_nn.cpp b/src/ML-IAP/mliap_model_nn.cpp index 853f1d9c6c..24fddda766 100644 --- a/src/ML-IAP/mliap_model_nn.cpp +++ b/src/ML-IAP/mliap_model_nn.cpp @@ -19,7 +19,6 @@ #include "mliap_model_nn.h" #include "mliap_data.h" -#include "pair_mliap.h" #include "comm.h" #include "error.h" diff --git a/src/ML-IAP/mliap_model_nn.h b/src/ML-IAP/mliap_model_nn.h index 5a45a34b5f..f2e43bccc8 100644 --- a/src/ML-IAP/mliap_model_nn.h +++ b/src/ML-IAP/mliap_model_nn.h @@ -23,13 +23,13 @@ namespace LAMMPS_NS { class MLIAPModelNN : public MLIAPModel { public: MLIAPModelNN(LAMMPS *, char * = nullptr); - ~MLIAPModelNN(); - virtual int get_nparams(); - virtual int get_gamma_nnz(class MLIAPData *); - virtual void compute_gradients(class MLIAPData *); - virtual void compute_gradgrads(class MLIAPData *); - virtual void compute_force_gradients(class MLIAPData *); - virtual double memory_usage(); + ~MLIAPModelNN() override; + int get_nparams() override; + int get_gamma_nnz(class MLIAPData *) override; + void compute_gradients(class MLIAPData *) override; + void compute_gradgrads(class MLIAPData *) override; + void compute_force_gradients(class MLIAPData *) override; + double memory_usage() override; int nlayers; // number of layers per element @@ -37,7 +37,7 @@ class MLIAPModelNN : public MLIAPModel { int *activation; // activation functions int *nnodes; // number of nodes per layer double ***scale; // element scale values - virtual void read_coeffs(char *); + void read_coeffs(char *) override; inline double sigm(double x, double &deriv) { diff --git a/src/ML-IAP/mliap_model_quadratic.h b/src/ML-IAP/mliap_model_quadratic.h index 74234066c8..36eab165e4 100644 --- a/src/ML-IAP/mliap_model_quadratic.h +++ b/src/ML-IAP/mliap_model_quadratic.h @@ -21,12 +21,12 @@ namespace LAMMPS_NS { class MLIAPModelQuadratic : public MLIAPModelSimple { public: MLIAPModelQuadratic(LAMMPS *, char * = nullptr); - ~MLIAPModelQuadratic() = default; - virtual int get_nparams(); - virtual int get_gamma_nnz(class MLIAPData *); - virtual void compute_gradients(class MLIAPData *); - virtual void compute_gradgrads(class MLIAPData *); - virtual void compute_force_gradients(class MLIAPData *); + + int get_nparams() override; + int get_gamma_nnz(class MLIAPData *) override; + void compute_gradients(class MLIAPData *) override; + void compute_gradgrads(class MLIAPData *) override; + void compute_force_gradients(class MLIAPData *) override; protected: }; diff --git a/src/ML-IAP/mliap_so3.h b/src/ML-IAP/mliap_so3.h index 2429803dde..27d4f406e4 100644 --- a/src/ML-IAP/mliap_so3.h +++ b/src/ML-IAP/mliap_so3.h @@ -11,7 +11,7 @@ class MLIAP_SO3 : protected Pointers { MLIAP_SO3(LAMMPS *, double vrcut, int vlmax, int vnmax, double valpha); MLIAP_SO3(LAMMPS *lmp) : Pointers(lmp){}; - ~MLIAP_SO3(); + ~MLIAP_SO3() override; void init(); diff --git a/src/ML-IAP/pair_mliap.h b/src/ML-IAP/pair_mliap.h index 641772effb..902b005041 100644 --- a/src/ML-IAP/pair_mliap.h +++ b/src/ML-IAP/pair_mliap.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairMLIAP : public Pair { public: PairMLIAP(class LAMMPS *); - ~PairMLIAP(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); + ~PairMLIAP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; void e_tally(class MLIAPData *); void v_tally(int, int, double *, double *); - virtual void init_style(); - virtual double init_one(int, int); - virtual double memory_usage(); + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; int *map; // mapping from atom types to elements protected: diff --git a/src/ML-PACE/pair_pace.h b/src/ML-PACE/pair_pace.h index c5cfa05b7e..c932b5a679 100644 --- a/src/ML-PACE/pair_pace.h +++ b/src/ML-PACE/pair_pace.h @@ -39,15 +39,15 @@ namespace LAMMPS_NS { class PairPACE : public Pair { public: PairPACE(class LAMMPS *); - virtual ~PairPACE(); + ~PairPACE() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; - void *extract(const char *, int &); + void *extract(const char *, int &) override; protected: struct ACEImpl *aceimpl; diff --git a/src/ML-QUIP/pair_quip.h b/src/ML-QUIP/pair_quip.h index 3040dc0ffd..49a381f5d0 100644 --- a/src/ML-QUIP/pair_quip.h +++ b/src/ML-QUIP/pair_quip.h @@ -34,13 +34,13 @@ namespace LAMMPS_NS { class PairQUIP : public Pair { public: PairQUIP(class LAMMPS *); - ~PairQUIP(); + ~PairQUIP() override; - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; void allocate(); private: diff --git a/src/ML-RANN/pair_rann.h b/src/ML-RANN/pair_rann.h index 71b4dcd4e6..15724575fa 100644 --- a/src/ML-RANN/pair_rann.h +++ b/src/ML-RANN/pair_rann.h @@ -51,13 +51,13 @@ class PairRANN : public Pair { public: //inherited functions PairRANN(class LAMMPS *); - ~PairRANN(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void init_list(int, NeighList *); + ~PairRANN() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void init_list(int, NeighList *) override; void errorf(const char *, int, const char *); int factorial(int); diff --git a/src/ML-RANN/rann_activation_linear.h b/src/ML-RANN/rann_activation_linear.h index 930ce70ee0..8f0d65f35c 100644 --- a/src/ML-RANN/rann_activation_linear.h +++ b/src/ML-RANN/rann_activation_linear.h @@ -38,9 +38,9 @@ namespace RANN { class Activation_linear : public Activation { public: Activation_linear(class PairRANN *); - double activation_function(double); - double dactivation_function(double); - double ddactivation_function(double); + double activation_function(double) override; + double dactivation_function(double) override; + double ddactivation_function(double) override; }; Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair) diff --git a/src/ML-RANN/rann_activation_sig_i.h b/src/ML-RANN/rann_activation_sig_i.h index fc82fe300d..01384b2061 100644 --- a/src/ML-RANN/rann_activation_sig_i.h +++ b/src/ML-RANN/rann_activation_sig_i.h @@ -39,9 +39,9 @@ namespace RANN { class Activation_sigI : public Activation { public: Activation_sigI(class PairRANN *); - double activation_function(double); - double dactivation_function(double); - double ddactivation_function(double); + double activation_function(double) override; + double dactivation_function(double) override; + double ddactivation_function(double) override; }; Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair) diff --git a/src/ML-RANN/rann_fingerprint_bond.h b/src/ML-RANN/rann_fingerprint_bond.h index cc844993cc..2d845f4e6f 100644 --- a/src/ML-RANN/rann_fingerprint_bond.h +++ b/src/ML-RANN/rann_fingerprint_bond.h @@ -39,20 +39,20 @@ namespace RANN { class Fingerprint_bond : public Fingerprint { public: Fingerprint_bond(PairRANN *); - ~Fingerprint_bond(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); + ~Fingerprint_bond() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *, - double *, int *, int, int *); + double *, int *, int, int *) override; void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, int, int, double *, double *, double *, int *, int, int *); void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, int, int, double *, double *, double *, int *, int, int *); void generate_exp_cut_table(); void generate_coefficients(); - int get_length(); + int get_length() override; double *expcuttable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_bondscreened.h b/src/ML-RANN/rann_fingerprint_bondscreened.h index 17f2874f7b..104c2b0bb8 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreened.h +++ b/src/ML-RANN/rann_fingerprint_bondscreened.h @@ -39,14 +39,14 @@ namespace RANN { class Fingerprint_bondscreened : public Fingerprint { public: Fingerprint_bondscreened(PairRANN *); - ~Fingerprint_bondscreened(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); + ~Fingerprint_bondscreened() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, int, int, double *, - double *, double *, int *, int, int *); + double *, double *, int *, int, int *) override; void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, int, int, double *, double *, @@ -57,7 +57,7 @@ namespace RANN { double *, int *, int, int *); void generate_exp_cut_table(); void generate_coefficients(); - int get_length(); + int get_length() override; double *expcuttable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.h b/src/ML-RANN/rann_fingerprint_bondscreenedspin.h index 306fa9ae75..5d52a18926 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.h +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.h @@ -39,14 +39,14 @@ namespace RANN { class Fingerprint_bondscreenedspin : public Fingerprint { public: Fingerprint_bondscreenedspin(PairRANN *); - ~Fingerprint_bondscreenedspin(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); + ~Fingerprint_bondscreenedspin() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, - bool *, int, int, double *, double *, double *, int *, int, int *); + bool *, int, int, double *, double *, double *, int *, int, int *) override; void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, int, @@ -57,7 +57,7 @@ namespace RANN { int, double *, double *, double *, int *, int, int *); void generate_exp_cut_table(); void generate_coefficients(); - int get_length(); + int get_length() override; double *expcuttable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_bondspin.h b/src/ML-RANN/rann_fingerprint_bondspin.h index e3577fdb3a..fb97893c8d 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.h +++ b/src/ML-RANN/rann_fingerprint_bondspin.h @@ -38,14 +38,14 @@ namespace RANN { class Fingerprint_bondspin : public Fingerprint { public: Fingerprint_bondspin(PairRANN *); - ~Fingerprint_bondspin(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); - virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + ~Fingerprint_bondspin() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, int, int, double *, double *, double *, int *, int, - int *); //spin + int *) override; //spin void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, double *, double *, int, int, double *, double *, double *, int *, int, int *); @@ -54,7 +54,7 @@ namespace RANN { double *, int *, int, int *); void generate_exp_cut_table(); void generate_coefficients(); - int get_length(); + int get_length() override; double *expcuttable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_radial.h b/src/ML-RANN/rann_fingerprint_radial.h index 1b5e6bf479..c2cdd01c07 100644 --- a/src/ML-RANN/rann_fingerprint_radial.h +++ b/src/ML-RANN/rann_fingerprint_radial.h @@ -39,14 +39,14 @@ namespace RANN { class Fingerprint_radial : public Fingerprint { public: Fingerprint_radial(PairRANN *); - ~Fingerprint_radial(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); + ~Fingerprint_radial() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *, - double *, int *, int, int *); - int get_length(); + double *, int *, int, int *) override; + int get_length() override; double *radialtable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_radialscreened.h b/src/ML-RANN/rann_fingerprint_radialscreened.h index 180bc5823d..885b15dee1 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreened.h +++ b/src/ML-RANN/rann_fingerprint_radialscreened.h @@ -38,15 +38,15 @@ namespace RANN { class Fingerprint_radialscreened : public Fingerprint { public: Fingerprint_radialscreened(PairRANN *); - ~Fingerprint_radialscreened(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); + ~Fingerprint_radialscreened() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, int, int, double *, - double *, double *, int *, int, int *); - int get_length(); + double *, double *, int *, int, int *) override; + int get_length() override; double *radialtable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_radialscreenedspin.h b/src/ML-RANN/rann_fingerprint_radialscreenedspin.h index 5bf3cc07ef..0ea498cf23 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreenedspin.h +++ b/src/ML-RANN/rann_fingerprint_radialscreenedspin.h @@ -38,16 +38,16 @@ namespace RANN { class Fingerprint_radialscreenedspin : public Fingerprint { public: Fingerprint_radialscreenedspin(PairRANN *); - ~Fingerprint_radialscreenedspin(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); - virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + ~Fingerprint_radialscreenedspin() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, int, int, double *, double *, - double *, int *, int, int *); //spin,screen - int get_length(); + double *, int *, int, int *) override; //spin,screen + int get_length() override; double *radialtable; double *dfctable; diff --git a/src/ML-RANN/rann_fingerprint_radialspin.h b/src/ML-RANN/rann_fingerprint_radialspin.h index 3bab1a0e28..778c479481 100644 --- a/src/ML-RANN/rann_fingerprint_radialspin.h +++ b/src/ML-RANN/rann_fingerprint_radialspin.h @@ -38,14 +38,14 @@ namespace RANN { class Fingerprint_radialspin : public Fingerprint { public: Fingerprint_radialspin(PairRANN *); - ~Fingerprint_radialspin(); - bool parse_values(std::string, std::vector); - void write_values(FILE *); - void init(int *, int); - void allocate(); + ~Fingerprint_radialspin() override; + bool parse_values(std::string, std::vector) override; + void write_values(FILE *) override; + void init(int *, int) override; + void allocate() override; void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, - int, int, double *, double *, double *, int *, int, int *); - int get_length(); + int, int, double *, double *, double *, int *, int, int *) override; + int get_length() override; double *radialtable; double *dfctable; diff --git a/src/ML-SNAP/compute_sna_atom.h b/src/ML-SNAP/compute_sna_atom.h index 3bcf217b51..ca5cd64d47 100644 --- a/src/ML-SNAP/compute_sna_atom.h +++ b/src/ML-SNAP/compute_sna_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeSNAAtom : public Compute { public: ComputeSNAAtom(class LAMMPS *, int, char **); - ~ComputeSNAAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeSNAAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/ML-SNAP/compute_snad_atom.h b/src/ML-SNAP/compute_snad_atom.h index f175538d5f..94dec9b85f 100644 --- a/src/ML-SNAP/compute_snad_atom.h +++ b/src/ML-SNAP/compute_snad_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeSNADAtom : public Compute { public: ComputeSNADAtom(class LAMMPS *, int, char **); - ~ComputeSNADAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeSNADAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int nmax; diff --git a/src/ML-SNAP/compute_snap.h b/src/ML-SNAP/compute_snap.h index 131fafd68c..f092ede729 100644 --- a/src/ML-SNAP/compute_snap.h +++ b/src/ML-SNAP/compute_snap.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeSnap : public Compute { public: ComputeSnap(class LAMMPS *, int, char **); - ~ComputeSnap(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); - double memory_usage(); + ~ComputeSnap() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_array() override; + double memory_usage() override; private: int natoms, nmax, size_peratom, lastcol; diff --git a/src/ML-SNAP/compute_snav_atom.h b/src/ML-SNAP/compute_snav_atom.h index 0c3fce54bb..d61d345408 100644 --- a/src/ML-SNAP/compute_snav_atom.h +++ b/src/ML-SNAP/compute_snav_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeSNAVAtom : public Compute { public: ComputeSNAVAtom(class LAMMPS *, int, char **); - ~ComputeSNAVAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeSNAVAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int nmax; diff --git a/src/ML-SNAP/pair_snap.h b/src/ML-SNAP/pair_snap.h index 9b07282462..26640aed1a 100644 --- a/src/ML-SNAP/pair_snap.h +++ b/src/ML-SNAP/pair_snap.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class PairSNAP : public Pair { public: PairSNAP(class LAMMPS *); - ~PairSNAP(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - virtual double memory_usage(); - virtual void *extract(const char *, int &); + ~PairSNAP() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; + void *extract(const char *, int &) override; double rcutfac, quadraticflag; // declared public to workaround gcc 4.9 int ncoeff; // compiler bug, manifest in KOKKOS package diff --git a/src/ML-SNAP/sna.h b/src/ML-SNAP/sna.h index bd2249a101..3b949d564c 100644 --- a/src/ML-SNAP/sna.h +++ b/src/ML-SNAP/sna.h @@ -36,7 +36,7 @@ class SNA : protected Pointers { SNA(LAMMPS *, double, int, double, int, int, int, int, int, int); SNA(LAMMPS *lmp) : Pointers(lmp){}; - ~SNA(); + ~SNA() override; void build_indexlist(); void init(); double memory_usage(); diff --git a/src/MOFFF/angle_class2_p6.h b/src/MOFFF/angle_class2_p6.h index fcefa99eb2..b4f2e9ff6a 100644 --- a/src/MOFFF/angle_class2_p6.h +++ b/src/MOFFF/angle_class2_p6.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleClass2P6 : public Angle { public: AngleClass2P6(class LAMMPS *); - virtual ~AngleClass2P6(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleClass2P6() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *theta0, *k2, *k3, *k4, *k5, *k6; diff --git a/src/MOFFF/angle_cosine_buck6d.h b/src/MOFFF/angle_cosine_buck6d.h index 44d47ea39d..268ae71141 100644 --- a/src/MOFFF/angle_cosine_buck6d.h +++ b/src/MOFFF/angle_cosine_buck6d.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class AngleCosineBuck6d : public Angle { public: AngleCosineBuck6d(class LAMMPS *); - virtual ~AngleCosineBuck6d(); - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCosineBuck6d() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *th0; diff --git a/src/MOFFF/improper_inversion_harmonic.h b/src/MOFFF/improper_inversion_harmonic.h index 5ab8e78a3c..e3bf1a0bc5 100644 --- a/src/MOFFF/improper_inversion_harmonic.h +++ b/src/MOFFF/improper_inversion_harmonic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperInversionHarmonic : public Improper { public: ImproperInversionHarmonic(class LAMMPS *); - virtual ~ImproperInversionHarmonic(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperInversionHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *kw, *w0; diff --git a/src/MOFFF/pair_buck6d_coul_gauss_dsf.h b/src/MOFFF/pair_buck6d_coul_gauss_dsf.h index bce07e89f1..5d3a642180 100644 --- a/src/MOFFF/pair_buck6d_coul_gauss_dsf.h +++ b/src/MOFFF/pair_buck6d_coul_gauss_dsf.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairBuck6dCoulGaussDSF : public Pair { public: PairBuck6dCoulGaussDSF(class LAMMPS *); - virtual ~PairBuck6dCoulGaussDSF(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairBuck6dCoulGaussDSF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/MOFFF/pair_buck6d_coul_gauss_long.h b/src/MOFFF/pair_buck6d_coul_gauss_long.h index f25328d82e..28cc6e3bb7 100644 --- a/src/MOFFF/pair_buck6d_coul_gauss_long.h +++ b/src/MOFFF/pair_buck6d_coul_gauss_long.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairBuck6dCoulGaussLong : public Pair { public: PairBuck6dCoulGaussLong(class LAMMPS *); - virtual ~PairBuck6dCoulGaussLong(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairBuck6dCoulGaussLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/MOLECULE/angle_charmm.h b/src/MOLECULE/angle_charmm.h index 72bae696cb..f864573ce7 100644 --- a/src/MOLECULE/angle_charmm.h +++ b/src/MOLECULE/angle_charmm.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCharmm : public Angle { public: AngleCharmm(class LAMMPS *); - virtual ~AngleCharmm(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCharmm() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *theta0, *k_ub, *r_ub; diff --git a/src/MOLECULE/angle_cosine.h b/src/MOLECULE/angle_cosine.h index 2c7b0ddbc4..19b6222c87 100644 --- a/src/MOLECULE/angle_cosine.h +++ b/src/MOLECULE/angle_cosine.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCosine : public Angle { public: AngleCosine(class LAMMPS *); - virtual ~AngleCosine(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCosine() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k; diff --git a/src/MOLECULE/angle_cosine_squared.h b/src/MOLECULE/angle_cosine_squared.h index d36aac64dd..d8f282ac47 100644 --- a/src/MOLECULE/angle_cosine_squared.h +++ b/src/MOLECULE/angle_cosine_squared.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCosineSquared : public Angle { public: AngleCosineSquared(class LAMMPS *); - virtual ~AngleCosineSquared(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - virtual double single(int, int, int, int); + ~AngleCosineSquared() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *theta0; diff --git a/src/MOLECULE/angle_harmonic.h b/src/MOLECULE/angle_harmonic.h index e722f7d065..718ac4bd0a 100644 --- a/src/MOLECULE/angle_harmonic.h +++ b/src/MOLECULE/angle_harmonic.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleHarmonic : public Angle { public: AngleHarmonic(class LAMMPS *); - virtual ~AngleHarmonic(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *k, *theta0; diff --git a/src/MOLECULE/angle_table.h b/src/MOLECULE/angle_table.h index 6b95cb6a23..83a53ecdd5 100644 --- a/src/MOLECULE/angle_table.h +++ b/src/MOLECULE/angle_table.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class AngleTable : public Angle { public: AngleTable(class LAMMPS *); - virtual ~AngleTable(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int); + ~AngleTable() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int) override; protected: int tabstyle, tablength; diff --git a/src/MOLECULE/atom_vec_angle.h b/src/MOLECULE/atom_vec_angle.h index 5ec0166f98..89d810063f 100644 --- a/src/MOLECULE/atom_vec_angle.h +++ b/src/MOLECULE/atom_vec_angle.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class AtomVecAngle : public AtomVec { public: AtomVecAngle(class LAMMPS *); - ~AtomVecAngle(); + ~AtomVecAngle() override; - void grow_pointers(); - void pack_restart_pre(int); - void pack_restart_post(int); - void unpack_restart_init(int); - void data_atom_post(int); + void grow_pointers() override; + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; private: int *num_bond, *num_angle; diff --git a/src/MOLECULE/atom_vec_bond.h b/src/MOLECULE/atom_vec_bond.h index 4aa8ff5edc..3c9e429ada 100644 --- a/src/MOLECULE/atom_vec_bond.h +++ b/src/MOLECULE/atom_vec_bond.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class AtomVecBond : public AtomVec { public: AtomVecBond(class LAMMPS *); - ~AtomVecBond(); + ~AtomVecBond() override; - void grow_pointers(); - void pack_restart_pre(int); - void pack_restart_post(int); - void unpack_restart_init(int); - void data_atom_post(int); + void grow_pointers() override; + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; private: int *num_bond; diff --git a/src/MOLECULE/atom_vec_full.h b/src/MOLECULE/atom_vec_full.h index 5fff686e78..a337ad3244 100644 --- a/src/MOLECULE/atom_vec_full.h +++ b/src/MOLECULE/atom_vec_full.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class AtomVecFull : public AtomVec { public: AtomVecFull(class LAMMPS *); - ~AtomVecFull(); + ~AtomVecFull() override; - void grow_pointers(); - void pack_restart_pre(int); - void pack_restart_post(int); - void unpack_restart_init(int); - void data_atom_post(int); + void grow_pointers() override; + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; private: int *num_bond, *num_angle, *num_dihedral, *num_improper; diff --git a/src/MOLECULE/atom_vec_molecular.h b/src/MOLECULE/atom_vec_molecular.h index b98b3114f0..9428a8491a 100644 --- a/src/MOLECULE/atom_vec_molecular.h +++ b/src/MOLECULE/atom_vec_molecular.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class AtomVecMolecular : public AtomVec { public: AtomVecMolecular(class LAMMPS *); - ~AtomVecMolecular(); + ~AtomVecMolecular() override; - void grow_pointers(); - void pack_restart_pre(int); - void pack_restart_post(int); - void unpack_restart_init(int); - void data_atom_post(int); + void grow_pointers() override; + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; private: int *num_bond, *num_angle, *num_dihedral, *num_improper; diff --git a/src/MOLECULE/atom_vec_template.h b/src/MOLECULE/atom_vec_template.h index 0050190eb6..2d7a2e12ac 100644 --- a/src/MOLECULE/atom_vec_template.h +++ b/src/MOLECULE/atom_vec_template.h @@ -28,12 +28,12 @@ class AtomVecTemplate : public AtomVec { public: AtomVecTemplate(class LAMMPS *); - void grow_pointers(); - void process_args(int, char **); - void create_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); - void data_atom_post(int); + void grow_pointers() override; + void process_args(int, char **) override; + void create_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; + void data_atom_post(int) override; private: int *molindex, *molatom; diff --git a/src/MOLECULE/bond_fene.h b/src/MOLECULE/bond_fene.h index 76ee2ea34f..1770893331 100644 --- a/src/MOLECULE/bond_fene.h +++ b/src/MOLECULE/bond_fene.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class BondFENE : public Bond { public: BondFENE(class LAMMPS *lmp) : Bond(lmp) {} - virtual ~BondFENE(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void init_style(); - double equilibrium_distance(int); - virtual void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondFENE() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *k, *r0, *epsilon, *sigma; diff --git a/src/MOLECULE/bond_fene_expand.h b/src/MOLECULE/bond_fene_expand.h index 9252165293..6ebd213a7f 100644 --- a/src/MOLECULE/bond_fene_expand.h +++ b/src/MOLECULE/bond_fene_expand.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondFENEExpand : public Bond { public: BondFENEExpand(class LAMMPS *lmp) : Bond(lmp) {} - virtual ~BondFENEExpand(); - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondFENEExpand() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *k, *r0, *epsilon, *sigma, *shift; diff --git a/src/MOLECULE/bond_gromos.h b/src/MOLECULE/bond_gromos.h index 1f555d09a8..bd73e11172 100644 --- a/src/MOLECULE/bond_gromos.h +++ b/src/MOLECULE/bond_gromos.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondGromos : public Bond { public: BondGromos(class LAMMPS *); - virtual ~BondGromos(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondGromos() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *k, *r0; diff --git a/src/MOLECULE/bond_harmonic.h b/src/MOLECULE/bond_harmonic.h index eb6c5e062e..443290aec1 100644 --- a/src/MOLECULE/bond_harmonic.h +++ b/src/MOLECULE/bond_harmonic.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondHarmonic : public Bond { public: BondHarmonic(class LAMMPS *); - virtual ~BondHarmonic(); - virtual void compute(int, int); - virtual void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *k, *r0; diff --git a/src/MOLECULE/bond_morse.h b/src/MOLECULE/bond_morse.h index 10e99c16a3..26073cd449 100644 --- a/src/MOLECULE/bond_morse.h +++ b/src/MOLECULE/bond_morse.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class BondMorse : public Bond { public: BondMorse(class LAMMPS *); - virtual ~BondMorse(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + ~BondMorse() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *d0, *alpha, *r0; diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index 40e2583e63..12f2230522 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -18,24 +18,27 @@ #include "bond_quartic.h" -#include #include "atom.h" -#include "neighbor.h" #include "comm.h" -#include "force.h" -#include "pair.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include "pair.h" +#include + +#include "math_const.h" using namespace LAMMPS_NS; +using namespace MathConst; /* ---------------------------------------------------------------------- */ -BondQuartic::BondQuartic(LAMMPS *lmp) : Bond(lmp) +BondQuartic::BondQuartic(LAMMPS *lmp) : Bond(lmp), k(nullptr), + b1(nullptr), b2(nullptr), rc(nullptr), u0(nullptr) { partial_flag = 1; - TWO_1_3 = pow(2.0,(1.0/3.0)); } /* ---------------------------------------------------------------------- */ @@ -121,7 +124,7 @@ void BondQuartic::compute(int eflag, int vflag) rb = dr - b2[type]; fbond = -k[type]/r * (r2*(ra+rb) + 2.0*dr*ra*rb); - if (rsq < TWO_1_3) { + if (rsq < MY_CUBEROOT2) { sr2 = 1.0/rsq; sr6 = sr2*sr2*sr2; fbond += 48.0*sr6*(sr6-0.5)/rsq; @@ -129,7 +132,7 @@ void BondQuartic::compute(int eflag, int vflag) if (eflag) { ebond = k[type]*r2*ra*rb + u0[type]; - if (rsq < TWO_1_3) ebond += 4.0*sr6*(sr6-1.0) + 1.0; + if (rsq < MY_CUBEROOT2) ebond += 4.0*sr6*(sr6-1.0) + 1.0; } // apply force to each of 2 atoms @@ -337,7 +340,7 @@ double BondQuartic::single(int type, double rsq, int i, int j, eng += k[type]*r2*ra*rb + u0[type]; fforce = -k[type]/r * (r2*(ra+rb) + 2.0*dr*ra*rb); - if (rsq < TWO_1_3) { + if (rsq < MY_CUBEROOT2) { sr2 = 1.0/rsq; sr6 = sr2*sr2*sr2; eng += 4.0*sr6*(sr6-1.0) + 1.0; diff --git a/src/MOLECULE/bond_quartic.h b/src/MOLECULE/bond_quartic.h index 35ec705849..f2e88a3356 100644 --- a/src/MOLECULE/bond_quartic.h +++ b/src/MOLECULE/bond_quartic.h @@ -27,18 +27,17 @@ namespace LAMMPS_NS { class BondQuartic : public Bond { public: BondQuartic(class LAMMPS *); - virtual ~BondQuartic(); - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondQuartic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: - double TWO_1_3; double *k, *b1, *b2, *rc, *u0; void allocate(); diff --git a/src/MOLECULE/bond_table.h b/src/MOLECULE/bond_table.h index b1b506a2a4..205397516a 100644 --- a/src/MOLECULE/bond_table.h +++ b/src/MOLECULE/bond_table.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class BondTable : public Bond { public: BondTable(class LAMMPS *); - virtual ~BondTable(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, double, int, int, double &); + ~BondTable() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, double, int, int, double &) override; protected: int tabstyle, tablength; diff --git a/src/MOLECULE/dihedral_charmm.h b/src/MOLECULE/dihedral_charmm.h index 9d0bd69606..2f9f297a3b 100644 --- a/src/MOLECULE/dihedral_charmm.h +++ b/src/MOLECULE/dihedral_charmm.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class DihedralCharmm : public Dihedral { public: DihedralCharmm(class LAMMPS *); - virtual ~DihedralCharmm(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void init_style(); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); + ~DihedralCharmm() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *weight, *cos_shift, *sin_shift; diff --git a/src/MOLECULE/dihedral_charmmfsw.h b/src/MOLECULE/dihedral_charmmfsw.h index afbcf66ade..01ee30c5d0 100644 --- a/src/MOLECULE/dihedral_charmmfsw.h +++ b/src/MOLECULE/dihedral_charmmfsw.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class DihedralCharmmfsw : public Dihedral { public: DihedralCharmmfsw(class LAMMPS *); - virtual ~DihedralCharmmfsw(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void init_style(); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralCharmmfsw() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int implicit, weightflag, dihedflag; diff --git a/src/MOLECULE/dihedral_harmonic.h b/src/MOLECULE/dihedral_harmonic.h index e3c29b34bd..a80ea4ee84 100644 --- a/src/MOLECULE/dihedral_harmonic.h +++ b/src/MOLECULE/dihedral_harmonic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralHarmonic : public Dihedral { public: DihedralHarmonic(class LAMMPS *); - virtual ~DihedralHarmonic(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); + ~DihedralHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *cos_shift, *sin_shift; diff --git a/src/MOLECULE/dihedral_multi_harmonic.h b/src/MOLECULE/dihedral_multi_harmonic.h index 9f79262da9..4534f0c697 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.h +++ b/src/MOLECULE/dihedral_multi_harmonic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralMultiHarmonic : public Dihedral { public: DihedralMultiHarmonic(class LAMMPS *); - virtual ~DihedralMultiHarmonic(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~DihedralMultiHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *a1, *a2, *a3, *a4, *a5; diff --git a/src/MOLECULE/dihedral_opls.h b/src/MOLECULE/dihedral_opls.h index 723fbb987b..ebd8b79ea5 100644 --- a/src/MOLECULE/dihedral_opls.h +++ b/src/MOLECULE/dihedral_opls.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class DihedralOPLS : public Dihedral { public: DihedralOPLS(class LAMMPS *); - virtual ~DihedralOPLS(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); + ~DihedralOPLS() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k1, *k2, *k3, *k4; diff --git a/src/MOLECULE/dihedral_table.h b/src/MOLECULE/dihedral_table.h index a6fced46bb..e55579a528 100644 --- a/src/MOLECULE/dihedral_table.h +++ b/src/MOLECULE/dihedral_table.h @@ -30,14 +30,14 @@ namespace LAMMPS_NS { class DihedralTable : public Dihedral { public: DihedralTable(class LAMMPS *); - virtual ~DihedralTable(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + ~DihedralTable() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double single(int type, int i1, int i2, int i3, int i4); protected: diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index a763c5d14c..01231b4b0e 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -37,12 +37,13 @@ #include "force.h" #include "math_const.h" #include "memory.h" +#include "potential_file_reader.h" #include "respa.h" -#include "tokenizer.h" #include "update.h" #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -634,150 +635,23 @@ double FixCMAP::compute_scalar() void FixCMAP::read_grid_map(char *cmapfile) { - char linebuf[MAXLINE]; - char *chunk,*line; - int i1, i2, i3, i4, i5, i6, j1, j2, j3, j4, j5, j6, counter; - - FILE *fp = nullptr; if (comm->me == 0) { - fp = utils::open_potential(cmapfile,lmp,nullptr); - if (fp == nullptr) - error->one(FLERR,"Cannot open fix cmap file {}: {}", - cmapfile, utils::getsyserror()); + try { + memset(&cmapgrid[0][0][0], 0, 6*CMAPDIM*CMAPDIM*sizeof(double)); + PotentialFileReader reader(lmp, cmapfile, "cmap grid"); - } + // there are six maps in this order. + // alanine, alanine-proline, proline, proline-proline, glycine, glycine-proline. + // read as one big blob of numbers while ignoring comments - for (int ix1 = 0; ix1 < 6; ix1++) - for (int ix2 = 0; ix2 < CMAPDIM; ix2++) - for (int ix3 = 0; ix3 < CMAPDIM; ix3++) - cmapgrid[ix1][ix2][ix3] = 0.0; + reader.next_dvector(&cmapgrid[0][0][0],6*CMAPDIM*CMAPDIM); - counter = 0; - i1 = i2 = i3 = i4 = i5 = i6 = 0; - j1 = j2 = j3 = j4 = j5 = j6 = 0; - - int done = 0; - - while (!done) { - // only read on rank 0 and broadcast to all other ranks - if (comm->me == 0) - done = (fgets(linebuf,MAXLINE,fp) == nullptr); - - MPI_Bcast(&done,1,MPI_INT,0,world); - if (done) continue; - - MPI_Bcast(linebuf,MAXLINE,MPI_CHAR,0,world); - - // remove leading whitespace - line = linebuf; - while (line && (*line == ' ' || *line == '\t' || *line == '\r')) ++line; - - // skip if empty line or comment - if (!line || *line =='\n' || *line == '\0' || *line == '#') continue; - - // read in the cmap grid point values - // NOTE: The order to read the 6 grid maps is HARD-CODED, thus errors - // will occur if content of the file "cmap.data" is altered - // - // Reading order of the maps: - // 1. Alanine map - // 2. Alanine before proline map - // 3. Proline map - // 4. Two adjacent prolines map - // 5. Glycine map - // 6. Glycine before proline map - - chunk = strtok(line, " \r\n"); - while (chunk != nullptr) { - - // alanine map - - if (counter < CMAPDIM*CMAPDIM) { - cmapgrid[0][i1][j1] = atof(chunk); - chunk = strtok(nullptr, " \r\n"); - j1++; - if (j1 == CMAPDIM) { - j1 = 0; - i1++; - } - counter++; - } - - // alanine-proline map - - else if (counter >= CMAPDIM*CMAPDIM && - counter < 2*CMAPDIM*CMAPDIM) { - cmapgrid[1][i2][j2]= atof(chunk); - chunk = strtok(nullptr, " \r\n"); - j2++; - if (j2 == CMAPDIM) { - j2 = 0; - i2++; - } - counter++; - } - - // proline map - - else if (counter >= 2*CMAPDIM*CMAPDIM && - counter < 3*CMAPDIM*CMAPDIM) { - cmapgrid[2][i3][j3] = atof(chunk); - chunk = strtok(nullptr, " \r\n"); - j3++; - if (j3 == CMAPDIM) { - j3 = 0; - i3++; - } - counter++; - } - - // 2 adjacent prolines map - - else if (counter >= 3*CMAPDIM*CMAPDIM && - counter < 4*CMAPDIM*CMAPDIM) { - cmapgrid[3][i4][j4] = atof(chunk); - chunk = strtok(nullptr, " \r\n"); - j4++; - if (j4 == CMAPDIM) { - j4 = 0; - i4++; - } - counter++; - } - - // glycine map - - else if (counter >= 4*CMAPDIM*CMAPDIM && - counter < 5*CMAPDIM*CMAPDIM) { - cmapgrid[4][i5][j5] = atof(chunk); - chunk = strtok(nullptr, " \r\n"); - j5++; - if (j5 == CMAPDIM) { - j5 = 0; - i5++; - } - counter++; - } - - // glycine-proline map - - else if (counter >= 5*CMAPDIM*CMAPDIM && - counter < 6*CMAPDIM*CMAPDIM) { - cmapgrid[5][i6][j6] = atof(chunk); - chunk = strtok(nullptr, " \r\n"); - j6++; - if (j6 == CMAPDIM) { - j6 = 0; - i6++; - } - counter++; - } - - else break; + } catch (std::exception &e) { + error->one(FLERR,"Error reading CMAP potential file: {}", e.what()); } } - if (comm->me == 0) fclose(fp); + MPI_Bcast(&cmapgrid[0][0][0],6*CMAPDIM*CMAPDIM,MPI_DOUBLE,0,world); } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/fix_cmap.h b/src/MOLECULE/fix_cmap.h index ae70f9faad..944c311001 100644 --- a/src/MOLECULE/fix_cmap.h +++ b/src/MOLECULE/fix_cmap.h @@ -26,43 +26,43 @@ namespace LAMMPS_NS { class FixCMAP : public Fix { public: FixCMAP(class LAMMPS *, int, char **); - ~FixCMAP(); - int setmask(); - void init(); - void setup(int); - void setup_pre_neighbor(); - void setup_pre_reverse(int, int); - void min_setup(int); - void pre_neighbor(); - void pre_reverse(int, int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); + ~FixCMAP() override; + int setmask() override; + void init() override; + void setup(int) override; + void setup_pre_neighbor() override; + void setup_pre_reverse(int, int) override; + void min_setup(int) override; + void pre_neighbor() override; + void pre_reverse(int, int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; - void read_data_header(char *); - void read_data_section(char *, int, char *, tagint); - bigint read_data_skip_lines(char *); - void write_data_header(FILE *, int); - void write_data_section_size(int, int &, int &); - void write_data_section_pack(int, double **); - void write_data_section_keyword(int, FILE *); - void write_data_section(int, FILE *, int, double **, int); + void read_data_header(char *) override; + void read_data_section(char *, int, char *, tagint) override; + bigint read_data_skip_lines(char *) override; + void write_data_header(FILE *, int) override; + void write_data_section_size(int, int &, int &) override; + void write_data_section_pack(int, double **) override; + void write_data_section_keyword(int, FILE *) override; + void write_data_section(int, FILE *, int, double **, int) override; - void write_restart(FILE *); - void restart(char *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + void write_restart(FILE *) override; + void restart(char *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; - double memory_usage(); + double memory_usage() override; private: int nprocs, me; diff --git a/src/MOLECULE/improper_cvff.h b/src/MOLECULE/improper_cvff.h index 821d29e607..1e724bc84b 100644 --- a/src/MOLECULE/improper_cvff.h +++ b/src/MOLECULE/improper_cvff.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperCvff : public Improper { public: ImproperCvff(class LAMMPS *); - virtual ~ImproperCvff(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperCvff() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k; diff --git a/src/MOLECULE/improper_harmonic.h b/src/MOLECULE/improper_harmonic.h index d81a81f951..64966b477c 100644 --- a/src/MOLECULE/improper_harmonic.h +++ b/src/MOLECULE/improper_harmonic.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperHarmonic : public Improper { public: ImproperHarmonic(class LAMMPS *); - virtual ~ImproperHarmonic(); - virtual void compute(int, int); - virtual void coeff(int, char **); - void write_restart(FILE *); - virtual void read_restart(FILE *); - void write_data(FILE *); + ~ImproperHarmonic() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *k, *chi; diff --git a/src/MOLECULE/improper_umbrella.h b/src/MOLECULE/improper_umbrella.h index 836527ee3c..fb671646e7 100644 --- a/src/MOLECULE/improper_umbrella.h +++ b/src/MOLECULE/improper_umbrella.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ImproperUmbrella : public Improper { public: ImproperUmbrella(class LAMMPS *); - virtual ~ImproperUmbrella(); - virtual void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + ~ImproperUmbrella() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: double *kw, *w0, *C; diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.h b/src/MOLECULE/pair_hbond_dreiding_lj.h index 67b5262e32..5912282702 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.h +++ b/src/MOLECULE/pair_hbond_dreiding_lj.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class PairHbondDreidingLJ : public Pair { public: PairHbondDreidingLJ(class LAMMPS *); - virtual ~PairHbondDreidingLJ(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairHbondDreidingLJ() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_inner_global, cut_outer_global, cut_angle_global; diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.h b/src/MOLECULE/pair_hbond_dreiding_morse.h index 9c0fa8f198..fa9d9ac588 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.h +++ b/src/MOLECULE/pair_hbond_dreiding_morse.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairHbondDreidingMorse : public PairHbondDreidingLJ { public: PairHbondDreidingMorse(class LAMMPS *); - virtual ~PairHbondDreidingMorse(){}; - virtual void compute(int, int); - void coeff(int, char **); - void init_style(); - double single(int, int, int, int, double, double, double, double &); + + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + double single(int, int, int, int, double, double, double, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.h b/src/MOLECULE/pair_lj_charmm_coul_charmm.h index b6878dd60b..4f938f154b 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.h +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJCharmmCoulCharmm : public Pair { public: PairLJCharmmCoulCharmm(class LAMMPS *); - virtual ~PairLJCharmmCoulCharmm(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairLJCharmmCoulCharmm() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: int implicit; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.h b/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.h index 5c497187ad..b358f6e1bc 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.h +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairLJCharmmCoulCharmmImplicit : public PairLJCharmmCoulCharmm { public: PairLJCharmmCoulCharmmImplicit(class LAMMPS *); - virtual void compute(int, int); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h index fd517e584f..f9931055f4 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJCharmmfswCoulCharmmfsh : public Pair { public: PairLJCharmmfswCoulCharmmfsh(class LAMMPS *); - virtual ~PairLJCharmmfswCoulCharmmfsh(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairLJCharmmfswCoulCharmmfsh() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: int implicit; diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.h b/src/MOLECULE/pair_lj_cut_tip4p_cut.h index 4e113649be..83e180915e 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.h +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJCutTIP4PCut : public Pair { public: PairLJCutTIP4PCut(class LAMMPS *); - virtual ~PairLJCutTIP4PCut(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - void *extract(const char *, int &); - double memory_usage(); + ~PairLJCutTIP4PCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/MOLECULE/pair_tip4p_cut.h b/src/MOLECULE/pair_tip4p_cut.h index 8280a78ecf..eb5d0256b3 100644 --- a/src/MOLECULE/pair_tip4p_cut.h +++ b/src/MOLECULE/pair_tip4p_cut.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairTIP4PCut : public Pair { public: PairTIP4PCut(class LAMMPS *); - virtual ~PairTIP4PCut(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_restart(FILE *); - void read_restart(FILE *); - double memory_usage(); + ~PairTIP4PCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double memory_usage() override; protected: double cut_coul_global; diff --git a/src/MOLFILE/dump_molfile.h b/src/MOLFILE/dump_molfile.h index 968ed783ca..3f627835e6 100644 --- a/src/MOLFILE/dump_molfile.h +++ b/src/MOLFILE/dump_molfile.h @@ -29,8 +29,8 @@ namespace LAMMPS_NS { class DumpMolfile : public Dump { public: DumpMolfile(LAMMPS *, int, char **); - virtual ~DumpMolfile(); - virtual void write(); + ~DumpMolfile() override; + void write() override; protected: class MolfileInterface *mf; //< handles low-level I/O @@ -46,13 +46,13 @@ class DumpMolfile : public Dump { int topology_flag; // 1 if writing topology data, 0 if not float cell[6]; // cell parameters: A, B, C, alpha, beta, gamma - virtual void init_style(); - virtual int modify_param(int, char **); - virtual void write_header(bigint){}; - virtual void pack(tagint *); - virtual void write_data(int, double *); - virtual double memory_usage(); - virtual void openfile(); + void init_style() override; + int modify_param(int, char **) override; + void write_header(bigint) override{}; + void pack(tagint *) override; + void write_data(int, double *) override; + double memory_usage() override; + void openfile() override; }; } // namespace LAMMPS_NS diff --git a/src/MOLFILE/reader_molfile.h b/src/MOLFILE/reader_molfile.h index 4330eaf4eb..946ea66b03 100644 --- a/src/MOLFILE/reader_molfile.h +++ b/src/MOLFILE/reader_molfile.h @@ -29,18 +29,18 @@ namespace LAMMPS_NS { class ReaderMolfile : public Reader { public: ReaderMolfile(class LAMMPS *); - virtual ~ReaderMolfile(); + ~ReaderMolfile() override; - virtual void settings(int, char **); + void settings(int, char **) override; - virtual int read_time(bigint &); - virtual void skip(); - virtual bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, - int &, int &, int &); - virtual void read_atoms(int, int, double **); + int read_time(bigint &) override; + void skip() override; + bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, + int &, int &, int &) override; + void read_atoms(int, int, double **) override; - virtual void open_file(const std::string &); - virtual void close_file(); + void open_file(const std::string &) override; + void close_file() override; private: int *fieldindex; // mapping of input fields to dump diff --git a/src/MPIIO/dump_atom_mpiio.h b/src/MPIIO/dump_atom_mpiio.h index b2c186df3c..9e0942d86f 100644 --- a/src/MPIIO/dump_atom_mpiio.h +++ b/src/MPIIO/dump_atom_mpiio.h @@ -28,7 +28,7 @@ class DumpAtomMPIIO : public DumpAtom { public: DumpAtomMPIIO(class LAMMPS *, int, char **); - virtual ~DumpAtomMPIIO(); + ~DumpAtomMPIIO() override; protected: bigint @@ -40,12 +40,12 @@ class DumpAtomMPIIO : public DumpAtom { int performEstimate; // switch for write_data and write_header methods to use for gathering data and detemining filesize for preallocation vs actually writing the data char *filecurrent; // name of file for this round (with % and * replaced) - virtual void openfile(); - virtual void write_header(bigint); - virtual void write(); - virtual void write_data(int, double *); + void openfile() override; + void write_header(bigint) override; + void write() override; + void write_data(int, double *) override; - virtual void init_style(); + void init_style() override; typedef void (DumpAtomMPIIO::*FnPtrHeader)(bigint); FnPtrHeader header_choice; // ptr to write header functions void header_binary(bigint); @@ -59,7 +59,7 @@ class DumpAtomMPIIO : public DumpAtom { int convert_noimage_omp(int, double *); // multithreaded version of convert_noimage #endif - int convert_string(int, double *); + int convert_string(int, double *) override; typedef void (DumpAtomMPIIO::*FnPtrData)(int, double *); FnPtrData write_choice; // ptr to write data functions void write_binary(int, double *); diff --git a/src/MPIIO/dump_cfg_mpiio.h b/src/MPIIO/dump_cfg_mpiio.h index 492f7c1adb..b6b17fb908 100644 --- a/src/MPIIO/dump_cfg_mpiio.h +++ b/src/MPIIO/dump_cfg_mpiio.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpCFGMPIIO : public DumpCFG { public: DumpCFGMPIIO(class LAMMPS *, int, char **); - virtual ~DumpCFGMPIIO(); + ~DumpCFGMPIIO() override; protected: bigint @@ -43,11 +43,11 @@ class DumpCFGMPIIO : public DumpCFG { int convert_string_omp(int, double *); // multithreaded version of convert_string #endif - virtual void openfile(); - virtual void init_style(); - virtual void write_header(bigint); - virtual void write(); - virtual void write_data(int, double *); + void openfile() override; + void init_style() override; + void write_header(bigint) override; + void write() override; + void write_data(int, double *) override; typedef void (DumpCFGMPIIO::*FnPtrData)(int, double *); FnPtrData write_choice; // ptr to write data functions diff --git a/src/MPIIO/dump_custom_mpiio.h b/src/MPIIO/dump_custom_mpiio.h index bb5b901d53..af125dae6e 100644 --- a/src/MPIIO/dump_custom_mpiio.h +++ b/src/MPIIO/dump_custom_mpiio.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpCustomMPIIO : public DumpCustom { public: DumpCustomMPIIO(class LAMMPS *, int, char **); - virtual ~DumpCustomMPIIO(); + ~DumpCustomMPIIO() override; protected: bigint @@ -43,12 +43,12 @@ class DumpCustomMPIIO : public DumpCustom { int convert_string_omp(int, double *); // multithreaded version of convert_string #endif - virtual void openfile(); - virtual void write_header(bigint); - virtual void write(); - virtual void write_data(int, double *); + void openfile() override; + void write_header(bigint) override; + void write() override; + void write_data(int, double *) override; - virtual void init_style(); + void init_style() override; typedef void (DumpCustomMPIIO::*FnPtrHeader)(bigint); FnPtrHeader header_choice; // ptr to write header functions void header_binary(bigint); diff --git a/src/MPIIO/dump_xyz_mpiio.h b/src/MPIIO/dump_xyz_mpiio.h index e85db01a87..8475bd03d1 100644 --- a/src/MPIIO/dump_xyz_mpiio.h +++ b/src/MPIIO/dump_xyz_mpiio.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpXYZMPIIO : public DumpXYZ { public: DumpXYZMPIIO(class LAMMPS *, int, char **); - virtual ~DumpXYZMPIIO(); + ~DumpXYZMPIIO() override; protected: bigint @@ -43,12 +43,12 @@ class DumpXYZMPIIO : public DumpXYZ { int convert_string_omp(int, double *); // multithreaded version of convert_string #endif - virtual void openfile(); - virtual void write_header(bigint); - virtual void write(); - virtual void write_data(int, double *); + void openfile() override; + void write_header(bigint) override; + void write() override; + void write_data(int, double *) override; - virtual void init_style(); + void init_style() override; typedef void (DumpXYZMPIIO::*FnPtrData)(int, double *); FnPtrData write_choice; // ptr to write data functions diff --git a/src/MPIIO/restart_mpiio.h b/src/MPIIO/restart_mpiio.h index a39808e69c..09f7c76fb0 100644 --- a/src/MPIIO/restart_mpiio.h +++ b/src/MPIIO/restart_mpiio.h @@ -27,7 +27,7 @@ class RestartMPIIO : protected Pointers { int mpiio_exists; RestartMPIIO(class LAMMPS *); - ~RestartMPIIO() {} + void openForRead(const char *); void openForWrite(const char *); void write(MPI_Offset, int, double *); diff --git a/src/MSCG/fix_mscg.h b/src/MSCG/fix_mscg.h index 1233db1748..972a48c1e0 100644 --- a/src/MSCG/fix_mscg.h +++ b/src/MSCG/fix_mscg.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixMSCG : public Fix { public: FixMSCG(class LAMMPS *, int, char **); - ~FixMSCG(); - int setmask(); - void post_constructor(); - void init(); - void end_of_step(); - void post_run(); + ~FixMSCG() override; + int setmask() override; + void post_constructor() override; + void init() override; + void end_of_step() override; + void post_run() override; private: int range_flag, name_flag, me, nprocs; diff --git a/src/Makefile b/src/Makefile index 0241b77117..6b51612a14 100644 --- a/src/Makefile +++ b/src/Makefile @@ -185,7 +185,6 @@ PACKMOST = \ orient \ peri \ plugin \ - poems \ qeq \ reaction \ reaxff \ @@ -358,10 +357,10 @@ gitversion: branch='(unknown)' ; \ describe='(unknown)' ; \ fi ; \ - echo "const bool LAMMPS_NS::LAMMPS::has_git_info = $${git};" >> ${TMPNAME}.lmpgitversion ; \ - echo "const char LAMMPS_NS::LAMMPS::git_commit[] = \"$${commit}\";" >> ${TMPNAME}.lmpgitversion ; \ - echo "const char LAMMPS_NS::LAMMPS::git_branch[] = \"$${branch}\";" >> ${TMPNAME}.lmpgitversion ; \ - echo "const char LAMMPS_NS::LAMMPS::git_descriptor[] = \"$${describe}\";" >> ${TMPNAME}.lmpgitversion + echo "bool LAMMPS_NS::LAMMPS::has_git_info() { return $${git}; }" >> ${TMPNAME}.lmpgitversion ; \ + echo "const char *LAMMPS_NS::LAMMPS::git_commit() { return \"$${commit}\"; }" >> ${TMPNAME}.lmpgitversion ; \ + echo "const char *LAMMPS_NS::LAMMPS::git_branch() { return \"$${branch}\"; }" >> ${TMPNAME}.lmpgitversion ; \ + echo "const char *LAMMPS_NS::LAMMPS::git_descriptor() { return \"$${describe}\"; }" >> ${TMPNAME}.lmpgitversion @echo '#endif' >> ${TMPNAME}.lmpgitversion @if [ -f lmpgitversion.h ]; \ then test "`diff --brief ${TMPNAME}.lmpgitversion lmpgitversion.h`" != "" && \ @@ -441,7 +440,7 @@ clean: clean-all: rm -rf Obj_* - rm style_*.h packages_*.h lmpgitversion.h lmpinstalledpkgs.h + rm -f style_*.h packages_*.h lmpgitversion.h lmpinstalledpkgs.h clean-%: @if [ $@ = "clean-serial" ]; \ diff --git a/src/NETCDF/dump_netcdf.h b/src/NETCDF/dump_netcdf.h index f3a4e81d9c..3d27ffcb50 100644 --- a/src/NETCDF/dump_netcdf.h +++ b/src/NETCDF/dump_netcdf.h @@ -33,8 +33,8 @@ namespace LAMMPS_NS { class DumpNetCDF : public DumpCustom { public: DumpNetCDF(class LAMMPS *, int, char **); - virtual ~DumpNetCDF(); - virtual void write(); + ~DumpNetCDF() override; + void write() override; private: static constexpr int NC_FIELD_NAME_MAX = 100; @@ -88,12 +88,12 @@ class DumpNetCDF : public DumpCustom { int cell_lengths_var; int cell_angles_var; - virtual void openfile(); + void openfile() override; void closefile(); - virtual void write_header(bigint); - virtual void write_data(int, double *); + void write_header(bigint) override; + void write_data(int, double *) override; - virtual int modify_param(int, char **); + int modify_param(int, char **) override; void ncerr(int, const char *, int); }; diff --git a/src/NETCDF/dump_netcdf_mpiio.h b/src/NETCDF/dump_netcdf_mpiio.h index ec6cbaec04..937850fcac 100644 --- a/src/NETCDF/dump_netcdf_mpiio.h +++ b/src/NETCDF/dump_netcdf_mpiio.h @@ -33,8 +33,8 @@ namespace LAMMPS_NS { class DumpNetCDFMPIIO : public DumpCustom { public: DumpNetCDFMPIIO(class LAMMPS *, int, char **); - virtual ~DumpNetCDFMPIIO(); - virtual void write(); + ~DumpNetCDFMPIIO() override; + void write() override; private: static constexpr int NC_MPIIO_FIELD_NAME_MAX = 100; @@ -85,13 +85,13 @@ class DumpNetCDFMPIIO : public DumpCustom { int cell_lengths_var; int cell_angles_var; - virtual void openfile(); + void openfile() override; void closefile(); void write_time_and_cell(); - virtual void write_data(int, double *); + void write_data(int, double *) override; void write_prmtop(); - virtual int modify_param(int, char **); + int modify_param(int, char **) override; void ncerr(int, const char *, int); }; diff --git a/src/OPENMP/angle_charmm_omp.h b/src/OPENMP/angle_charmm_omp.h index 80e3777071..f478dfdc89 100644 --- a/src/OPENMP/angle_charmm_omp.h +++ b/src/OPENMP/angle_charmm_omp.h @@ -33,7 +33,7 @@ class AngleCharmmOMP : public AngleCharmm, public ThrOMP { public: AngleCharmmOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_class2_omp.h b/src/OPENMP/angle_class2_omp.h index 03ab80ce23..a9753c2e6b 100644 --- a/src/OPENMP/angle_class2_omp.h +++ b/src/OPENMP/angle_class2_omp.h @@ -33,7 +33,7 @@ class AngleClass2OMP : public AngleClass2, public ThrOMP { public: AngleClass2OMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_cosine_delta_omp.h b/src/OPENMP/angle_cosine_delta_omp.h index 5cd17c5c17..e5e70a24f9 100644 --- a/src/OPENMP/angle_cosine_delta_omp.h +++ b/src/OPENMP/angle_cosine_delta_omp.h @@ -33,7 +33,7 @@ class AngleCosineDeltaOMP : public AngleCosineDelta, public ThrOMP { public: AngleCosineDeltaOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_cosine_omp.h b/src/OPENMP/angle_cosine_omp.h index a02f5340ff..25d07fc565 100644 --- a/src/OPENMP/angle_cosine_omp.h +++ b/src/OPENMP/angle_cosine_omp.h @@ -33,7 +33,7 @@ class AngleCosineOMP : public AngleCosine, public ThrOMP { public: AngleCosineOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_cosine_periodic_omp.h b/src/OPENMP/angle_cosine_periodic_omp.h index 30507be888..45a02cf2c4 100644 --- a/src/OPENMP/angle_cosine_periodic_omp.h +++ b/src/OPENMP/angle_cosine_periodic_omp.h @@ -33,7 +33,7 @@ class AngleCosinePeriodicOMP : public AngleCosinePeriodic, public ThrOMP { public: AngleCosinePeriodicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_cosine_shift_exp_omp.h b/src/OPENMP/angle_cosine_shift_exp_omp.h index e8003e6168..b394e7e529 100644 --- a/src/OPENMP/angle_cosine_shift_exp_omp.h +++ b/src/OPENMP/angle_cosine_shift_exp_omp.h @@ -33,7 +33,7 @@ class AngleCosineShiftExpOMP : public AngleCosineShiftExp, public ThrOMP { public: AngleCosineShiftExpOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_cosine_shift_omp.h b/src/OPENMP/angle_cosine_shift_omp.h index 2502534c28..073f5288f3 100644 --- a/src/OPENMP/angle_cosine_shift_omp.h +++ b/src/OPENMP/angle_cosine_shift_omp.h @@ -33,7 +33,7 @@ class AngleCosineShiftOMP : public AngleCosineShift, public ThrOMP { public: AngleCosineShiftOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_cosine_squared_omp.h b/src/OPENMP/angle_cosine_squared_omp.h index 028fe66be3..50b22fe5e4 100644 --- a/src/OPENMP/angle_cosine_squared_omp.h +++ b/src/OPENMP/angle_cosine_squared_omp.h @@ -33,7 +33,7 @@ class AngleCosineSquaredOMP : public AngleCosineSquared, public ThrOMP { public: AngleCosineSquaredOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_dipole_omp.h b/src/OPENMP/angle_dipole_omp.h index fd3376d80f..ddd7aac6ea 100644 --- a/src/OPENMP/angle_dipole_omp.h +++ b/src/OPENMP/angle_dipole_omp.h @@ -33,7 +33,7 @@ class AngleDipoleOMP : public AngleDipole, public ThrOMP { public: AngleDipoleOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template void eval(int ifrom, int ito, ThrData *const thr); diff --git a/src/OPENMP/angle_fourier_omp.h b/src/OPENMP/angle_fourier_omp.h index 94ea79aaa0..9a5964df49 100644 --- a/src/OPENMP/angle_fourier_omp.h +++ b/src/OPENMP/angle_fourier_omp.h @@ -33,7 +33,7 @@ class AngleFourierOMP : public AngleFourier, public ThrOMP { public: AngleFourierOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_fourier_simple_omp.h b/src/OPENMP/angle_fourier_simple_omp.h index 43893732d3..db96dbfb86 100644 --- a/src/OPENMP/angle_fourier_simple_omp.h +++ b/src/OPENMP/angle_fourier_simple_omp.h @@ -33,7 +33,7 @@ class AngleFourierSimpleOMP : public AngleFourierSimple, public ThrOMP { public: AngleFourierSimpleOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_harmonic_omp.h b/src/OPENMP/angle_harmonic_omp.h index 4e292deed9..8c6cc39f7a 100644 --- a/src/OPENMP/angle_harmonic_omp.h +++ b/src/OPENMP/angle_harmonic_omp.h @@ -33,7 +33,7 @@ class AngleHarmonicOMP : public AngleHarmonic, public ThrOMP { public: AngleHarmonicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_quartic_omp.h b/src/OPENMP/angle_quartic_omp.h index a2bb6666ea..7953891d55 100644 --- a/src/OPENMP/angle_quartic_omp.h +++ b/src/OPENMP/angle_quartic_omp.h @@ -33,7 +33,7 @@ class AngleQuarticOMP : public AngleQuartic, public ThrOMP { public: AngleQuarticOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_sdk_omp.h b/src/OPENMP/angle_sdk_omp.h index 1c32222488..c4d12787f9 100644 --- a/src/OPENMP/angle_sdk_omp.h +++ b/src/OPENMP/angle_sdk_omp.h @@ -33,7 +33,7 @@ class AngleSDKOMP : public AngleSDK, public ThrOMP { public: AngleSDKOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/angle_table_omp.h b/src/OPENMP/angle_table_omp.h index 1e8a55c56a..585e40a934 100644 --- a/src/OPENMP/angle_table_omp.h +++ b/src/OPENMP/angle_table_omp.h @@ -33,7 +33,7 @@ class AngleTableOMP : public AngleTable, public ThrOMP { public: AngleTableOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_class2_omp.h b/src/OPENMP/bond_class2_omp.h index 0a868c6ef4..24a1ccebbc 100644 --- a/src/OPENMP/bond_class2_omp.h +++ b/src/OPENMP/bond_class2_omp.h @@ -33,7 +33,7 @@ class BondClass2OMP : public BondClass2, public ThrOMP { public: BondClass2OMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_fene_expand_omp.h b/src/OPENMP/bond_fene_expand_omp.h index e44444dd06..8995b2a00e 100644 --- a/src/OPENMP/bond_fene_expand_omp.h +++ b/src/OPENMP/bond_fene_expand_omp.h @@ -33,7 +33,7 @@ class BondFENEExpandOMP : public BondFENEExpand, public ThrOMP { public: BondFENEExpandOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_fene_omp.h b/src/OPENMP/bond_fene_omp.h index 65ef8e993d..0029cc7db5 100644 --- a/src/OPENMP/bond_fene_omp.h +++ b/src/OPENMP/bond_fene_omp.h @@ -33,7 +33,7 @@ class BondFENEOMP : public BondFENE, public ThrOMP { public: BondFENEOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_gromos_omp.h b/src/OPENMP/bond_gromos_omp.h index 8077dad2ba..c9ff442fa6 100644 --- a/src/OPENMP/bond_gromos_omp.h +++ b/src/OPENMP/bond_gromos_omp.h @@ -33,7 +33,7 @@ class BondGromosOMP : public BondGromos, public ThrOMP { public: BondGromosOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_harmonic_omp.h b/src/OPENMP/bond_harmonic_omp.h index eab41e6515..a607d810b8 100644 --- a/src/OPENMP/bond_harmonic_omp.h +++ b/src/OPENMP/bond_harmonic_omp.h @@ -33,7 +33,7 @@ class BondHarmonicOMP : public BondHarmonic, public ThrOMP { public: BondHarmonicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_harmonic_shift_cut_omp.h b/src/OPENMP/bond_harmonic_shift_cut_omp.h index 3f467b943d..976013cad4 100644 --- a/src/OPENMP/bond_harmonic_shift_cut_omp.h +++ b/src/OPENMP/bond_harmonic_shift_cut_omp.h @@ -33,7 +33,7 @@ class BondHarmonicShiftCutOMP : public BondHarmonicShiftCut, public ThrOMP { public: BondHarmonicShiftCutOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_harmonic_shift_omp.h b/src/OPENMP/bond_harmonic_shift_omp.h index b7004b7d14..cfbdc7d9f6 100644 --- a/src/OPENMP/bond_harmonic_shift_omp.h +++ b/src/OPENMP/bond_harmonic_shift_omp.h @@ -33,7 +33,7 @@ class BondHarmonicShiftOMP : public BondHarmonicShift, public ThrOMP { public: BondHarmonicShiftOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_morse_omp.h b/src/OPENMP/bond_morse_omp.h index 2184488e0f..592328fc0c 100644 --- a/src/OPENMP/bond_morse_omp.h +++ b/src/OPENMP/bond_morse_omp.h @@ -33,7 +33,7 @@ class BondMorseOMP : public BondMorse, public ThrOMP { public: BondMorseOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_nonlinear_omp.h b/src/OPENMP/bond_nonlinear_omp.h index bdf496093f..8799b159c6 100644 --- a/src/OPENMP/bond_nonlinear_omp.h +++ b/src/OPENMP/bond_nonlinear_omp.h @@ -33,7 +33,7 @@ class BondNonlinearOMP : public BondNonlinear, public ThrOMP { public: BondNonlinearOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_quartic_omp.cpp b/src/OPENMP/bond_quartic_omp.cpp index 00e8357644..427293dd3e 100644 --- a/src/OPENMP/bond_quartic_omp.cpp +++ b/src/OPENMP/bond_quartic_omp.cpp @@ -22,13 +22,15 @@ #include "comm.h" #include "force.h" #include "neighbor.h" - #include "pair.h" #include #include "suffix.h" +#include "math_const.h" + using namespace LAMMPS_NS; +using namespace MathConst; /* ---------------------------------------------------------------------- */ @@ -143,7 +145,7 @@ void BondQuarticOMP::eval(int nfrom, int nto, ThrData * const thr) rb = dr - b2[type]; fbond = -k[type]/r * (r2*(ra+rb) + 2.0*dr*ra*rb); - if (rsq < TWO_1_3) { + if (rsq < MY_CUBEROOT2) { sr2 = 1.0/rsq; sr6 = sr2*sr2*sr2; fbond += 48.0*sr6*(sr6-0.5)/rsq; @@ -151,7 +153,7 @@ void BondQuarticOMP::eval(int nfrom, int nto, ThrData * const thr) if (EFLAG) { ebond = k[type]*r2*ra*rb + u0[type]; - if (rsq < TWO_1_3) ebond += 4.0*sr6*(sr6-1.0) + 1.0; + if (rsq < MY_CUBEROOT2) ebond += 4.0*sr6*(sr6-1.0) + 1.0; } // apply force to each of 2 atoms diff --git a/src/OPENMP/bond_quartic_omp.h b/src/OPENMP/bond_quartic_omp.h index 169da27562..dd010537de 100644 --- a/src/OPENMP/bond_quartic_omp.h +++ b/src/OPENMP/bond_quartic_omp.h @@ -33,7 +33,7 @@ class BondQuarticOMP : public BondQuartic, public ThrOMP { public: BondQuarticOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/bond_table_omp.h b/src/OPENMP/bond_table_omp.h index d6147709e3..886fb0c9d7 100644 --- a/src/OPENMP/bond_table_omp.h +++ b/src/OPENMP/bond_table_omp.h @@ -33,7 +33,7 @@ class BondTableOMP : public BondTable, public ThrOMP { public: BondTableOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_charmm_omp.h b/src/OPENMP/dihedral_charmm_omp.h index b326cf9329..40c5f10e43 100644 --- a/src/OPENMP/dihedral_charmm_omp.h +++ b/src/OPENMP/dihedral_charmm_omp.h @@ -33,7 +33,7 @@ class DihedralCharmmOMP : public DihedralCharmm, public ThrOMP { public: DihedralCharmmOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_class2_omp.h b/src/OPENMP/dihedral_class2_omp.h index f80dbafdec..4465792da4 100644 --- a/src/OPENMP/dihedral_class2_omp.h +++ b/src/OPENMP/dihedral_class2_omp.h @@ -33,7 +33,7 @@ class DihedralClass2OMP : public DihedralClass2, public ThrOMP { public: DihedralClass2OMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_cosine_shift_exp_omp.h b/src/OPENMP/dihedral_cosine_shift_exp_omp.h index 862a2d6428..2259e1fcfc 100644 --- a/src/OPENMP/dihedral_cosine_shift_exp_omp.h +++ b/src/OPENMP/dihedral_cosine_shift_exp_omp.h @@ -33,7 +33,7 @@ class DihedralCosineShiftExpOMP : public DihedralCosineShiftExp, public ThrOMP { public: DihedralCosineShiftExpOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_fourier_omp.h b/src/OPENMP/dihedral_fourier_omp.h index d493f4a2b9..01e11122b0 100644 --- a/src/OPENMP/dihedral_fourier_omp.h +++ b/src/OPENMP/dihedral_fourier_omp.h @@ -33,7 +33,7 @@ class DihedralFourierOMP : public DihedralFourier, public ThrOMP { public: DihedralFourierOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_harmonic_omp.h b/src/OPENMP/dihedral_harmonic_omp.h index 5a29dbc647..c664eccadb 100644 --- a/src/OPENMP/dihedral_harmonic_omp.h +++ b/src/OPENMP/dihedral_harmonic_omp.h @@ -33,7 +33,7 @@ class DihedralHarmonicOMP : public DihedralHarmonic, public ThrOMP { public: DihedralHarmonicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_helix_omp.h b/src/OPENMP/dihedral_helix_omp.h index 1361519be2..9528ccdb42 100644 --- a/src/OPENMP/dihedral_helix_omp.h +++ b/src/OPENMP/dihedral_helix_omp.h @@ -33,7 +33,7 @@ class DihedralHelixOMP : public DihedralHelix, public ThrOMP { public: DihedralHelixOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_multi_harmonic_omp.h b/src/OPENMP/dihedral_multi_harmonic_omp.h index 977915e2b2..b0f7b9183b 100644 --- a/src/OPENMP/dihedral_multi_harmonic_omp.h +++ b/src/OPENMP/dihedral_multi_harmonic_omp.h @@ -33,7 +33,7 @@ class DihedralMultiHarmonicOMP : public DihedralMultiHarmonic, public ThrOMP { public: DihedralMultiHarmonicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_nharmonic_omp.h b/src/OPENMP/dihedral_nharmonic_omp.h index f7bff45358..c19dff9c0b 100644 --- a/src/OPENMP/dihedral_nharmonic_omp.h +++ b/src/OPENMP/dihedral_nharmonic_omp.h @@ -33,7 +33,7 @@ class DihedralNHarmonicOMP : public DihedralNHarmonic, public ThrOMP { public: DihedralNHarmonicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_opls_omp.h b/src/OPENMP/dihedral_opls_omp.h index cec4229e09..d71f2a8b43 100644 --- a/src/OPENMP/dihedral_opls_omp.h +++ b/src/OPENMP/dihedral_opls_omp.h @@ -33,7 +33,7 @@ class DihedralOPLSOMP : public DihedralOPLS, public ThrOMP { public: DihedralOPLSOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_quadratic_omp.h b/src/OPENMP/dihedral_quadratic_omp.h index 9f31bc88ed..00054f7de0 100644 --- a/src/OPENMP/dihedral_quadratic_omp.h +++ b/src/OPENMP/dihedral_quadratic_omp.h @@ -33,7 +33,7 @@ class DihedralQuadraticOMP : public DihedralQuadratic, public ThrOMP { public: DihedralQuadraticOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/dihedral_table_omp.h b/src/OPENMP/dihedral_table_omp.h index b1a121e7be..1e2d0e63ef 100644 --- a/src/OPENMP/dihedral_table_omp.h +++ b/src/OPENMP/dihedral_table_omp.h @@ -33,7 +33,7 @@ class DihedralTableOMP : public DihedralTable, public ThrOMP { public: DihedralTableOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/ewald_omp.h b/src/OPENMP/ewald_omp.h index 6547b0fbf6..a938360e2f 100644 --- a/src/OPENMP/ewald_omp.h +++ b/src/OPENMP/ewald_omp.h @@ -28,12 +28,12 @@ namespace LAMMPS_NS { class EwaldOMP : public Ewald, public ThrOMP { public: EwaldOMP(class LAMMPS *); - virtual ~EwaldOMP(){}; - virtual void allocate(); - virtual void compute(int, int); + + void allocate() override; + void compute(int, int) override; protected: - virtual void eik_dot_r(); + void eik_dot_r() override; virtual void eik_dot_r_triclinic(); }; diff --git a/src/OPENMP/fix_gravity_omp.h b/src/OPENMP/fix_gravity_omp.h index da7187202a..688e92d466 100644 --- a/src/OPENMP/fix_gravity_omp.h +++ b/src/OPENMP/fix_gravity_omp.h @@ -28,8 +28,8 @@ class FixGravityOMP : public FixGravity { public: FixGravityOMP(class LAMMPS *, int, char **); - virtual void post_force(int); - virtual void post_force_respa(int, int, int); + void post_force(int) override; + void post_force_respa(int, int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_neigh_history_omp.h b/src/OPENMP/fix_neigh_history_omp.h index d373cff7c9..f2ba38850b 100644 --- a/src/OPENMP/fix_neigh_history_omp.h +++ b/src/OPENMP/fix_neigh_history_omp.h @@ -28,10 +28,10 @@ class FixNeighHistoryOMP : public FixNeighHistory { public: FixNeighHistoryOMP(class LAMMPS *lmp, int narg, char **argv); - void pre_exchange_onesided(); - void pre_exchange_newton(); - void pre_exchange_no_newton(); - void post_neighbor(); + void pre_exchange_onesided() override; + void pre_exchange_newton() override; + void pre_exchange_no_newton() override; + void post_neighbor() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nh_asphere_omp.h b/src/OPENMP/fix_nh_asphere_omp.h index d6332c2b03..fd39e3dce6 100644 --- a/src/OPENMP/fix_nh_asphere_omp.h +++ b/src/OPENMP/fix_nh_asphere_omp.h @@ -21,16 +21,16 @@ namespace LAMMPS_NS { class FixNHAsphereOMP : public FixNHOMP { public: FixNHAsphereOMP(class LAMMPS *, int, char **); - virtual ~FixNHAsphereOMP() {} - virtual void init(); + + void init() override; protected: double dtq; class AtomVecEllipsoid *avec; - virtual void nve_v(); - virtual void nve_x(); - virtual void nh_v_temp(); + void nve_v() override; + void nve_x() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nh_omp.h b/src/OPENMP/fix_nh_omp.h index 2c16b18987..f95bcf3e54 100644 --- a/src/OPENMP/fix_nh_omp.h +++ b/src/OPENMP/fix_nh_omp.h @@ -21,14 +21,13 @@ namespace LAMMPS_NS { class FixNHOMP : public FixNH { public: FixNHOMP(class LAMMPS *lmp, int narg, char **args) : FixNH(lmp, narg, args){}; - virtual ~FixNHOMP(){}; protected: - virtual void remap(); - virtual void nh_v_press(); - virtual void nh_v_temp(); - virtual void nve_v(); - virtual void nve_x(); + void remap() override; + void nh_v_press() override; + void nh_v_temp() override; + void nve_v() override; + void nve_x() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nh_sphere_omp.h b/src/OPENMP/fix_nh_sphere_omp.h index bbbae69bfa..3cc716450a 100644 --- a/src/OPENMP/fix_nh_sphere_omp.h +++ b/src/OPENMP/fix_nh_sphere_omp.h @@ -21,12 +21,12 @@ namespace LAMMPS_NS { class FixNHSphereOMP : public FixNHOMP { public: FixNHSphereOMP(class LAMMPS *, int, char **); - virtual ~FixNHSphereOMP() {} - virtual void init(); + + void init() override; protected: - virtual void nve_v(); - virtual void nh_v_temp(); + void nve_v() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nph_asphere_omp.h b/src/OPENMP/fix_nph_asphere_omp.h index 7cf5e817db..e2b297e26f 100644 --- a/src/OPENMP/fix_nph_asphere_omp.h +++ b/src/OPENMP/fix_nph_asphere_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHAsphereOMP : public FixNHAsphereOMP { public: FixNPHAsphereOMP(class LAMMPS *, int, char **); - virtual ~FixNPHAsphereOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nph_omp.h b/src/OPENMP/fix_nph_omp.h index 3ad206c688..f494a0e487 100644 --- a/src/OPENMP/fix_nph_omp.h +++ b/src/OPENMP/fix_nph_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHOMP : public FixNHOMP { public: FixNPHOMP(class LAMMPS *, int, char **); - ~FixNPHOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nph_sphere_omp.h b/src/OPENMP/fix_nph_sphere_omp.h index fec448374f..26ec718abb 100644 --- a/src/OPENMP/fix_nph_sphere_omp.h +++ b/src/OPENMP/fix_nph_sphere_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHSphereOMP : public FixNHSphereOMP { public: FixNPHSphereOMP(class LAMMPS *, int, char **); - virtual ~FixNPHSphereOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_npt_asphere_omp.h b/src/OPENMP/fix_npt_asphere_omp.h index 17827c941a..e125d7d707 100644 --- a/src/OPENMP/fix_npt_asphere_omp.h +++ b/src/OPENMP/fix_npt_asphere_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTAsphereOMP : public FixNHAsphereOMP { public: FixNPTAsphereOMP(class LAMMPS *, int, char **); - virtual ~FixNPTAsphereOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_npt_omp.h b/src/OPENMP/fix_npt_omp.h index e6abd4a71c..a726f12313 100644 --- a/src/OPENMP/fix_npt_omp.h +++ b/src/OPENMP/fix_npt_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTOMP : public FixNHOMP { public: FixNPTOMP(class LAMMPS *, int, char **); - ~FixNPTOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_npt_sphere_omp.h b/src/OPENMP/fix_npt_sphere_omp.h index bdd7438418..d806b9ccaf 100644 --- a/src/OPENMP/fix_npt_sphere_omp.h +++ b/src/OPENMP/fix_npt_sphere_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTSphereOMP : public FixNHSphereOMP { public: FixNPTSphereOMP(class LAMMPS *, int, char **); - virtual ~FixNPTSphereOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nve_omp.h b/src/OPENMP/fix_nve_omp.h index 8ad347a00e..47722f0078 100644 --- a/src/OPENMP/fix_nve_omp.h +++ b/src/OPENMP/fix_nve_omp.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixNVEOMP : public FixNVE { public: FixNVEOMP(class LAMMPS *, int, char **); - virtual ~FixNVEOMP() {} - virtual void initial_integrate(int); - virtual void final_integrate(); + + void initial_integrate(int) override; + void final_integrate() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nve_sphere_omp.h b/src/OPENMP/fix_nve_sphere_omp.h index 60b3bd4e49..647668c440 100644 --- a/src/OPENMP/fix_nve_sphere_omp.h +++ b/src/OPENMP/fix_nve_sphere_omp.h @@ -28,8 +28,8 @@ class FixNVESphereOMP : public FixNVESphere { public: FixNVESphereOMP(class LAMMPS *lmp, int narg, char **arg) : FixNVESphere(lmp, narg, arg){}; - virtual void initial_integrate(int); - virtual void final_integrate(); + void initial_integrate(int) override; + void final_integrate() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nvt_asphere_omp.h b/src/OPENMP/fix_nvt_asphere_omp.h index 1e1e5c3198..78104e9800 100644 --- a/src/OPENMP/fix_nvt_asphere_omp.h +++ b/src/OPENMP/fix_nvt_asphere_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTAsphereOMP : public FixNHAsphereOMP { public: FixNVTAsphereOMP(class LAMMPS *, int, char **); - virtual ~FixNVTAsphereOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nvt_omp.h b/src/OPENMP/fix_nvt_omp.h index 94f05d0bcd..4b67a52c3d 100644 --- a/src/OPENMP/fix_nvt_omp.h +++ b/src/OPENMP/fix_nvt_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTOMP : public FixNHOMP { public: FixNVTOMP(class LAMMPS *, int, char **); - ~FixNVTOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nvt_sllod_omp.h b/src/OPENMP/fix_nvt_sllod_omp.h index b24c698c7a..d93941a9a9 100644 --- a/src/OPENMP/fix_nvt_sllod_omp.h +++ b/src/OPENMP/fix_nvt_sllod_omp.h @@ -27,13 +27,12 @@ namespace LAMMPS_NS { class FixNVTSllodOMP : public FixNHOMP { public: FixNVTSllodOMP(class LAMMPS *, int, char **); - virtual ~FixNVTSllodOMP() {} - virtual void init(); + void init() override; private: int nondeformbias; - virtual void nh_v_temp(); + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_nvt_sphere_omp.h b/src/OPENMP/fix_nvt_sphere_omp.h index 08f93740eb..d436017507 100644 --- a/src/OPENMP/fix_nvt_sphere_omp.h +++ b/src/OPENMP/fix_nvt_sphere_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTSphereOMP : public FixNHSphereOMP { public: FixNVTSphereOMP(class LAMMPS *, int, char **); - virtual ~FixNVTSphereOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_omp.h b/src/OPENMP/fix_omp.h index 3f62cb7876..af57abc85c 100644 --- a/src/OPENMP/fix_omp.h +++ b/src/OPENMP/fix_omp.h @@ -32,20 +32,20 @@ class FixOMP : public Fix { public: FixOMP(class LAMMPS *, int, char **); - virtual ~FixOMP(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void min_setup(int flag) { setup(flag); } - virtual void pre_force(int); + ~FixOMP() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int flag) override { setup(flag); } + void pre_force(int) override; - virtual void setup_pre_force(int vflag) { pre_force(vflag); } + void setup_pre_force(int vflag) override { pre_force(vflag); } virtual void min_setup_pre_force(int vflag) { pre_force(vflag); } - virtual void min_pre_force(int vflag) { pre_force(vflag); } - virtual void setup_pre_force_respa(int vflag, int) { pre_force(vflag); } - virtual void pre_force_respa(int vflag, int, int) { pre_force(vflag); } + void min_pre_force(int vflag) override { pre_force(vflag); } + void setup_pre_force_respa(int vflag, int) override { pre_force(vflag); } + void pre_force_respa(int vflag, int, int) override { pre_force(vflag); } - virtual double memory_usage(); + double memory_usage() override; protected: ThrData **thr; diff --git a/src/OPENMP/fix_peri_neigh_omp.h b/src/OPENMP/fix_peri_neigh_omp.h index c7d4a6be57..1c52132b1c 100644 --- a/src/OPENMP/fix_peri_neigh_omp.h +++ b/src/OPENMP/fix_peri_neigh_omp.h @@ -28,7 +28,7 @@ class FixPeriNeighOMP : public FixPeriNeigh { public: FixPeriNeighOMP(class LAMMPS *lmp, int narg, char **argv) : FixPeriNeigh(lmp, narg, argv){}; - virtual void init(); + void init() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_qeq_comb_omp.h b/src/OPENMP/fix_qeq_comb_omp.h index e7de0d4fa5..2f7188b5e9 100644 --- a/src/OPENMP/fix_qeq_comb_omp.h +++ b/src/OPENMP/fix_qeq_comb_omp.h @@ -22,8 +22,8 @@ namespace LAMMPS_NS { class FixQEQCombOMP : public FixQEQComb { public: FixQEQCombOMP(class LAMMPS *, int, char **); - virtual void init(); - virtual void post_force(int); + void init() override; + void post_force(int) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_qeq_reaxff_omp.h b/src/OPENMP/fix_qeq_reaxff_omp.h index b99034edf0..20bcbdda29 100644 --- a/src/OPENMP/fix_qeq_reaxff_omp.h +++ b/src/OPENMP/fix_qeq_reaxff_omp.h @@ -29,11 +29,11 @@ class FixQEqReaxFFOMP : public FixQEqReaxFF { public: FixQEqReaxFFOMP(class LAMMPS *, int, char **); - ~FixQEqReaxFFOMP(); - virtual void init(); - virtual void init_storage(); - virtual void pre_force(int); - virtual void post_constructor(); + ~FixQEqReaxFFOMP() override; + void init() override; + void init_storage() override; + void pre_force(int) override; + void post_constructor() override; protected: double **b_temp; @@ -43,17 +43,17 @@ class FixQEqReaxFFOMP : public FixQEqReaxFF { double aspc_omega; double *aspc_b; - virtual void allocate_storage(); - virtual void deallocate_storage(); - virtual void init_matvec(); - virtual void compute_H(); + void allocate_storage() override; + void deallocate_storage() override; + void init_matvec() override; + void compute_H() override; - virtual int CG(double *, double *); - virtual void sparse_matvec(sparse_matrix *, double *, double *); - virtual void calculate_Q(); + int CG(double *, double *) override; + void sparse_matvec(sparse_matrix *, double *, double *) override; + void calculate_Q() override; - virtual void vector_sum(double *, double, double *, double, double *, int); - virtual void vector_add(double *, double, double *, int); + void vector_sum(double *, double, double *, double, double *, int) override; + void vector_add(double *, double, double *, int) override; // dual CG support virtual int dual_CG(double *, double *, double *, double *); diff --git a/src/OPENMP/fix_rigid_nh_omp.h b/src/OPENMP/fix_rigid_nh_omp.h index d923257e2f..ce6309213b 100644 --- a/src/OPENMP/fix_rigid_nh_omp.h +++ b/src/OPENMP/fix_rigid_nh_omp.h @@ -21,10 +21,9 @@ namespace LAMMPS_NS { class FixRigidNHOMP : public FixRigidNH { public: FixRigidNHOMP(class LAMMPS *lmp, int narg, char **args) : FixRigidNH(lmp, narg, args) {} - virtual ~FixRigidNHOMP() {} - virtual void initial_integrate(int); - virtual void final_integrate(); + void initial_integrate(int) override; + void final_integrate() override; virtual void remap(); protected: diff --git a/src/OPENMP/fix_rigid_nph_omp.h b/src/OPENMP/fix_rigid_nph_omp.h index e0ac1a2156..b02134df21 100644 --- a/src/OPENMP/fix_rigid_nph_omp.h +++ b/src/OPENMP/fix_rigid_nph_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNPHOMP : public FixRigidNHOMP { public: FixRigidNPHOMP(class LAMMPS *, int, char **); - ~FixRigidNPHOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_rigid_npt_omp.h b/src/OPENMP/fix_rigid_npt_omp.h index 9e6487fac7..8d329d097d 100644 --- a/src/OPENMP/fix_rigid_npt_omp.h +++ b/src/OPENMP/fix_rigid_npt_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNPTOMP : public FixRigidNHOMP { public: FixRigidNPTOMP(class LAMMPS *, int, char **); - ~FixRigidNPTOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_rigid_nve_omp.h b/src/OPENMP/fix_rigid_nve_omp.h index e3276b9974..a9c1dfeaf4 100644 --- a/src/OPENMP/fix_rigid_nve_omp.h +++ b/src/OPENMP/fix_rigid_nve_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNVEOMP : public FixRigidNHOMP { public: FixRigidNVEOMP(class LAMMPS *, int, char **); - ~FixRigidNVEOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_rigid_nvt_omp.h b/src/OPENMP/fix_rigid_nvt_omp.h index 06e71b7de5..f3ee9bcbbc 100644 --- a/src/OPENMP/fix_rigid_nvt_omp.h +++ b/src/OPENMP/fix_rigid_nvt_omp.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNVTOMP : public FixRigidNHOMP { public: FixRigidNVTOMP(class LAMMPS *, int, char **); - ~FixRigidNVTOMP() {} }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/fix_rigid_omp.h b/src/OPENMP/fix_rigid_omp.h index 8b7354642c..657ae681ec 100644 --- a/src/OPENMP/fix_rigid_omp.h +++ b/src/OPENMP/fix_rigid_omp.h @@ -27,10 +27,9 @@ namespace LAMMPS_NS { class FixRigidOMP : public FixRigid { public: FixRigidOMP(class LAMMPS *lmp, int narg, char **args) : FixRigid(lmp, narg, args) {} - ~FixRigidOMP() {} - virtual void initial_integrate(int); - virtual void final_integrate(); + void initial_integrate(int) override; + void final_integrate() override; protected: virtual void compute_forces_and_torques(); diff --git a/src/OPENMP/fix_rigid_small_omp.h b/src/OPENMP/fix_rigid_small_omp.h index 82b0d1b8cd..f318f6cf21 100644 --- a/src/OPENMP/fix_rigid_small_omp.h +++ b/src/OPENMP/fix_rigid_small_omp.h @@ -31,10 +31,9 @@ class FixRigidSmallOMP : public FixRigidSmall { { centroidstressflag = CENTROID_NOTAVAIL; } - virtual ~FixRigidSmallOMP(){}; - virtual void initial_integrate(int); - virtual void final_integrate(); + void initial_integrate(int) override; + void final_integrate() override; protected: virtual void compute_forces_and_torques(); diff --git a/src/OPENMP/improper_class2_omp.h b/src/OPENMP/improper_class2_omp.h index 4930e5795d..efb1f67c4c 100644 --- a/src/OPENMP/improper_class2_omp.h +++ b/src/OPENMP/improper_class2_omp.h @@ -33,7 +33,7 @@ class ImproperClass2OMP : public ImproperClass2, public ThrOMP { public: ImproperClass2OMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/improper_cossq_omp.h b/src/OPENMP/improper_cossq_omp.h index 98069222b3..515ee0d076 100644 --- a/src/OPENMP/improper_cossq_omp.h +++ b/src/OPENMP/improper_cossq_omp.h @@ -33,7 +33,7 @@ class ImproperCossqOMP : public ImproperCossq, public ThrOMP { public: ImproperCossqOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/improper_cvff_omp.h b/src/OPENMP/improper_cvff_omp.h index b994ec0547..04faba38ac 100644 --- a/src/OPENMP/improper_cvff_omp.h +++ b/src/OPENMP/improper_cvff_omp.h @@ -33,7 +33,7 @@ class ImproperCvffOMP : public ImproperCvff, public ThrOMP { public: ImproperCvffOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/improper_fourier_omp.h b/src/OPENMP/improper_fourier_omp.h index 734b17e101..e9b63b68dc 100644 --- a/src/OPENMP/improper_fourier_omp.h +++ b/src/OPENMP/improper_fourier_omp.h @@ -33,7 +33,7 @@ class ImproperFourierOMP : public ImproperFourier, public ThrOMP { public: ImproperFourierOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/improper_harmonic_omp.h b/src/OPENMP/improper_harmonic_omp.h index 78eb32e505..4caf47d56e 100644 --- a/src/OPENMP/improper_harmonic_omp.h +++ b/src/OPENMP/improper_harmonic_omp.h @@ -33,7 +33,7 @@ class ImproperHarmonicOMP : public ImproperHarmonic, public ThrOMP { public: ImproperHarmonicOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/improper_ring_omp.h b/src/OPENMP/improper_ring_omp.h index 9199830be7..7adce7014c 100644 --- a/src/OPENMP/improper_ring_omp.h +++ b/src/OPENMP/improper_ring_omp.h @@ -33,7 +33,7 @@ class ImproperRingOMP : public ImproperRing, public ThrOMP { public: ImproperRingOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/improper_umbrella_omp.h b/src/OPENMP/improper_umbrella_omp.h index 17dd81ca80..81f1a05787 100644 --- a/src/OPENMP/improper_umbrella_omp.h +++ b/src/OPENMP/improper_umbrella_omp.h @@ -33,7 +33,7 @@ class ImproperUmbrellaOMP : public ImproperUmbrella, public ThrOMP { public: ImproperUmbrellaOMP(class LAMMPS *lmp); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/msm_cg_omp.h b/src/OPENMP/msm_cg_omp.h index ae38dc8027..7ad12c8123 100644 --- a/src/OPENMP/msm_cg_omp.h +++ b/src/OPENMP/msm_cg_omp.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class MSMCGOMP : public MSMOMP { public: MSMCGOMP(class LAMMPS *); - virtual ~MSMCGOMP(); - virtual void settings(int, char **); - virtual void compute(int, int); - virtual double memory_usage(); + ~MSMCGOMP() override; + void settings(int, char **) override; + void compute(int, int) override; + double memory_usage() override; protected: int num_charged; @@ -38,10 +38,10 @@ class MSMCGOMP : public MSMOMP { double smallq; protected: - virtual void particle_map(); - virtual void make_rho(); - virtual void fieldforce(); - virtual void fieldforce_peratom(); + void particle_map() override; + void make_rho() override; + void fieldforce() override; + void fieldforce_peratom() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/msm_omp.h b/src/OPENMP/msm_omp.h index 3beaab4bcd..2925a21688 100644 --- a/src/OPENMP/msm_omp.h +++ b/src/OPENMP/msm_omp.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class MSMOMP : public MSM, public ThrOMP { public: MSMOMP(class LAMMPS *); - virtual ~MSMOMP(){}; protected: - virtual void direct(int); - virtual void compute(int, int); + void direct(int) override; + void compute(int, int) override; private: template void direct_eval(int); diff --git a/src/OPENMP/npair_full_bin_atomonly_omp.h b/src/OPENMP/npair_full_bin_atomonly_omp.h index 2cdc5d086d..0b17edd6ec 100644 --- a/src/OPENMP/npair_full_bin_atomonly_omp.h +++ b/src/OPENMP/npair_full_bin_atomonly_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullBinAtomonlyOmp : public NPair { public: NPairFullBinAtomonlyOmp(class LAMMPS *); - ~NPairFullBinAtomonlyOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_full_bin_ghost_omp.h b/src/OPENMP/npair_full_bin_ghost_omp.h index 0483cf7575..e53b4f6a8e 100644 --- a/src/OPENMP/npair_full_bin_ghost_omp.h +++ b/src/OPENMP/npair_full_bin_ghost_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullBinGhostOmp : public NPair { public: NPairFullBinGhostOmp(class LAMMPS *); - ~NPairFullBinGhostOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_full_bin_omp.h b/src/OPENMP/npair_full_bin_omp.h index f701556950..1ce8a70e13 100644 --- a/src/OPENMP/npair_full_bin_omp.h +++ b/src/OPENMP/npair_full_bin_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullBinOmp : public NPair { public: NPairFullBinOmp(class LAMMPS *); - ~NPairFullBinOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_full_multi_old_omp.h b/src/OPENMP/npair_full_multi_old_omp.h index 0b28db12d6..e8430623e1 100644 --- a/src/OPENMP/npair_full_multi_old_omp.h +++ b/src/OPENMP/npair_full_multi_old_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullMultiOldOmp : public NPair { public: NPairFullMultiOldOmp(class LAMMPS *); - ~NPairFullMultiOldOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_full_multi_omp.h b/src/OPENMP/npair_full_multi_omp.h index 8ee3cadbc8..9d0067703f 100644 --- a/src/OPENMP/npair_full_multi_omp.h +++ b/src/OPENMP/npair_full_multi_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullMultiOmp : public NPair { public: NPairFullMultiOmp(class LAMMPS *); - ~NPairFullMultiOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_full_nsq_ghost_omp.h b/src/OPENMP/npair_full_nsq_ghost_omp.h index b34d1fb74d..c19f7c5a0a 100644 --- a/src/OPENMP/npair_full_nsq_ghost_omp.h +++ b/src/OPENMP/npair_full_nsq_ghost_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullNsqGhostOmp : public NPair { public: NPairFullNsqGhostOmp(class LAMMPS *); - ~NPairFullNsqGhostOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_full_nsq_omp.h b/src/OPENMP/npair_full_nsq_omp.h index e16f830e97..bb0849e8a6 100644 --- a/src/OPENMP/npair_full_nsq_omp.h +++ b/src/OPENMP/npair_full_nsq_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullNsqOmp : public NPair { public: NPairFullNsqOmp(class LAMMPS *); - ~NPairFullNsqOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_bin_atomonly_newton_omp.h b/src/OPENMP/npair_half_bin_atomonly_newton_omp.h index 9ebf5c6f65..42d92b6e16 100644 --- a/src/OPENMP/npair_half_bin_atomonly_newton_omp.h +++ b/src/OPENMP/npair_half_bin_atomonly_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinAtomonlyNewtonOmp : public NPair { public: NPairHalfBinAtomonlyNewtonOmp(class LAMMPS *); - ~NPairHalfBinAtomonlyNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h index 2c94ff83f3..319fac9b35 100644 --- a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h +++ b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtoffGhostOmp : public NPair { public: NPairHalfBinNewtoffGhostOmp(class LAMMPS *); - ~NPairHalfBinNewtoffGhostOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_bin_newtoff_omp.h b/src/OPENMP/npair_half_bin_newtoff_omp.h index 849766e803..83dd355b2a 100644 --- a/src/OPENMP/npair_half_bin_newtoff_omp.h +++ b/src/OPENMP/npair_half_bin_newtoff_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtoffOmp : public NPair { public: NPairHalfBinNewtoffOmp(class LAMMPS *); - ~NPairHalfBinNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_bin_newton_omp.h b/src/OPENMP/npair_half_bin_newton_omp.h index ddbb46b57e..f80df43b22 100644 --- a/src/OPENMP/npair_half_bin_newton_omp.h +++ b/src/OPENMP/npair_half_bin_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtonOmp : public NPair { public: NPairHalfBinNewtonOmp(class LAMMPS *); - ~NPairHalfBinNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_bin_newton_tri_omp.h b/src/OPENMP/npair_half_bin_newton_tri_omp.h index 0506b1a561..6b40d6b95f 100644 --- a/src/OPENMP/npair_half_bin_newton_tri_omp.h +++ b/src/OPENMP/npair_half_bin_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtonTriOmp : public NPair { public: NPairHalfBinNewtonTriOmp(class LAMMPS *); - ~NPairHalfBinNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_multi_newtoff_omp.h b/src/OPENMP/npair_half_multi_newtoff_omp.h index 1be3c8d0e7..c166c34ce0 100644 --- a/src/OPENMP/npair_half_multi_newtoff_omp.h +++ b/src/OPENMP/npair_half_multi_newtoff_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiNewtoffOmp : public NPair { public: NPairHalfMultiNewtoffOmp(class LAMMPS *); - ~NPairHalfMultiNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_multi_newton_omp.h b/src/OPENMP/npair_half_multi_newton_omp.h index a665f788dc..c1684bb282 100644 --- a/src/OPENMP/npair_half_multi_newton_omp.h +++ b/src/OPENMP/npair_half_multi_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiNewtonOmp : public NPair { public: NPairHalfMultiNewtonOmp(class LAMMPS *); - ~NPairHalfMultiNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_multi_newton_tri_omp.h b/src/OPENMP/npair_half_multi_newton_tri_omp.h index a4cb2245b0..44aed7a09c 100644 --- a/src/OPENMP/npair_half_multi_newton_tri_omp.h +++ b/src/OPENMP/npair_half_multi_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiNewtonTriOmp : public NPair { public: NPairHalfMultiNewtonTriOmp(class LAMMPS *); - ~NPairHalfMultiNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_multi_old_newtoff_omp.h b/src/OPENMP/npair_half_multi_old_newtoff_omp.h index 1ad1f2c91c..7964e53a88 100644 --- a/src/OPENMP/npair_half_multi_old_newtoff_omp.h +++ b/src/OPENMP/npair_half_multi_old_newtoff_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiOldNewtoffOmp : public NPair { public: NPairHalfMultiOldNewtoffOmp(class LAMMPS *); - ~NPairHalfMultiOldNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_multi_old_newton_omp.h b/src/OPENMP/npair_half_multi_old_newton_omp.h index 66e67ec818..3486712933 100644 --- a/src/OPENMP/npair_half_multi_old_newton_omp.h +++ b/src/OPENMP/npair_half_multi_old_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiOldNewtonOmp : public NPair { public: NPairHalfMultiOldNewtonOmp(class LAMMPS *); - ~NPairHalfMultiOldNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_multi_old_newton_tri_omp.h b/src/OPENMP/npair_half_multi_old_newton_tri_omp.h index 2147a88ee6..007c936c33 100644 --- a/src/OPENMP/npair_half_multi_old_newton_tri_omp.h +++ b/src/OPENMP/npair_half_multi_old_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiOldNewtonTriOmp : public NPair { public: NPairHalfMultiOldNewtonTriOmp(class LAMMPS *); - ~NPairHalfMultiOldNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h index 84e066b618..f3ee492dec 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h +++ b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfNsqNewtoffGhostOmp : public NPair { public: NPairHalfNsqNewtoffGhostOmp(class LAMMPS *); - ~NPairHalfNsqNewtoffGhostOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_nsq_newtoff_omp.h b/src/OPENMP/npair_half_nsq_newtoff_omp.h index 68ed500e9f..80b56188f2 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_omp.h +++ b/src/OPENMP/npair_half_nsq_newtoff_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfNsqNewtoffOmp : public NPair { public: NPairHalfNsqNewtoffOmp(class LAMMPS *); - ~NPairHalfNsqNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_nsq_newton_omp.h b/src/OPENMP/npair_half_nsq_newton_omp.h index 94575915d2..5905af9b26 100644 --- a/src/OPENMP/npair_half_nsq_newton_omp.h +++ b/src/OPENMP/npair_half_nsq_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfNsqNewtonOmp : public NPair { public: NPairHalfNsqNewtonOmp(class LAMMPS *); - ~NPairHalfNsqNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_respa_bin_newtoff_omp.h b/src/OPENMP/npair_half_respa_bin_newtoff_omp.h index 1d2a7f31e5..c9fae76f58 100644 --- a/src/OPENMP/npair_half_respa_bin_newtoff_omp.h +++ b/src/OPENMP/npair_half_respa_bin_newtoff_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfRespaBinNewtoffOmp : public NPair { public: NPairHalfRespaBinNewtoffOmp(class LAMMPS *); - ~NPairHalfRespaBinNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_respa_bin_newton_omp.h b/src/OPENMP/npair_half_respa_bin_newton_omp.h index f6e30722f0..56c6b3bf1e 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_omp.h +++ b/src/OPENMP/npair_half_respa_bin_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaBinNewtonOmp : public NPair { public: NPairHalfRespaBinNewtonOmp(class LAMMPS *); - ~NPairHalfRespaBinNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h index f1a4d16b21..e43a9ecddc 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h +++ b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaBinNewtonTriOmp : public NPair { public: NPairHalfRespaBinNewtonTriOmp(class LAMMPS *); - ~NPairHalfRespaBinNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h index 7c9a3cc8d2..4d1b524b7c 100644 --- a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h +++ b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfRespaNsqNewtoffOmp : public NPair { public: NPairHalfRespaNsqNewtoffOmp(class LAMMPS *); - ~NPairHalfRespaNsqNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_respa_nsq_newton_omp.h b/src/OPENMP/npair_half_respa_nsq_newton_omp.h index 7adda81885..b9a879c134 100644 --- a/src/OPENMP/npair_half_respa_nsq_newton_omp.h +++ b/src/OPENMP/npair_half_respa_nsq_newton_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfRespaNsqNewtonOmp : public NPair { public: NPairHalfRespaNsqNewtonOmp(class LAMMPS *); - ~NPairHalfRespaNsqNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_bin_newtoff_omp.h b/src/OPENMP/npair_half_size_bin_newtoff_omp.h index 728a435ffe..ac226a798a 100644 --- a/src/OPENMP/npair_half_size_bin_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_bin_newtoff_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfSizeBinNewtoffOmp : public NPair { public: NPairHalfSizeBinNewtoffOmp(class LAMMPS *); - ~NPairHalfSizeBinNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_bin_newton_omp.h b/src/OPENMP/npair_half_size_bin_newton_omp.h index 0902f0f417..03143e3353 100644 --- a/src/OPENMP/npair_half_size_bin_newton_omp.h +++ b/src/OPENMP/npair_half_size_bin_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeBinNewtonOmp : public NPair { public: NPairHalfSizeBinNewtonOmp(class LAMMPS *); - ~NPairHalfSizeBinNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_bin_newton_tri_omp.h b/src/OPENMP/npair_half_size_bin_newton_tri_omp.h index 4b1ca9e71b..4924f4d157 100644 --- a/src/OPENMP/npair_half_size_bin_newton_tri_omp.h +++ b/src/OPENMP/npair_half_size_bin_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeBinNewtonTriOmp : public NPair { public: NPairHalfSizeBinNewtonTriOmp(class LAMMPS *); - ~NPairHalfSizeBinNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_multi_newtoff_omp.h b/src/OPENMP/npair_half_size_multi_newtoff_omp.h index 5865a977ed..29e5945454 100644 --- a/src/OPENMP/npair_half_size_multi_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_multi_newtoff_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiNewtoffOmp : public NPair { public: NPairHalfSizeMultiNewtoffOmp(class LAMMPS *); - ~NPairHalfSizeMultiNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_multi_newton_omp.h b/src/OPENMP/npair_half_size_multi_newton_omp.h index 3f9e76adbf..e3200d094e 100644 --- a/src/OPENMP/npair_half_size_multi_newton_omp.h +++ b/src/OPENMP/npair_half_size_multi_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiNewtonOmp : public NPair { public: NPairHalfSizeMultiNewtonOmp(class LAMMPS *); - ~NPairHalfSizeMultiNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_multi_newton_tri_omp.h b/src/OPENMP/npair_half_size_multi_newton_tri_omp.h index fa0b2ead6c..8eee91e055 100644 --- a/src/OPENMP/npair_half_size_multi_newton_tri_omp.h +++ b/src/OPENMP/npair_half_size_multi_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiNewtonTriOmp : public NPair { public: NPairHalfSizeMultiNewtonTriOmp(class LAMMPS *); - ~NPairHalfSizeMultiNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h index fa61e86b92..2ace70c519 100644 --- a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiOldNewtoffOmp : public NPair { public: NPairHalfSizeMultiOldNewtoffOmp(class LAMMPS *); - ~NPairHalfSizeMultiOldNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_multi_old_newton_omp.h b/src/OPENMP/npair_half_size_multi_old_newton_omp.h index c406e3524e..b6df50980c 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_omp.h +++ b/src/OPENMP/npair_half_size_multi_old_newton_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiOldNewtonOmp : public NPair { public: NPairHalfSizeMultiOldNewtonOmp(class LAMMPS *); - ~NPairHalfSizeMultiOldNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h index 37156c7a43..e9635de08a 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h +++ b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiOldNewtonTriOmp : public NPair { public: NPairHalfSizeMultiOldNewtonTriOmp(class LAMMPS *); - ~NPairHalfSizeMultiOldNewtonTriOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_nsq_newtoff_omp.h b/src/OPENMP/npair_half_size_nsq_newtoff_omp.h index 2d3c21aa73..bc6f2ebf8c 100644 --- a/src/OPENMP/npair_half_size_nsq_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_nsq_newtoff_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfSizeNsqNewtoffOmp : public NPair { public: NPairHalfSizeNsqNewtoffOmp(class LAMMPS *); - ~NPairHalfSizeNsqNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_half_size_nsq_newton_omp.h b/src/OPENMP/npair_half_size_nsq_newton_omp.h index bb7eb3e071..19b16afc30 100644 --- a/src/OPENMP/npair_half_size_nsq_newton_omp.h +++ b/src/OPENMP/npair_half_size_nsq_newton_omp.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairHalfSizeNsqNewtonOmp : public NPair { public: NPairHalfSizeNsqNewtonOmp(class LAMMPS *); - ~NPairHalfSizeNsqNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_halffull_newtoff_omp.h b/src/OPENMP/npair_halffull_newtoff_omp.h index 8cd7b64004..272fb8f570 100644 --- a/src/OPENMP/npair_halffull_newtoff_omp.h +++ b/src/OPENMP/npair_halffull_newtoff_omp.h @@ -35,8 +35,7 @@ namespace LAMMPS_NS { class NPairHalffullNewtoffOmp : public NPair { public: NPairHalffullNewtoffOmp(class LAMMPS *); - ~NPairHalffullNewtoffOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/npair_halffull_newton_omp.h b/src/OPENMP/npair_halffull_newton_omp.h index 78ca839a43..bd54ec03fe 100644 --- a/src/OPENMP/npair_halffull_newton_omp.h +++ b/src/OPENMP/npair_halffull_newton_omp.h @@ -35,8 +35,7 @@ namespace LAMMPS_NS { class NPairHalffullNewtonOmp : public NPair { public: NPairHalffullNewtonOmp(class LAMMPS *); - ~NPairHalffullNewtonOmp() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_adp_omp.h b/src/OPENMP/pair_adp_omp.h index d60d004dc1..f1df192f0e 100644 --- a/src/OPENMP/pair_adp_omp.h +++ b/src/OPENMP/pair_adp_omp.h @@ -34,8 +34,8 @@ class PairADPOMP : public PairADP, public ThrOMP { public: PairADPOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_agni_omp.h b/src/OPENMP/pair_agni_omp.h index 832db111d3..9288b982cf 100644 --- a/src/OPENMP/pair_agni_omp.h +++ b/src/OPENMP/pair_agni_omp.h @@ -34,8 +34,8 @@ class PairAGNIOMP : public PairAGNI, public ThrOMP { public: PairAGNIOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_airebo_morse_omp.h b/src/OPENMP/pair_airebo_morse_omp.h index aea460098f..b7212b1b1c 100644 --- a/src/OPENMP/pair_airebo_morse_omp.h +++ b/src/OPENMP/pair_airebo_morse_omp.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairAIREBOMorseOMP : public PairAIREBOOMP { public: PairAIREBOMorseOMP(class LAMMPS *); - virtual void settings(int, char **); + void settings(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_airebo_omp.h b/src/OPENMP/pair_airebo_omp.h index 355614552e..5f94c6d13a 100644 --- a/src/OPENMP/pair_airebo_omp.h +++ b/src/OPENMP/pair_airebo_omp.h @@ -29,8 +29,8 @@ class PairAIREBOOMP : public PairAIREBO, public ThrOMP { public: PairAIREBOOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: double bondorder_thr(int i, int j, double rij[3], double rijmag, double VA, ThrData *const thr); diff --git a/src/OPENMP/pair_beck_omp.h b/src/OPENMP/pair_beck_omp.h index b21ea4dda8..55bf4db335 100644 --- a/src/OPENMP/pair_beck_omp.h +++ b/src/OPENMP/pair_beck_omp.h @@ -34,8 +34,8 @@ class PairBeckOMP : public PairBeck, public ThrOMP { public: PairBeckOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_born_coul_long_omp.h b/src/OPENMP/pair_born_coul_long_omp.h index 78923925b0..e61353cbcd 100644 --- a/src/OPENMP/pair_born_coul_long_omp.h +++ b/src/OPENMP/pair_born_coul_long_omp.h @@ -34,8 +34,8 @@ class PairBornCoulLongOMP : public PairBornCoulLong, public ThrOMP { public: PairBornCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_born_coul_msm_omp.h b/src/OPENMP/pair_born_coul_msm_omp.h index 71845a574d..c1e52006c6 100644 --- a/src/OPENMP/pair_born_coul_msm_omp.h +++ b/src/OPENMP/pair_born_coul_msm_omp.h @@ -34,8 +34,8 @@ class PairBornCoulMSMOMP : public PairBornCoulMSM, public ThrOMP { public: PairBornCoulMSMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_born_coul_wolf_omp.h b/src/OPENMP/pair_born_coul_wolf_omp.h index 9037fa7554..afcfe41fe6 100644 --- a/src/OPENMP/pair_born_coul_wolf_omp.h +++ b/src/OPENMP/pair_born_coul_wolf_omp.h @@ -34,8 +34,8 @@ class PairBornCoulWolfOMP : public PairBornCoulWolf, public ThrOMP { public: PairBornCoulWolfOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_born_omp.h b/src/OPENMP/pair_born_omp.h index 198e3148aa..dfa262f300 100644 --- a/src/OPENMP/pair_born_omp.h +++ b/src/OPENMP/pair_born_omp.h @@ -34,8 +34,8 @@ class PairBornOMP : public PairBorn, public ThrOMP { public: PairBornOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_brownian_omp.h b/src/OPENMP/pair_brownian_omp.h index 42ca4babc6..53abf600a4 100644 --- a/src/OPENMP/pair_brownian_omp.h +++ b/src/OPENMP/pair_brownian_omp.h @@ -33,10 +33,10 @@ class PairBrownianOMP : public PairBrownian, public ThrOMP { public: PairBrownianOMP(class LAMMPS *); - virtual ~PairBrownianOMP(); + ~PairBrownianOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: class RanMars **random_thr; diff --git a/src/OPENMP/pair_brownian_poly_omp.h b/src/OPENMP/pair_brownian_poly_omp.h index 1fe54e809d..9ff184fb78 100644 --- a/src/OPENMP/pair_brownian_poly_omp.h +++ b/src/OPENMP/pair_brownian_poly_omp.h @@ -33,10 +33,10 @@ class PairBrownianPolyOMP : public PairBrownianPoly, public ThrOMP { public: PairBrownianPolyOMP(class LAMMPS *); - virtual ~PairBrownianPolyOMP(); + ~PairBrownianPolyOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: class RanMars **random_thr; diff --git a/src/OPENMP/pair_buck_coul_cut_omp.h b/src/OPENMP/pair_buck_coul_cut_omp.h index 163950cad7..5e714853d8 100644 --- a/src/OPENMP/pair_buck_coul_cut_omp.h +++ b/src/OPENMP/pair_buck_coul_cut_omp.h @@ -34,8 +34,8 @@ class PairBuckCoulCutOMP : public PairBuckCoulCut, public ThrOMP { public: PairBuckCoulCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_buck_coul_long_omp.h b/src/OPENMP/pair_buck_coul_long_omp.h index 7f55db80c1..2bca674344 100644 --- a/src/OPENMP/pair_buck_coul_long_omp.h +++ b/src/OPENMP/pair_buck_coul_long_omp.h @@ -34,8 +34,8 @@ class PairBuckCoulLongOMP : public PairBuckCoulLong, public ThrOMP { public: PairBuckCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_buck_coul_msm_omp.h b/src/OPENMP/pair_buck_coul_msm_omp.h index 8377bb2077..8928234007 100644 --- a/src/OPENMP/pair_buck_coul_msm_omp.h +++ b/src/OPENMP/pair_buck_coul_msm_omp.h @@ -34,8 +34,8 @@ class PairBuckCoulMSMOMP : public PairBuckCoulMSM, public ThrOMP { public: PairBuckCoulMSMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_buck_long_coul_long_omp.h b/src/OPENMP/pair_buck_long_coul_long_omp.h index 76502fd05c..3681e6e48e 100644 --- a/src/OPENMP/pair_buck_long_coul_long_omp.h +++ b/src/OPENMP/pair_buck_long_coul_long_omp.h @@ -30,10 +30,10 @@ class PairBuckLongCoulLongOMP : public PairBuckLongCoulLong, public ThrOMP { public: PairBuckLongCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual void compute_inner(); - virtual void compute_middle(); - virtual void compute_outer(int, int); + void compute(int, int) override; + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; private: template diff --git a/src/OPENMP/pair_colloid_omp.h b/src/OPENMP/pair_colloid_omp.h index bcebbd4437..f433c57723 100644 --- a/src/OPENMP/pair_colloid_omp.h +++ b/src/OPENMP/pair_colloid_omp.h @@ -34,8 +34,8 @@ class PairColloidOMP : public PairColloid, public ThrOMP { public: PairColloidOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_comb_omp.h b/src/OPENMP/pair_comb_omp.h index 69adc2fe3e..0eedff3b5f 100644 --- a/src/OPENMP/pair_comb_omp.h +++ b/src/OPENMP/pair_comb_omp.h @@ -29,10 +29,10 @@ class PairCombOMP : public PairComb, public ThrOMP { public: PairCombOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; - virtual double yasu_char(double *, int &); + double yasu_char(double *, int &) override; private: template diff --git a/src/OPENMP/pair_coul_cut_global_omp.h b/src/OPENMP/pair_coul_cut_global_omp.h index 118b769e0b..811c2fe913 100644 --- a/src/OPENMP/pair_coul_cut_global_omp.h +++ b/src/OPENMP/pair_coul_cut_global_omp.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairCoulCutGlobalOMP : public PairCoulCutOMP { public: PairCoulCutGlobalOMP(class LAMMPS *lmp) : PairCoulCutOMP(lmp) {} - void coeff(int, char **); - void *extract(const char *, int &); + void coeff(int, char **) override; + void *extract(const char *, int &) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_coul_cut_omp.h b/src/OPENMP/pair_coul_cut_omp.h index 1cfad1f91a..218ff4cfc2 100644 --- a/src/OPENMP/pair_coul_cut_omp.h +++ b/src/OPENMP/pair_coul_cut_omp.h @@ -34,8 +34,8 @@ class PairCoulCutOMP : public PairCoulCut, public ThrOMP { public: PairCoulCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_cut_soft_omp.h b/src/OPENMP/pair_coul_cut_soft_omp.h index 54bcc58efd..b2ecc64b80 100644 --- a/src/OPENMP/pair_coul_cut_soft_omp.h +++ b/src/OPENMP/pair_coul_cut_soft_omp.h @@ -34,8 +34,8 @@ class PairCoulCutSoftOMP : public PairCoulCutSoft, public ThrOMP { public: PairCoulCutSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_debye_omp.h b/src/OPENMP/pair_coul_debye_omp.h index f993c6bafd..e1b67a7d26 100644 --- a/src/OPENMP/pair_coul_debye_omp.h +++ b/src/OPENMP/pair_coul_debye_omp.h @@ -34,8 +34,8 @@ class PairCoulDebyeOMP : public PairCoulDebye, public ThrOMP { public: PairCoulDebyeOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_diel_omp.h b/src/OPENMP/pair_coul_diel_omp.h index 5a86469056..4c7c386e86 100644 --- a/src/OPENMP/pair_coul_diel_omp.h +++ b/src/OPENMP/pair_coul_diel_omp.h @@ -34,8 +34,8 @@ class PairCoulDielOMP : public PairCoulDiel, public ThrOMP { public: PairCoulDielOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_dsf_omp.h b/src/OPENMP/pair_coul_dsf_omp.h index 1ad36b5c39..d0aa45c11c 100644 --- a/src/OPENMP/pair_coul_dsf_omp.h +++ b/src/OPENMP/pair_coul_dsf_omp.h @@ -34,8 +34,8 @@ class PairCoulDSFOMP : public PairCoulDSF, public ThrOMP { public: PairCoulDSFOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_long_omp.h b/src/OPENMP/pair_coul_long_omp.h index 80cfa8e601..cbe876f3d4 100644 --- a/src/OPENMP/pair_coul_long_omp.h +++ b/src/OPENMP/pair_coul_long_omp.h @@ -34,8 +34,8 @@ class PairCoulLongOMP : public PairCoulLong, public ThrOMP { public: PairCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_long_soft_omp.h b/src/OPENMP/pair_coul_long_soft_omp.h index e4cb6cdadb..6cee02c424 100644 --- a/src/OPENMP/pair_coul_long_soft_omp.h +++ b/src/OPENMP/pair_coul_long_soft_omp.h @@ -34,8 +34,8 @@ class PairCoulLongSoftOMP : public PairCoulLongSoft, public ThrOMP { public: PairCoulLongSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_msm_omp.h b/src/OPENMP/pair_coul_msm_omp.h index 4780567b4a..f825a57956 100644 --- a/src/OPENMP/pair_coul_msm_omp.h +++ b/src/OPENMP/pair_coul_msm_omp.h @@ -34,8 +34,8 @@ class PairCoulMSMOMP : public PairCoulMSM, public ThrOMP { public: PairCoulMSMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_coul_wolf_omp.h b/src/OPENMP/pair_coul_wolf_omp.h index 09bec2e39c..47aadd7443 100644 --- a/src/OPENMP/pair_coul_wolf_omp.h +++ b/src/OPENMP/pair_coul_wolf_omp.h @@ -34,8 +34,8 @@ class PairCoulWolfOMP : public PairCoulWolf, public ThrOMP { public: PairCoulWolfOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_dpd_omp.h b/src/OPENMP/pair_dpd_omp.h index 73f80eff03..4b004ad81e 100644 --- a/src/OPENMP/pair_dpd_omp.h +++ b/src/OPENMP/pair_dpd_omp.h @@ -33,10 +33,10 @@ class PairDPDOMP : public PairDPD, public ThrOMP { public: PairDPDOMP(class LAMMPS *); - virtual ~PairDPDOMP(); + ~PairDPDOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: class RanMars **random_thr; diff --git a/src/OPENMP/pair_dpd_tstat_omp.h b/src/OPENMP/pair_dpd_tstat_omp.h index 79c928075a..b9cbe902f7 100644 --- a/src/OPENMP/pair_dpd_tstat_omp.h +++ b/src/OPENMP/pair_dpd_tstat_omp.h @@ -33,10 +33,10 @@ class PairDPDTstatOMP : public PairDPDTstat, public ThrOMP { public: PairDPDTstatOMP(class LAMMPS *); - virtual ~PairDPDTstatOMP(); + ~PairDPDTstatOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: class RanMars **random_thr; diff --git a/src/OPENMP/pair_eam_alloy_omp.cpp b/src/OPENMP/pair_eam_alloy_omp.cpp index 814533c9f8..4914186f46 100644 --- a/src/OPENMP/pair_eam_alloy_omp.cpp +++ b/src/OPENMP/pair_eam_alloy_omp.cpp @@ -23,7 +23,6 @@ #include "error.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include diff --git a/src/OPENMP/pair_eam_alloy_omp.h b/src/OPENMP/pair_eam_alloy_omp.h index d51b9698fc..38e32ddedf 100644 --- a/src/OPENMP/pair_eam_alloy_omp.h +++ b/src/OPENMP/pair_eam_alloy_omp.h @@ -29,12 +29,12 @@ namespace LAMMPS_NS { class PairEAMAlloyOMP : virtual public PairEAMOMP { public: PairEAMAlloyOMP(class LAMMPS *); - virtual ~PairEAMAlloyOMP() {} - void coeff(int, char **); + + void coeff(int, char **) override; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_eam_fs_omp.cpp b/src/OPENMP/pair_eam_fs_omp.cpp index 395b79701a..ea7bb11794 100644 --- a/src/OPENMP/pair_eam_fs_omp.cpp +++ b/src/OPENMP/pair_eam_fs_omp.cpp @@ -23,7 +23,6 @@ #include "error.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include diff --git a/src/OPENMP/pair_eam_fs_omp.h b/src/OPENMP/pair_eam_fs_omp.h index 6455cbbd17..c68de71623 100644 --- a/src/OPENMP/pair_eam_fs_omp.h +++ b/src/OPENMP/pair_eam_fs_omp.h @@ -29,12 +29,12 @@ namespace LAMMPS_NS { class PairEAMFSOMP : virtual public PairEAMOMP { public: PairEAMFSOMP(class LAMMPS *); - virtual ~PairEAMFSOMP() {} - void coeff(int, char **); + + void coeff(int, char **) override; protected: - void read_file(char *); - void file2array(); + void read_file(char *) override; + void file2array() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_eam_omp.h b/src/OPENMP/pair_eam_omp.h index 14531f0105..3401241808 100644 --- a/src/OPENMP/pair_eam_omp.h +++ b/src/OPENMP/pair_eam_omp.h @@ -34,8 +34,8 @@ class PairEAMOMP : public PairEAM, public ThrOMP { public: PairEAMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_edip_omp.h b/src/OPENMP/pair_edip_omp.h index a3b99ec46e..e9afe243ab 100644 --- a/src/OPENMP/pair_edip_omp.h +++ b/src/OPENMP/pair_edip_omp.h @@ -29,8 +29,8 @@ class PairEDIPOMP : public PairEDIP, public ThrOMP { public: PairEDIPOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_eim_omp.h b/src/OPENMP/pair_eim_omp.h index 8242c2d141..708c15243f 100644 --- a/src/OPENMP/pair_eim_omp.h +++ b/src/OPENMP/pair_eim_omp.h @@ -34,8 +34,8 @@ class PairEIMOMP : public PairEIM, public ThrOMP { public: PairEIMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_gauss_cut_omp.h b/src/OPENMP/pair_gauss_cut_omp.h index d59daf3c3b..3ed1603222 100644 --- a/src/OPENMP/pair_gauss_cut_omp.h +++ b/src/OPENMP/pair_gauss_cut_omp.h @@ -34,8 +34,8 @@ class PairGaussCutOMP : public PairGaussCut, public ThrOMP { public: PairGaussCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_gauss_omp.h b/src/OPENMP/pair_gauss_omp.h index ec5ca92f70..4cda138e48 100644 --- a/src/OPENMP/pair_gauss_omp.h +++ b/src/OPENMP/pair_gauss_omp.h @@ -34,8 +34,8 @@ class PairGaussOMP : public PairGauss, public ThrOMP { public: PairGaussOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_gayberne_omp.h b/src/OPENMP/pair_gayberne_omp.h index 89d5f22023..3038f0faf6 100644 --- a/src/OPENMP/pair_gayberne_omp.h +++ b/src/OPENMP/pair_gayberne_omp.h @@ -34,8 +34,8 @@ class PairGayBerneOMP : public PairGayBerne, public ThrOMP { public: PairGayBerneOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_gran_hertz_history_omp.h b/src/OPENMP/pair_gran_hertz_history_omp.h index 029d37c6f8..393104d0d8 100644 --- a/src/OPENMP/pair_gran_hertz_history_omp.h +++ b/src/OPENMP/pair_gran_hertz_history_omp.h @@ -34,8 +34,8 @@ class PairGranHertzHistoryOMP : public PairGranHertzHistory, public ThrOMP { public: PairGranHertzHistoryOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_gran_hooke_history_omp.h b/src/OPENMP/pair_gran_hooke_history_omp.h index 3f0dd1d503..c07a847fab 100644 --- a/src/OPENMP/pair_gran_hooke_history_omp.h +++ b/src/OPENMP/pair_gran_hooke_history_omp.h @@ -34,8 +34,8 @@ class PairGranHookeHistoryOMP : public PairGranHookeHistory, public ThrOMP { public: PairGranHookeHistoryOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_gran_hooke_omp.h b/src/OPENMP/pair_gran_hooke_omp.h index 158b128558..153290a780 100644 --- a/src/OPENMP/pair_gran_hooke_omp.h +++ b/src/OPENMP/pair_gran_hooke_omp.h @@ -34,8 +34,8 @@ class PairGranHookeOMP : public PairGranHooke, public ThrOMP { public: PairGranHookeOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template void eval(int ifrom, int ito, ThrData *const thr); diff --git a/src/OPENMP/pair_harmonic_cut_omp.cpp b/src/OPENMP/pair_harmonic_cut_omp.cpp new file mode 100644 index 0000000000..dd7be3ba36 --- /dev/null +++ b/src/OPENMP/pair_harmonic_cut_omp.cpp @@ -0,0 +1,154 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#include "pair_harmonic_cut_omp.h" + +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neigh_list.h" +#include "suffix.h" + +#include + +#include "omp_compat.h" +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairHarmonicCutOMP::PairHarmonicCutOMP(LAMMPS *lmp) : PairHarmonicCut(lmp), ThrOMP(lmp, THR_PAIR) +{ + suffix_flag |= Suffix::OMP; +} + +/* ---------------------------------------------------------------------- */ + +void PairHarmonicCutOMP::compute(int eflag, int vflag) +{ + ev_init(eflag, vflag); + + const int nall = atom->nlocal + atom->nghost; + const int nthreads = comm->nthreads; + const int inum = list->inum; + +#if defined(_OPENMP) +#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag, vflag) +#endif + { + int ifrom, ito, tid; + + loop_setup_thr(ifrom, ito, tid, inum, nthreads); + ThrData *thr = fix->get_thr(tid); + thr->timer(Timer::START); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); + + if (evflag) { + if (eflag) { + if (force->newton_pair) + eval<1, 1, 1>(ifrom, ito, thr); + else + eval<1, 1, 0>(ifrom, ito, thr); + } else { + if (force->newton_pair) + eval<1, 0, 1>(ifrom, ito, thr); + else + eval<1, 0, 0>(ifrom, ito, thr); + } + } else { + if (force->newton_pair) + eval<0, 0, 1>(ifrom, ito, thr); + else + eval<0, 0, 0>(ifrom, ito, thr); + } + thr->timer(Timer::PAIR); + reduce_thr(this, eflag, vflag, thr); + } // end of omp parallel region +} + +template +void PairHarmonicCutOMP::eval(int iifrom, int iito, ThrData *const thr) +{ + const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const int *_noalias const type = atom->type; + const double *_noalias const special_lj = force->special_lj; + const int *_noalias const ilist = list->ilist; + const int *_noalias const numneigh = list->numneigh; + const int *const *const firstneigh = list->firstneigh; + + double xtmp, ytmp, ztmp, delx, dely, delz, fxtmp, fytmp, fztmp; + double rsq, factor_lj; + + const int nlocal = atom->nlocal; + int j, jj, jnum, jtype; + + // loop over neighbors of my atoms + + for (int ii = iifrom; ii < iito; ++ii) { + const int i = ilist[ii]; + const int itype = type[i]; + const int *_noalias const jlist = firstneigh[i]; + const double *_noalias const cutsqi = cutsq[itype]; + + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; + jnum = numneigh[i]; + fxtmp = fytmp = fztmp = 0.0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; + rsq = delx * delx + dely * dely + delz * delz; + jtype = type[j]; + + if (rsq < cutsqi[jtype]) { + const double r = sqrt(rsq); + const double delta = cut[itype][jtype] - r; + const double philj = factor_lj * delta * k[itype][jtype]; + const double fpair = delta * philj / r; + + fxtmp += delx * fpair; + fytmp += dely * fpair; + fztmp += delz * fpair; + if (NEWTON_PAIR || j < nlocal) { + f[j].x -= delx * fpair; + f[j].y -= dely * fpair; + f[j].z -= delz * fpair; + } + + if (EVFLAG) + ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, philj, 0.0, fpair, delx, dely, delz, thr); + } + } + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; + } +} + +/* ---------------------------------------------------------------------- */ + +double PairHarmonicCutOMP::memory_usage() +{ + double bytes = memory_usage_thr(); + bytes += PairHarmonicCut::memory_usage(); + + return bytes; +} diff --git a/src/OPENMP/pair_harmonic_cut_omp.h b/src/OPENMP/pair_harmonic_cut_omp.h new file mode 100644 index 0000000000..9e84e508c0 --- /dev/null +++ b/src/OPENMP/pair_harmonic_cut_omp.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(harmonic/cut/omp,PairHarmonicCutOMP); +// clang-format on +#else + +#ifndef LMP_PAIR_HARMONIC_CUT_OMP_H +#define LMP_PAIR_HARMONIC_CUT_OMP_H + +#include "pair_harmonic_cut.h" +#include "thr_omp.h" + +namespace LAMMPS_NS { + +class PairHarmonicCutOMP : public PairHarmonicCut, public ThrOMP { + + public: + PairHarmonicCutOMP(class LAMMPS *); + + void compute(int, int) override; + double memory_usage() override; + + private: + template + void eval(int ifrom, int ito, ThrData *const thr); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/OPENMP/pair_hbond_dreiding_lj_omp.h b/src/OPENMP/pair_hbond_dreiding_lj_omp.h index b3a97c59db..7b51c071b9 100644 --- a/src/OPENMP/pair_hbond_dreiding_lj_omp.h +++ b/src/OPENMP/pair_hbond_dreiding_lj_omp.h @@ -33,10 +33,10 @@ class PairHbondDreidingLJOMP : public PairHbondDreidingLJ, public ThrOMP { public: PairHbondDreidingLJOMP(class LAMMPS *); - virtual ~PairHbondDreidingLJOMP(); + ~PairHbondDreidingLJOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: double *hbcount_thr, *hbeng_thr; diff --git a/src/OPENMP/pair_hbond_dreiding_morse_omp.h b/src/OPENMP/pair_hbond_dreiding_morse_omp.h index 44b0671087..c5ebd9bc47 100644 --- a/src/OPENMP/pair_hbond_dreiding_morse_omp.h +++ b/src/OPENMP/pair_hbond_dreiding_morse_omp.h @@ -33,10 +33,10 @@ class PairHbondDreidingMorseOMP : public PairHbondDreidingMorse, public ThrOMP { public: PairHbondDreidingMorseOMP(class LAMMPS *); - virtual ~PairHbondDreidingMorseOMP(); + ~PairHbondDreidingMorseOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: double *hbcount_thr, *hbeng_thr; diff --git a/src/OPENMP/pair_lj96_cut_omp.h b/src/OPENMP/pair_lj96_cut_omp.h index de2460c99f..59c6606cdb 100644 --- a/src/OPENMP/pair_lj96_cut_omp.h +++ b/src/OPENMP/pair_lj96_cut_omp.h @@ -34,8 +34,8 @@ class PairLJ96CutOMP : public PairLJ96Cut, public ThrOMP { public: PairLJ96CutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.h b/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.h index e3b8d40d18..d6c08e2e97 100644 --- a/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.h +++ b/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.h @@ -34,8 +34,8 @@ class PairLJCharmmCoulCharmmImplicitOMP : public PairLJCharmmCoulCharmmImplicit, public: PairLJCharmmCoulCharmmImplicitOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_charmm_coul_charmm_omp.h b/src/OPENMP/pair_lj_charmm_coul_charmm_omp.h index 83d1e8bdc1..f020cba462 100644 --- a/src/OPENMP/pair_lj_charmm_coul_charmm_omp.h +++ b/src/OPENMP/pair_lj_charmm_coul_charmm_omp.h @@ -34,8 +34,8 @@ class PairLJCharmmCoulCharmmOMP : public PairLJCharmmCoulCharmm, public ThrOMP { public: PairLJCharmmCoulCharmmOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_charmm_coul_long_omp.h b/src/OPENMP/pair_lj_charmm_coul_long_omp.h index c507c5e29e..5dae557380 100644 --- a/src/OPENMP/pair_lj_charmm_coul_long_omp.h +++ b/src/OPENMP/pair_lj_charmm_coul_long_omp.h @@ -34,8 +34,8 @@ class PairLJCharmmCoulLongOMP : public PairLJCharmmCoulLong, public ThrOMP { public: PairLJCharmmCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.h b/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.h index 757ddb689d..d4087d4e4f 100644 --- a/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.h +++ b/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.h @@ -34,8 +34,8 @@ class PairLJCharmmCoulLongSoftOMP : public PairLJCharmmCoulLongSoft, public ThrO public: PairLJCharmmCoulLongSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_charmm_coul_msm_omp.h b/src/OPENMP/pair_lj_charmm_coul_msm_omp.h index 08f109e53e..b91c8faef6 100644 --- a/src/OPENMP/pair_lj_charmm_coul_msm_omp.h +++ b/src/OPENMP/pair_lj_charmm_coul_msm_omp.h @@ -34,8 +34,8 @@ class PairLJCharmmCoulMSMOMP : public PairLJCharmmCoulMSM, public ThrOMP { public: PairLJCharmmCoulMSMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_class2_coul_cut_omp.h b/src/OPENMP/pair_lj_class2_coul_cut_omp.h index dbd9b77799..10d1574436 100644 --- a/src/OPENMP/pair_lj_class2_coul_cut_omp.h +++ b/src/OPENMP/pair_lj_class2_coul_cut_omp.h @@ -34,8 +34,8 @@ class PairLJClass2CoulCutOMP : public PairLJClass2CoulCut, public ThrOMP { public: PairLJClass2CoulCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_class2_coul_long_omp.h b/src/OPENMP/pair_lj_class2_coul_long_omp.h index 2db5dc9642..a6e297aea6 100644 --- a/src/OPENMP/pair_lj_class2_coul_long_omp.h +++ b/src/OPENMP/pair_lj_class2_coul_long_omp.h @@ -34,8 +34,8 @@ class PairLJClass2CoulLongOMP : public PairLJClass2CoulLong, public ThrOMP { public: PairLJClass2CoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_class2_omp.h b/src/OPENMP/pair_lj_class2_omp.h index 38e072a7f3..e9864c5985 100644 --- a/src/OPENMP/pair_lj_class2_omp.h +++ b/src/OPENMP/pair_lj_class2_omp.h @@ -34,8 +34,8 @@ class PairLJClass2OMP : public PairLJClass2, public ThrOMP { public: PairLJClass2OMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cubic_omp.h b/src/OPENMP/pair_lj_cubic_omp.h index a4e74d95b9..a01c6ce5f1 100644 --- a/src/OPENMP/pair_lj_cubic_omp.h +++ b/src/OPENMP/pair_lj_cubic_omp.h @@ -34,8 +34,8 @@ class PairLJCubicOMP : public PairLJCubic, public ThrOMP { public: PairLJCubicOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h index 5f28aa4d17..527309909e 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h @@ -28,8 +28,8 @@ namespace LAMMPS_NS { class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public ThrOMP { public: PairLJCutCoulCutDielectricOMP(class LAMMPS *); - virtual ~PairLJCutCoulCutDielectricOMP() = default; - virtual void compute(int, int); + ~PairLJCutCoulCutDielectricOMP() override = default; + void compute(int, int) override; protected: template diff --git a/src/OPENMP/pair_lj_cut_coul_cut_omp.h b/src/OPENMP/pair_lj_cut_coul_cut_omp.h index 36a35b112e..2b2af00741 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_cut_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulCutOMP : public PairLJCutCoulCut, public ThrOMP { public: PairLJCutCoulCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.h b/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.h index bc25b7e18a..8482937910 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulCutSoftOMP : public PairLJCutCoulCutSoft, public ThrOMP { public: PairLJCutCoulCutSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_debye_omp.h b/src/OPENMP/pair_lj_cut_coul_debye_omp.h index 8e565bdcdf..fdaf692bae 100644 --- a/src/OPENMP/pair_lj_cut_coul_debye_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_debye_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulDebyeOMP : public PairLJCutCoulDebye, public ThrOMP { public: PairLJCutCoulDebyeOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_dsf_omp.h b/src/OPENMP/pair_lj_cut_coul_dsf_omp.h index 06ec6348e8..c7d5baf921 100644 --- a/src/OPENMP/pair_lj_cut_coul_dsf_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_dsf_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulDSFOMP : public PairLJCutCoulDSF, public ThrOMP { public: PairLJCutCoulDSFOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h index f70809524f..4aa7e70ee6 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h @@ -29,8 +29,8 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi public: PairLJCutCoulLongDielectricOMP(class LAMMPS *); - virtual ~PairLJCutCoulLongDielectricOMP() = default; - virtual void compute(int, int); + ~PairLJCutCoulLongDielectricOMP() override = default; + void compute(int, int) override; protected: template diff --git a/src/OPENMP/pair_lj_cut_coul_long_omp.h b/src/OPENMP/pair_lj_cut_coul_long_omp.h index d18ca10f8e..ca7c30dede 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_long_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulLongOMP : public PairLJCutCoulLong, public ThrOMP { public: PairLJCutCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_long_soft_omp.h b/src/OPENMP/pair_lj_cut_coul_long_soft_omp.h index 8ee2d3ced0..00c6b031a4 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_soft_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_long_soft_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulLongSoftOMP : public PairLJCutCoulLongSoft, public ThrOMP { public: PairLJCutCoulLongSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_msm_omp.h b/src/OPENMP/pair_lj_cut_coul_msm_omp.h index 900a975991..8f9892903a 100644 --- a/src/OPENMP/pair_lj_cut_coul_msm_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_msm_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulMSMOMP : public PairLJCutCoulMSM, public ThrOMP { public: PairLJCutCoulMSMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_coul_wolf_omp.h b/src/OPENMP/pair_lj_cut_coul_wolf_omp.h index b108769aee..b0fd2b3258 100644 --- a/src/OPENMP/pair_lj_cut_coul_wolf_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_wolf_omp.h @@ -34,8 +34,8 @@ class PairLJCutCoulWolfOMP : public PairLJCutCoulWolf, public ThrOMP { public: PairLJCutCoulWolfOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_dipole_cut_omp.h b/src/OPENMP/pair_lj_cut_dipole_cut_omp.h index 584810d1c2..117b17a0ac 100644 --- a/src/OPENMP/pair_lj_cut_dipole_cut_omp.h +++ b/src/OPENMP/pair_lj_cut_dipole_cut_omp.h @@ -34,8 +34,8 @@ class PairLJCutDipoleCutOMP : public PairLJCutDipoleCut, public ThrOMP { public: PairLJCutDipoleCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_omp.h b/src/OPENMP/pair_lj_cut_omp.h index 1e93a589c4..604b5f2c81 100644 --- a/src/OPENMP/pair_lj_cut_omp.h +++ b/src/OPENMP/pair_lj_cut_omp.h @@ -34,8 +34,8 @@ class PairLJCutOMP : public PairLJCut, public ThrOMP { public: PairLJCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_soft_omp.h b/src/OPENMP/pair_lj_cut_soft_omp.h index 8139cfb6fd..70a72f8986 100644 --- a/src/OPENMP/pair_lj_cut_soft_omp.h +++ b/src/OPENMP/pair_lj_cut_soft_omp.h @@ -34,8 +34,8 @@ class PairLJCutSoftOMP : public PairLJCutSoft, public ThrOMP { public: PairLJCutSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_cut_thole_long_omp.h b/src/OPENMP/pair_lj_cut_thole_long_omp.h index 9e0e56a35f..ea17517487 100644 --- a/src/OPENMP/pair_lj_cut_thole_long_omp.h +++ b/src/OPENMP/pair_lj_cut_thole_long_omp.h @@ -29,7 +29,7 @@ class PairLJCutTholeLongOMP : public PairLJCutTholeLong, public ThrOMP { public: PairLJCutTholeLongOMP(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; private: template diff --git a/src/OPENMP/pair_lj_cut_tip4p_cut_omp.h b/src/OPENMP/pair_lj_cut_tip4p_cut_omp.h index a0700930ab..2516413af3 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_cut_omp.h +++ b/src/OPENMP/pair_lj_cut_tip4p_cut_omp.h @@ -33,10 +33,10 @@ class PairLJCutTIP4PCutOMP : public PairLJCutTIP4PCut, public ThrOMP { public: PairLJCutTIP4PCutOMP(class LAMMPS *); - virtual ~PairLJCutTIP4PCutOMP(); + ~PairLJCutTIP4PCutOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: dbl3_t *newsite_thr; diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_omp.h b/src/OPENMP/pair_lj_cut_tip4p_long_omp.h index 49598158dc..54e93a4791 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_omp.h +++ b/src/OPENMP/pair_lj_cut_tip4p_long_omp.h @@ -33,10 +33,10 @@ class PairLJCutTIP4PLongOMP : public PairLJCutTIP4PLong, public ThrOMP { public: PairLJCutTIP4PLongOMP(class LAMMPS *); - virtual ~PairLJCutTIP4PLongOMP(); + ~PairLJCutTIP4PLongOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: dbl3_t *newsite_thr; diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.h b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.h index 9ca41a122b..0ea785b067 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.h +++ b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.h @@ -33,10 +33,10 @@ class PairLJCutTIP4PLongSoftOMP : public PairLJCutTIP4PLongSoft, public ThrOMP { public: PairLJCutTIP4PLongSoftOMP(class LAMMPS *); - virtual ~PairLJCutTIP4PLongSoftOMP(); + ~PairLJCutTIP4PLongSoftOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: dbl3_t *newsite_thr; diff --git a/src/OPENMP/pair_lj_expand_omp.h b/src/OPENMP/pair_lj_expand_omp.h index 3be4b6113d..ddfc09b789 100644 --- a/src/OPENMP/pair_lj_expand_omp.h +++ b/src/OPENMP/pair_lj_expand_omp.h @@ -34,8 +34,8 @@ class PairLJExpandOMP : public PairLJExpand, public ThrOMP { public: PairLJExpandOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.h b/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.h index 60c2d755b0..7ee77daf77 100644 --- a/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.h +++ b/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.h @@ -34,8 +34,8 @@ class PairLJGromacsCoulGromacsOMP : public PairLJGromacsCoulGromacs, public ThrO public: PairLJGromacsCoulGromacsOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_gromacs_omp.h b/src/OPENMP/pair_lj_gromacs_omp.h index ae69bae5f5..54e837864c 100644 --- a/src/OPENMP/pair_lj_gromacs_omp.h +++ b/src/OPENMP/pair_lj_gromacs_omp.h @@ -34,8 +34,8 @@ class PairLJGromacsOMP : public PairLJGromacs, public ThrOMP { public: PairLJGromacsOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_long_coul_long_omp.h b/src/OPENMP/pair_lj_long_coul_long_omp.h index 7ada6e7686..24b38ceeb6 100644 --- a/src/OPENMP/pair_lj_long_coul_long_omp.h +++ b/src/OPENMP/pair_lj_long_coul_long_omp.h @@ -34,11 +34,11 @@ class PairLJLongCoulLongOMP : public PairLJLongCoulLong, public ThrOMP { public: PairLJLongCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual void compute_inner(); - virtual void compute_middle(); - virtual void compute_outer(int, int); - virtual double memory_usage(); + void compute(int, int) override; + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_sdk_coul_long_omp.h b/src/OPENMP/pair_lj_sdk_coul_long_omp.h index 7fc55ffde4..d19139de26 100644 --- a/src/OPENMP/pair_lj_sdk_coul_long_omp.h +++ b/src/OPENMP/pair_lj_sdk_coul_long_omp.h @@ -34,8 +34,8 @@ class PairLJSDKCoulLongOMP : public PairLJSDKCoulLong, public ThrOMP { public: PairLJSDKCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_sdk_coul_msm_omp.h b/src/OPENMP/pair_lj_sdk_coul_msm_omp.h index d9f800b3a4..a1c881f4d0 100644 --- a/src/OPENMP/pair_lj_sdk_coul_msm_omp.h +++ b/src/OPENMP/pair_lj_sdk_coul_msm_omp.h @@ -34,8 +34,8 @@ class PairLJSDKCoulMSMOMP : public PairLJSDKCoulMSM, public ThrOMP { public: PairLJSDKCoulMSMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_sdk_omp.h b/src/OPENMP/pair_lj_sdk_omp.h index ebd262f333..1ef27f6fb6 100644 --- a/src/OPENMP/pair_lj_sdk_omp.h +++ b/src/OPENMP/pair_lj_sdk_omp.h @@ -34,8 +34,8 @@ class PairLJSDKOMP : public PairLJSDK, public ThrOMP { public: PairLJSDKOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_sf_dipole_sf_omp.h b/src/OPENMP/pair_lj_sf_dipole_sf_omp.h index fd57a466b0..6f85cbd6ee 100644 --- a/src/OPENMP/pair_lj_sf_dipole_sf_omp.h +++ b/src/OPENMP/pair_lj_sf_dipole_sf_omp.h @@ -34,8 +34,8 @@ class PairLJSFDipoleSFOMP : public PairLJSFDipoleSF, public ThrOMP { public: PairLJSFDipoleSFOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_smooth_linear_omp.h b/src/OPENMP/pair_lj_smooth_linear_omp.h index e39362f6f7..b0ed2d6a12 100644 --- a/src/OPENMP/pair_lj_smooth_linear_omp.h +++ b/src/OPENMP/pair_lj_smooth_linear_omp.h @@ -35,8 +35,8 @@ class PairLJSmoothLinearOMP : public PairLJSmoothLinear, public ThrOMP { public: PairLJSmoothLinearOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lj_smooth_omp.h b/src/OPENMP/pair_lj_smooth_omp.h index b2497aa7a5..de8601b79c 100644 --- a/src/OPENMP/pair_lj_smooth_omp.h +++ b/src/OPENMP/pair_lj_smooth_omp.h @@ -34,8 +34,8 @@ class PairLJSmoothOMP : public PairLJSmooth, public ThrOMP { public: PairLJSmoothOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lubricate_omp.h b/src/OPENMP/pair_lubricate_omp.h index 1f5fc340bb..4c5d25f67d 100644 --- a/src/OPENMP/pair_lubricate_omp.h +++ b/src/OPENMP/pair_lubricate_omp.h @@ -33,10 +33,10 @@ class PairLubricateOMP : public PairLubricate, public ThrOMP { public: PairLubricateOMP(class LAMMPS *); - virtual ~PairLubricateOMP() = default; + ~PairLubricateOMP() override = default; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_lubricate_poly_omp.h b/src/OPENMP/pair_lubricate_poly_omp.h index 5a36d232b8..4b783784b4 100644 --- a/src/OPENMP/pair_lubricate_poly_omp.h +++ b/src/OPENMP/pair_lubricate_poly_omp.h @@ -33,10 +33,10 @@ class PairLubricatePolyOMP : public PairLubricatePoly, public ThrOMP { public: PairLubricatePolyOMP(class LAMMPS *); - virtual ~PairLubricatePolyOMP() = default; + ~PairLubricatePolyOMP() override = default; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_meam_spline_omp.h b/src/OPENMP/pair_meam_spline_omp.h index 7086705320..5e7dc49f67 100644 --- a/src/OPENMP/pair_meam_spline_omp.h +++ b/src/OPENMP/pair_meam_spline_omp.h @@ -34,8 +34,8 @@ class PairMEAMSplineOMP : public PairMEAMSpline, public ThrOMP { public: PairMEAMSplineOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template void eval(int iifrom, int iito, ThrData *const thr); diff --git a/src/OPENMP/pair_morse_omp.h b/src/OPENMP/pair_morse_omp.h index e390ef1cd2..a781ed327b 100644 --- a/src/OPENMP/pair_morse_omp.h +++ b/src/OPENMP/pair_morse_omp.h @@ -34,8 +34,8 @@ class PairMorseOMP : public PairMorse, public ThrOMP { public: PairMorseOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_morse_smooth_linear_omp.h b/src/OPENMP/pair_morse_smooth_linear_omp.h index ed1ad5c88c..ecddb473dd 100644 --- a/src/OPENMP/pair_morse_smooth_linear_omp.h +++ b/src/OPENMP/pair_morse_smooth_linear_omp.h @@ -29,8 +29,8 @@ class PairMorseSmoothLinearOMP : public PairMorseSmoothLinear, public ThrOMP { public: PairMorseSmoothLinearOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_nm_cut_coul_cut_omp.h b/src/OPENMP/pair_nm_cut_coul_cut_omp.h index 3d3aefb8f1..7a07dfda0d 100644 --- a/src/OPENMP/pair_nm_cut_coul_cut_omp.h +++ b/src/OPENMP/pair_nm_cut_coul_cut_omp.h @@ -34,8 +34,8 @@ class PairNMCutCoulCutOMP : public PairNMCutCoulCut, public ThrOMP { public: PairNMCutCoulCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_nm_cut_coul_long_omp.h b/src/OPENMP/pair_nm_cut_coul_long_omp.h index 1519af2547..0d59763ee5 100644 --- a/src/OPENMP/pair_nm_cut_coul_long_omp.h +++ b/src/OPENMP/pair_nm_cut_coul_long_omp.h @@ -34,8 +34,8 @@ class PairNMCutCoulLongOMP : public PairNMCutCoulLong, public ThrOMP { public: PairNMCutCoulLongOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_nm_cut_omp.h b/src/OPENMP/pair_nm_cut_omp.h index 15f90dff33..f9c93489c8 100644 --- a/src/OPENMP/pair_nm_cut_omp.h +++ b/src/OPENMP/pair_nm_cut_omp.h @@ -34,8 +34,8 @@ class PairNMCutOMP : public PairNMCut, public ThrOMP { public: PairNMCutOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_peri_lps_omp.cpp b/src/OPENMP/pair_peri_lps_omp.cpp index 0eefe8d55c..3e1a37ade9 100644 --- a/src/OPENMP/pair_peri_lps_omp.cpp +++ b/src/OPENMP/pair_peri_lps_omp.cpp @@ -23,7 +23,6 @@ #include "lattice.h" #include "math_const.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neighbor.h" #include "suffix.h" diff --git a/src/OPENMP/pair_peri_lps_omp.h b/src/OPENMP/pair_peri_lps_omp.h index 758e17bcf3..5a2e32256c 100644 --- a/src/OPENMP/pair_peri_lps_omp.h +++ b/src/OPENMP/pair_peri_lps_omp.h @@ -34,8 +34,8 @@ class PairPeriLPSOMP : public PairPeriLPS, public ThrOMP { public: PairPeriLPSOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_peri_pmb_omp.cpp b/src/OPENMP/pair_peri_pmb_omp.cpp index 54d5969d8f..25f36f2d22 100644 --- a/src/OPENMP/pair_peri_pmb_omp.cpp +++ b/src/OPENMP/pair_peri_pmb_omp.cpp @@ -22,7 +22,6 @@ #include "force.h" #include "lattice.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "suffix.h" diff --git a/src/OPENMP/pair_peri_pmb_omp.h b/src/OPENMP/pair_peri_pmb_omp.h index e2017f841e..4e48a30b5b 100644 --- a/src/OPENMP/pair_peri_pmb_omp.h +++ b/src/OPENMP/pair_peri_pmb_omp.h @@ -34,8 +34,8 @@ class PairPeriPMBOMP : public PairPeriPMB, public ThrOMP { public: PairPeriPMBOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_reaxff_omp.cpp b/src/OPENMP/pair_reaxff_omp.cpp index 454f56c55f..be270cd3d0 100644 --- a/src/OPENMP/pair_reaxff_omp.cpp +++ b/src/OPENMP/pair_reaxff_omp.cpp @@ -117,7 +117,6 @@ void PairReaxFFOMP::init_style() api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts - api->system->bigN = static_cast (atom->natoms); // all atoms in the system api->system->wsize = comm->nprocs; if (atom->tag_enable == 0) @@ -125,11 +124,6 @@ void PairReaxFFOMP::init_style() if (force->newton_pair == 0) error->all(FLERR,"Pair style reaxff/omp requires newton pair on"); - // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT - - if (atom->natoms > MAXSMALLINT) - error->all(FLERR,"Too many atoms for pair style reaxff/omp"); - // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs @@ -159,7 +153,6 @@ void PairReaxFFOMP::setup() api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts oldN = api->system->N; - api->system->bigN = static_cast (atom->natoms); // all atoms in the system if (api->system->N > nmax) { memory->destroy(num_nbrs_offset); @@ -226,7 +219,6 @@ void PairReaxFFOMP::setup() void PairReaxFFOMP::compute(int eflag, int vflag) { - double evdwl,ecoul; // communicate num_bonds once every reneighboring // 2 num arrays stored by fix, grab ptr to them @@ -235,12 +227,10 @@ void PairReaxFFOMP::compute(int eflag, int vflag) int *num_bonds = fix_reaxff->num_bonds; int *num_hbonds = fix_reaxff->num_hbonds; - evdwl = ecoul = 0.0; ev_init(eflag,vflag); api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts - api->system->bigN = static_cast (atom->natoms); // all atoms in the system const int nall = api->system->N; #if defined(_OPENMP) @@ -304,20 +294,6 @@ void PairReaxFFOMP::compute(int eflag, int vflag) // energies and pressure if (eflag_global) { - evdwl += api->data->my_en.e_bond; - evdwl += api->data->my_en.e_ov; - evdwl += api->data->my_en.e_un; - evdwl += api->data->my_en.e_lp; - evdwl += api->data->my_en.e_ang; - evdwl += api->data->my_en.e_pen; - evdwl += api->data->my_en.e_coa; - evdwl += api->data->my_en.e_hb; - evdwl += api->data->my_en.e_tor; - evdwl += api->data->my_en.e_con; - evdwl += api->data->my_en.e_vdW; - - ecoul += api->data->my_en.e_ele; - ecoul += api->data->my_en.e_pol; // Store the different parts of the energy // in a list for output by compute pair command diff --git a/src/OPENMP/pair_reaxff_omp.h b/src/OPENMP/pair_reaxff_omp.h index 4424c90b39..d2ec2fb6bb 100644 --- a/src/OPENMP/pair_reaxff_omp.h +++ b/src/OPENMP/pair_reaxff_omp.h @@ -29,9 +29,9 @@ namespace LAMMPS_NS { class PairReaxFFOMP : public PairReaxFF, public ThrOMP { public: PairReaxFFOMP(class LAMMPS *); - ~PairReaxFFOMP(); - virtual void compute(int, int); - virtual void init_style(); + ~PairReaxFFOMP() override; + void compute(int, int) override; + void init_style() override; inline FixOMP *getFixOMP() { return fix; }; @@ -98,7 +98,7 @@ class PairReaxFFOMP : public PairReaxFF, public ThrOMP { } protected: - virtual void setup(); + void setup() override; virtual void write_reax_atoms(); virtual int estimate_reax_lists(); virtual int write_reax_lists(); diff --git a/src/OPENMP/pair_rebo_omp.h b/src/OPENMP/pair_rebo_omp.h index 5629a37318..55cfcfa647 100644 --- a/src/OPENMP/pair_rebo_omp.h +++ b/src/OPENMP/pair_rebo_omp.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class PairREBOOMP : public PairAIREBOOMP { public: PairREBOOMP(class LAMMPS *); - virtual void settings(int, char **); + void settings(int, char **) override; protected: - void spline_init(); + void spline_init() override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_resquared_omp.h b/src/OPENMP/pair_resquared_omp.h index 58718104ff..515e3dc8ec 100644 --- a/src/OPENMP/pair_resquared_omp.h +++ b/src/OPENMP/pair_resquared_omp.h @@ -34,8 +34,8 @@ class PairRESquaredOMP : public PairRESquared, public ThrOMP { public: PairRESquaredOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_soft_omp.h b/src/OPENMP/pair_soft_omp.h index 6435f5b4ca..d8a4d885f2 100644 --- a/src/OPENMP/pair_soft_omp.h +++ b/src/OPENMP/pair_soft_omp.h @@ -34,8 +34,8 @@ class PairSoftOMP : public PairSoft, public ThrOMP { public: PairSoftOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_sw_mod_omp.h b/src/OPENMP/pair_sw_mod_omp.h index 7e69ca283b..1b7fd31ee9 100644 --- a/src/OPENMP/pair_sw_mod_omp.h +++ b/src/OPENMP/pair_sw_mod_omp.h @@ -32,15 +32,14 @@ class PairSWMODOMP : public PairSWOMP { public: PairSWMODOMP(class LAMMPS *); - virtual ~PairSWMODOMP() {} protected: double delta1; double delta2; - void settings(int, char **); + void settings(int, char **) override; void threebody(Param *, Param *, Param *, double, double, double *, double *, double *, double *, - int, double &); + int, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_sw_omp.h b/src/OPENMP/pair_sw_omp.h index 263e25e99a..84c35ae0e3 100644 --- a/src/OPENMP/pair_sw_omp.h +++ b/src/OPENMP/pair_sw_omp.h @@ -34,8 +34,8 @@ class PairSWOMP : public PairSW, public ThrOMP { public: PairSWOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template void eval(int ifrom, int ito, ThrData *const thr); diff --git a/src/OPENMP/pair_table_omp.h b/src/OPENMP/pair_table_omp.h index f3a02ce55e..8ccb8d7e87 100644 --- a/src/OPENMP/pair_table_omp.h +++ b/src/OPENMP/pair_table_omp.h @@ -34,8 +34,8 @@ class PairTableOMP : public PairTable, public ThrOMP { public: PairTableOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_tersoff_mod_c_omp.h b/src/OPENMP/pair_tersoff_mod_c_omp.h index 787089efc4..c50d74b67a 100644 --- a/src/OPENMP/pair_tersoff_mod_c_omp.h +++ b/src/OPENMP/pair_tersoff_mod_c_omp.h @@ -29,8 +29,8 @@ class PairTersoffMODCOMP : public PairTersoffMODC, public ThrOMP { public: PairTersoffMODCOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_tersoff_mod_omp.h b/src/OPENMP/pair_tersoff_mod_omp.h index e7dd8b6178..fd90a1bb57 100644 --- a/src/OPENMP/pair_tersoff_mod_omp.h +++ b/src/OPENMP/pair_tersoff_mod_omp.h @@ -29,8 +29,8 @@ class PairTersoffMODOMP : public PairTersoffMOD, public ThrOMP { public: PairTersoffMODOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_tersoff_omp.h b/src/OPENMP/pair_tersoff_omp.h index e044615138..22d7ea7597 100644 --- a/src/OPENMP/pair_tersoff_omp.h +++ b/src/OPENMP/pair_tersoff_omp.h @@ -29,8 +29,8 @@ class PairTersoffOMP : public PairTersoff, public ThrOMP { public: PairTersoffOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_tersoff_table_omp.h b/src/OPENMP/pair_tersoff_table_omp.h index c686087f11..1426334ee0 100644 --- a/src/OPENMP/pair_tersoff_table_omp.h +++ b/src/OPENMP/pair_tersoff_table_omp.h @@ -28,17 +28,17 @@ class PairTersoffTableOMP : public PairTersoffTable, public ThrOMP { public: PairTersoffTableOMP(class LAMMPS *); - virtual ~PairTersoffTableOMP(); + ~PairTersoffTableOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: double ***thrGtetaFunction, ***thrGtetaFunctionDerived; double **thrCutoffFunction, **thrCutoffFunctionDerived; - void allocatePreLoops(); - void deallocatePreLoops(); + void allocatePreLoops() override; + void deallocatePreLoops() override; private: template void eval(int ifrom, int ito, ThrData *const thr); diff --git a/src/OPENMP/pair_tersoff_zbl_omp.cpp b/src/OPENMP/pair_tersoff_zbl_omp.cpp index 9541695611..4b3034a204 100644 --- a/src/OPENMP/pair_tersoff_zbl_omp.cpp +++ b/src/OPENMP/pair_tersoff_zbl_omp.cpp @@ -25,7 +25,6 @@ #include "math_special.h" #include "memory.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include "update.h" #include diff --git a/src/OPENMP/pair_tersoff_zbl_omp.h b/src/OPENMP/pair_tersoff_zbl_omp.h index 60426ea77c..cad15b2caa 100644 --- a/src/OPENMP/pair_tersoff_zbl_omp.h +++ b/src/OPENMP/pair_tersoff_zbl_omp.h @@ -26,16 +26,15 @@ namespace LAMMPS_NS { class PairTersoffZBLOMP : public PairTersoffOMP { public: PairTersoffZBLOMP(class LAMMPS *); - virtual ~PairTersoffZBLOMP() {} protected: double global_a_0; // Bohr radius for Coulomb repulsion double global_epsilon_0; // permittivity of vacuum for Coulomb repulsion double global_e; // proton charge (negative of electron charge) - virtual void read_file(char *); - virtual void repulsive(Param *, double, double &, int, double &); - virtual void force_zeta(Param *, double, double, double &, double &, int, double &); + void read_file(char *) override; + void repulsive(Param *, double, double &, int, double &) override; + void force_zeta(Param *, double, double, double &, double &, int, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_tip4p_cut_omp.h b/src/OPENMP/pair_tip4p_cut_omp.h index c9b1b367fe..56cde26914 100644 --- a/src/OPENMP/pair_tip4p_cut_omp.h +++ b/src/OPENMP/pair_tip4p_cut_omp.h @@ -33,10 +33,10 @@ class PairTIP4PCutOMP : public PairTIP4PCut, public ThrOMP { public: PairTIP4PCutOMP(class LAMMPS *); - virtual ~PairTIP4PCutOMP(); + ~PairTIP4PCutOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: dbl3_t *newsite_thr; diff --git a/src/OPENMP/pair_tip4p_long_omp.h b/src/OPENMP/pair_tip4p_long_omp.h index f19c2c6528..37eaae6c25 100644 --- a/src/OPENMP/pair_tip4p_long_omp.h +++ b/src/OPENMP/pair_tip4p_long_omp.h @@ -33,10 +33,10 @@ class PairTIP4PLongOMP : public PairTIP4PLong, public ThrOMP { public: PairTIP4PLongOMP(class LAMMPS *); - virtual ~PairTIP4PLongOMP(); + ~PairTIP4PLongOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: dbl3_t *newsite_thr; diff --git a/src/OPENMP/pair_tip4p_long_soft_omp.h b/src/OPENMP/pair_tip4p_long_soft_omp.h index 21b29310e5..be2840484f 100644 --- a/src/OPENMP/pair_tip4p_long_soft_omp.h +++ b/src/OPENMP/pair_tip4p_long_soft_omp.h @@ -33,10 +33,10 @@ class PairTIP4PLongSoftOMP : public PairTIP4PLongSoft, public ThrOMP { public: PairTIP4PLongSoftOMP(class LAMMPS *); - virtual ~PairTIP4PLongSoftOMP(); + ~PairTIP4PLongSoftOMP() override; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: dbl3_t *newsite_thr; diff --git a/src/OPENMP/pair_ufm_omp.h b/src/OPENMP/pair_ufm_omp.h index 2c25393bba..27f68613f2 100644 --- a/src/OPENMP/pair_ufm_omp.h +++ b/src/OPENMP/pair_ufm_omp.h @@ -36,8 +36,8 @@ class PairUFMOMP : public PairUFM, public ThrOMP { public: PairUFMOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_vashishta_omp.h b/src/OPENMP/pair_vashishta_omp.h index f5b9fd1fb2..a161bc7c8b 100644 --- a/src/OPENMP/pair_vashishta_omp.h +++ b/src/OPENMP/pair_vashishta_omp.h @@ -34,8 +34,8 @@ class PairVashishtaOMP : public PairVashishta, public ThrOMP { public: PairVashishtaOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template void eval(int ifrom, int ito, ThrData *const thr); diff --git a/src/OPENMP/pair_vashishta_table_omp.h b/src/OPENMP/pair_vashishta_table_omp.h index 5f2a147361..2bc731a04a 100644 --- a/src/OPENMP/pair_vashishta_table_omp.h +++ b/src/OPENMP/pair_vashishta_table_omp.h @@ -34,8 +34,8 @@ class PairVashishtaTableOMP : public PairVashishtaTable, public ThrOMP { public: PairVashishtaTableOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template void eval(int ifrom, int ito, ThrData *const thr); diff --git a/src/OPENMP/pair_yukawa_colloid_omp.h b/src/OPENMP/pair_yukawa_colloid_omp.h index a1b0a840b3..5dddc26eb9 100644 --- a/src/OPENMP/pair_yukawa_colloid_omp.h +++ b/src/OPENMP/pair_yukawa_colloid_omp.h @@ -34,8 +34,8 @@ class PairYukawaColloidOMP : public PairYukawaColloid, public ThrOMP { public: PairYukawaColloidOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_yukawa_omp.h b/src/OPENMP/pair_yukawa_omp.h index 3d956d74c2..c905359fa3 100644 --- a/src/OPENMP/pair_yukawa_omp.h +++ b/src/OPENMP/pair_yukawa_omp.h @@ -34,8 +34,8 @@ class PairYukawaOMP : public PairYukawa, public ThrOMP { public: PairYukawaOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pair_zbl_omp.h b/src/OPENMP/pair_zbl_omp.h index 65965b759a..3b482a7f5d 100644 --- a/src/OPENMP/pair_zbl_omp.h +++ b/src/OPENMP/pair_zbl_omp.h @@ -34,8 +34,8 @@ class PairZBLOMP : public PairZBL, public ThrOMP { public: PairZBLOMP(class LAMMPS *); - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; private: template diff --git a/src/OPENMP/pppm_cg_omp.h b/src/OPENMP/pppm_cg_omp.h index ca21b2ccc5..6ecceed759 100644 --- a/src/OPENMP/pppm_cg_omp.h +++ b/src/OPENMP/pppm_cg_omp.h @@ -28,19 +28,19 @@ namespace LAMMPS_NS { class PPPMCGOMP : public PPPMCG, public ThrOMP { public: PPPMCGOMP(class LAMMPS *); - virtual ~PPPMCGOMP(); - virtual void compute(int, int); + ~PPPMCGOMP() override; + void compute(int, int) override; protected: - virtual void allocate(); + void allocate() override; - virtual void compute_gf_ik(); - virtual void compute_gf_ad(); + void compute_gf_ik() override; + void compute_gf_ad() override; - virtual void make_rho(); - virtual void fieldforce_ik(); - virtual void fieldforce_ad(); - virtual void fieldforce_peratom(); + void make_rho() override; + void fieldforce_ik() override; + void fieldforce_ad() override; + void fieldforce_peratom() override; private: void compute_rho1d_thr(FFT_SCALAR *const *const, const FFT_SCALAR &, const FFT_SCALAR &, diff --git a/src/OPENMP/pppm_disp_omp.h b/src/OPENMP/pppm_disp_omp.h index 384b359523..bc463e60b4 100644 --- a/src/OPENMP/pppm_disp_omp.h +++ b/src/OPENMP/pppm_disp_omp.h @@ -28,31 +28,31 @@ namespace LAMMPS_NS { class PPPMDispOMP : public PPPMDisp, public ThrOMP { public: PPPMDispOMP(class LAMMPS *); - virtual ~PPPMDispOMP(); - virtual void compute(int, int); + ~PPPMDispOMP() override; + void compute(int, int) override; protected: - virtual void allocate(); + void allocate() override; virtual void compute_gf(); virtual void compute_gf_6(); - virtual void particle_map(double, double, double, double, int **, int, int, int, int, int, int, - int, int); + void particle_map(double, double, double, double, int **, int, int, int, int, int, int, + int, int) override; - virtual void fieldforce_c_ik(); - virtual void fieldforce_c_ad(); - virtual void fieldforce_c_peratom(); - virtual void fieldforce_g_ik(); - virtual void fieldforce_g_ad(); - virtual void fieldforce_g_peratom(); - virtual void fieldforce_a_ik(); - virtual void fieldforce_a_ad(); - virtual void fieldforce_a_peratom(); + void fieldforce_c_ik() override; + void fieldforce_c_ad() override; + void fieldforce_c_peratom() override; + void fieldforce_g_ik() override; + void fieldforce_g_ad() override; + void fieldforce_g_peratom() override; + void fieldforce_a_ik() override; + void fieldforce_a_ad() override; + void fieldforce_a_peratom() override; - virtual void make_rho_c(); - virtual void make_rho_g(); - virtual void make_rho_a(); + void make_rho_c() override; + void make_rho_g() override; + void make_rho_a() override; void compute_rho1d_thr(FFT_SCALAR *const *const, const FFT_SCALAR &, const FFT_SCALAR &, const FFT_SCALAR &, const int, FFT_SCALAR *const *const); diff --git a/src/OPENMP/pppm_disp_tip4p_omp.h b/src/OPENMP/pppm_disp_tip4p_omp.h index c85bbe9437..9b08f5966e 100644 --- a/src/OPENMP/pppm_disp_tip4p_omp.h +++ b/src/OPENMP/pppm_disp_tip4p_omp.h @@ -28,33 +28,33 @@ namespace LAMMPS_NS { class PPPMDispTIP4POMP : public PPPMDispTIP4P, public ThrOMP { public: PPPMDispTIP4POMP(class LAMMPS *); - virtual ~PPPMDispTIP4POMP(); + ~PPPMDispTIP4POMP() override; protected: - virtual void allocate(); + void allocate() override; virtual void compute_gf(); virtual void compute_gf_6(); - virtual void compute(int, int); + void compute(int, int) override; - virtual void particle_map(double, double, double, double, int **, int, int, int, int, int, int, - int, int); - virtual void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, - int, int); - virtual void make_rho_c(); // XXX: not (yet) multi-threaded - virtual void make_rho_g(); - virtual void make_rho_a(); + void particle_map(double, double, double, double, int **, int, int, int, int, int, int, + int, int) override; + void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, + int, int) override; + void make_rho_c() override; // XXX: not (yet) multi-threaded + void make_rho_g() override; + void make_rho_a() override; - virtual void fieldforce_c_ik(); - virtual void fieldforce_c_ad(); + void fieldforce_c_ik() override; + void fieldforce_c_ad() override; // virtual void fieldforce_peratom(); XXX: need to benchmark first. - virtual void fieldforce_g_ik(); - virtual void fieldforce_g_ad(); - virtual void fieldforce_g_peratom(); - virtual void fieldforce_a_ik(); - virtual void fieldforce_a_ad(); - virtual void fieldforce_a_peratom(); + void fieldforce_g_ik() override; + void fieldforce_g_ad() override; + void fieldforce_g_peratom() override; + void fieldforce_a_ik() override; + void fieldforce_a_ad() override; + void fieldforce_a_peratom() override; private: void compute_rho1d_thr(FFT_SCALAR *const *const, const FFT_SCALAR &, const FFT_SCALAR &, diff --git a/src/OPENMP/pppm_omp.h b/src/OPENMP/pppm_omp.h index 3c17ede721..8da1f26bfd 100644 --- a/src/OPENMP/pppm_omp.h +++ b/src/OPENMP/pppm_omp.h @@ -28,19 +28,19 @@ namespace LAMMPS_NS { class PPPMOMP : public PPPM, public ThrOMP { public: PPPMOMP(class LAMMPS *); - virtual ~PPPMOMP(); - virtual void compute(int, int); + ~PPPMOMP() override; + void compute(int, int) override; protected: - virtual void allocate(); + void allocate() override; - virtual void compute_gf_ik(); - virtual void compute_gf_ad(); + void compute_gf_ik() override; + void compute_gf_ad() override; - virtual void make_rho(); - virtual void fieldforce_ik(); - virtual void fieldforce_ad(); - virtual void fieldforce_peratom(); + void make_rho() override; + void fieldforce_ik() override; + void fieldforce_ad() override; + void fieldforce_peratom() override; private: void compute_rho1d_thr(FFT_SCALAR *const *const, const FFT_SCALAR &, const FFT_SCALAR &, diff --git a/src/OPENMP/pppm_tip4p_omp.h b/src/OPENMP/pppm_tip4p_omp.h index ba445b0353..bcb5890269 100644 --- a/src/OPENMP/pppm_tip4p_omp.h +++ b/src/OPENMP/pppm_tip4p_omp.h @@ -28,20 +28,20 @@ namespace LAMMPS_NS { class PPPMTIP4POMP : public PPPMTIP4P, public ThrOMP { public: PPPMTIP4POMP(class LAMMPS *); - virtual ~PPPMTIP4POMP(); - virtual void compute(int, int); + ~PPPMTIP4POMP() override; + void compute(int, int) override; protected: - virtual void allocate(); + void allocate() override; - virtual void compute_gf_ik(); - virtual void compute_gf_ad(); + void compute_gf_ik() override; + void compute_gf_ad() override; - virtual void particle_map(); - virtual void make_rho(); // XXX: not (yet) multi-threaded + void particle_map() override; + void make_rho() override; // XXX: not (yet) multi-threaded - virtual void fieldforce_ik(); - virtual void fieldforce_ad(); + void fieldforce_ik() override; + void fieldforce_ad() override; // virtual void fieldforce_peratom(); XXX: need to benchmark first. private: diff --git a/src/OPENMP/reaxff_bond_orders_omp.cpp b/src/OPENMP/reaxff_bond_orders_omp.cpp index 2fe68280d1..38901807c2 100644 --- a/src/OPENMP/reaxff_bond_orders_omp.cpp +++ b/src/OPENMP/reaxff_bond_orders_omp.cpp @@ -28,7 +28,6 @@ #include "reaxff_omp.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/reaxff_bonds_omp.cpp b/src/OPENMP/reaxff_bonds_omp.cpp index 1a97f2a6af..41fb7a822a 100644 --- a/src/OPENMP/reaxff_bonds_omp.cpp +++ b/src/OPENMP/reaxff_bonds_omp.cpp @@ -27,7 +27,6 @@ #include "reaxff_omp.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/reaxff_forces_omp.cpp b/src/OPENMP/reaxff_forces_omp.cpp index 77106a5e44..3cb938213f 100644 --- a/src/OPENMP/reaxff_forces_omp.cpp +++ b/src/OPENMP/reaxff_forces_omp.cpp @@ -30,7 +30,6 @@ #include "reaxff_omp.h" #include "error.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp b/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp index 64bbbf56b1..e8db77389f 100644 --- a/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp +++ b/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp @@ -29,7 +29,6 @@ #include "reaxff_omp.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/reaxff_init_md_omp.cpp b/src/OPENMP/reaxff_init_md_omp.cpp index a0100e648a..c1f6504c6e 100644 --- a/src/OPENMP/reaxff_init_md_omp.cpp +++ b/src/OPENMP/reaxff_init_md_omp.cpp @@ -29,8 +29,6 @@ #include "reaxff_omp.h" #include "reaxff_api.h" -#include "error.h" - #include #include diff --git a/src/OPENMP/reaxff_multi_body_omp.cpp b/src/OPENMP/reaxff_multi_body_omp.cpp index 17b93d7487..25fcb6a0cf 100644 --- a/src/OPENMP/reaxff_multi_body_omp.cpp +++ b/src/OPENMP/reaxff_multi_body_omp.cpp @@ -29,7 +29,6 @@ #include "reaxff_omp.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/reaxff_torsion_angles_omp.cpp b/src/OPENMP/reaxff_torsion_angles_omp.cpp index 648603b143..3b730e26d4 100644 --- a/src/OPENMP/reaxff_torsion_angles_omp.cpp +++ b/src/OPENMP/reaxff_torsion_angles_omp.cpp @@ -29,7 +29,6 @@ #include "reaxff_omp.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/reaxff_valence_angles_omp.cpp b/src/OPENMP/reaxff_valence_angles_omp.cpp index 423b6336df..c7c3ef6323 100644 --- a/src/OPENMP/reaxff_valence_angles_omp.cpp +++ b/src/OPENMP/reaxff_valence_angles_omp.cpp @@ -30,7 +30,6 @@ #include "reaxff_omp.h" #include "error.h" -#include "fix_omp.h" #include "pair_reaxff_omp.h" #include "reaxff_api.h" diff --git a/src/OPENMP/respa_omp.h b/src/OPENMP/respa_omp.h index 9d20ec23cb..5e6af71102 100644 --- a/src/OPENMP/respa_omp.h +++ b/src/OPENMP/respa_omp.h @@ -28,13 +28,13 @@ namespace LAMMPS_NS { class RespaOMP : public Respa, public ThrOMP { public: RespaOMP(class LAMMPS *, int, char **); - virtual ~RespaOMP() {} - virtual void init(); - virtual void setup(int); - virtual void setup_minimal(int); + + void init() override; + void setup(int) override; + void setup_minimal(int) override; protected: - virtual void recurse(int); + void recurse(int) override; }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_eam_alloy_opt.h b/src/OPT/pair_eam_alloy_opt.h index 7da08bfecb..b83ddc235b 100644 --- a/src/OPT/pair_eam_alloy_opt.h +++ b/src/OPT/pair_eam_alloy_opt.h @@ -28,7 +28,6 @@ namespace LAMMPS_NS { class PairEAMAlloyOpt : public PairEAMAlloy, public PairEAMOpt { public: PairEAMAlloyOpt(class LAMMPS *); - virtual ~PairEAMAlloyOpt() {} }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_eam_fs_opt.h b/src/OPT/pair_eam_fs_opt.h index 5349e25740..89cb54531c 100644 --- a/src/OPT/pair_eam_fs_opt.h +++ b/src/OPT/pair_eam_fs_opt.h @@ -28,7 +28,6 @@ namespace LAMMPS_NS { class PairEAMFSOpt : public PairEAMFS, public PairEAMOpt { public: PairEAMFSOpt(class LAMMPS *); - virtual ~PairEAMFSOpt() {} }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_eam_opt.h b/src/OPT/pair_eam_opt.h index 02af32b6a1..496439a3dc 100644 --- a/src/OPT/pair_eam_opt.h +++ b/src/OPT/pair_eam_opt.h @@ -29,8 +29,8 @@ namespace LAMMPS_NS { class PairEAMOpt : virtual public PairEAM { public: PairEAMOpt(class LAMMPS *); - virtual ~PairEAMOpt() {} - void compute(int, int); + + void compute(int, int) override; private: template void eval(); diff --git a/src/OPT/pair_lj_charmm_coul_long_opt.h b/src/OPT/pair_lj_charmm_coul_long_opt.h index b1f3a69069..0a652cfb93 100644 --- a/src/OPT/pair_lj_charmm_coul_long_opt.h +++ b/src/OPT/pair_lj_charmm_coul_long_opt.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairLJCharmmCoulLongOpt : public PairLJCharmmCoulLong { public: PairLJCharmmCoulLongOpt(class LAMMPS *); - void compute(int, int); + void compute(int, int) override; private: template void eval(); diff --git a/src/OPT/pair_lj_cut_coul_long_opt.h b/src/OPT/pair_lj_cut_coul_long_opt.h index 9b6fb077aa..e86f0fac05 100644 --- a/src/OPT/pair_lj_cut_coul_long_opt.h +++ b/src/OPT/pair_lj_cut_coul_long_opt.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairLJCutCoulLongOpt : public PairLJCutCoulLong { public: PairLJCutCoulLongOpt(class LAMMPS *); - virtual void compute(int, int); + void compute(int, int) override; protected: template void eval(); diff --git a/src/OPT/pair_lj_cut_opt.h b/src/OPT/pair_lj_cut_opt.h index 895ee64392..fb34efd99a 100644 --- a/src/OPT/pair_lj_cut_opt.h +++ b/src/OPT/pair_lj_cut_opt.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairLJCutOpt : public PairLJCut { public: PairLJCutOpt(class LAMMPS *); - void compute(int, int); + void compute(int, int) override; private: template void eval(); diff --git a/src/OPT/pair_lj_cut_tip4p_long_opt.h b/src/OPT/pair_lj_cut_tip4p_long_opt.h index dc82e077c0..a86fcd3298 100644 --- a/src/OPT/pair_lj_cut_tip4p_long_opt.h +++ b/src/OPT/pair_lj_cut_tip4p_long_opt.h @@ -27,10 +27,9 @@ namespace LAMMPS_NS { class PairLJCutTIP4PLongOpt : public PairLJCutTIP4PLong { public: PairLJCutTIP4PLongOpt(class LAMMPS *); - virtual ~PairLJCutTIP4PLongOpt(){}; - virtual void compute(int, int); - virtual double memory_usage(); + void compute(int, int) override; + double memory_usage() override; protected: template void eval(); diff --git a/src/OPT/pair_lj_long_coul_long_opt.h b/src/OPT/pair_lj_long_coul_long_opt.h index 47a10ef648..2ffcff23db 100644 --- a/src/OPT/pair_lj_long_coul_long_opt.h +++ b/src/OPT/pair_lj_long_coul_long_opt.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairLJLongCoulLongOpt : public PairLJLongCoulLong { public: PairLJLongCoulLongOpt(class LAMMPS *); - virtual void compute(int, int); - virtual void compute_outer(int, int); + void compute(int, int) override; + void compute_outer(int, int) override; protected: template void eval(); diff --git a/src/OPT/pair_ufm_opt.h b/src/OPT/pair_ufm_opt.h index c79cf0024e..06fd07dd02 100644 --- a/src/OPT/pair_ufm_opt.h +++ b/src/OPT/pair_ufm_opt.h @@ -33,7 +33,7 @@ namespace LAMMPS_NS { class PairUFMOpt : public PairUFM { public: PairUFMOpt(class LAMMPS *); - void compute(int, int); + void compute(int, int) override; private: template void eval(); diff --git a/src/ORIENT/fix_orient_bcc.h b/src/ORIENT/fix_orient_bcc.h index 7483cd457f..4a58ae0130 100644 --- a/src/ORIENT/fix_orient_bcc.h +++ b/src/ORIENT/fix_orient_bcc.h @@ -44,17 +44,17 @@ class FixOrientBCC : public Fix { }; FixOrientBCC(class LAMMPS *, int, char **); - ~FixOrientBCC(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_scalar(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~FixOrientBCC() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_scalar() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: int me; diff --git a/src/ORIENT/fix_orient_eco.h b/src/ORIENT/fix_orient_eco.h index d8e593a0ea..ca9fa31d7d 100644 --- a/src/ORIENT/fix_orient_eco.h +++ b/src/ORIENT/fix_orient_eco.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixOrientECO : public Fix { public: FixOrientECO(class LAMMPS *, int, char **); - ~FixOrientECO(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_scalar(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~FixOrientECO() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_scalar() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: struct Nbr; // forward declaration. private struct for managing precomputed terms diff --git a/src/ORIENT/fix_orient_fcc.h b/src/ORIENT/fix_orient_fcc.h index 0c4c2433e5..a38c57daa1 100644 --- a/src/ORIENT/fix_orient_fcc.h +++ b/src/ORIENT/fix_orient_fcc.h @@ -44,17 +44,17 @@ class FixOrientFCC : public Fix { }; FixOrientFCC(class LAMMPS *, int, char **); - ~FixOrientFCC(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - double compute_scalar(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~FixOrientFCC() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_scalar() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: int me; diff --git a/src/PERI/atom_vec_peri.h b/src/PERI/atom_vec_peri.h index 10c68bbb41..0d37138b36 100644 --- a/src/PERI/atom_vec_peri.h +++ b/src/PERI/atom_vec_peri.h @@ -28,11 +28,11 @@ class AtomVecPeri : public AtomVec { public: AtomVecPeri(class LAMMPS *); - void grow_pointers(); - void create_atom_post(int); - void data_atom_post(int); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + void grow_pointers() override; + void create_atom_post(int) override; + void data_atom_post(int) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; private: double *rmass, *vfrac, *s0; diff --git a/src/PERI/compute_damage_atom.cpp b/src/PERI/compute_damage_atom.cpp index 6349d324b2..80aff909ae 100644 --- a/src/PERI/compute_damage_atom.cpp +++ b/src/PERI/compute_damage_atom.cpp @@ -26,8 +26,6 @@ #include "modify.h" #include "update.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_damage_atom.h b/src/PERI/compute_damage_atom.h index 43b28c3794..3195977101 100644 --- a/src/PERI/compute_damage_atom.h +++ b/src/PERI/compute_damage_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeDamageAtom : public Compute { public: ComputeDamageAtom(class LAMMPS *, int, char **); - ~ComputeDamageAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeDamageAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index fe78bc76bf..7bf2679443 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -27,8 +27,6 @@ #include "pair.h" #include "update.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_dilatation_atom.h b/src/PERI/compute_dilatation_atom.h index 476634753d..b035c79255 100644 --- a/src/PERI/compute_dilatation_atom.h +++ b/src/PERI/compute_dilatation_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeDilatationAtom : public Compute { public: ComputeDilatationAtom(class LAMMPS *, int, char **); - ~ComputeDilatationAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeDilatationAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/PERI/compute_plasticity_atom.cpp b/src/PERI/compute_plasticity_atom.cpp index 11ecdfb7ec..e22c8765b4 100644 --- a/src/PERI/compute_plasticity_atom.cpp +++ b/src/PERI/compute_plasticity_atom.cpp @@ -27,8 +27,6 @@ #include "modify.h" #include "update.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_plasticity_atom.h b/src/PERI/compute_plasticity_atom.h index cbb1182dee..ba0e04a48c 100644 --- a/src/PERI/compute_plasticity_atom.h +++ b/src/PERI/compute_plasticity_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputePlasticityAtom : public Compute { public: ComputePlasticityAtom(class LAMMPS *, int, char **); - ~ComputePlasticityAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputePlasticityAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/PERI/fix_peri_neigh.h b/src/PERI/fix_peri_neigh.h index bde8f3f2da..1ead6a0f97 100644 --- a/src/PERI/fix_peri_neigh.h +++ b/src/PERI/fix_peri_neigh.h @@ -37,26 +37,26 @@ class FixPeriNeigh : public Fix { public: FixPeriNeigh(class LAMMPS *, int, char **); - virtual ~FixPeriNeigh(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup(int); - void min_setup(int); + ~FixPeriNeigh() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void min_setup(int) override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void write_restart(FILE *); - void restart(char *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void write_restart(FILE *) override; + void restart(char *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: int first; // flag for first time initialization diff --git a/src/PERI/pair_peri.cpp b/src/PERI/pair_peri.cpp index 44c83661c9..a13b6adad1 100644 --- a/src/PERI/pair_peri.cpp +++ b/src/PERI/pair_peri.cpp @@ -20,7 +20,6 @@ #include "lattice.h" #include "memory.h" #include "modify.h" -#include "neigh_request.h" #include "neighbor.h" #include diff --git a/src/PERI/pair_peri.h b/src/PERI/pair_peri.h index f3b41de4f5..14c93aa14a 100644 --- a/src/PERI/pair_peri.h +++ b/src/PERI/pair_peri.h @@ -22,13 +22,13 @@ namespace LAMMPS_NS { class PairPeri : public Pair { public: PairPeri(class LAMMPS *); - virtual ~PairPeri(); + ~PairPeri() override; - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; - virtual void init_style(); - virtual void settings(int, char **); + void init_style() override; + void settings(int, char **) override; static constexpr double NEAR_ZERO = 2.2204e-16; double influence_function(const double &xi_x, const double &xi_y, const double &xi_z) const @@ -38,8 +38,8 @@ class PairPeri : public Pair { } void compute_dilatation(int, int); - double memory_usage(); - virtual void *extract(const char *, int &); + double memory_usage() override; + void *extract(const char *, int &) override; protected: class FixPeriNeigh *fix_peri_neigh; diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 8d1aa9b49f..175adadb47 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -28,7 +28,6 @@ #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neighbor.h" diff --git a/src/PERI/pair_peri_eps.h b/src/PERI/pair_peri_eps.h index 5d9a437ac8..b135537d97 100644 --- a/src/PERI/pair_peri_eps.h +++ b/src/PERI/pair_peri_eps.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class PairPeriEPS : public PairPeri { public: PairPeriEPS(class LAMMPS *); - virtual ~PairPeriEPS() = default; - virtual void compute(int, int); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *) {} - void read_restart_settings(FILE *) {} + void compute(int, int) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override {} + void read_restart_settings(FILE *) override {} double compute_DeviatoricForceStateNorm(int); }; diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index f7c024983b..c0136ff586 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -27,7 +27,6 @@ #include "lattice.h" #include "math_const.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neighbor.h" diff --git a/src/PERI/pair_peri_lps.h b/src/PERI/pair_peri_lps.h index 0d9132f612..13afdef06c 100644 --- a/src/PERI/pair_peri_lps.h +++ b/src/PERI/pair_peri_lps.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class PairPeriLPS : public PairPeri { public: PairPeriLPS(class LAMMPS *); - virtual ~PairPeriLPS() = default; - virtual void compute(int, int); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *) {} - void read_restart_settings(FILE *) {} + void compute(int, int) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override {} + void read_restart_settings(FILE *) override {} }; } // namespace LAMMPS_NS diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 0f88f0d80a..8743600d6e 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -26,9 +26,7 @@ #include "force.h" #include "lattice.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" -#include "neighbor.h" #include #include diff --git a/src/PERI/pair_peri_pmb.h b/src/PERI/pair_peri_pmb.h index 44a46093de..a028c43aa3 100644 --- a/src/PERI/pair_peri_pmb.h +++ b/src/PERI/pair_peri_pmb.h @@ -27,18 +27,17 @@ namespace LAMMPS_NS { class PairPeriPMB : public PairPeri { public: PairPeriPMB(class LAMMPS *); - virtual ~PairPeriPMB() = default; - virtual void compute(int, int); - void coeff(int, char **); - double init_one(int, int); + void compute(int, int) override; + void coeff(int, char **) override; + double init_one(int, int) override; - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *) {} - void read_restart_settings(FILE *) {} + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override {} + void read_restart_settings(FILE *) override {} - double single(int, int, int, int, double, double, double, double &); + double single(int, int, int, int, double, double, double, double &) override; }; } // namespace LAMMPS_NS diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index 522d05e04f..f0ae16899d 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -26,7 +26,6 @@ #include "force.h" #include "lattice.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neighbor.h" #include "update.h" diff --git a/src/PERI/pair_peri_ves.h b/src/PERI/pair_peri_ves.h index e80c5e3383..330ee7ef02 100644 --- a/src/PERI/pair_peri_ves.h +++ b/src/PERI/pair_peri_ves.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class PairPeriVES : public PairPeri { public: PairPeriVES(class LAMMPS *); - virtual ~PairPeriVES() = default; - virtual void compute(int, int); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *) {} - void read_restart_settings(FILE *) {} + void compute(int, int) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override {} + void read_restart_settings(FILE *) override {} }; } // namespace LAMMPS_NS diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index e236e24a15..57b82fbe64 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -10,11 +10,11 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. - ----------------------------------------------------------------------- */ +------------------------------------------------------------------------- */ -// -// Created by charlie sievers on 6/21/18. -// +/* ---------------------------------------------------------------------- + Contributing author: Charlie Sievers (UC Davis), charliesievers at cox.net +------------------------------------------------------------------------- */ #include "dynamical_matrix.h" @@ -48,14 +48,14 @@ enum{REGULAR,ESKM}; DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Command(lmp), fp(nullptr) { - external_force_clear = 1; + external_force_clear = 0; } /* ---------------------------------------------------------------------- */ DynamicalMatrix::~DynamicalMatrix() { - if (fp && me == 0) { + if (fp && comm->me == 0) { if (compressed) platform::pclose(fp); else fclose(fp); memory->destroy(groupmap); @@ -71,111 +71,120 @@ DynamicalMatrix::~DynamicalMatrix() void DynamicalMatrix::setup() { - // setup domain, communication and neighboring - // acquire ghosts - // build neighbor lists - if (triclinic) domain->x2lamda(atom->nlocal); - domain->pbc(); - domain->reset_box(); - comm->setup(); - if (neighbor->style) neighbor->setup_bins(); - comm->exchange(); - comm->borders(); - if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); - domain->image_check(); - domain->box_too_small_check(); - neighbor->build(1); + // setup domain, communication and neighboring + // acquire ghosts + // build neighbor lists + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + if (neighbor->style) neighbor->setup_bins(); + comm->exchange(); + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + domain->image_check(); + domain->box_too_small_check(); + neighbor->build(1); - // compute all forces - external_force_clear = 0; - eflag=0; - vflag=0; - update_force(); + // compute all forces + eflag=0; + vflag=0; + if (force->kspace) { + force->kspace->setup(); + } + update_force(); - //if all then skip communication groupmap population - if (gcount == atom->natoms) - for (bigint i=0; inatoms; i++) - groupmap[i] = i; - else - create_groupmap(); + + update->setupflag = 0; + + //if all then skip communication groupmap population + if (gcount == atom->natoms) + for (bigint i=0; inatoms; i++) + groupmap[i] = i; + else + create_groupmap(); } /* ---------------------------------------------------------------------- */ void DynamicalMatrix::command(int narg, char **arg) { - MPI_Comm_rank(world,&me); + MPI_Comm_rank(world,&me); - if (domain->box_exist == 0) - error->all(FLERR,"Dynamical_matrix command before simulation box is defined"); - if (narg < 2) error->all(FLERR,"Illegal dynamical_matrix command"); + if (domain->box_exist == 0) + error->all(FLERR,"Dynamical_matrix command before simulation box is defined"); + if (narg < 2) error->all(FLERR,"Illegal dynamical_matrix command"); - lmp->init(); + lmp->init(); - // orthogonal vs triclinic simulation box + // orthogonal vs triclinic simulation box - triclinic = domain->triclinic; + triclinic = domain->triclinic; - if (force->pair && force->pair->compute_flag) pair_compute_flag = 1; - else pair_compute_flag = 0; - if (force->kspace && force->kspace->compute_flag) kspace_compute_flag = 1; - else kspace_compute_flag = 0; + if (force->pair && force->pair->compute_flag) pair_compute_flag = 1; + else pair_compute_flag = 0; + if (force->kspace && force->kspace->compute_flag) kspace_compute_flag = 1; + else kspace_compute_flag = 0; - // group and style + // group and style - igroup = group->find(arg[0]); - if (igroup == -1) error->all(FLERR,"Could not find dynamical matrix group ID"); - groupbit = group->bitmask[igroup]; - gcount = group->count(igroup); - dynlen = (gcount)*3; - memory->create(groupmap,atom->natoms,"total_group_map:totalgm"); - update->setupflag = 1; + igroup = group->find(arg[0]); + if (igroup == -1) error->all(FLERR,"Could not find dynamical matrix group ID"); + groupbit = group->bitmask[igroup]; + gcount = group->count(igroup); + dynlen = (gcount)*3; + memory->create(groupmap,atom->natoms,"total_group_map:totalgm"); + update->setupflag = 1; - int style = -1; - if (strcmp(arg[1],"regular") == 0) style = REGULAR; - else if (strcmp(arg[1],"eskm") == 0) style = ESKM; - else error->all(FLERR,"Illegal Dynamical Matrix command"); - del = utils::numeric(FLERR, arg[2],false,lmp); + int style = -1; + if (strcmp(arg[1],"regular") == 0) style = REGULAR; + else if (strcmp(arg[1],"eskm") == 0) style = ESKM; + else error->all(FLERR,"Illegal Dynamical_matrix command"); + del = utils::numeric(FLERR, arg[2],false,lmp); - // set option defaults + // set option defaults - binaryflag = 0; - scaleflag = 0; - compressed = 0; - file_flag = 0; - file_opened = 0; - conversion = 1; + binaryflag = 0; + scaleflag = 0; + compressed = 0; + file_flag = 0; + file_opened = 0; + folded = 0; + conversion = 1; - // read options from end of input line - if (style == REGULAR) options(narg-3,&arg[3]); //COME BACK - else if (style == ESKM) options(narg-3,&arg[3]); //COME BACK - else if (comm->me == 0 && screen) fprintf(screen,"Illegal Dynamical Matrix command\n"); + // read options from end of input line + if (style == REGULAR) options(narg-3,&arg[3]); + else if (style == ESKM) options(narg-3,&arg[3]); + else if (me == 0 && screen) fprintf(screen,"Illegal Dynamical Matrix command\n"); - if (atom->map_style == Atom::MAP_NONE) - error->all(FLERR,"Dynamical_matrix command requires an atom map, see atom_modify"); + if (!folded) dynlenb = dynlen; + else dynlenb = (atom->natoms)*3; - // move atoms by 3-vector or specified variable(s) + if (atom->map_style == Atom::MAP_NONE) + error->all(FLERR,"Dynamical_matrix command requires an atom map"); - if (style == REGULAR) { - setup(); - timer->init(); - timer->barrier_start(); - calculateMatrix(); - timer->barrier_stop(); - } + // move atoms by 3-vector or specified variable(s) - if (style == ESKM) { - setup(); - convert_units(update->unit_style); - conversion = conv_energy/conv_distance/conv_mass; - timer->init(); - timer->barrier_start(); - calculateMatrix(); - timer->barrier_stop(); - } + if (style == REGULAR) { + setup(); + timer->init(); + timer->barrier_start(); + calculateMatrix(); + timer->barrier_stop(); + } - Finish finish(lmp); - finish.end(1); + if (style == ESKM) { + setup(); + convert_units(update->unit_style); + conversion = conv_energy/conv_distance/conv_mass; + timer->init(); + timer->barrier_start(); + calculateMatrix(); + timer->barrier_stop(); + } + + Finish finish(lmp); + finish.end(1); } /* ---------------------------------------------------------------------- @@ -192,9 +201,9 @@ void DynamicalMatrix::options(int narg, char **arg) if (strcmp(arg[iarg],"binary") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal dynamical_matrix command"); if (strcmp(arg[iarg+1],"gzip") == 0) { - compressed = 1; + compressed = 1; } else { - binaryflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + binaryflag = utils::logical(FLERR,arg[iarg+1],false,lmp); } iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { @@ -202,6 +211,14 @@ void DynamicalMatrix::options(int narg, char **arg) filename = arg[iarg + 1]; file_flag = 1; iarg += 2; + } else if (strcmp(arg[iarg],"fold") == 0) { + if (iarg+2 > narg) error->all(FLERR, "Illegal dynamical_matrix command"); + if (strcmp(arg[iarg+1],"yes") == 0) { + folded = 1; + } else if (strcmp(arg[iarg+1],"no") == 0) { + folded = 0; + } else error->all(FLERR,"Illegal input for dynamical_matrix fold option"); + iarg += 2; } else error->all(FLERR,"Illegal dynamical_matrix command"); } if (file_flag == 1) { @@ -217,23 +234,23 @@ void DynamicalMatrix::options(int narg, char **arg) void DynamicalMatrix::openfile(const char *filename) { - // if file already opened, return - if (file_opened) return; - fp = nullptr; + // if file already opened, return + if (file_opened) return; + fp = nullptr; - if (me == 0) { - if (compressed) { - fp = platform::compressed_write(std::string(filename)+".gz"); - if (!fp) error->one(FLERR,"Cannot open compressed file"); - } else if (binaryflag) { - fp = fopen(filename,"wb"); - } else { - fp = fopen(filename,"w"); - } - if (!fp) error->one(FLERR,"Cannot open dynmat file: {}", utils::getsyserror()); + if (me == 0) { + if (compressed) { + fp = platform::compressed_write(std::string(filename)+".gz"); + if (!fp) error->one(FLERR,"Cannot open compressed file"); + } else if (binaryflag) { + fp = fopen(filename,"wb"); + } else { + fp = fopen(filename,"w"); } + if (!fp) error->one(FLERR,"Cannot open dynmat file: {}", utils::getsyserror()); + } - file_opened = 1; + file_opened = 1; } /* ---------------------------------------------------------------------- @@ -242,98 +259,113 @@ void DynamicalMatrix::openfile(const char *filename) void DynamicalMatrix::calculateMatrix() { - int local_idx; // local index - int local_jdx; // second local index - int nlocal = atom->nlocal; - bigint natoms = atom->natoms; - int *type = atom->type; - bigint *gm = groupmap; - double imass; // dynamical matrix element - double *m = atom->mass; - double **f = atom->f; + int local_idx; // local index + int local_jdx; // second local index + int nlocal = atom->nlocal; + bigint natoms = atom->natoms; + int *type = atom->type; + bigint *gm = groupmap; + double imass; // dynamical matrix element + double *m = atom->mass; + double **f = atom->f; - double **dynmat = new double*[3]; - for (int i=0; i<3; i++) - dynmat[i] = new double[dynlen]; + double **dynmat = new double*[3]; + for (int i=0; i<3; i++) + dynmat[i] = new double[dynlenb]; - double **fdynmat = new double*[3]; - for (int i=0; i<3; i++) - fdynmat[i] = new double[dynlen]; + double **fdynmat = new double*[3]; + for (int i=0; i<3; i++) + fdynmat[i] = new double[dynlenb]; - //initialize dynmat to all zeros + //initialize dynmat to all zeros + dynmat_clear(dynmat); + + if (me == 0 && screen) { + fputs("Calculating Dynamical Matrix ...\n", screen); + fmt::print(screen," Total # of atoms = {}\n" + " Atoms in group = {}\n" + " Total dynamical matrix elements = {}\n", + natoms, gcount, dynlen*dynlen); + } + + // emit dynlen rows of dimalpha*dynlen*dimbeta elements + + update->nsteps = 0; + int prog = 0; + for (bigint i=1; i<=natoms; i++) { + local_idx = atom->map(i); + if (gm[i-1] < 0) + continue; + for (int alpha=0; alpha<3; alpha++) { + displace_atom(local_idx, alpha, 1); + update_force(); + for (bigint j=1; j<=natoms; j++) { + local_jdx = atom->map(j); + if (local_idx >= 0 && local_jdx >= 0 && local_jdx < nlocal + && (gm[j-1] >= 0 || folded)){ + if (folded) { + for (int beta=0; beta<3; beta++){ + dynmat[alpha][(j-1)*3+beta] -= f[local_jdx][beta]; + } + } else { + for (int beta=0; beta<3; beta++){ + dynmat[alpha][gm[j-1]*3+beta] -= f[local_jdx][beta]; + } + } + } + } + displace_atom(local_idx,alpha,-2); + update_force(); + for (bigint j=1; j<=natoms; j++) { + local_jdx = atom->map(j); + if (local_idx >= 0 && local_jdx >= 0 && local_jdx < nlocal + && (gm[j-1] >= 0 || folded)){ + if (atom->rmass_flag == 1) + imass = sqrt(m[local_idx] * m[local_jdx]); + else + imass = sqrt(m[type[local_idx]] * m[type[local_jdx]]); + if (folded){ + for (int beta=0; beta<3; beta++){ + dynmat[alpha][(j-1)*3+beta] -= -f[local_jdx][beta]; + dynmat[alpha][(j-1)*3+beta] /= (2 * del * imass); + dynmat[alpha][(j-1)*3+beta] *= conversion; + } + } else { + for (int beta=0; beta<3; beta++){ + dynmat[alpha][gm[j-1]*3+beta] -= -f[local_jdx][beta]; + dynmat[alpha][gm[j-1]*3+beta] /= (2 * del * imass); + dynmat[alpha][gm[j-1]*3+beta] *= conversion; + } + } + } + } + displace_atom(local_idx,alpha,1); + } + for (int k=0; k<3; k++) + MPI_Reduce(dynmat[k],fdynmat[k],dynlenb,MPI_DOUBLE,MPI_SUM,0,world); + if (me == 0) + writeMatrix(fdynmat); dynmat_clear(dynmat); - - if (comm->me == 0 && screen) { - fprintf(screen,"Calculating Dynamical Matrix ...\n"); - fprintf(screen," Total # of atoms = " BIGINT_FORMAT "\n", natoms); - fprintf(screen," Atoms in group = " BIGINT_FORMAT "\n", gcount); - fprintf(screen," Total dynamical matrix elements = " BIGINT_FORMAT "\n", (dynlen*dynlen) ); + if (me == 0 && screen) { + int p = 10 * gm[i-1] / gcount; + if (p > prog) { + prog = p; + fprintf(screen," %d%%",p*10); + fflush(screen); + } } + } + if (me == 0 && screen) fprintf(screen,"\n"); - // emit dynlen rows of dimalpha*dynlen*dimbeta elements + for (int i=0; i < 3; i++) + delete [] dynmat[i]; + delete [] dynmat; - update->nsteps = 0; - int prog = 0; - for (bigint i=1; i<=natoms; i++) { - local_idx = atom->map(i); - if (gm[i-1] < 0) - continue; - for (int alpha=0; alpha<3; alpha++) { - displace_atom(local_idx, alpha, 1); - update_force(); - for (bigint j=1; j<=natoms; j++) { - local_jdx = atom->map(j); - if (local_idx >= 0 && local_jdx >= 0 && local_jdx < nlocal - && gm[j-1] >= 0) { - for (int beta=0; beta<3; beta++) { - dynmat[alpha][gm[j-1]*3+beta] -= f[local_jdx][beta]; - } - } - } - displace_atom(local_idx,alpha,-2); - update_force(); - for (bigint j=1; j<=natoms; j++) { - local_jdx = atom->map(j); - if (local_idx >= 0 && local_jdx >= 0 && local_jdx < nlocal - && gm[j-1] >= 0) { - for (int beta=0; beta<3; beta++) { - if (atom->rmass_flag == 1) - imass = sqrt(m[local_idx] * m[local_jdx]); - else - imass = sqrt(m[type[local_idx]] * m[type[local_jdx]]); - dynmat[alpha][gm[j-1]*3+beta] -= -f[local_jdx][beta]; - dynmat[alpha][gm[j-1]*3+beta] /= (2 * del * imass); - dynmat[alpha][gm[j-1]*3+beta] *= conversion; - } - } - } - displace_atom(local_idx,alpha,1); - } - for (int k=0; k<3; k++) - MPI_Reduce(dynmat[k],fdynmat[k],dynlen,MPI_DOUBLE,MPI_SUM,0,world); - if (me == 0) - writeMatrix(fdynmat); - dynmat_clear(dynmat); - if (comm->me == 0 && screen) { - int p = 10 * gm[i-1] / gcount; - if (p > prog) { - prog = p; - fprintf(screen," %d%%",p*10); - fflush(screen); - } - } - } - if (comm->me == 0 && screen) fprintf(screen,"\n"); + for (int i=0; i < 3; i++) + delete [] fdynmat[i]; + delete [] fdynmat; - for (int i=0; i < 3; i++) - delete [] dynmat[i]; - delete [] dynmat; - - for (int i=0; i < 3; i++) - delete [] fdynmat[i]; - delete [] fdynmat; - - if (screen && me ==0 ) fprintf(screen,"Finished Calculating Dynamical Matrix\n"); + if (screen && me ==0 ) fprintf(screen,"Finished Calculating Dynamical Matrix\n"); } /* ---------------------------------------------------------------------- @@ -342,25 +374,25 @@ void DynamicalMatrix::calculateMatrix() void DynamicalMatrix::writeMatrix(double **dynmat) { - if (me != 0 || !fp) - return; + if (me != 0 || !fp) + return; - clearerr(fp); - if (binaryflag) { - for (int i=0; i<3; i++) - fwrite(dynmat[i], sizeof(double), dynlen, fp); - if (ferror(fp)) - error->one(FLERR, "Error writing to binary file"); - } else { - for (int i = 0; i < 3; i++) { - for (bigint j = 0; j < dynlen; j++) { - if ((j+1)%3==0) fprintf(fp, "%4.8f\n", dynmat[i][j]); - else fprintf(fp, "%4.8f ",dynmat[i][j]); - } - } - if (ferror(fp)) - error->one(FLERR,"Error writing to file"); + clearerr(fp); + if (binaryflag) { + for (int i=0; i<3; i++) + fwrite(dynmat[i], sizeof(double), dynlenb, fp); + if (ferror(fp)) + error->one(FLERR, "Error writing to binary file"); + } else { + for (int i = 0; i < 3; i++) { + for (bigint j = 0; j < dynlenb; j++) { + if ((j+1)%3==0) fprintf(fp, "%4.8f\n", dynmat[i][j]); + else fprintf(fp, "%4.8f ",dynmat[i][j]); + } } + if (ferror(fp)) + error->one(FLERR,"Error writing to file"); + } } /* ---------------------------------------------------------------------- @@ -369,18 +401,18 @@ void DynamicalMatrix::writeMatrix(double **dynmat) void DynamicalMatrix::displace_atom(int local_idx, int direction, int magnitude) { - if (local_idx < 0) return; + if (local_idx < 0) return; - double **x = atom->x; - int *sametag = atom->sametag; - int j = local_idx; + double **x = atom->x; + int *sametag = atom->sametag; + int j = local_idx; - x[local_idx][direction] += del*magnitude; + x[local_idx][direction] += del*magnitude; - while (sametag[j] >= 0) { - j = sametag[j]; - x[j][direction] += del*magnitude; - } + while (sametag[j] >= 0) { + j = sametag[j]; + x[j][direction] += del*magnitude; + } } @@ -394,35 +426,50 @@ void DynamicalMatrix::displace_atom(int local_idx, int direction, int magnitude) void DynamicalMatrix::update_force() { - force_clear(); - int n_post_force = modify->n_post_force; + neighbor->ago = 0; + if ((modify->get_fix_by_id("package_intel")) ? true : false) + neighbor->decide(); + force_clear(); + int n_pre_force = modify->n_pre_force; + int n_pre_reverse = modify->n_pre_reverse; + int n_post_force = modify->n_post_force; - if (pair_compute_flag) { - force->pair->compute(eflag,vflag); - timer->stamp(Timer::PAIR); - } - if (atom->molecular != Atom::ATOMIC) { - if (force->bond) force->bond->compute(eflag,vflag); - if (force->angle) force->angle->compute(eflag,vflag); - if (force->dihedral) force->dihedral->compute(eflag,vflag); - if (force->improper) force->improper->compute(eflag,vflag); - timer->stamp(Timer::BOND); - } - if (kspace_compute_flag) { - force->kspace->compute(eflag,vflag); - timer->stamp(Timer::KSPACE); - } - if (force->newton) { - comm->reverse_comm(); - timer->stamp(Timer::COMM); - } - - // force modifications - - if (n_post_force) modify->post_force(vflag); + if (n_pre_force) { + modify->pre_force(vflag); timer->stamp(Timer::MODIFY); + } - ++ update->nsteps; + if (pair_compute_flag) { + force->pair->compute(eflag,vflag); + timer->stamp(Timer::PAIR); + } + if (atom->molecular != Atom::ATOMIC) { + if (force->bond) force->bond->compute(eflag,vflag); + if (force->angle) force->angle->compute(eflag,vflag); + if (force->dihedral) force->dihedral->compute(eflag,vflag); + if (force->improper) force->improper->compute(eflag,vflag); + timer->stamp(Timer::BOND); + } + if (kspace_compute_flag) { + force->kspace->compute(eflag,vflag); + timer->stamp(Timer::KSPACE); + } + if (n_pre_reverse) { + modify->pre_reverse(eflag,vflag); + timer->stamp(Timer::MODIFY); + } + if (force->newton) { + comm->reverse_comm(); + timer->stamp(Timer::COMM); + } + // force modifications + + if (n_post_force) { + modify->post_force(vflag); + timer->stamp(Timer::MODIFY); + } + + ++ update->nsteps; } /* ---------------------------------------------------------------------- @@ -432,17 +479,17 @@ void DynamicalMatrix::update_force() void DynamicalMatrix::force_clear() { - if (external_force_clear) return; + if (external_force_clear) return; - // clear global force array - // if either newton flag is set, also include ghosts + // clear global force array + // if either newton flag is set, also include ghosts - size_t nbytes = sizeof(double) * atom->nlocal; - if (force->newton) nbytes += sizeof(double) * atom->nghost; + size_t nbytes = sizeof(double) * atom->nlocal; + if (force->newton) nbytes += sizeof(double) * atom->nghost; - if (nbytes) { - memset(&atom->f[0][0],0,3*nbytes); - } + if (nbytes) { + memset(&atom->f[0][0],0,3*nbytes); + } } /* ---------------------------------------------------------------------- @@ -451,67 +498,66 @@ void DynamicalMatrix::force_clear() void DynamicalMatrix::dynmat_clear(double **dynmat) { + size_t nbytes = sizeof(double) * dynlenb; - size_t nbytes = sizeof(double) * dynlen; - - if (nbytes) { - for (int i=0; i<3; i++) - memset(&dynmat[i][0],0,nbytes); - } + if (nbytes) { + for (int i=0; i<3; i++) + memset(&dynmat[i][0],0,nbytes); + } } /* ---------------------------------------------------------------------- */ void DynamicalMatrix::convert_units(const char *style) { - // physical constants from: - // https://physics.nist.gov/cuu/Constants/Table/allascii.txt - // using thermochemical calorie = 4.184 J + // physical constants from: + // https://physics.nist.gov/cuu/Constants/Table/allascii.txt + // using thermochemical calorie = 4.184 J - if (strcmp(style,"lj") == 0) { - error->all(FLERR,"Conversion Not Set"); - //conversion = 1; // lj -> 10 J/mol + if (strcmp(style,"lj") == 0) { + error->all(FLERR,"Conversion Not Set"); + //conversion = 1; // lj -> 10 J/mol - } else if (strcmp(style,"real") == 0) { - conv_energy = 418.4; // kcal/mol -> 10 J/mol - conv_mass = 1; // g/mol -> g/mol - conv_distance = 1; // angstrom -> angstrom + } else if (strcmp(style,"real") == 0) { + conv_energy = 418.4; // kcal/mol -> 10 J/mol + conv_mass = 1; // g/mol -> g/mol + conv_distance = 1; // angstrom -> angstrom - } else if (strcmp(style,"metal") == 0) { - conv_energy = 9648.5; // eV -> 10 J/mol - conv_mass = 1; // g/mol -> g/mol - conv_distance = 1; // angstrom -> angstrom + } else if (strcmp(style,"metal") == 0) { + conv_energy = 9648.5; // eV -> 10 J/mol + conv_mass = 1; // g/mol -> g/mol + conv_distance = 1; // angstrom -> angstrom - } else if (strcmp(style,"si") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); - conv_energy = 6.022E22; // J -> 10 J/mol - conv_mass = 6.022E26; // kg -> g/mol - conv_distance = 1E-10; // meter -> angstrom + } else if (strcmp(style,"si") == 0) { + if (me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); + conv_energy = 6.022E22; // J -> 10 J/mol + conv_mass = 6.022E26; // kg -> g/mol + conv_distance = 1E-10; // meter -> angstrom - } else if (strcmp(style,"cgs") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); - conv_energy = 6.022E12; // Erg -> 10 J/mol - conv_mass = 6.022E23; // g -> g/mol - conv_distance = 1E-7; // centimeter -> angstrom + } else if (strcmp(style,"cgs") == 0) { + if (me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); + conv_energy = 6.022E12; // Erg -> 10 J/mol + conv_mass = 6.022E23; // g -> g/mol + conv_distance = 1E-7; // centimeter -> angstrom - } else if (strcmp(style,"electron") == 0) { - conv_energy = 262550; // Hartree -> 10 J/mol - conv_mass = 1; // amu -> g/mol - conv_distance = 0.529177249; // bohr -> angstrom + } else if (strcmp(style,"electron") == 0) { + conv_energy = 262550; // Hartree -> 10 J/mol + conv_mass = 1; // amu -> g/mol + conv_distance = 0.529177249; // bohr -> angstrom - } else if (strcmp(style,"micro") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); - conv_energy = 6.022E10; // picogram-micrometer^2/microsecond^2 -> 10 J/mol - conv_mass = 6.022E11; // pg -> g/mol - conv_distance = 1E-4; // micrometer -> angstrom + } else if (strcmp(style,"micro") == 0) { + if (me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); + conv_energy = 6.022E10; // picogram-micrometer^2/microsecond^2 -> 10 J/mol + conv_mass = 6.022E11; // pg -> g/mol + conv_distance = 1E-4; // micrometer -> angstrom - } else if (strcmp(style,"nano") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); - conv_energy = 6.022E4; // attogram-nanometer^2/nanosecond^2 -> 10 J/mol - conv_mass = 6.022E5; // ag -> g/mol - conv_distance = 0.1; // angstrom -> angstrom + } else if (strcmp(style,"nano") == 0) { + if (me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); + conv_energy = 6.022E4; // attogram-nanometer^2/nanosecond^2 -> 10 J/mol + conv_mass = 6.022E5; // ag -> g/mol + conv_distance = 0.1; // angstrom -> angstrom - } else error->all(FLERR,"Units Type Conversion Not Found"); + } else error->all(FLERR,"Units Type Conversion Not Found"); } @@ -519,66 +565,66 @@ void DynamicalMatrix::convert_units(const char *style) void DynamicalMatrix::create_groupmap() { - //Create a group map which maps atom order onto group - // groupmap[global atom index-1] = output column/row + //Create a group map which maps atom order onto group + // groupmap[global atom index-1] = output column/row - int local_idx; // local index - int gid = 0; //group index - int nlocal = atom->nlocal; - int *mask = atom->mask; - bigint natoms = atom->natoms; - int *recv = new int[comm->nprocs]; - int *displs = new int[comm->nprocs]; - bigint *temp_groupmap = new bigint[natoms]; + int local_idx; // local index + int gid = 0; //group index + int nlocal = atom->nlocal; + int *mask = atom->mask; + bigint natoms = atom->natoms; + int *recv = new int[comm->nprocs]; + int *displs = new int[comm->nprocs]; + bigint *temp_groupmap = new bigint[natoms]; - //find number of local atoms in the group (final_gid) - for (bigint i=1; i<=natoms; i++) { - local_idx = atom->map(i); - if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) - gid += 1; // gid at the end of loop is final_Gid + //find number of local atoms in the group (final_gid) + for (bigint i=1; i<=natoms; i++) { + local_idx = atom->map(i); + if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) + gid += 1; // gid at the end of loop is final_Gid + } + //create an array of length final_gid + bigint *sub_groupmap = new bigint[gid]; + + gid = 0; + //create a map between global atom id and group atom id for each proc + for (bigint i=1; i<=natoms; i++) { + local_idx = atom->map(i); + if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) { + sub_groupmap[gid] = i; + gid += 1; } - //create an array of length final_gid - bigint *sub_groupmap = new bigint[gid]; + } - gid = 0; - //create a map between global atom id and group atom id for each proc - for (bigint i=1; i<=natoms; i++) { - local_idx = atom->map(i); - if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) { - sub_groupmap[gid] = i; - gid += 1; - } - } + //populate arrays for Allgatherv + for (int i=0; i < comm->nprocs; i++) { + recv[i] = 0; + } + recv[me] = gid; + MPI_Allreduce(recv,displs,comm->nprocs,MPI_INT,MPI_SUM,world); + for (int i=0; inprocs; i++) { + recv[i]=displs[i]; + if (i>0) displs[i] = displs[i-1]+recv[i-1]; + else displs[i] = 0; + } - //populate arrays for Allgatherv - for (int i=0; inprocs; i++) { - recv[i] = 0; - } - recv[comm->me] = gid; - MPI_Allreduce(recv,displs,comm->nprocs,MPI_INT,MPI_SUM,world); - for (int i=0; inprocs; i++) { - recv[i]=displs[i]; - if (i>0) displs[i] = displs[i-1]+recv[i-1]; - else displs[i] = 0; - } + //combine subgroup maps into total temporary groupmap + MPI_Allgatherv(sub_groupmap,gid,MPI_LMP_BIGINT,temp_groupmap,recv,displs,MPI_LMP_BIGINT,world); + std::sort(temp_groupmap,temp_groupmap+gcount); - //combine subgroup maps into total temporary groupmap - MPI_Allgatherv(sub_groupmap,gid,MPI_LMP_BIGINT,temp_groupmap,recv,displs,MPI_LMP_BIGINT,world); - std::sort(temp_groupmap,temp_groupmap+gcount); + //populate member groupmap based on temp groupmap + bigint j = 0; + for (bigint i=1; i<=natoms; i++) { + // flag groupmap contents that are in temp_groupmap + if (j < gcount && i == temp_groupmap[j]) + groupmap[i-1] = j++; + else + groupmap[i-1] = -1; + } - //populate member groupmap based on temp groupmap - bigint j = 0; - for (bigint i=1; i<=natoms; i++) { - // flag groupmap contents that are in temp_groupmap - if (j < gcount && i == temp_groupmap[j]) - groupmap[i-1] = j++; - else - groupmap[i-1] = -1; - } - - //free that memory! - delete[] recv; - delete[] displs; - delete[] sub_groupmap; - delete[] temp_groupmap; + //free that memory! + delete[] recv; + delete[] displs; + delete[] sub_groupmap; + delete[] temp_groupmap; } diff --git a/src/PHONON/dynamical_matrix.h b/src/PHONON/dynamical_matrix.h index cc70cd026e..4a08420381 100644 --- a/src/PHONON/dynamical_matrix.h +++ b/src/PHONON/dynamical_matrix.h @@ -18,8 +18,8 @@ namespace LAMMPS_NS { class DynamicalMatrix : public Command { public: DynamicalMatrix(class LAMMPS *); - virtual ~DynamicalMatrix(); - void command(int, char **); + ~DynamicalMatrix() override; + void command(int, char **) override; void setup(); protected: @@ -34,11 +34,10 @@ class DynamicalMatrix : public Command { int nvec; // local atomic dof = length of xvec - void update_force(); - void force_clear(); + virtual void update_force(); + virtual void force_clear(); virtual void openfile(const char *filename); - private: void options(int, char **); void calculateMatrix(); void dynmat_clear(double **dynmat); @@ -55,6 +54,7 @@ class DynamicalMatrix : public Command { int igroup, groupbit; bigint gcount; // number of atoms in group bigint dynlen; // rank of dynamical matrix + bigint dynlenb; // new dynlen if folded int scaleflag; int me; bigint *groupmap; @@ -63,6 +63,7 @@ class DynamicalMatrix : public Command { int binaryflag; // 1 if dump file is written binary, 0 no int file_opened; // 1 if openfile method has been called, 0 no int file_flag; // 1 custom file name, 0 dynmat.dat + int folded; // 1 folded, 0 nonfolded FILE *fp; }; diff --git a/src/PHONON/fix_phonon.h b/src/PHONON/fix_phonon.h index 0e3c251528..d61a9d2e03 100644 --- a/src/PHONON/fix_phonon.h +++ b/src/PHONON/fix_phonon.h @@ -49,15 +49,15 @@ namespace LAMMPS_NS { class FixPhonon : public Fix { public: FixPhonon(class LAMMPS *, int, char **); - ~FixPhonon(); + ~FixPhonon() override; - int setmask(); - void init(); - void setup(int); - void end_of_step(); - void post_run(); - double memory_usage(); - int modify_param(int, char **); + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + void post_run() override; + double memory_usage() override; + int modify_param(int, char **) override; private: int me, nprocs; diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index 3206882a4a..0f70a591d8 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -10,11 +10,11 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. - ----------------------------------------------------------------------- */ +------------------------------------------------------------------------- */ -// -// Created by charlie sievers on 7/5/18. -// +/* ---------------------------------------------------------------------- + Contributing author: Charlie Sievers (UC Davis), charliesievers at cox.net +------------------------------------------------------------------------- */ #include "third_order.h" @@ -32,6 +32,9 @@ #include "kspace.h" #include "math_special.h" #include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neigh_request.h" #include "neighbor.h" #include "pair.h" #include "timer.h" @@ -42,7 +45,7 @@ using namespace LAMMPS_NS; using namespace MathSpecial; -enum{REGULAR,BALLISTICO}; +enum{REGULAR,ESKM}; /* ---------------------------------------------------------------------- */ @@ -86,12 +89,22 @@ void ThirdOrder::setup() domain->box_too_small_check(); neighbor->build(1); + // build neighbor list this command needs based on earlier request + + neighbor->build_one(list); + // compute all forces external_force_clear = 0; eflag=0; vflag=0; + if (force->kspace) { + force->kspace->setup(); + } update_force(); + modify->setup(vflag); + update->setupflag = 0; + if (gcount == atom->natoms) for (bigint i=0; inatoms; i++) groupmap[i] = i; @@ -109,7 +122,18 @@ void ThirdOrder::command(int narg, char **arg) error->all(FLERR,"third_order command before simulation box is defined"); if (narg < 2) error->all(FLERR,"Illegal third_order command"); + // request a full neighbor list for use by this command + + int irequest = neighbor->request(this); + neighbor->requests[irequest]->pair = 0; + neighbor->requests[irequest]->command = 1; + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; + neighbor->requests[irequest]->occasional = 1; + neighbor->requests[irequest]->command_style = "third_order"; + lmp->init(); + list = neighbor->lists[irequest]; // orthogonal vs triclinic simulation box @@ -123,7 +147,7 @@ void ThirdOrder::command(int narg, char **arg) // group and style igroup = group->find(arg[0]); - if (igroup == -1) error->all(FLERR,"Could not find dynamical matrix group ID"); + if (igroup == -1) error->all(FLERR,"Could not find third_order group ID"); groupbit = group->bitmask[igroup]; gcount = group->count(igroup); dynlen = (gcount)*3; @@ -132,7 +156,7 @@ void ThirdOrder::command(int narg, char **arg) int style = -1; if (strcmp(arg[1],"regular") == 0) style = REGULAR; - else if (strcmp(arg[1],"eskm") == 0) style = BALLISTICO; + else if (strcmp(arg[1],"eskm") == 0) style = ESKM; else error->all(FLERR,"Illegal Dynamical Matrix command"); // set option defaults @@ -143,15 +167,23 @@ void ThirdOrder::command(int narg, char **arg) file_flag = 0; file_opened = 0; conversion = 1; + folded = 0; + + // set Neigborlist attributes to NULL + ijnum = NULL; + neighbortags = NULL; // read options from end of input line - if (style == REGULAR) options(narg-3,&arg[3]); //COME BACK - else if (style == BALLISTICO) options(narg-3,&arg[3]); //COME BACK - else if (comm->me == 0 && screen) fprintf(screen,"Illegal Dynamical Matrix command\n"); + if (style == REGULAR) options(narg-3,&arg[3]); + else if (style == ESKM) options(narg-3,&arg[3]); + else error->all(FLERR,"Illegal Third Order command"); del = utils::numeric(FLERR, arg[2],false,lmp); + if (!folded) dynlenb = dynlen; + else dynlenb = (atom->natoms)*3; + if (atom->map_style == Atom::MAP_NONE) - error->all(FLERR,"third_order command requires an atom map, see atom_modify"); + error->all(FLERR,"Third Order command requires an atom map, see atom_modify"); // move atoms by 3-vector or specified variable(s) @@ -163,7 +195,7 @@ void ThirdOrder::command(int narg, char **arg) timer->barrier_stop(); } - if (style == BALLISTICO) { + if (style == ESKM) { setup(); convert_units(update->unit_style); conversion = conv_energy/conv_distance/conv_distance; @@ -183,13 +215,13 @@ void ThirdOrder::command(int narg, char **arg) void ThirdOrder::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR,"Illegal third_order command"); + if (narg < 0) error->all(FLERR,"Illegal Third Order command"); int iarg = 0; - const char *filename = "third_order.dat"; + const char *filename = "Third Order.dat"; while (iarg < narg) { if (strcmp(arg[iarg],"binary") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal third_order command"); + if (iarg + 2 > narg) error->all(FLERR, "Illegal Third Order command"); if (strcmp(arg[iarg+1],"gzip") == 0) { compressed = 1; } else { @@ -201,7 +233,15 @@ void ThirdOrder::options(int narg, char **arg) filename = arg[iarg + 1]; file_flag = 1; iarg += 2; - } else error->all(FLERR,"Illegal third_order command"); + } else if (strcmp(arg[iarg],"fold") == 0) { + if (iarg+2 > narg) error->all(FLERR, "Illegal Third Order command"); + if (strcmp(arg[iarg+1],"yes") == 0) { + folded = 1; + } else if (strcmp(arg[iarg+1],"no") == 0) { + folded = 0; + } else error->all(FLERR,"Illegal input for Third Order fold option"); + iarg += 2; + } else error->all(FLERR,"Illegal Third Order command"); } if (file_flag == 1 && me == 0) { openfile(filename); @@ -231,11 +271,13 @@ void ThirdOrder::openfile(const char* filename) } if (!fp) error->one(FLERR,"Cannot open third_order file: {}", utils::getsyserror()); } + + file_opened = 1; } /* ---------------------------------------------------------------------- - create dynamical matrix + create third order tensor ------------------------------------------------------------------------- */ void ThirdOrder::calculateMatrix() @@ -247,28 +289,40 @@ void ThirdOrder::calculateMatrix() bigint natoms = atom->natoms; bigint *gm = groupmap; double **f = atom->f; + int inum; + bigint j; + bigint *firstneigh; - double *dynmat = new double[3*dynlen]; - double *fdynmat = new double[3*dynlen]; - memset(&dynmat[0],0,dynlen*sizeof(double)); - memset(&fdynmat[0],0,dynlen*sizeof(double)); + double *dynmat = new double[dynlenb]; + double *fdynmat = new double[dynlenb]; + memset(&dynmat[0],0,dynlenb*sizeof(double)); + memset(&fdynmat[0],0,dynlenb*sizeof(double)); + + getNeighbortags(); if (comm->me == 0 && screen) { - fprintf(screen,"Calculating Third Order ...\n"); - fprintf(screen," Total # of atoms = " BIGINT_FORMAT "\n", natoms); - fprintf(screen," Atoms in group = " BIGINT_FORMAT "\n", gcount); - fprintf(screen," Total third order elements = " - BIGINT_FORMAT "\n", (dynlen*dynlen*dynlen) ); + fputs("Calculating Third Order ...\n", screen); + fmt::print(screen," Total # of atoms = {}\n" + " Atoms in group = {}\n" + " Total third order elements = {}\n", + natoms, gcount, dynlen*dynlen*dynlen); } update->nsteps = 0; int prog = 0; - for (bigint i=1; i<=natoms; i++) { + for (bigint i=1; i<=natoms; i++){ + if (gm[i-1] < 0) + continue; + inum = ijnum[i-1]; + firstneigh = neighbortags[i-1]; local_idx = atom->map(i); - for (int alpha=0; alpha<3; alpha++) { - for (bigint j=1; j<=natoms; j++) { - local_jdx = atom->map(j); - for (int beta=0; beta<3; beta++) { + for (int alpha=0; alpha<3; alpha++){ + for (int jj=0; jjmap(j+1); + for (int beta=0; beta<3; beta++){ displace_atom(local_idx, alpha, 1); displace_atom(local_jdx, beta, 1); update_force(); @@ -276,9 +330,13 @@ void ThirdOrder::calculateMatrix() local_kdx = atom->map(k); for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 - && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 + && ((gm[j] >= 0 && gm[k-1] >= 0) || folded) && local_kdx < nlocal) { - dynmat[gm[k-1]*3+gamma] += f[local_kdx][gamma]; + if (folded) { + dynmat[(k-1)*3+gamma] += f[local_kdx][gamma]; + } else { + dynmat[gm[k-1]*3+gamma] += f[local_kdx][gamma]; + } } } } @@ -288,9 +346,13 @@ void ThirdOrder::calculateMatrix() local_kdx = atom->map(k); for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 - && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 + && ((gm[j] >= 0 && gm[k-1] >= 0) || folded) && local_kdx < nlocal) { - dynmat[gm[k-1]*3+gamma] -= f[local_kdx][gamma]; + if (folded) { + dynmat[(k-1)*3+gamma] -= f[local_kdx][gamma]; + } else { + dynmat[gm[k-1]*3+gamma] -= f[local_kdx][gamma]; + } } } } @@ -302,9 +364,13 @@ void ThirdOrder::calculateMatrix() local_kdx = atom->map(k); for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 - && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 + && ((gm[j] >= 0 && gm[k-1] >= 0) || folded) && local_kdx < nlocal) { - dynmat[gm[k-1]*3+gamma] -= f[local_kdx][gamma]; + if (folded) { + dynmat[(k-1)*3+gamma] -= f[local_kdx][gamma]; + } else { + dynmat[gm[k-1]*3+gamma] -= f[local_kdx][gamma]; + } } } } @@ -314,24 +380,33 @@ void ThirdOrder::calculateMatrix() local_kdx = atom->map(k); for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 - && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 + && ((gm[j] >= 0 && gm[k-1] >= 0) || folded) && local_kdx < nlocal) { - dynmat[gm[k-1]*3+gamma] += f[local_kdx][gamma]; - dynmat[gm[k-1]*3+gamma] /= (4 * del * del); + if (folded) { + dynmat[(k-1)*3+gamma] += f[local_kdx][gamma]; + dynmat[(k-1)*3+gamma] /= (4 * del * del); + } else { + dynmat[gm[k-1]*3+gamma] += f[local_kdx][gamma]; + dynmat[gm[k-1]*3+gamma] /= (4 * del * del); + } } } } displace_atom(local_jdx, beta, 1); displace_atom(local_idx, alpha, 1); - MPI_Reduce(dynmat,fdynmat,3*dynlen,MPI_DOUBLE,MPI_SUM,0,world); - if (me == 0) { - writeMatrix(fdynmat, gm[i-1], alpha, gm[j-1], beta); + MPI_Reduce(dynmat,fdynmat,dynlenb,MPI_DOUBLE,MPI_SUM,0,world); + if (me == 0){ + if (folded) { + writeMatrix(fdynmat, gm[i-1], alpha, j, beta); + } else { + writeMatrix(fdynmat, gm[i-1], alpha, gm[j], beta); + } } - memset(&dynmat[0],0,dynlen*sizeof(double)); + memset(&dynmat[0],0,dynlenb*sizeof(double)); } } } - if (comm->me == 0 && screen) { + if (me == 0 && screen) { int p = 10 * gm[i-1] / gcount; if (p > prog) { prog = p; @@ -344,12 +419,12 @@ void ThirdOrder::calculateMatrix() delete [] dynmat; delete [] fdynmat; - if (screen && me ==0 ) + if (screen && me ==0) fprintf(screen,"Finished Calculating Third Order Tensor\n"); } /* ---------------------------------------------------------------------- - write dynamical matrix + write third order tensor ------------------------------------------------------------------------- */ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) @@ -360,18 +435,22 @@ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) double norm; if (!binaryflag && fp) { clearerr(fp); - for (int k = 0; k < gcount; k++) { - norm = square(dynmat[k*3])+ - square(dynmat[k*3+1])+ - square(dynmat[k*3+2]); - if (norm > 1.0e-16) - fprintf(fp, - BIGINT_FORMAT " %d " BIGINT_FORMAT " %d " BIGINT_FORMAT - " %7.8f %7.8f %7.8f\n", - i+1, a + 1, j+1, b + 1, groupmap[k]+1, - dynmat[k*3] * conversion, - dynmat[k*3+1] * conversion, - dynmat[k*3+2] * conversion); + if (folded){ + for (int k = 0; k < atom->natoms; k++){ + norm = square(dynmat[k*3])+square(dynmat[k*3+1])+square(dynmat[k*3+2]); + if (norm > 1.0e-16) + fmt::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", + i+1, a+1, j+1, b+1, k+1, dynmat[k*3] * conversion, + dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); + } + } else { + for (int k = 0; k < gcount; k++){ + norm = square(dynmat[k*3])+square(dynmat[k*3+1])+square(dynmat[k*3+2]); + if (norm > 1.0e-16) + fmt::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", + i+1, a+1, j+1, b+1, groupmap[k]+1, dynmat[k*3] * conversion, + dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); + } } } else if (binaryflag && fp) { clearerr(fp); @@ -411,7 +490,18 @@ void ThirdOrder::displace_atom(int local_idx, int direction, int magnitude) void ThirdOrder::update_force() { + neighbor->ago = 0; + if ((modify->get_fix_by_id("package_intel")) ? true : false) + neighbor->decide(); force_clear(); + int n_post_force = modify->n_post_force; + int n_pre_force = modify->n_pre_force; + int n_pre_reverse = modify->n_pre_reverse; + + if (n_pre_force) { + modify->pre_force(vflag); + timer->stamp(Timer::MODIFY); + } if (pair_compute_flag) { force->pair->compute(eflag,vflag); @@ -428,10 +518,22 @@ void ThirdOrder::update_force() force->kspace->compute(eflag,vflag); timer->stamp(Timer::KSPACE); } + if (n_pre_reverse) { + modify->pre_reverse(eflag,vflag); + timer->stamp(Timer::MODIFY); + } if (force->newton) { comm->reverse_comm(); timer->stamp(Timer::COMM); } + + // force modifications + + if (n_post_force) { + modify->post_force(vflag); + timer->stamp(Timer::MODIFY); + } + ++ update->nsteps; } @@ -478,13 +580,13 @@ void ThirdOrder::convert_units(const char *style) conv_distance = 1; // angstrom -> angstrom } else if (strcmp(style,"si") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); + if (me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); conv_energy = 6.022E22; // J -> 10 J/mol conv_mass = 6.022E26; // kg -> g/mol conv_distance = 1E-10; // meter -> angstrom } else if (strcmp(style,"cgs") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); + if (me) error->warning(FLERR,"Conversion Warning: Multiplication by Large Float"); conv_energy = 6.022E12; // Erg -> 10 J/mol conv_mass = 6.022E23; // g -> g/mol conv_distance = 1E-7; // centimeter -> angstrom @@ -495,13 +597,13 @@ void ThirdOrder::convert_units(const char *style) conv_distance = 0.529177249; // bohr -> angstrom } else if (strcmp(style,"micro") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); + if (me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); conv_energy = 6.022E10; // picogram-micrometer^2/microsecond^2 -> 10 J/mol conv_mass = 6.022E11; // pg -> g/mol conv_distance = 1E-4; // micrometer -> angstrom } else if (strcmp(style,"nano") == 0) { - if (comm->me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); + if (me) error->warning(FLERR,"Conversion Warning: Untested Conversion"); conv_energy = 6.022E4; // attogram-nanometer^2/nanosecond^2 -> 10 J/mol conv_mass = 6.022E5; // ag -> g/mol conv_distance = 0.1; // angstrom -> angstrom @@ -550,7 +652,7 @@ void ThirdOrder::create_groupmap() for (int i=0; inprocs; i++) { recv[i] = 0; } - recv[comm->me] = gid; + recv[me] = gid; MPI_Allreduce(recv,displs,comm->nprocs,MPI_INT,MPI_SUM,world); for (int i=0; inprocs; i++) { recv[i]=displs[i]; @@ -559,8 +661,7 @@ void ThirdOrder::create_groupmap() } //combine subgroup maps into total temporary groupmap - MPI_Allgatherv(sub_groupmap,gid,MPI_LMP_BIGINT, - temp_groupmap,recv,displs,MPI_LMP_BIGINT,world); + MPI_Allgatherv(sub_groupmap,gid,MPI_LMP_BIGINT,temp_groupmap,recv,displs,MPI_LMP_BIGINT,world); std::sort(temp_groupmap,temp_groupmap+gcount); //populate member groupmap based on temp groupmap @@ -579,3 +680,144 @@ void ThirdOrder::create_groupmap() delete[] sub_groupmap; delete[] temp_groupmap; } + +/* ---------------------------------------------------------------------- */ + +void ThirdOrder::getNeighbortags() { + // Create an extended neighbor list which is indexed by atom tag and yields atom tags + // groupmap[global atom index-1] = global atom indices (-1) of extended neighbors + + bigint natoms = atom->natoms; + int *ilist,*jlist,*numneigh,**firstneigh; + bigint *Jlist,*klist; + int ii,jj,kk,inum,jnum,knum,sum; + int *temptags = (int*) malloc(natoms*sizeof(int)); + int *ijnumproc = (int*) malloc(natoms*sizeof(int)); + memory->create(ijnum, natoms, "thirdorder:ijnum"); + bigint **firsttags; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + memset(&ijnum[0],0,natoms*sizeof(int)); + for (ii = 0; ii < inum; ii++) { + sum = 0; + memset(&temptags[0],0,natoms*sizeof(int)); + jnum = numneigh[ii]; + jlist = firstneigh[ii]; + temptags[atom->tag[ilist[ii] & NEIGHMASK]-1] = 1; + for (jj = 0; jj < jnum; jj++) { + temptags[atom->tag[jlist[jj] & NEIGHMASK]-1] = 1; + } + for (bigint i=0; i<=natoms-1; i++) { + sum += temptags[i]; + } + ijnum[atom->tag[ilist[ii] & NEIGHMASK]-1] = sum; + } + MPI_Allreduce(ijnum,ijnumproc,natoms,MPI_INT,MPI_SUM,world); + memset(&ijnum[0],0,natoms*sizeof(int)); + sum = 0; + for (bigint i=0; i<=natoms-1; i++) { + sum += ijnumproc[i]; + } + + bigint nbytes = ((bigint) sizeof(bigint)) * sum; + bigint *data = (bigint *) memory->smalloc(nbytes, "thirdorder:firsttags"); + bigint *datarecv = (bigint *) memory->smalloc(nbytes, "thirdorder:neighbortags"); + nbytes = ((bigint) sizeof(bigint *)) * natoms; + firsttags = (bigint **) memory->smalloc(nbytes, "thirdorder:firsttags"); + neighbortags = (bigint **) memory->smalloc(nbytes, "thirdorder:neighbortags"); + memset(&data[0],0,sum*sizeof(bigint)); + memset(&datarecv[0],0,sum*sizeof(bigint)); + + bigint n = 0; + for (bigint i = 0; i < natoms; i++) { + firsttags[i] = &data[n]; + neighbortags[i] = &datarecv[n]; + n += ijnumproc[i]; + } + + for (ii = 0; ii < inum; ii++) { + int m = 0; + memset(&temptags[0],0,natoms*sizeof(int)); + jnum = numneigh[ii]; + jlist = firstneigh[ii]; + temptags[atom->tag[ilist[ii] & NEIGHMASK]-1] = 1; + for (jj = 0; jj < jnum; jj++) { + temptags[atom->tag[jlist[jj] & NEIGHMASK]-1] = 1; + } + for (int j=0; j < natoms; j++) { + if (temptags[j] == 1) { + neighbortags[atom->tag[ilist[ii] & NEIGHMASK]-1][m] = j; + m += 1; + } + } + } + MPI_Allreduce(datarecv,data,sum,MPI_LMP_BIGINT,MPI_SUM,world); + + for (bigint i = 0; i < natoms; i++) { + ijnum[i] = 0; + sum = 0; + memset(&temptags[0],0,natoms*sizeof(int)); + jnum = ijnumproc[i]; + Jlist = firsttags[i]; + temptags[i] = 1; + for (jj = 0; jj < jnum; jj++) { + temptags[Jlist[jj]] = 1; + klist = firsttags[Jlist[jj]]; + knum = ijnumproc[Jlist[jj]]; + for (kk = 0; kk < knum; kk++) { + temptags[klist[kk]] = 1; + } + } + for (bigint j=0; jsmalloc(nbytes, "thirdorder:firsttags"); + nbytes = ((bigint) sizeof(bigint *)) * natoms; + neighbortags = (bigint **) memory->smalloc(nbytes, "thirdorder:neighbortags"); + memset(&datarecv[0],0,sum*sizeof(bigint)); + + n = 0; + for (bigint i = 0; i < natoms; i++) { + neighbortags[i] = &datarecv[n]; + n += ijnum[i]; + } + + for (bigint i = 0; i < natoms; i++) { + int m = 0; + memset(&temptags[0],0,natoms*sizeof(int)); + jnum = ijnumproc[i]; + Jlist = firsttags[i]; + temptags[i] = 1; + for (int j = 0; j < jnum; j++) { + temptags[Jlist[j]] = 1; + klist = firsttags[Jlist[j]]; + knum = ijnumproc[Jlist[j]]; + for (kk = 0; kk < knum; kk++) { + temptags[klist[kk]] = 1; + } + } + for (bigint j=0; j < natoms; j++) { + if (temptags[j] == 1) { + neighbortags[i][m] = j; + m += 1; + } + } + } + + free (firsttags); + free (ijnumproc); + free (temptags); +} diff --git a/src/PHONON/third_order.h b/src/PHONON/third_order.h index fa8741cfc6..e3d2cdc16e 100644 --- a/src/PHONON/third_order.h +++ b/src/PHONON/third_order.h @@ -18,13 +18,14 @@ namespace LAMMPS_NS { class ThirdOrder : public Command { public: ThirdOrder(class LAMMPS *); - virtual ~ThirdOrder(); - void command(int, char **); + ~ThirdOrder() override; + void command(int, char **) override; void setup(); protected: - int eflag, vflag; // flags for energy/virial computation - int external_force_clear; // clear forces locally or externally + int eflag,vflag; // flags for energy/virial computation + int external_force_clear; // clear forces locally or externally + int triclinic; // 0 if domain is orthog, 1 if triclinic int pairflag; @@ -34,25 +35,28 @@ class ThirdOrder : public Command { int nvec; // local atomic dof = length of xvec - void update_force(); - void force_clear(); - virtual void openfile(const char *filename); + virtual void update_force(); + virtual void force_clear(); + virtual void openfile(const char* filename); - private: + + protected: void options(int, char **); void create_groupmap(); void calculateMatrix(); void convert_units(const char *style); void displace_atom(int local_idx, int direction, int magnitude); void writeMatrix(double *, bigint, int, bigint, int); + void getNeighbortags(); double conversion; double conv_energy; double conv_distance; double conv_mass; double del; - int igroup, groupbit; + int igroup,groupbit; bigint dynlen; + bigint dynlenb; int scaleflag; int me; bigint gcount; // number of atoms in group @@ -62,6 +66,11 @@ class ThirdOrder : public Command { int binaryflag; // 1 if dump file is written binary, 0 no int file_opened; // 1 if openfile method has been called, 0 no int file_flag; // 1 custom file name, 0 dynmat.dat + int folded; // 1 if system is folded, 0 no + + class NeighList *list; + int *ijnum; + bigint **neighbortags; FILE *fp; }; diff --git a/src/PLUGIN/plugin.h b/src/PLUGIN/plugin.h index d98430bae6..cc1a3bf2dc 100644 --- a/src/PLUGIN/plugin.h +++ b/src/PLUGIN/plugin.h @@ -28,7 +28,7 @@ namespace LAMMPS_NS { class Plugin : public Command { public: Plugin(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; void plugin_load(const char *, LAMMPS *); diff --git a/src/PLUMED/fix_plumed.h b/src/PLUMED/fix_plumed.h index 0d9e226d38..f4dce376b8 100644 --- a/src/PLUMED/fix_plumed.h +++ b/src/PLUMED/fix_plumed.h @@ -32,18 +32,18 @@ namespace LAMMPS_NS { class FixPlumed : public Fix { public: FixPlumed(class LAMMPS *, int, char **); - ~FixPlumed(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - void reset_dt(); - int modify_param(int narg, char **arg); - double memory_usage(); + ~FixPlumed() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + void reset_dt() override; + int modify_param(int narg, char **arg) override; + double memory_usage() override; private: PLMD::Plumed *p; // pointer to plumed object diff --git a/src/POEMS/fix_poems.h b/src/POEMS/fix_poems.h index 537dbdd1b1..0b610189bd 100644 --- a/src/POEMS/fix_poems.h +++ b/src/POEMS/fix_poems.h @@ -29,28 +29,28 @@ namespace LAMMPS_NS { class FixPOEMS : public Fix { public: FixPOEMS(class LAMMPS *, int narg, char **arg); - ~FixPOEMS(); - int setmask(); - void init(); - void setup(int); - void initial_integrate(int); - void post_force(int); - void final_integrate(); - void initial_integrate_respa(int, int, int); - void post_force_respa(int, int, int); - void final_integrate_respa(int, int); + ~FixPOEMS() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void post_force(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void post_force_respa(int, int, int) override; + void final_integrate_respa(int, int) override; - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - double memory_usage(); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + double memory_usage() override; - void pre_neighbor(); - int dof(int); - void deform(int); - int modify_param(int, char **); - void reset_dt(); + void pre_neighbor() override; + int dof(int) override; + void deform(int) override; + int modify_param(int, char **) override; + void reset_dt() override; private: int me; diff --git a/src/PTM/compute_ptm_atom.h b/src/PTM/compute_ptm_atom.h index 3df1c2518e..61101f6efa 100644 --- a/src/PTM/compute_ptm_atom.h +++ b/src/PTM/compute_ptm_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputePTMAtom : public Compute { public: ComputePTMAtom(class LAMMPS *, int, char **); - ~ComputePTMAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputePTMAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/PTM/ptm_voronoi_cell.h b/src/PTM/ptm_voronoi_cell.h index 6fea7a7175..6b1c800441 100644 --- a/src/PTM/ptm_voronoi_cell.h +++ b/src/PTM/ptm_voronoi_cell.h @@ -273,7 +273,7 @@ class voronoicell_neighbor : public voronoicell_base { * face that is clockwise from the jth edge. */ int **ne; voronoicell_neighbor(); - ~voronoicell_neighbor(); + ~voronoicell_neighbor() override; void operator=(voronoicell_neighbor &c); /** Cuts the Voronoi cell by a particle whose center is at a * separation of (x,y,z) from the cell center. The value of rsq @@ -321,7 +321,7 @@ class voronoicell_neighbor : public voronoicell_base { } void init(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax); void check_facets(); - virtual void neighbors(std::vector &v); + void neighbors(std::vector &v) override; private: int *paux1; diff --git a/src/PYTHON/fix_python_invoke.h b/src/PYTHON/fix_python_invoke.h index a60b6e5f69..3396fe05d8 100644 --- a/src/PYTHON/fix_python_invoke.h +++ b/src/PYTHON/fix_python_invoke.h @@ -28,10 +28,10 @@ namespace LAMMPS_NS { class FixPythonInvoke : public Fix { public: FixPythonInvoke(class LAMMPS *, int, char **); - virtual ~FixPythonInvoke(); - int setmask(); - virtual void end_of_step(); - virtual void post_force(int); + ~FixPythonInvoke() override; + int setmask() override; + void end_of_step() override; + void post_force(int) override; private: void *lmpPtr; diff --git a/src/PYTHON/fix_python_move.h b/src/PYTHON/fix_python_move.h index fa2a275579..d861e98801 100644 --- a/src/PYTHON/fix_python_move.h +++ b/src/PYTHON/fix_python_move.h @@ -37,15 +37,15 @@ namespace LAMMPS_NS { class FixPythonMove : public Fix { public: FixPythonMove(LAMMPS *lmp, int narg, char **arg); - virtual ~FixPythonMove(); + ~FixPythonMove() override; - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - virtual void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; protected: void *py_move; diff --git a/src/PYTHON/pair_python.h b/src/PYTHON/pair_python.h index bb202b8cc5..d2366620c8 100644 --- a/src/PYTHON/pair_python.h +++ b/src/PYTHON/pair_python.h @@ -37,12 +37,12 @@ namespace LAMMPS_NS { class PairPython : public Pair { public: PairPython(class LAMMPS *); - virtual ~PairPython(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - double single(int, int, int, int, double, double, double, double &); + ~PairPython() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index 983aafb16b..bc593d5b8a 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -329,9 +329,11 @@ void PythonImpl::invoke_function(int ifunc, char *result) if (pfuncs[ifunc].noutput) { int otype = pfuncs[ifunc].otype; if (otype == INT) { - sprintf(result, "%ld", PY_INT_AS_LONG(pValue)); + auto value = fmt::format("{}", PY_INT_AS_LONG(pValue)); + strncpy(result, value.c_str(), Variable::VALUELENGTH - 1); } else if (otype == DOUBLE) { - sprintf(result, "%.15g", PyFloat_AsDouble(pValue)); + auto value = fmt::format("{:.15g}", PyFloat_AsDouble(pValue)); + strncpy(result, value.c_str(), Variable::VALUELENGTH - 1); } else if (otype == STRING) { const char *pystr = PY_STRING_AS_STRING(pValue); if (pfuncs[ifunc].longstr) diff --git a/src/PYTHON/python_impl.h b/src/PYTHON/python_impl.h index fe14862186..90726023c0 100644 --- a/src/PYTHON/python_impl.h +++ b/src/PYTHON/python_impl.h @@ -23,15 +23,15 @@ class PythonImpl : protected Pointers, public PythonInterface { public: PythonImpl(class LAMMPS *); - ~PythonImpl(); - void command(int, char **); - void invoke_function(int, char *); - int find(const char *); - int variable_match(const char *, const char *, int); - char *long_string(int); - int execute_string(char *); - int execute_file(char *); - bool has_minimum_version(int major, int minor); + ~PythonImpl() override; + void command(int, char **) override; + void invoke_function(int, char *) override; + int find(const char *) override; + int variable_match(const char *, const char *, int) override; + char *long_string(int) override; + int execute_string(char *) override; + int execute_file(char *) override; + bool has_minimum_version(int major, int minor) override; static void finalize(); private: diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index ffd45719a5..8c6be2f1c6 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -47,7 +47,7 @@ namespace { std::string message; public: explicit qeq_parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; } diff --git a/src/QEQ/fix_qeq.h b/src/QEQ/fix_qeq.h index bd25628508..cf1d40ae13 100644 --- a/src/QEQ/fix_qeq.h +++ b/src/QEQ/fix_qeq.h @@ -27,30 +27,30 @@ namespace LAMMPS_NS { class FixQEq : public Fix { public: FixQEq(class LAMMPS *, int, char **); - ~FixQEq(); - int setmask(); - void init_list(int, class NeighList *); - void setup_pre_force(int); - void setup_pre_force_respa(int, int); - void pre_force_respa(int, int, int); - void min_pre_force(int); + ~FixQEq() override; + int setmask() override; + void init_list(int, class NeighList *) override; + void setup_pre_force(int) override; + void setup_pre_force_respa(int, int) override; + void pre_force_respa(int, int, int) override; + void min_pre_force(int) override; - virtual double compute_scalar(); + double compute_scalar() override; // derived child classes must provide these functions - virtual void init(); - virtual void pre_force(int) = 0; + void init() override; + void pre_force(int) override = 0; - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - virtual int pack_reverse_comm(int, int, double *); - virtual void unpack_reverse_comm(int, int *, double *); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + double memory_usage() override; protected: int nevery; diff --git a/src/QEQ/fix_qeq_dynamic.h b/src/QEQ/fix_qeq_dynamic.h index 2ae4ea907b..3a28d10af3 100644 --- a/src/QEQ/fix_qeq_dynamic.h +++ b/src/QEQ/fix_qeq_dynamic.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixQEqDynamic : public FixQEq { public: FixQEqDynamic(class LAMMPS *, int, char **); - ~FixQEqDynamic() {} - void init(); - void pre_force(int); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + void init() override; + void pre_force(int) override; + + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; private: double compute_eneg(); diff --git a/src/QEQ/fix_qeq_fire.h b/src/QEQ/fix_qeq_fire.h index fb910129dc..f331100c15 100644 --- a/src/QEQ/fix_qeq_fire.h +++ b/src/QEQ/fix_qeq_fire.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixQEqFire : public FixQEq { public: FixQEqFire(class LAMMPS *, int, char **); - ~FixQEqFire() {} - void init(); - void pre_force(int); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + void init() override; + void pre_force(int) override; + + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; private: double compute_eneg(); diff --git a/src/QEQ/fix_qeq_point.h b/src/QEQ/fix_qeq_point.h index a680a9416d..2576c6c164 100644 --- a/src/QEQ/fix_qeq_point.h +++ b/src/QEQ/fix_qeq_point.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixQEqPoint : public FixQEq { public: FixQEqPoint(class LAMMPS *, int, char **); - ~FixQEqPoint() {} - void init(); - void pre_force(int); + + void init() override; + void pre_force(int) override; private: void init_matvec(); diff --git a/src/QEQ/fix_qeq_shielded.h b/src/QEQ/fix_qeq_shielded.h index 4d8d3c1395..5a676370e1 100644 --- a/src/QEQ/fix_qeq_shielded.h +++ b/src/QEQ/fix_qeq_shielded.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixQEqShielded : public FixQEq { public: FixQEqShielded(class LAMMPS *, int, char **); - ~FixQEqShielded() {} - void init(); - void pre_force(int); + + void init() override; + void pre_force(int) override; private: void extract_reax(); diff --git a/src/QEQ/fix_qeq_slater.h b/src/QEQ/fix_qeq_slater.h index 3247b0ddd6..6dd9f10e41 100644 --- a/src/QEQ/fix_qeq_slater.h +++ b/src/QEQ/fix_qeq_slater.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixQEqSlater : public FixQEq { public: FixQEqSlater(class LAMMPS *, int, char **); - ~FixQEqSlater() {} - void init(); - void pre_force(int); + + void init() override; + void pre_force(int) override; private: void init_matvec(); - void sparse_matvec(sparse_matrix *, double *, double *); + void sparse_matvec(sparse_matrix *, double *, double *) override; void compute_H(); double calculate_H(double, double, double, double, double &); double calculate_H_wolf(double, double, double, double, double &); diff --git a/src/QMMM/fix_qmmm.h b/src/QMMM/fix_qmmm.h index 830e52d772..7c16c59fb9 100644 --- a/src/QMMM/fix_qmmm.h +++ b/src/QMMM/fix_qmmm.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class FixQMMM : public Fix { public: FixQMMM(class LAMMPS *, int, char **); - ~FixQMMM(); - int setmask(); - void init(); + ~FixQMMM() override; + int setmask() override; + void init() override; // send up-to-date position information to QM and MM slave code - void post_integrate(); + void post_integrate() override; // receive and update forces - void setup(int); - void post_force(int); + void setup(int) override; + void post_force(int) override; - double memory_usage(); + double memory_usage() override; protected: void exchange_positions(); // communicate positions to QM and MM slave diff --git a/src/QTB/fix_qbmsst.h b/src/QTB/fix_qbmsst.h index 819bbd63a3..c3830b0c35 100644 --- a/src/QTB/fix_qbmsst.h +++ b/src/QTB/fix_qbmsst.h @@ -32,22 +32,22 @@ namespace LAMMPS_NS { class FixQBMSST : public Fix { public: FixQBMSST(class LAMMPS *, int, char **); - ~FixQBMSST(); - int setmask(); - void init(); - void setup(int); - void initial_integrate(int); - void final_integrate(); - double compute_scalar(); - double compute_vector(int); - void write_restart(FILE *); - void restart(char *); - int modify_param(int, char **); - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + ~FixQBMSST() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + double compute_scalar() override; + double compute_vector(int) override; + void write_restart(FILE *) override; + void restart(char *) override; + int modify_param(int, char **) override; + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: // msst parameters diff --git a/src/QTB/fix_qtb.h b/src/QTB/fix_qtb.h index 1f52e9f4b0..1ee939a68e 100644 --- a/src/QTB/fix_qtb.h +++ b/src/QTB/fix_qtb.h @@ -32,18 +32,18 @@ namespace LAMMPS_NS { class FixQTB : public Fix { public: FixQTB(class LAMMPS *, int, char **); - virtual ~FixQTB(); - int setmask(); - void init(); - void setup(int); - void post_force(int); - void post_force_respa(int, int, int); - int modify_param(int, char **); - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + ~FixQTB() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + int modify_param(int, char **) override; + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: // qtb parameters diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 08eff6dc48..32e3eea25b 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -580,6 +580,11 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : FixBondReact::~FixBondReact() { + for (int i = 0; i < narrhenius; i++) { + delete rrhandom[i]; + } + delete [] rrhandom; + for (int i = 0; i < nreacts; i++) { delete random[i]; } diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 097133cb00..93a6f76f62 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -35,20 +35,20 @@ class FixBondReact : public Fix { enum { MAXCONPAR = 5 }; // max # of constraint parameters FixBondReact(class LAMMPS *, int, char **); - ~FixBondReact(); - int setmask(); - void post_constructor(); - void init(); - void init_list(int, class NeighList *); - void post_integrate(); - void post_integrate_respa(int, int); + ~FixBondReact() override; + int setmask() override; + void post_constructor() override; + void init() override; + void init_list(int, class NeighList *) override; + void post_integrate() override; + void post_integrate_respa(int, int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double compute_vector(int); - double memory_usage(); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double compute_vector(int) override; + double memory_usage() override; private: int me, nprocs; @@ -197,8 +197,8 @@ class FixBondReact : public Fix { void unlimit_bond(); void limit_bond(int); void dedup_mega_gloves(int); //dedup global mega_glove - virtual void write_restart(FILE *); - virtual void restart(char *buf); + void write_restart(FILE *) override; + void restart(char *buf) override; struct Set { int nreacts; diff --git a/src/REAXFF/compute_spec_atom.h b/src/REAXFF/compute_spec_atom.h index 3974f38354..40f184e3ed 100644 --- a/src/REAXFF/compute_spec_atom.h +++ b/src/REAXFF/compute_spec_atom.h @@ -28,10 +28,10 @@ namespace LAMMPS_NS { class ComputeSpecAtom : public Compute { public: ComputeSpecAtom(class LAMMPS *, int, char **); - ~ComputeSpecAtom(); - void init() {} - void compute_peratom(); - double memory_usage(); + ~ComputeSpecAtom() override; + void init() override {} + void compute_peratom() override; + double memory_usage() override; private: int nvalues; diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index b6789b1b2e..ee017b8be0 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -22,20 +22,14 @@ #include "citeme.h" #include "comm.h" #include "error.h" -#include "fix_efield.h" #include "force.h" -#include "group.h" #include "memory.h" #include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" #include "pair.h" #include "pair_reaxff.h" #include "reaxff_api.h" -#include "respa.h" #include "text_file_reader.h" #include "update.h" -#include "utils.h" #include #include @@ -429,7 +423,7 @@ void FixACKS2ReaxFF::compute_X() double **x = atom->x; int *mask = atom->mask; - memset(X_diag,0.0,atom->nmax*sizeof(double)); + memset(X_diag,0,atom->nmax*sizeof(double)); // fill in the X matrix m_fill = 0; diff --git a/src/REAXFF/fix_acks2_reaxff.h b/src/REAXFF/fix_acks2_reaxff.h index 6c4b85e23e..2d21f80fe0 100644 --- a/src/REAXFF/fix_acks2_reaxff.h +++ b/src/REAXFF/fix_acks2_reaxff.h @@ -28,11 +28,11 @@ namespace LAMMPS_NS { class FixACKS2ReaxFF : public FixQEqReaxFF { public: FixACKS2ReaxFF(class LAMMPS *, int, char **); - virtual ~FixACKS2ReaxFF(); - void post_constructor(); - virtual void init(); - void init_storage(); - virtual void pre_force(int); + ~FixACKS2ReaxFF() override; + void post_constructor() override; + void init() override; + void init_storage() override; + void pre_force(int) override; double *get_s() { return s; } @@ -49,39 +49,39 @@ class FixACKS2ReaxFF : public FixQEqReaxFF { //BiCGStab storage double *g, *q_hat, *r_hat, *y, *z; - void pertype_parameters(char *); + void pertype_parameters(char *) override; void init_bondcut(); - void allocate_storage(); - void deallocate_storage(); - void allocate_matrix(); - void deallocate_matrix(); + void allocate_storage() override; + void deallocate_storage() override; + void allocate_matrix() override; + void deallocate_matrix() override; - void init_matvec(); + void init_matvec() override; void compute_X(); double calculate_X(double, double); - void calculate_Q(); + void calculate_Q() override; int BiCGStab(double *, double *); void sparse_matvec_acks2(sparse_matrix *, sparse_matrix *, double *, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void more_forward_comm(double *); void more_reverse_comm(double *); - double memory_usage(); - virtual void grow_arrays(int); - virtual void copy_arrays(int, int, int); - virtual int pack_exchange(int, double *); - virtual int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; - double parallel_norm(double *, int); - double parallel_dot(double *, double *, int); - double parallel_vector_acc(double *, int); + double parallel_norm(double *, int) override; + double parallel_dot(double *, double *, int) override; + double parallel_vector_acc(double *, int) override; - void vector_sum(double *, double, double *, double, double *, int); - void vector_add(double *, double, double *, int); + void vector_sum(double *, double, double *, double, double *, int) override; + void vector_add(double *, double, double *, int) override; void vector_copy(double *, double *, int); }; diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index fa8fa79e00..361c6e9ce6 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -30,6 +30,7 @@ #include "force.h" #include "group.h" #include "memory.h" +#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" @@ -45,7 +46,6 @@ #include #include #include -#include using namespace LAMMPS_NS; using namespace FixConst; @@ -1084,7 +1084,7 @@ void FixQEqReaxFF::vector_add(double* dest, double c, double* v, int k) void FixQEqReaxFF::get_chi_field() { - memset(&chi_field[0],0.0,atom->nmax*sizeof(double)); + memset(&chi_field[0],0,atom->nmax*sizeof(double)); if (!efield) return; const double * const *x = (const double * const *)atom->x; diff --git a/src/REAXFF/fix_qeq_reaxff.h b/src/REAXFF/fix_qeq_reaxff.h index ac54ff72ca..5ebb410a10 100644 --- a/src/REAXFF/fix_qeq_reaxff.h +++ b/src/REAXFF/fix_qeq_reaxff.h @@ -39,22 +39,22 @@ namespace LAMMPS_NS { class FixQEqReaxFF : public Fix { public: FixQEqReaxFF(class LAMMPS *, int, char **); - ~FixQEqReaxFF(); - int setmask(); - virtual void post_constructor(); - virtual void init(); - void init_list(int, class NeighList *); + ~FixQEqReaxFF() override; + int setmask() override; + void post_constructor() override; + void init() override; + void init_list(int, class NeighList *) override; virtual void init_storage(); - virtual void setup_pre_force(int); - virtual void pre_force(int); + void setup_pre_force(int) override; + void pre_force(int) override; - void setup_pre_force_respa(int, int); - void pre_force_respa(int, int, int); + void setup_pre_force_respa(int, int) override; + void pre_force_respa(int, int, int) override; void min_setup_pre_force(int); - void min_pre_force(int); + void min_pre_force(int) override; - virtual double compute_scalar(); + double compute_scalar() override; protected: int nevery, reaxflag; @@ -119,15 +119,15 @@ class FixQEqReaxFF : public Fix { virtual int CG(double *, double *); virtual void sparse_matvec(sparse_matrix *, double *, double *); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - virtual int pack_reverse_comm(int, int, double *); - virtual void unpack_reverse_comm(int, int *, double *); - virtual double memory_usage(); - virtual void grow_arrays(int); - virtual void copy_arrays(int, int, int); - virtual int pack_exchange(int, double *); - virtual int unpack_exchange(int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; virtual double parallel_norm(double *, int); virtual double parallel_dot(double *, double *, int); diff --git a/src/REAXFF/fix_reaxff.h b/src/REAXFF/fix_reaxff.h index 165be197be..650b75c9d8 100644 --- a/src/REAXFF/fix_reaxff.h +++ b/src/REAXFF/fix_reaxff.h @@ -41,16 +41,16 @@ class FixReaxFF : public Fix { public: FixReaxFF(class LAMMPS *, int, char **); - ~FixReaxFF(); - int setmask(); + ~FixReaxFF() override; + int setmask() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; private: int maxbonds; // max # of bonds for any atom diff --git a/src/REAXFF/fix_reaxff_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp index 740a32a0a6..30c55d8f1a 100644 --- a/src/REAXFF/fix_reaxff_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -28,8 +28,6 @@ #include "pair_reaxff.h" #include "reaxff_api.h" -#include - using namespace LAMMPS_NS; using namespace FixConst; using namespace ReaxFF; diff --git a/src/REAXFF/fix_reaxff_bonds.h b/src/REAXFF/fix_reaxff_bonds.h index 4c40017e43..7443db8658 100644 --- a/src/REAXFF/fix_reaxff_bonds.h +++ b/src/REAXFF/fix_reaxff_bonds.h @@ -29,11 +29,11 @@ namespace LAMMPS_NS { class FixReaxFFBonds : public Fix { public: FixReaxFFBonds(class LAMMPS *, int, char **); - virtual ~FixReaxFFBonds(); - int setmask(); - virtual void init(); - void setup(int); - void end_of_step(); + ~FixReaxFFBonds() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; protected: int me, nprocs, nmax, ntypes, maxsize, compressed; @@ -49,7 +49,7 @@ class FixReaxFFBonds : public Fix { void PassBuffer(double *, int &); void RecvBuffer(double *, int, int, int, int); int nint(const double &); - virtual double memory_usage(); + double memory_usage() override; bigint nvalid, nextvalid(); struct _reax_list *lists; diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 4f44cc7c64..ac556ade9e 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -34,6 +34,7 @@ #include "reaxff_defs.h" #include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -246,8 +247,10 @@ FixReaxFFSpecies::~FixReaxFFSpecies() if (posflag && multipos_opened) fclose(pos); } - modify->delete_compute(fmt::format("SPECATOM_{}",id)); - modify->delete_fix(fmt::format("SPECBOND_{}",id)); + try { + modify->delete_compute(fmt::format("SPECATOM_{}",id)); + modify->delete_fix(fmt::format("SPECBOND_{}",id)); + } catch (std::exception &) {} } /* ---------------------------------------------------------------------- */ diff --git a/src/REAXFF/fix_reaxff_species.h b/src/REAXFF/fix_reaxff_species.h index ca5e0e512d..f441c3bc92 100644 --- a/src/REAXFF/fix_reaxff_species.h +++ b/src/REAXFF/fix_reaxff_species.h @@ -35,13 +35,13 @@ typedef struct { class FixReaxFFSpecies : public Fix { public: FixReaxFFSpecies(class LAMMPS *, int, char **); - virtual ~FixReaxFFSpecies(); - int setmask(); - virtual void init(); - void init_list(int, class NeighList *); - void setup(int); - void post_integrate(); - double compute_vector(int); + ~FixReaxFFSpecies() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void post_integrate() override; + double compute_vector(int) override; protected: int me, nprocs, nmax, nlocal, ntypes, ntotal; @@ -68,11 +68,11 @@ class FixReaxFFSpecies : public Fix { int CheckExistence(int, int); int nint(const double &); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; void OpenPos(); void WritePos(int, int); - double memory_usage(); + double memory_usage() override; bigint nvalid; diff --git a/src/REAXFF/pair_reaxff.cpp b/src/REAXFF/pair_reaxff.cpp index 9a3bdf2f79..f7b4056427 100644 --- a/src/REAXFF/pair_reaxff.cpp +++ b/src/REAXFF/pair_reaxff.cpp @@ -90,7 +90,6 @@ PairReaxFF::PairReaxFF(LAMMPS *lmp) : Pair(lmp) api->system->num_nbrs = 0; api->system->n = 0; // my atoms api->system->N = 0; // mine + ghosts - api->system->bigN = 0; // all atoms in the system api->system->local_cap = 0; api->system->total_cap = 0; api->system->my_atoms = nullptr; @@ -348,7 +347,6 @@ void PairReaxFF::init_style() api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts - api->system->bigN = static_cast (atom->natoms); // all atoms in the system api->system->wsize = comm->nprocs; if (atom->tag_enable == 0) @@ -356,11 +354,6 @@ void PairReaxFF::init_style() if (force->newton_pair == 0) error->all(FLERR,"Pair style reaxff requires newton pair on"); - // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT - - if (atom->natoms > MAXSMALLINT) - error->all(FLERR,"Too many atoms for pair style reaxff"); - // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs @@ -388,7 +381,6 @@ void PairReaxFF::setup() api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts oldN = api->system->N; - api->system->bigN = static_cast (atom->natoms); // all atoms in the system if (setup_flag == 0) { @@ -455,8 +447,6 @@ double PairReaxFF::init_one(int i, int j) void PairReaxFF::compute(int eflag, int vflag) { - double evdwl,ecoul; - // communicate num_bonds once every reneighboring // 2 num arrays stored by fix, grab ptr to them @@ -464,12 +454,10 @@ void PairReaxFF::compute(int eflag, int vflag) int *num_bonds = fix_reaxff->num_bonds; int *num_hbonds = fix_reaxff->num_hbonds; - evdwl = ecoul = 0.0; ev_init(eflag,vflag); api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts - api->system->bigN = static_cast (atom->natoms); // all atoms in the system if (api->system->acks2_flag) { auto ifix = modify->get_fix_by_style("^acks2/reax").front(); @@ -496,20 +484,6 @@ void PairReaxFF::compute(int eflag, int vflag) // energies and pressure if (eflag_global) { - evdwl += api->data->my_en.e_bond; - evdwl += api->data->my_en.e_ov; - evdwl += api->data->my_en.e_un; - evdwl += api->data->my_en.e_lp; - evdwl += api->data->my_en.e_ang; - evdwl += api->data->my_en.e_pen; - evdwl += api->data->my_en.e_coa; - evdwl += api->data->my_en.e_hb; - evdwl += api->data->my_en.e_tor; - evdwl += api->data->my_en.e_con; - evdwl += api->data->my_en.e_vdW; - - ecoul += api->data->my_en.e_ele; - ecoul += api->data->my_en.e_pol; // Store the different parts of the energy // in a list for output by compute pair command diff --git a/src/REAXFF/pair_reaxff.h b/src/REAXFF/pair_reaxff.h index 23b2ae894a..3b8d84c93a 100644 --- a/src/REAXFF/pair_reaxff.h +++ b/src/REAXFF/pair_reaxff.h @@ -44,13 +44,13 @@ namespace LAMMPS_NS { class PairReaxFF : public Pair { public: PairReaxFF(class LAMMPS *); - ~PairReaxFF(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); - void *extract(const char *, int &); + ~PairReaxFF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void *extract(const char *, int &) override; int fixbond_flag, fixspecies_flag; int **tmpid; double **tmpbo, **tmpr; @@ -69,7 +69,7 @@ class PairReaxFF : public Pair { int firstwarn; void allocate(); - void setup(); + void setup() override; void create_compute(); void create_fix(); void write_reax_atoms(); @@ -81,7 +81,7 @@ class PairReaxFF : public Pair { int nmax; void FindBond(); - double memory_usage(); + double memory_usage() override; }; } // namespace LAMMPS_NS diff --git a/src/REAXFF/reaxff_control.cpp b/src/REAXFF/reaxff_control.cpp index 62a45b0dc7..d914765f45 100644 --- a/src/REAXFF/reaxff_control.cpp +++ b/src/REAXFF/reaxff_control.cpp @@ -60,7 +60,7 @@ namespace ReaxFF { explicit control_parser_error(const std::string &format, const std::string &keyword) { message = fmt::format(format, keyword); } - const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; // NOTE: this function is run on MPI rank 0 only diff --git a/src/REAXFF/reaxff_ffield.cpp b/src/REAXFF/reaxff_ffield.cpp index ac22609317..d79d63b87b 100644 --- a/src/REAXFF/reaxff_ffield.cpp +++ b/src/REAXFF/reaxff_ffield.cpp @@ -47,7 +47,7 @@ namespace ReaxFF { std::string message; public: explicit ffield_parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; void Read_Force_Field(const char *filename, reax_interaction *reax, diff --git a/src/REAXFF/reaxff_types.h b/src/REAXFF/reaxff_types.h index 1eac663e52..94818f6ebf 100644 --- a/src/REAXFF/reaxff_types.h +++ b/src/REAXFF/reaxff_types.h @@ -196,7 +196,6 @@ struct LR_lookup_table; // forward declaration struct reax_system { reax_interaction reax_param; - rc_bigint bigN; int n, N, numH; int local_cap, total_cap, Hcap; int wsize, my_rank, num_nbrs; diff --git a/src/REPLICA/compute_event_displace.h b/src/REPLICA/compute_event_displace.h index c8c4c8810d..d4ee68a092 100644 --- a/src/REPLICA/compute_event_displace.h +++ b/src/REPLICA/compute_event_displace.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeEventDisplace : public Compute { public: ComputeEventDisplace(class LAMMPS *, int, char **); - ~ComputeEventDisplace(); - void init(); - double compute_scalar(); + ~ComputeEventDisplace() override; + void init() override; + double compute_scalar() override; int all_events(); - void reset_extra_compute_fix(const char *); + void reset_extra_compute_fix(const char *) override; private: int triclinic; diff --git a/src/REPLICA/compute_pressure_grem.h b/src/REPLICA/compute_pressure_grem.h index 74a504270d..8fa62965ee 100644 --- a/src/REPLICA/compute_pressure_grem.h +++ b/src/REPLICA/compute_pressure_grem.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputePressureGrem : public ComputePressure { public: ComputePressureGrem(class LAMMPS *, int, char **); - virtual ~ComputePressureGrem(); - virtual void init(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputePressureGrem() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; protected: // Access to gREM fix scale factor diff --git a/src/REPLICA/fix_event.h b/src/REPLICA/fix_event.h index 963b505c85..d131d7eed2 100644 --- a/src/REPLICA/fix_event.h +++ b/src/REPLICA/fix_event.h @@ -21,16 +21,16 @@ namespace LAMMPS_NS { class FixEvent : public Fix { public: FixEvent(class LAMMPS *, int, char **); - virtual ~FixEvent() = 0; // use destructor to make base class virtual - int setmask(); + ~FixEvent() override = 0; // use destructor to make base class virtual + int setmask() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - virtual void write_restart(FILE *) {} - virtual void restart(char *) {} + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void write_restart(FILE *) override {} + void restart(char *) override {} // methods specific to FixEvent diff --git a/src/REPLICA/fix_event_hyper.h b/src/REPLICA/fix_event_hyper.h index b86e448775..2bcb6a8218 100644 --- a/src/REPLICA/fix_event_hyper.h +++ b/src/REPLICA/fix_event_hyper.h @@ -34,10 +34,9 @@ class FixEventHyper : public FixEvent { int ncoincident; // # of simultaneous events on different replicas FixEventHyper(class LAMMPS *, int, char **); - ~FixEventHyper() {} - void write_restart(FILE *); - void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; // methods specific to FixEventHyper, invoked by hyper diff --git a/src/REPLICA/fix_event_prd.h b/src/REPLICA/fix_event_prd.h index a5ed2418da..6ed8521a81 100644 --- a/src/REPLICA/fix_event_prd.h +++ b/src/REPLICA/fix_event_prd.h @@ -34,10 +34,9 @@ class FixEventPRD : public FixEvent { int ncoincident; // # of simultaneous events on different replicas FixEventPRD(class LAMMPS *, int, char **); - ~FixEventPRD() {} - void write_restart(FILE *); - void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; // methods specific to FixEventPRD, invoked by PRD diff --git a/src/REPLICA/fix_event_tad.h b/src/REPLICA/fix_event_tad.h index 88f27c20e9..2b44ce45f0 100644 --- a/src/REPLICA/fix_event_tad.h +++ b/src/REPLICA/fix_event_tad.h @@ -32,10 +32,9 @@ class FixEventTAD : public FixEvent { double ebarrier; // energy barrier for this event FixEventTAD(class LAMMPS *, int, char **); - ~FixEventTAD() {} - void write_restart(FILE *); - void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; // methods specific to FixEventTAD, invoked by TAD diff --git a/src/REPLICA/fix_grem.h b/src/REPLICA/fix_grem.h index 71dd5d939d..cd7f0b35b3 100644 --- a/src/REPLICA/fix_grem.h +++ b/src/REPLICA/fix_grem.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixGrem : public Fix { public: FixGrem(class LAMMPS *, int, char **); - ~FixGrem(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void *extract(const char *, int &); - double compute_scalar(); + ~FixGrem() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void *extract(const char *, int &) override; + double compute_scalar() override; double scale_grem, lambda, eta, h0; int pressflag; diff --git a/src/REPLICA/fix_hyper.h b/src/REPLICA/fix_hyper.h index 64552b18c6..b6b35ff031 100644 --- a/src/REPLICA/fix_hyper.h +++ b/src/REPLICA/fix_hyper.h @@ -23,8 +23,7 @@ class FixHyper : public Fix { bigint ntimestep_initial; FixHyper(class LAMMPS *, int, char **); - virtual ~FixHyper() {} - void *extract(const char *, int &); + void *extract(const char *, int &) override; // must be provided by child class diff --git a/src/REPLICA/fix_hyper_global.h b/src/REPLICA/fix_hyper_global.h index 4b9f2886cd..0273c4ce63 100644 --- a/src/REPLICA/fix_hyper_global.h +++ b/src/REPLICA/fix_hyper_global.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class FixHyperGlobal : public FixHyper { public: FixHyperGlobal(class LAMMPS *, int, char **); - ~FixHyperGlobal(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup_pre_neighbor(); - void setup_pre_reverse(int, int); - void pre_neighbor(); - void pre_reverse(int, int); - double compute_scalar(); - double compute_vector(int); - double query(int); + ~FixHyperGlobal() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup_pre_neighbor() override; + void setup_pre_reverse(int, int) override; + void pre_neighbor() override; + void pre_reverse(int, int) override; + double compute_scalar() override; + double compute_vector(int) override; + double query(int) override; - double memory_usage(); + double memory_usage() override; // extra methods visible to callers - void init_hyper(); - void build_bond_list(int); + void init_hyper() override; + void build_bond_list(int) override; private: int me; diff --git a/src/REPLICA/fix_hyper_local.h b/src/REPLICA/fix_hyper_local.h index 91a594fc64..ace74c7eec 100644 --- a/src/REPLICA/fix_hyper_local.h +++ b/src/REPLICA/fix_hyper_local.h @@ -29,31 +29,31 @@ struct HyperOneCoeff; class FixHyperLocal : public FixHyper { public: FixHyperLocal(class LAMMPS *, int, char **); - ~FixHyperLocal(); - int setmask(); - void init(); - void init_list(int, class NeighList *); - void setup_pre_neighbor(); - void setup_pre_reverse(int, int); - void pre_neighbor(); - void pre_reverse(int, int); - void min_pre_neighbor(); - double compute_scalar(); - double compute_vector(int); - double query(int); + ~FixHyperLocal() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup_pre_neighbor() override; + void setup_pre_reverse(int, int) override; + void pre_neighbor() override; + void pre_reverse(int, int) override; + void min_pre_neighbor() override; + double compute_scalar() override; + double compute_vector(int) override; + double query(int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - int pack_reverse_comm_size(int, int); - void unpack_reverse_comm(int, int *, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + int pack_reverse_comm_size(int, int) override; + void unpack_reverse_comm(int, int *, double *) override; - double memory_usage(); + double memory_usage() override; // extra methods visible to callers - void init_hyper(); - void build_bond_list(int); + void init_hyper() override; + void build_bond_list(int) override; private: int me; diff --git a/src/REPLICA/fix_neb.h b/src/REPLICA/fix_neb.h index 3bdec0414f..5c9930d73f 100644 --- a/src/REPLICA/fix_neb.h +++ b/src/REPLICA/fix_neb.h @@ -30,11 +30,11 @@ class FixNEB : public Fix { int rclimber; FixNEB(class LAMMPS *, int, char **); - ~FixNEB(); - int setmask(); - void init(); - void min_setup(int); - void min_post_force(int); + ~FixNEB() override; + int setmask() override; + void init() override; + void min_setup(int) override; + void min_post_force(int) override; private: int me, nprocs, nprocs_universe; diff --git a/src/REPLICA/fix_pimd.h b/src/REPLICA/fix_pimd.h index 05a24dedce..ad3c7d31b0 100644 --- a/src/REPLICA/fix_pimd.h +++ b/src/REPLICA/fix_pimd.h @@ -27,29 +27,29 @@ namespace LAMMPS_NS { class FixPIMD : public Fix { public: FixPIMD(class LAMMPS *, int, char **); - virtual ~FixPIMD(); + ~FixPIMD() override; - int setmask(); + int setmask() override; - void init(); - void setup(int); - void post_force(int); - void initial_integrate(int); - void final_integrate(); + void init() override; + void setup(int) override; + void post_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int maxsize_restart(); - int size_restart(int); - double compute_vector(int); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int maxsize_restart() override; + int size_restart(int) override; + double compute_vector(int) override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; int method; int np; diff --git a/src/REPLICA/hyper.h b/src/REPLICA/hyper.h index c17fc7a6d8..8d20439c1c 100644 --- a/src/REPLICA/hyper.h +++ b/src/REPLICA/hyper.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class Hyper : public Command { public: Hyper(class LAMMPS *); - ~Hyper() {} - void command(int, char **); + + void command(int, char **) override; private: int me, nprocs; diff --git a/src/REPLICA/neb.h b/src/REPLICA/neb.h index 26d3b72541..c99ab60904 100644 --- a/src/REPLICA/neb.h +++ b/src/REPLICA/neb.h @@ -28,8 +28,8 @@ class NEB : public Command { public: NEB(class LAMMPS *); NEB(class LAMMPS *, double, double, int, int, int, double *, double *); - ~NEB(); - void command(int, char **); // process neb command + ~NEB() override; + void command(int, char **) override; // process neb command void run(); // run NEB double ebf, ebr; // forward and reverse energy barriers diff --git a/src/REPLICA/prd.h b/src/REPLICA/prd.h index a5342c47b8..81582ec3d4 100644 --- a/src/REPLICA/prd.h +++ b/src/REPLICA/prd.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PRD : public Command { public: PRD(class LAMMPS *); - ~PRD() {} - void command(int, char **); + + void command(int, char **) override; private: int me, nprocs; diff --git a/src/REPLICA/tad.h b/src/REPLICA/tad.h index 7e528acfbb..e0432db9fd 100644 --- a/src/REPLICA/tad.h +++ b/src/REPLICA/tad.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class TAD : public Command { public: TAD(class LAMMPS *); - ~TAD(); - void command(int, char **); + ~TAD() override; + void command(int, char **) override; private: int me, nprocs; diff --git a/src/REPLICA/temper.h b/src/REPLICA/temper.h index d7ebf79c33..0bce33a5f8 100644 --- a/src/REPLICA/temper.h +++ b/src/REPLICA/temper.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class Temper : public Command { public: Temper(class LAMMPS *); - ~Temper(); - void command(int, char **); + ~Temper() override; + void command(int, char **) override; private: int me, me_universe; // my proc ID in world and universe diff --git a/src/REPLICA/temper_grem.h b/src/REPLICA/temper_grem.h index cdcf6a26aa..2aea1e1414 100644 --- a/src/REPLICA/temper_grem.h +++ b/src/REPLICA/temper_grem.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class TemperGrem : public Command { public: TemperGrem(class LAMMPS *); - ~TemperGrem(); - void command(int, char **); + ~TemperGrem() override; + void command(int, char **) override; private: int me, me_universe; // my proc ID in world and universe diff --git a/src/REPLICA/temper_npt.h b/src/REPLICA/temper_npt.h index 47eec7053b..b6f37ea8c1 100644 --- a/src/REPLICA/temper_npt.h +++ b/src/REPLICA/temper_npt.h @@ -28,8 +28,8 @@ namespace LAMMPS_NS { class TemperNPT : public Command { public: TemperNPT(class LAMMPS *); - ~TemperNPT(); - void command(int, char **); + ~TemperNPT() override; + void command(int, char **) override; private: int me, me_universe; // my proc ID in world and universe diff --git a/src/REPLICA/verlet_split.h b/src/REPLICA/verlet_split.h index 57561a9daf..f7adeaf536 100644 --- a/src/REPLICA/verlet_split.h +++ b/src/REPLICA/verlet_split.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class VerletSplit : public Verlet { public: VerletSplit(class LAMMPS *, int, char **); - ~VerletSplit(); - void init(); - void setup(int); - void setup_minimal(int); - void run(int); - double memory_usage(); + ~VerletSplit() override; + void init() override; + void setup(int) override; + void setup_minimal(int) override; + void run(int) override; + double memory_usage() override; private: int master; // 1 if an Rspace proc, 0 if Kspace diff --git a/src/RIGID/compute_erotate_rigid.h b/src/RIGID/compute_erotate_rigid.h index b8571fa21a..3005df8493 100644 --- a/src/RIGID/compute_erotate_rigid.h +++ b/src/RIGID/compute_erotate_rigid.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeERotateRigid : public Compute { public: ComputeERotateRigid(class LAMMPS *, int, char **); - ~ComputeERotateRigid(); - void init(); - double compute_scalar(); + ~ComputeERotateRigid() override; + void init() override; + double compute_scalar() override; private: int irfix; diff --git a/src/RIGID/compute_ke_rigid.h b/src/RIGID/compute_ke_rigid.h index 32ec7e062e..dfdd4d2e21 100644 --- a/src/RIGID/compute_ke_rigid.h +++ b/src/RIGID/compute_ke_rigid.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeKERigid : public Compute { public: ComputeKERigid(class LAMMPS *, int, char **); - ~ComputeKERigid(); - void init(); - double compute_scalar(); + ~ComputeKERigid() override; + void init() override; + double compute_scalar() override; private: int irfix; diff --git a/src/RIGID/compute_rigid_local.h b/src/RIGID/compute_rigid_local.h index 3c8b48f366..1d07f835b2 100644 --- a/src/RIGID/compute_rigid_local.h +++ b/src/RIGID/compute_rigid_local.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeRigidLocal : public Compute { public: ComputeRigidLocal(class LAMMPS *, int, char **); - ~ComputeRigidLocal(); - void init(); - void compute_local(); - double memory_usage(); + ~ComputeRigidLocal() override; + void init() override; + void compute_local() override; + double memory_usage() override; private: int nvalues; diff --git a/src/RIGID/fix_ehex.h b/src/RIGID/fix_ehex.h index 32ff1b9560..f4ea872533 100644 --- a/src/RIGID/fix_ehex.h +++ b/src/RIGID/fix_ehex.h @@ -29,17 +29,17 @@ class FixEHEX : public Fix { public: FixEHEX(class LAMMPS *, int, char **); - ~FixEHEX(); - int setmask(); - void init(); - void end_of_step(); + ~FixEHEX() override; + int setmask() override; + void init() override; + void end_of_step() override; void rescale(); - double compute_scalar(); - double memory_usage(); + double compute_scalar() override; + double memory_usage() override; void update_scalingmask(); void com_properties(double *, double *, double *, double *, double *, double *); bool rescale_atom(int i, class Region *region); - virtual void grow_arrays(int nmax); + void grow_arrays(int nmax) override; bool check_cluster(tagint *shake_atom, int n, class Region *region); private: diff --git a/src/RIGID/fix_rattle.h b/src/RIGID/fix_rattle.h index d8bcec753c..937a2e1233 100644 --- a/src/RIGID/fix_rattle.h +++ b/src/RIGID/fix_rattle.h @@ -32,23 +32,23 @@ class FixRattle : public FixShake { double verr_max; // velocity error FixRattle(class LAMMPS *, int, char **); - ~FixRattle(); - int setmask(); - virtual void init(); - virtual void post_force(int); - virtual void post_force_respa(int, int, int); - virtual void final_integrate(); - virtual void final_integrate_respa(int, int); + ~FixRattle() override; + int setmask() override; + void init() override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void final_integrate() override; + void final_integrate_respa(int, int) override; - virtual void correct_coordinates(int vflag); - virtual void correct_velocities(); - virtual void shake_end_of_step(int vflag); + void correct_coordinates(int vflag) override; + void correct_velocities() override; + void shake_end_of_step(int vflag) override; - virtual double memory_usage(); - virtual void grow_arrays(int); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); - virtual void reset_dt(); + double memory_usage() override; + void grow_arrays(int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + void reset_dt() override; private: void update_v_half_nocons(); @@ -68,7 +68,7 @@ class FixRattle : public FixShake { bool check3(double **v, int m, bool checkr, bool checkv); bool check4(double **v, int m, bool checkr, bool checkv); bool check_constraints(double **v, bool checkr, bool checkv); - void end_of_step(); + void end_of_step() override; }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid.h b/src/RIGID/fix_rigid.h index 90663acc47..36ab138868 100644 --- a/src/RIGID/fix_rigid.h +++ b/src/RIGID/fix_rigid.h @@ -27,38 +27,38 @@ namespace LAMMPS_NS { class FixRigid : public Fix { public: FixRigid(class LAMMPS *, int, char **); - virtual ~FixRigid(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - void post_force(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); - void write_restart_file(const char *); - virtual double compute_scalar(); + ~FixRigid() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void post_force(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void write_restart_file(const char *) override; + double compute_scalar() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; - void setup_pre_neighbor(); - void pre_neighbor(); - int dof(int); - void deform(int); - void enforce2d(); - void reset_dt(); - void zero_momentum(); - void zero_rotation(); - virtual int modify_param(int, char **); - virtual void *extract(const char *, int &); + void setup_pre_neighbor() override; + void pre_neighbor() override; + int dof(int) override; + void deform(int) override; + void enforce2d() override; + void reset_dt() override; + void zero_momentum() override; + void zero_rotation() override; + int modify_param(int, char **) override; + void *extract(const char *, int &) override; double extract_ke(); double extract_erotational(); - double compute_array(int, int); + double compute_array(int, int) override; protected: int me, nprocs; diff --git a/src/RIGID/fix_rigid_nh.h b/src/RIGID/fix_rigid_nh.h index 0335eecabf..88f27126ef 100644 --- a/src/RIGID/fix_rigid_nh.h +++ b/src/RIGID/fix_rigid_nh.h @@ -21,17 +21,17 @@ namespace LAMMPS_NS { class FixRigidNH : public FixRigid { public: FixRigidNH(class LAMMPS *, int, char **); - virtual ~FixRigidNH(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual double compute_scalar(); - int modify_param(int, char **); - void write_restart(FILE *); - void restart(char *buf); - void reset_target(double); + ~FixRigidNH() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + double compute_scalar() override; + int modify_param(int, char **) override; + void write_restart(FILE *) override; + void restart(char *buf) override; + void reset_target(double) override; protected: double **conjqm; // conjugate quaternion momentum diff --git a/src/RIGID/fix_rigid_nh_small.h b/src/RIGID/fix_rigid_nh_small.h index 11dae8f211..b52797f194 100644 --- a/src/RIGID/fix_rigid_nh_small.h +++ b/src/RIGID/fix_rigid_nh_small.h @@ -21,17 +21,17 @@ namespace LAMMPS_NS { class FixRigidNHSmall : public FixRigidSmall { public: FixRigidNHSmall(class LAMMPS *, int, char **); - virtual ~FixRigidNHSmall(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual double compute_scalar(); - int modify_param(int, char **); - void write_restart(FILE *); - void restart(char *buf); - void reset_target(double); + ~FixRigidNHSmall() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + double compute_scalar() override; + int modify_param(int, char **) override; + void write_restart(FILE *) override; + void restart(char *buf) override; + void reset_target(double) override; protected: double boltz, nktv2p, mvv2e; // boltzman constant, conversion factors diff --git a/src/RIGID/fix_rigid_nph.h b/src/RIGID/fix_rigid_nph.h index 4cdb61c141..0d9de7edc3 100644 --- a/src/RIGID/fix_rigid_nph.h +++ b/src/RIGID/fix_rigid_nph.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNPH : public FixRigidNH { public: FixRigidNPH(class LAMMPS *, int, char **); - ~FixRigidNPH() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_nph_small.h b/src/RIGID/fix_rigid_nph_small.h index ae4d2e6466..3c7245ceae 100644 --- a/src/RIGID/fix_rigid_nph_small.h +++ b/src/RIGID/fix_rigid_nph_small.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNPHSmall : public FixRigidNHSmall { public: FixRigidNPHSmall(class LAMMPS *, int, char **); - ~FixRigidNPHSmall() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_npt.h b/src/RIGID/fix_rigid_npt.h index a4bcda5b3d..a0ba26a06d 100644 --- a/src/RIGID/fix_rigid_npt.h +++ b/src/RIGID/fix_rigid_npt.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNPT : public FixRigidNH { public: FixRigidNPT(class LAMMPS *, int, char **); - ~FixRigidNPT() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_npt_small.h b/src/RIGID/fix_rigid_npt_small.h index 24d4fda374..1d02688bab 100644 --- a/src/RIGID/fix_rigid_npt_small.h +++ b/src/RIGID/fix_rigid_npt_small.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNPTSmall : public FixRigidNHSmall { public: FixRigidNPTSmall(class LAMMPS *, int, char **); - ~FixRigidNPTSmall() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_nve.h b/src/RIGID/fix_rigid_nve.h index b05df5b606..b38203c114 100644 --- a/src/RIGID/fix_rigid_nve.h +++ b/src/RIGID/fix_rigid_nve.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNVE : public FixRigidNH { public: FixRigidNVE(class LAMMPS *, int, char **); - ~FixRigidNVE() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_nve_small.h b/src/RIGID/fix_rigid_nve_small.h index 3cc790befa..0255d1d750 100644 --- a/src/RIGID/fix_rigid_nve_small.h +++ b/src/RIGID/fix_rigid_nve_small.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNVESmall : public FixRigidNHSmall { public: FixRigidNVESmall(class LAMMPS *, int, char **); - ~FixRigidNVESmall() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_nvt.h b/src/RIGID/fix_rigid_nvt.h index 5224fd56ae..7e6bb54937 100644 --- a/src/RIGID/fix_rigid_nvt.h +++ b/src/RIGID/fix_rigid_nvt.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNVT : public FixRigidNH { public: FixRigidNVT(class LAMMPS *, int, char **); - ~FixRigidNVT() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_nvt_small.h b/src/RIGID/fix_rigid_nvt_small.h index edb781884b..0138a3a561 100644 --- a/src/RIGID/fix_rigid_nvt_small.h +++ b/src/RIGID/fix_rigid_nvt_small.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixRigidNVTSmall : public FixRigidNHSmall { public: FixRigidNVTSmall(class LAMMPS *, int, char **); - ~FixRigidNVTSmall() {} }; } // namespace LAMMPS_NS diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 14742155db..e09d4eb569 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -220,7 +220,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"infile") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - delete [] inpfile; + delete[] inpfile; inpfile = utils::strdup(arg[iarg+1]); restart_file = 1; reinitflag = 0; @@ -327,7 +327,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"all") == 0) allremap = 1; else { allremap = 0; - delete [] id_dilate; + delete[] id_dilate; id_dilate = utils::strdup(arg[iarg+1]); int idilate = group->find(id_dilate); if (idilate == -1) @@ -354,7 +354,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"gravity") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - delete [] id_gravity; + delete[] id_gravity; id_gravity = utils::strdup(arg[iarg+1]); iarg += 2; @@ -395,7 +395,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : double time1 = platform::walltime(); create_bodies(bodyID); - if (customflag) delete [] bodyID; + if (customflag) delete[] bodyID; if (comm->me == 0) utils::logmesg(lmp," create bodies CPU = {:.3f} seconds\n", @@ -501,9 +501,9 @@ FixRigidSmall::~FixRigidSmall() memory->destroy(dorient); delete random; - delete [] inpfile; - delete [] id_dilate; - delete [] id_gravity; + delete[] inpfile; + delete[] id_dilate; + delete[] id_gravity; memory->destroy(langextra); memory->destroy(mass_body); @@ -1351,8 +1351,8 @@ void FixRigidSmall::set_xv() vr[4] = 0.5*x0*fc2; vr[5] = 0.5*x1*fc2; - double rlist[][3] = {x0, x1, x2}; - double flist[][3] = {0.5*fc0, 0.5*fc1, 0.5*fc2}; + double rlist[1][3] = {{x0, x1, x2}}; + double flist[1][3] = {{0.5*fc0, 0.5*fc1, 0.5*fc2}}; v_tally(1,&i,1.0,vr,rlist,flist,b->xgc); } } @@ -1513,8 +1513,8 @@ void FixRigidSmall::set_v() vr[4] = 0.5*x0*fc2; vr[5] = 0.5*x1*fc2; - double rlist[][3] = {x0, x1, x2}; - double flist[][3] = {0.5*fc0, 0.5*fc1, 0.5*fc2}; + double rlist[1][3] = {{x0, x1, x2}}; + double flist[1][3] = {{0.5*fc0, 0.5*fc1, 0.5*fc2}}; v_tally(1,&i,1.0,vr,rlist,flist,b->xgc); } } @@ -2578,8 +2578,8 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (me == 0) fclose(fp); - delete [] buffer; - delete [] values; + delete[] buffer; + delete[] values; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_rigid_small.h b/src/RIGID/fix_rigid_small.h index e289c179d9..1a5f224d58 100644 --- a/src/RIGID/fix_rigid_small.h +++ b/src/RIGID/fix_rigid_small.h @@ -29,43 +29,43 @@ class FixRigidSmall : public Fix { public: FixRigidSmall(class LAMMPS *, int, char **); - virtual ~FixRigidSmall(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - void post_force(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); - void write_restart_file(const char *); + ~FixRigidSmall() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void post_force(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void write_restart_file(const char *) override; - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - virtual void set_molecule(int, tagint, int, double *, double *, double *); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + void set_molecule(int, tagint, int, double *, double *, double *) override; - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; - void setup_pre_neighbor(); - void pre_neighbor(); - int dof(int); - void deform(int); - void enforce2d(); - void reset_dt(); - void zero_momentum(); - void zero_rotation(); - int modify_param(int, char **); - void *extract(const char *, int &); + void setup_pre_neighbor() override; + void pre_neighbor() override; + int dof(int) override; + void deform(int) override; + void enforce2d() override; + void reset_dt() override; + void zero_momentum() override; + void zero_rotation() override; + int modify_param(int, char **) override; + void *extract(const char *, int &) override; double extract_ke(); double extract_erotational(); - double compute_scalar(); - double memory_usage(); + double compute_scalar() override; + double memory_usage() override; protected: int me, nprocs; @@ -84,8 +84,9 @@ class FixRigidSmall : public Fix { double maxextent; // furthest distance from body owner to body atom struct Body { - double mass; // total mass of body int natoms; // total number of atoms in body + int ilocal; // index of owning atom + double mass; // total mass of body double xcm[3]; // COM position double xgc[3]; // geometric center position double vcm[3]; // COM velocity @@ -97,12 +98,12 @@ class FixRigidSmall : public Fix { double ey_space[3]; double ez_space[3]; double xgc_body[3]; // geometric center relative to xcm in body coords - double angmom[3]; // space-frame angular momentum of body - double omega[3]; // space-frame omega of body - double conjqm[4]; // conjugate quaternion momentum - imageint image; // image flags of xcm - int remapflag[4]; // PBC remap flags - int ilocal; // index of owning atom + double angmom[3]; // space-frame angular momentum of body + double omega[3]; // space-frame omega of body + double conjqm[4]; // conjugate quaternion momentum + int remapflag[4]; // PBC remap flags + imageint image; // image flags of xcm + imageint dummy; // dummy entry for better alignment }; Body *body; // list of rigid bodies, owned and ghost diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index 3db415281d..5a956bd798 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -30,33 +30,33 @@ class FixShake : public Fix { public: FixShake(class LAMMPS *, int, char **); - virtual ~FixShake(); - virtual int setmask(); - virtual void init(); - void setup(int); - virtual void pre_neighbor(); - virtual void post_force(int); - virtual void post_force_respa(int, int, int); + ~FixShake() override; + int setmask() override; + void init() override; + void setup(int) override; + void pre_neighbor() override; + void post_force(int) override; + void post_force_respa(int, int, int) override; - virtual double memory_usage(); - virtual void grow_arrays(int); - virtual void copy_arrays(int, int, int); - virtual void set_arrays(int); - virtual void update_arrays(int, int); - virtual void set_molecule(int, tagint, int, double *, double *, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + void update_arrays(int, int) override; + void set_molecule(int, tagint, int, double *, double *, double *) override; - virtual int pack_exchange(int, double *); - virtual int unpack_exchange(int, double *); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; virtual void shake_end_of_step(int vflag); virtual void correct_coordinates(int vflag); virtual void correct_velocities(); - virtual int dof(int); - virtual void reset_dt(); - void *extract(const char *, int &); + int dof(int) override; + void reset_dt() override; + void *extract(const char *, int &) override; protected: int vflag_post_force; // store the vflag of last post_force call diff --git a/src/SCAFACOS/scafacos.h b/src/SCAFACOS/scafacos.h index b42c4df437..0ea0008c19 100644 --- a/src/SCAFACOS/scafacos.h +++ b/src/SCAFACOS/scafacos.h @@ -28,13 +28,13 @@ namespace LAMMPS_NS { class Scafacos : public KSpace { public: Scafacos(class LAMMPS *); - ~Scafacos(); - void init(); - void setup() {} - void settings(int, char **); - void compute(int, int); - int modify_param(int, char **); - double memory_usage(); + ~Scafacos() override; + void init() override; + void setup() override {} + void settings(int, char **) override; + void compute(int, int) override; + int modify_param(int, char **) override; + double memory_usage() override; private: int me; diff --git a/src/SHOCK/fix_append_atoms.h b/src/SHOCK/fix_append_atoms.h index a8ba145b97..41c14a2c20 100644 --- a/src/SHOCK/fix_append_atoms.h +++ b/src/SHOCK/fix_append_atoms.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixAppendAtoms : public Fix { public: FixAppendAtoms(class LAMMPS *, int, char **); - ~FixAppendAtoms(); - int setmask(); - void setup(int); - void pre_exchange(); - void initial_integrate(int); - void post_force(int); + ~FixAppendAtoms() override; + int setmask() override; + void setup(int) override; + void pre_exchange() override; + void initial_integrate(int) override; + void post_force(int) override; private: int get_spatial(); diff --git a/src/SHOCK/fix_msst.h b/src/SHOCK/fix_msst.h index 76bfbf6d55..98b47c60f6 100644 --- a/src/SHOCK/fix_msst.h +++ b/src/SHOCK/fix_msst.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class FixMSST : public Fix { public: FixMSST(class LAMMPS *, int, char **); - ~FixMSST(); - int setmask(); - void init(); - void setup(int); - void initial_integrate(int); - void final_integrate(); - double compute_scalar(); - double compute_vector(int); - void write_restart(FILE *); - void restart(char *); - int modify_param(int, char **); - double memory_usage(); + ~FixMSST() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + double compute_scalar() override; + double compute_vector(int) override; + void write_restart(FILE *) override; + void restart(char *) override; + int modify_param(int, char **) override; + double memory_usage() override; private: double dtv, dtf, dthalf; // full and half step sizes diff --git a/src/SHOCK/fix_nphug.h b/src/SHOCK/fix_nphug.h index 57b4dabc9c..9c67b070d3 100644 --- a/src/SHOCK/fix_nphug.h +++ b/src/SHOCK/fix_nphug.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class FixNPHug : public FixNH { public: FixNPHug(class LAMMPS *, int, char **); - ~FixNPHug(); - void init(); - void setup(int); - int modify_param(int, char **); - int pack_restart_data(double *); // pack restart data - void restart(char *); + ~FixNPHug() override; + void init() override; + void setup(int) override; + int modify_param(int, char **) override; + int pack_restart_data(double *) override; // pack restart data + void restart(char *) override; private: class Compute *pe; // PE compute pointer - void compute_temp_target(); - double compute_vector(int); + void compute_temp_target() override; + double compute_vector(int) override; double compute_etotal(); double compute_vol(); double compute_hugoniot(); @@ -52,7 +52,7 @@ class FixNPHug : public FixNH { int idir; int uniaxial; - int size_restart_global(); + int size_restart_global() override; }; } // namespace LAMMPS_NS diff --git a/src/SHOCK/fix_wall_piston.h b/src/SHOCK/fix_wall_piston.h index 5d2e02a21e..3e9f73fd94 100644 --- a/src/SHOCK/fix_wall_piston.h +++ b/src/SHOCK/fix_wall_piston.h @@ -26,10 +26,10 @@ namespace LAMMPS_NS { class FixWallPiston : public Fix { public: FixWallPiston(class LAMMPS *, int, char **); - virtual ~FixWallPiston(); - int setmask(); - void post_integrate(); - void initial_integrate(int); + ~FixWallPiston() override; + int setmask() override; + void post_integrate() override; + void initial_integrate(int) override; private: int xloflag, xhiflag, yloflag, yhiflag, zloflag, zhiflag; diff --git a/src/SMTBQ/pair_smtbq.h b/src/SMTBQ/pair_smtbq.h index ec2de51fbc..636cff8266 100644 --- a/src/SMTBQ/pair_smtbq.h +++ b/src/SMTBQ/pair_smtbq.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class PairSMTBQ : public Pair { public: PairSMTBQ(class LAMMPS *); - virtual ~PairSMTBQ(); - virtual void compute(int, int); + ~PairSMTBQ() override; + void compute(int, int) override; - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - double memory_usage(); + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + double memory_usage() override; protected: struct Param { @@ -140,10 +140,10 @@ class PairSMTBQ : public Pair { // =========================================== // Communication pack - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void forward(double *); void reverse(double *); void forward_int(int *); diff --git a/src/SPH/atom_vec_sph.h b/src/SPH/atom_vec_sph.h index 2ff254da68..8af3ac2fc3 100644 --- a/src/SPH/atom_vec_sph.h +++ b/src/SPH/atom_vec_sph.h @@ -28,12 +28,12 @@ class AtomVecSPH : public AtomVec { public: AtomVecSPH(class LAMMPS *); - void grow_pointers(); - void force_clear(int, size_t); - void create_atom_post(int); - void data_atom_post(int); - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void create_atom_post(int) override; + void data_atom_post(int) override; + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; private: double *rho, *drho, *esph, *desph, *cv; diff --git a/src/SPH/compute_sph_e_atom.h b/src/SPH/compute_sph_e_atom.h index fa6d995dcc..00ff5550d7 100644 --- a/src/SPH/compute_sph_e_atom.h +++ b/src/SPH/compute_sph_e_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeSPHEAtom : public Compute { public: ComputeSPHEAtom(class LAMMPS *, int, char **); - ~ComputeSPHEAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSPHEAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/SPH/compute_sph_rho_atom.h b/src/SPH/compute_sph_rho_atom.h index 9c3a367b6c..a3a366df07 100644 --- a/src/SPH/compute_sph_rho_atom.h +++ b/src/SPH/compute_sph_rho_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeSPHRhoAtom : public Compute { public: ComputeSPHRhoAtom(class LAMMPS *, int, char **); - ~ComputeSPHRhoAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSPHRhoAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/SPH/compute_sph_t_atom.h b/src/SPH/compute_sph_t_atom.h index 937ab6da33..786fb8b063 100644 --- a/src/SPH/compute_sph_t_atom.h +++ b/src/SPH/compute_sph_t_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeSPHTAtom : public Compute { public: ComputeSPHTAtom(class LAMMPS *, int, char **); - ~ComputeSPHTAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeSPHTAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/SPH/fix_sph.h b/src/SPH/fix_sph.h index 5b3d25f666..0bb9f2f965 100644 --- a/src/SPH/fix_sph.h +++ b/src/SPH/fix_sph.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixSPH : public Fix { public: FixSPH(class LAMMPS *, int, char **); - int setmask(); - virtual void init(); - virtual void setup_pre_force(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - void reset_dt(); + int setmask() override; + void init() override; + void setup_pre_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; private: class NeighList *list; diff --git a/src/SPH/fix_sph_stationary.h b/src/SPH/fix_sph_stationary.h index 8dde541b0a..b558aba917 100644 --- a/src/SPH/fix_sph_stationary.h +++ b/src/SPH/fix_sph_stationary.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixSPHStationary : public Fix { public: FixSPHStationary(class LAMMPS *, int, char **); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; private: class NeighList *list; diff --git a/src/SPH/pair_sph_heatconduction.h b/src/SPH/pair_sph_heatconduction.h index bf8a96773f..de35075680 100644 --- a/src/SPH/pair_sph_heatconduction.h +++ b/src/SPH/pair_sph_heatconduction.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairSPHHeatConduction : public Pair { public: PairSPHHeatConduction(class LAMMPS *); - virtual ~PairSPHHeatConduction(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairSPHHeatConduction() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double **cut, **alpha; diff --git a/src/SPH/pair_sph_idealgas.h b/src/SPH/pair_sph_idealgas.h index ad185bcd25..a9c1e25b05 100644 --- a/src/SPH/pair_sph_idealgas.h +++ b/src/SPH/pair_sph_idealgas.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairSPHIdealGas : public Pair { public: PairSPHIdealGas(class LAMMPS *); - virtual ~PairSPHIdealGas(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairSPHIdealGas() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double **cut, **viscosity; diff --git a/src/SPH/pair_sph_lj.h b/src/SPH/pair_sph_lj.h index a934993805..7fe51ed39f 100644 --- a/src/SPH/pair_sph_lj.h +++ b/src/SPH/pair_sph_lj.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class PairSPHLJ : public Pair { public: PairSPHLJ(class LAMMPS *); - virtual ~PairSPHLJ(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairSPHLJ() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; //double LJEOS(int); void LJEOS2(double, double, double, double *, double *); diff --git a/src/SPH/pair_sph_rhosum.h b/src/SPH/pair_sph_rhosum.h index 9874e6e2eb..f2021360ca 100644 --- a/src/SPH/pair_sph_rhosum.h +++ b/src/SPH/pair_sph_rhosum.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class PairSPHRhoSum : public Pair { public: PairSPHRhoSum(class LAMMPS *); - virtual ~PairSPHRhoSum(); - void init_style(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~PairSPHRhoSum() override; + void init_style() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: double **cut; diff --git a/src/SPH/pair_sph_taitwater.h b/src/SPH/pair_sph_taitwater.h index d162106691..40cda898b7 100644 --- a/src/SPH/pair_sph_taitwater.h +++ b/src/SPH/pair_sph_taitwater.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairSPHTaitwater : public Pair { public: PairSPHTaitwater(class LAMMPS *); - virtual ~PairSPHTaitwater(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); + ~PairSPHTaitwater() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; protected: double *rho0, *soundspeed, *B; diff --git a/src/SPH/pair_sph_taitwater_morris.h b/src/SPH/pair_sph_taitwater_morris.h index 7c1d377319..1bd0153b5f 100644 --- a/src/SPH/pair_sph_taitwater_morris.h +++ b/src/SPH/pair_sph_taitwater_morris.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairSPHTaitwaterMorris : public Pair { public: PairSPHTaitwaterMorris(class LAMMPS *); - virtual ~PairSPHTaitwaterMorris(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); + ~PairSPHTaitwaterMorris() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; protected: double *rho0, *soundspeed, *B; diff --git a/src/SPIN/atom_vec_spin.h b/src/SPIN/atom_vec_spin.h index ff995d2f13..de376475ea 100644 --- a/src/SPIN/atom_vec_spin.h +++ b/src/SPIN/atom_vec_spin.h @@ -28,9 +28,9 @@ class AtomVecSpin : public AtomVec { public: AtomVecSpin(class LAMMPS *); - void grow_pointers(); - void force_clear(int, size_t); - void data_atom_post(int); + void grow_pointers() override; + void force_clear(int, size_t) override; + void data_atom_post(int) override; private: double **sp, **fm, **fm_long; diff --git a/src/SPIN/compute_spin.h b/src/SPIN/compute_spin.h index 766cfa4ccd..7f85053c0c 100644 --- a/src/SPIN/compute_spin.h +++ b/src/SPIN/compute_spin.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeSpin : public Compute { public: ComputeSpin(class LAMMPS *, int, char **); - ~ComputeSpin(); - void init(); - void compute_vector(); + ~ComputeSpin() override; + void init() override; + void compute_vector() override; private: int pair_spin_flag; // magnetic pair flags diff --git a/src/SPIN/fix_langevin_spin.h b/src/SPIN/fix_langevin_spin.h index c9608748d9..d5262fae64 100644 --- a/src/SPIN/fix_langevin_spin.h +++ b/src/SPIN/fix_langevin_spin.h @@ -29,10 +29,10 @@ class FixLangevinSpin : public Fix { int tdamp_flag, temp_flag; // damping and temperature flags FixLangevinSpin(class LAMMPS *, int, char **); - virtual ~FixLangevinSpin(); - int setmask(); - void init(); - void setup(int); + ~FixLangevinSpin() override; + int setmask() override; + void init() override; + void setup(int) override; void add_tdamping(double *, double *); // add transverse damping void add_temperature(double[3]); void compute_single_langevin(int, double *, double *); diff --git a/src/SPIN/fix_neb_spin.h b/src/SPIN/fix_neb_spin.h index 5ddef9c791..79fbdf454d 100644 --- a/src/SPIN/fix_neb_spin.h +++ b/src/SPIN/fix_neb_spin.h @@ -30,11 +30,11 @@ class FixNEBSpin : public Fix { int rclimber; FixNEBSpin(class LAMMPS *, int, char **); - ~FixNEBSpin(); - int setmask(); - void init(); - void min_setup(int); - void min_post_force(int); + ~FixNEBSpin() override; + int setmask() override; + void init() override; + void min_setup(int) override; + void min_post_force(int) override; private: int me, nprocs, nprocs_universe; diff --git a/src/SPIN/fix_nve_spin.h b/src/SPIN/fix_nve_spin.h index 718eb3a733..b468f60fc0 100644 --- a/src/SPIN/fix_nve_spin.h +++ b/src/SPIN/fix_nve_spin.h @@ -29,11 +29,11 @@ class FixNVESpin : public Fix { public: FixNVESpin(class LAMMPS *, int, char **); - virtual ~FixNVESpin(); - int setmask(); - void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); + ~FixNVESpin() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; void ComputeInteractionsSpin(int); // compute and advance single spin functions void AdvanceSingleSpin(int); @@ -41,8 +41,8 @@ class FixNVESpin : public Fix { void sectoring(); // sectoring operation functions int coords2sector(double *); - void setup_pre_neighbor(); - void pre_neighbor(); + void setup_pre_neighbor() override; + void pre_neighbor() override; int lattice_flag; // lattice_flag = 0 if spins only // lattice_flag = 1 if spin-lattice calc. diff --git a/src/SPIN/fix_precession_spin.h b/src/SPIN/fix_precession_spin.h index dafc729337..96c369b43a 100644 --- a/src/SPIN/fix_precession_spin.h +++ b/src/SPIN/fix_precession_spin.h @@ -29,15 +29,15 @@ class FixPrecessionSpin : public Fix { public: FixPrecessionSpin(class LAMMPS *, int, char **); - ~FixPrecessionSpin(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); + ~FixPrecessionSpin() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; int zeeman_flag, stt_flag, aniso_flag, cubic_flag, hexaniso_flag; void compute_single_precession(int, double *, double *); diff --git a/src/SPIN/fix_setforce_spin.h b/src/SPIN/fix_setforce_spin.h index 678a00da37..bc018e02e5 100644 --- a/src/SPIN/fix_setforce_spin.h +++ b/src/SPIN/fix_setforce_spin.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixSetForceSpin : public FixSetForce { public: FixSetForceSpin(class LAMMPS *, int, char **); - virtual void post_force(int); - void post_force_respa(int, int, int); + void post_force(int) override; + void post_force_respa(int, int, int) override; void single_setforce_spin(int, double *); }; diff --git a/src/SPIN/min_spin.h b/src/SPIN/min_spin.h index 929528defd..14117d9189 100644 --- a/src/SPIN/min_spin.h +++ b/src/SPIN/min_spin.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class MinSpin : public Min { public: MinSpin(class LAMMPS *); - ~MinSpin() {} - void init(); - void setup_style(); - int modify_param(int, char **); - void reset_vectors(); - int iterate(int); + + void init() override; + void setup_style() override; + int modify_param(int, char **) override; + void reset_vectors() override; + int iterate(int) override; double evaluate_dt(); void advance_spins(double); diff --git a/src/SPIN/min_spin_cg.h b/src/SPIN/min_spin_cg.h index b1ee51da85..581a343233 100644 --- a/src/SPIN/min_spin_cg.h +++ b/src/SPIN/min_spin_cg.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class MinSpinCG : public Min { public: MinSpinCG(class LAMMPS *); - virtual ~MinSpinCG(); - void init(); - void setup_style(); - void reset_vectors(); - int modify_param(int, char **); - int iterate(int); + ~MinSpinCG() override; + void init() override; + void setup_style() override; + void reset_vectors() override; + int modify_param(int, char **) override; + int iterate(int) override; private: int local_iter; // for neb diff --git a/src/SPIN/min_spin_lbfgs.h b/src/SPIN/min_spin_lbfgs.h index 0bc81c2113..bc8ae42567 100644 --- a/src/SPIN/min_spin_lbfgs.h +++ b/src/SPIN/min_spin_lbfgs.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class MinSpinLBFGS : public Min { public: MinSpinLBFGS(class LAMMPS *); - virtual ~MinSpinLBFGS(); - void init(); - void setup_style(); - int modify_param(int, char **); - void reset_vectors(); - int iterate(int); + ~MinSpinLBFGS() override; + void init() override; + void setup_style() override; + int modify_param(int, char **) override; + void reset_vectors() override; + int iterate(int) override; private: int local_iter; // for neb diff --git a/src/SPIN/neb_spin.h b/src/SPIN/neb_spin.h index 8de68830d6..b667215520 100644 --- a/src/SPIN/neb_spin.h +++ b/src/SPIN/neb_spin.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class NEBSpin : public Command { public: NEBSpin(class LAMMPS *); - ~NEBSpin(); - void command(int, char **); // process neb/spin command + ~NEBSpin() override; + void command(int, char **) override; // process neb/spin command void run(); // run NEBSpin double ebf, ebr; // forward and reverse energy barriers diff --git a/src/SPIN/pair_spin.h b/src/SPIN/pair_spin.h index a9341bcb71..598d114ebd 100644 --- a/src/SPIN/pair_spin.h +++ b/src/SPIN/pair_spin.h @@ -23,14 +23,14 @@ class PairSpin : public Pair { public: PairSpin(class LAMMPS *); - virtual ~PairSpin() = default; - virtual void settings(int, char **); - virtual void coeff(int, char **) {} - virtual void init_style(); - virtual double init_one(int, int) { return 0.0; } - virtual void *extract(const char *, int &) { return nullptr; } - virtual void compute(int, int) {} + void settings(int, char **) override; + void coeff(int, char **) override {} + void init_style() override; + double init_one(int, int) override { return 0.0; } + void *extract(const char *, int &) override { return nullptr; } + + void compute(int, int) override {} virtual void compute_single_pair(int, double *) {} // storing magnetic energies diff --git a/src/SPIN/pair_spin_dipole_cut.h b/src/SPIN/pair_spin_dipole_cut.h index abda4bb206..2fe443e71e 100644 --- a/src/SPIN/pair_spin_dipole_cut.h +++ b/src/SPIN/pair_spin_dipole_cut.h @@ -30,22 +30,22 @@ class PairSpinDipoleCut : public PairSpin { double **sigma; PairSpinDipoleCut(LAMMPS *); - virtual ~PairSpinDipoleCut(); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinDipoleCut() override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_dipolar(int, int, double *, double *, double *, double *, double); void compute_dipolar_mech(int, int, double *, double *, double *, double *, double); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_long_global; // global long cutoff distance @@ -61,7 +61,7 @@ class PairSpinDipoleCut : public PairSpin { double g_ewald; int ewald_order; - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SPIN/pair_spin_dipole_long.h b/src/SPIN/pair_spin_dipole_long.h index c70d23bdd5..7a0560f7d8 100644 --- a/src/SPIN/pair_spin_dipole_long.h +++ b/src/SPIN/pair_spin_dipole_long.h @@ -30,23 +30,23 @@ class PairSpinDipoleLong : public PairSpin { double **sigma; PairSpinDipoleLong(LAMMPS *); - virtual ~PairSpinDipoleLong(); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinDipoleLong() override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_long(int, int, double *, double *, double *, double *, double *); void compute_long_mech(int, int, double *, double *, double *, double *, double *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_long_global; // global long cutoff distance @@ -62,7 +62,7 @@ class PairSpinDipoleLong : public PairSpin { double g_ewald; int ewald_order; - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SPIN/pair_spin_dmi.h b/src/SPIN/pair_spin_dmi.h index bdd02946af..9462afae58 100644 --- a/src/SPIN/pair_spin_dmi.h +++ b/src/SPIN/pair_spin_dmi.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairSpinDmi : public PairSpin { public: PairSpinDmi(LAMMPS *lmp) : PairSpin(lmp) {} - virtual ~PairSpinDmi(); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinDmi() override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_dmi(int, int, double *, double *, double *); void compute_dmi_mech(int, int, double, double *, double *, double *, double *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_dmi_global; // short range pair cutoff @@ -52,7 +52,7 @@ class PairSpinDmi : public PairSpin { double **vmech_dmx, **vmech_dmy, **vmech_dmz; // dmi mech direction double **cut_spin_dmi; // cutoff distance dmi - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SPIN/pair_spin_exchange.h b/src/SPIN/pair_spin_exchange.h index 0dd3d06fc5..485157d49e 100644 --- a/src/SPIN/pair_spin_exchange.h +++ b/src/SPIN/pair_spin_exchange.h @@ -27,23 +27,23 @@ namespace LAMMPS_NS { class PairSpinExchange : public PairSpin { public: PairSpinExchange(class LAMMPS *); - virtual ~PairSpinExchange(); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinExchange() override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_exchange(int, int, double, double *, double *); void compute_exchange_mech(int, int, double, double *, double *, double *, double *); double compute_energy(int, int, double, double *, double *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_exchange_global; // global exchange cutoff distance @@ -54,7 +54,7 @@ class PairSpinExchange : public PairSpin { double **J2, **J3; // J1 in eV, J2 adim, J3 in Ang double **cut_spin_exchange; // cutoff distance exchange - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SPIN/pair_spin_exchange_biquadratic.h b/src/SPIN/pair_spin_exchange_biquadratic.h index ccfe874fff..0a0b7be5ba 100644 --- a/src/SPIN/pair_spin_exchange_biquadratic.h +++ b/src/SPIN/pair_spin_exchange_biquadratic.h @@ -27,23 +27,23 @@ namespace LAMMPS_NS { class PairSpinExchangeBiquadratic : public PairSpin { public: PairSpinExchangeBiquadratic(class LAMMPS *); - virtual ~PairSpinExchangeBiquadratic(); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinExchangeBiquadratic() override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_exchange(int, int, double, double *, double *, double *); void compute_exchange_mech(int, int, double, double *, double *, double *, double *); double compute_energy(int, int, double, double *, double *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_exchange_global; // global exchange cutoff distance @@ -57,7 +57,7 @@ class PairSpinExchangeBiquadratic : public PairSpin { double **K2, **K3; // K1 in eV, K2 Ang-1, K3 in Ang double **cut_spin_exchange; // cutoff distance exchange - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SPIN/pair_spin_magelec.h b/src/SPIN/pair_spin_magelec.h index 08f60f5a02..ece4534d0b 100644 --- a/src/SPIN/pair_spin_magelec.h +++ b/src/SPIN/pair_spin_magelec.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class PairSpinMagelec : public PairSpin { public: PairSpinMagelec(LAMMPS *lmp) : PairSpin(lmp) {} - virtual ~PairSpinMagelec(); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinMagelec() override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_magelec(int, int, double *, double *, double *); void compute_magelec_mech(int, int, double *, double *, double *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_magelec_global; // global me cutoff @@ -51,7 +51,7 @@ class PairSpinMagelec : public PairSpin { double **v_mex, **v_mey, **v_mez; // magelec direction double **cut_spin_magelec; // magelec cutoff distance - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SPIN/pair_spin_neel.h b/src/SPIN/pair_spin_neel.h index 046171927e..192a6e5129 100644 --- a/src/SPIN/pair_spin_neel.h +++ b/src/SPIN/pair_spin_neel.h @@ -27,23 +27,23 @@ namespace LAMMPS_NS { class PairSpinNeel : public PairSpin { public: PairSpinNeel(LAMMPS *lmp) : PairSpin(lmp) {} - virtual ~PairSpinNeel(); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void *extract(const char *, int &); + ~PairSpinNeel() override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void *extract(const char *, int &) override; - void compute(int, int); - void compute_single_pair(int, double *); + void compute(int, int) override; + void compute_single_pair(int, double *) override; void compute_neel(int, int, double, double *, double *, double *, double *); void compute_neel_mech(int, int, double, double *, double *, double *, double *); double compute_neel_energy(int, int, double, double *, double *, double *); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; double cut_spin_neel_global; // global neel cutoff distance @@ -56,7 +56,7 @@ class PairSpinNeel : public PairSpin { double **q2, **q3; // q1 in eV, q2 adim, q3 in Ang double **cut_spin_neel; // cutoff distance exchange - void allocate(); + void allocate() override; }; } // namespace LAMMPS_NS diff --git a/src/SRD/fix_srd.h b/src/SRD/fix_srd.h index e4dd557394..e6a203cba4 100644 --- a/src/SRD/fix_srd.h +++ b/src/SRD/fix_srd.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixSRD : public Fix { public: FixSRD(class LAMMPS *, int, char **); - ~FixSRD(); - int setmask(); - void init(); - void setup(int); - void pre_neighbor(); - void post_force(int); - double compute_vector(int); + ~FixSRD() override; + int setmask() override; + void init() override; + void setup(int) override; + void pre_neighbor() override; + void post_force(int) override; + double compute_vector(int) override; - double memory_usage(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + double memory_usage() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; private: int me, nprocs; diff --git a/src/SRD/fix_wall_srd.h b/src/SRD/fix_wall_srd.h index 81c0064721..ecd16c6e6d 100644 --- a/src/SRD/fix_wall_srd.h +++ b/src/SRD/fix_wall_srd.h @@ -32,10 +32,10 @@ class FixWallSRD : public Fix { double **fwall; FixWallSRD(class LAMMPS *, int, char **); - ~FixWallSRD(); - int setmask(); - void init(); - double compute_array(int, int); + ~FixWallSRD() override; + int setmask() override; + void init() override; + double compute_array(int, int) override; void wall_params(int); diff --git a/src/TALLY/compute_force_tally.h b/src/TALLY/compute_force_tally.h index f35ea9ad0a..a46e074103 100644 --- a/src/TALLY/compute_force_tally.h +++ b/src/TALLY/compute_force_tally.h @@ -28,19 +28,19 @@ class ComputeForceTally : public Compute { public: ComputeForceTally(class LAMMPS *, int, char **); - virtual ~ComputeForceTally(); + ~ComputeForceTally() override; - void init(); + void init() override; - double compute_scalar(); - void compute_peratom(); + double compute_scalar() override; + void compute_peratom() override; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; - void pair_setup_callback(int, int); - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double); + void pair_setup_callback(int, int) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; private: bigint did_setup; diff --git a/src/TALLY/compute_heat_flux_tally.h b/src/TALLY/compute_heat_flux_tally.h index 234afa8c68..8110ad6fc7 100644 --- a/src/TALLY/compute_heat_flux_tally.h +++ b/src/TALLY/compute_heat_flux_tally.h @@ -28,18 +28,18 @@ class ComputeHeatFluxTally : public Compute { public: ComputeHeatFluxTally(class LAMMPS *, int, char **); - virtual ~ComputeHeatFluxTally(); + ~ComputeHeatFluxTally() override; - void init(); + void init() override; - void compute_vector(); + void compute_vector() override; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; - void pair_setup_callback(int, int); - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double); + void pair_setup_callback(int, int) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; private: bigint did_setup; diff --git a/src/TALLY/compute_heat_flux_virial_tally.h b/src/TALLY/compute_heat_flux_virial_tally.h index d2a3d39a7d..1d664ce560 100644 --- a/src/TALLY/compute_heat_flux_virial_tally.h +++ b/src/TALLY/compute_heat_flux_virial_tally.h @@ -28,19 +28,19 @@ class ComputeHeatFluxVirialTally : public Compute { public: ComputeHeatFluxVirialTally(class LAMMPS *, int, char **); - virtual ~ComputeHeatFluxVirialTally(); + ~ComputeHeatFluxVirialTally() override; - void init(); + void init() override; - double compute_scalar(); - void compute_peratom(); + double compute_scalar() override; + void compute_peratom() override; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; - void pair_setup_callback(int, int); - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double); + void pair_setup_callback(int, int) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; private: bigint did_setup; diff --git a/src/TALLY/compute_pe_mol_tally.h b/src/TALLY/compute_pe_mol_tally.h index 3f7457aad5..b123d7cf78 100644 --- a/src/TALLY/compute_pe_mol_tally.h +++ b/src/TALLY/compute_pe_mol_tally.h @@ -28,13 +28,13 @@ class ComputePEMolTally : public Compute { public: ComputePEMolTally(class LAMMPS *, int, char **); - virtual ~ComputePEMolTally(); + ~ComputePEMolTally() override; - void init(); - void compute_vector(); + void init() override; + void compute_vector() override; - void pair_setup_callback(int, int); - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double); + void pair_setup_callback(int, int) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; private: bigint did_setup; diff --git a/src/TALLY/compute_pe_tally.h b/src/TALLY/compute_pe_tally.h index 8f6f42a685..dfccce5f7e 100644 --- a/src/TALLY/compute_pe_tally.h +++ b/src/TALLY/compute_pe_tally.h @@ -28,19 +28,19 @@ class ComputePETally : public Compute { public: ComputePETally(class LAMMPS *, int, char **); - virtual ~ComputePETally(); + ~ComputePETally() override; - void init(); + void init() override; - double compute_scalar(); - void compute_peratom(); + double compute_scalar() override; + void compute_peratom() override; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; - void pair_setup_callback(int, int); - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double); + void pair_setup_callback(int, int) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; private: bigint did_setup; diff --git a/src/TALLY/compute_stress_tally.h b/src/TALLY/compute_stress_tally.h index 709a8caa8f..9910667df3 100644 --- a/src/TALLY/compute_stress_tally.h +++ b/src/TALLY/compute_stress_tally.h @@ -28,19 +28,19 @@ class ComputeStressTally : public Compute { public: ComputeStressTally(class LAMMPS *, int, char **); - virtual ~ComputeStressTally(); + ~ComputeStressTally() override; - void init(); + void init() override; - double compute_scalar(); - void compute_peratom(); + double compute_scalar() override; + void compute_peratom() override; - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; - void pair_setup_callback(int, int); - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double); + void pair_setup_callback(int, int) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; private: bigint did_setup; diff --git a/src/UEF/compute_pressure_uef.h b/src/UEF/compute_pressure_uef.h index cbbd241119..d969f2f7ad 100644 --- a/src/UEF/compute_pressure_uef.h +++ b/src/UEF/compute_pressure_uef.h @@ -29,10 +29,10 @@ namespace LAMMPS_NS { class ComputePressureUef : public ComputePressure { public: ComputePressureUef(class LAMMPS *, int, char **); - virtual ~ComputePressureUef() {} - virtual void init(); - virtual void compute_vector(); - virtual double compute_scalar(); + + void init() override; + void compute_vector() override; + double compute_scalar() override; void update_rot(); bool in_fix; //true if this compute is used in fix/nvt/npt diff --git a/src/UEF/compute_temp_uef.h b/src/UEF/compute_temp_uef.h index 92e9293040..eb5bdac37d 100644 --- a/src/UEF/compute_temp_uef.h +++ b/src/UEF/compute_temp_uef.h @@ -29,9 +29,9 @@ namespace LAMMPS_NS { class ComputeTempUef : public ComputeTemp { public: ComputeTempUef(class LAMMPS *, int, char **); - virtual ~ComputeTempUef() {} - virtual void init(); - virtual void compute_vector(); + + void init() override; + void compute_vector() override; void yes_rot(); void no_rot(); diff --git a/src/UEF/dump_cfg_uef.h b/src/UEF/dump_cfg_uef.h index 56df6db033..d4fa3bfc02 100644 --- a/src/UEF/dump_cfg_uef.h +++ b/src/UEF/dump_cfg_uef.h @@ -29,8 +29,8 @@ namespace LAMMPS_NS { class DumpCFGUef : public DumpCFG { public: DumpCFGUef(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) {} - void init_style(); - void write_header(bigint); + void init_style() override; + void write_header(bigint) override; protected: int ifix_uef; diff --git a/src/UEF/fix_nh_uef.h b/src/UEF/fix_nh_uef.h index b8fb776366..8f74de7bbb 100644 --- a/src/UEF/fix_nh_uef.h +++ b/src/UEF/fix_nh_uef.h @@ -27,28 +27,28 @@ namespace UEF_utils { class FixNHUef : public FixNH { public: FixNHUef(class LAMMPS *, int, char **); - virtual ~FixNHUef(); - virtual int setmask(); - virtual void init(); - virtual void setup(int); - virtual void pre_exchange(); - virtual int pack_restart_data(double *); - virtual void restart(char *); - virtual void end_of_step(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - virtual void post_run(); + ~FixNHUef() override; + int setmask() override; + void init() override; + void setup(int) override; + void pre_exchange() override; + int pack_restart_data(double *) override; + void restart(char *) override; + void end_of_step() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void post_run() override; void get_rot(double[3][3]); void get_ext_flags(bool *); void get_box(double[3][3]); protected: - virtual void remap(); - virtual int size_restart_global(); - virtual void nve_x(); - virtual void nve_v(); + void remap() override; + int size_restart_global() override; + void nve_x() override; + void nve_v() override; void rotate_x(double[3][3]); void inv_rotate_x(double[3][3]); void rotate_v(double[3][3]); diff --git a/src/UEF/fix_npt_uef.h b/src/UEF/fix_npt_uef.h index a46b388412..565e12e19b 100644 --- a/src/UEF/fix_npt_uef.h +++ b/src/UEF/fix_npt_uef.h @@ -29,7 +29,6 @@ namespace LAMMPS_NS { class FixNPTUef : public FixNHUef { public: FixNPTUef(class LAMMPS *, int, char **); - ~FixNPTUef() {} }; } // namespace LAMMPS_NS diff --git a/src/UEF/fix_nvt_uef.h b/src/UEF/fix_nvt_uef.h index 7192aa6412..f1e7031054 100644 --- a/src/UEF/fix_nvt_uef.h +++ b/src/UEF/fix_nvt_uef.h @@ -29,7 +29,6 @@ namespace LAMMPS_NS { class FixNVTUef : public FixNHUef { public: FixNVTUef(class LAMMPS *, int, char **); - ~FixNVTUef() {} }; } // namespace LAMMPS_NS diff --git a/src/VORONOI/compute_voronoi_atom.h b/src/VORONOI/compute_voronoi_atom.h index de49636d76..960a3d703a 100644 --- a/src/VORONOI/compute_voronoi_atom.h +++ b/src/VORONOI/compute_voronoi_atom.h @@ -33,15 +33,15 @@ namespace LAMMPS_NS { class ComputeVoronoi : public Compute { public: ComputeVoronoi(class LAMMPS *, int, char **); - ~ComputeVoronoi(); - void init(); - void compute_peratom(); - void compute_vector(); - void compute_local(); - double memory_usage(); + ~ComputeVoronoi() override; + void init() override; + void compute_peratom() override; + void compute_vector() override; + void compute_local() override; + double memory_usage() override; - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; private: voro::container *con_mono; diff --git a/src/VTK/dump_vtk.h b/src/VTK/dump_vtk.h index 9f01469442..92886dc2ec 100644 --- a/src/VTK/dump_vtk.h +++ b/src/VTK/dump_vtk.h @@ -57,9 +57,9 @@ namespace LAMMPS_NS { class DumpVTK : public DumpCustom { public: DumpVTK(class LAMMPS *, int, char **); - virtual ~DumpVTK(); + ~DumpVTK() override; - virtual void write(); + void write() override; protected: char *label; // string for dump file header @@ -72,12 +72,12 @@ class DumpVTK : public DumpCustom { // private methods - virtual void init_style(); - virtual void write_header(bigint); - int count(); - void pack(tagint *); - virtual void write_data(int, double *); - double memory_usage(); + void init_style() override; + void write_header(bigint) override; + int count() override; + void pack(tagint *) override; + void write_data(int, double *) override; + double memory_usage() override; int parse_fields(int, char **); void identify_vectors(); @@ -85,7 +85,7 @@ class DumpVTK : public DumpCustom { int add_fix(const char *); int add_variable(const char *); int add_custom(const char *, int); - virtual int modify_param(int, char **); + int modify_param(int, char **) override; typedef void (DumpVTK::*FnPtrHeader)(bigint); FnPtrHeader header_choice; // ptr to write header functions diff --git a/src/YAFF/angle_cross.h b/src/YAFF/angle_cross.h index a23aea3f38..c2cb07b143 100644 --- a/src/YAFF/angle_cross.h +++ b/src/YAFF/angle_cross.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleCross : public Angle { public: AngleCross(class LAMMPS *); - virtual ~AngleCross(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleCross() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *kss, *kbs0, *kbs1, *r00, *r01, *theta0; diff --git a/src/YAFF/angle_mm3.h b/src/YAFF/angle_mm3.h index c61823813e..18ff0a59fc 100644 --- a/src/YAFF/angle_mm3.h +++ b/src/YAFF/angle_mm3.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AngleMM3 : public Angle { public: AngleMM3(class LAMMPS *); - virtual ~AngleMM3(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, int, int, int); + ~AngleMM3() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, int, int, int) override; protected: double *theta0, *k2; diff --git a/src/YAFF/bond_mm3.h b/src/YAFF/bond_mm3.h index aece32e359..799677d360 100644 --- a/src/YAFF/bond_mm3.h +++ b/src/YAFF/bond_mm3.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class BondMM3 : public Bond { public: BondMM3(class LAMMPS *); - virtual ~BondMM3(); - virtual void compute(int, int); - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); - double single(int, double, int, int, double &); + ~BondMM3() override; + void compute(int, int) override; + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; protected: double *r0, *k2; diff --git a/src/YAFF/improper_distharm.h b/src/YAFF/improper_distharm.h index e30c63981c..ebc4c701d5 100644 --- a/src/YAFF/improper_distharm.h +++ b/src/YAFF/improper_distharm.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ImproperDistHarm : public Improper { public: ImproperDistHarm(class LAMMPS *); - ~ImproperDistHarm(); - void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); + ~ImproperDistHarm() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; private: double *k, *chi; diff --git a/src/YAFF/improper_sqdistharm.h b/src/YAFF/improper_sqdistharm.h index 57727929de..e7a1e62661 100644 --- a/src/YAFF/improper_sqdistharm.h +++ b/src/YAFF/improper_sqdistharm.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ImproperSQDistHarm : public Improper { public: ImproperSQDistHarm(class LAMMPS *); - ~ImproperSQDistHarm(); - void compute(int, int); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); + ~ImproperSQDistHarm() override; + void compute(int, int) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; private: double *k, *chi; diff --git a/src/YAFF/pair_lj_switch3_coulgauss_long.h b/src/YAFF/pair_lj_switch3_coulgauss_long.h index 10fd765f34..3591f4eeb1 100644 --- a/src/YAFF/pair_lj_switch3_coulgauss_long.h +++ b/src/YAFF/pair_lj_switch3_coulgauss_long.h @@ -28,21 +28,21 @@ class PairLJSwitch3CoulGaussLong : public Pair { public: PairLJSwitch3CoulGaussLong(class LAMMPS *); - virtual ~PairLJSwitch3CoulGaussLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairLJSwitch3CoulGaussLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - virtual void *extract(const char *, int &); + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/YAFF/pair_mm3_switch3_coulgauss_long.h b/src/YAFF/pair_mm3_switch3_coulgauss_long.h index 9dec102bee..14d16b8ec8 100644 --- a/src/YAFF/pair_mm3_switch3_coulgauss_long.h +++ b/src/YAFF/pair_mm3_switch3_coulgauss_long.h @@ -28,21 +28,21 @@ class PairMM3Switch3CoulGaussLong : public Pair { public: PairMM3Switch3CoulGaussLong(class LAMMPS *); - virtual ~PairMM3Switch3CoulGaussLong(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairMM3Switch3CoulGaussLong() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - virtual void *extract(const char *, int &); + void *extract(const char *, int &) override; protected: double cut_lj_global; diff --git a/src/accelerator_kokkos.h b/src/accelerator_kokkos.h index 0cea855f1e..a6cfdd12df 100644 --- a/src/accelerator_kokkos.h +++ b/src/accelerator_kokkos.h @@ -66,7 +66,6 @@ class AtomKokkos : public Atom { public: tagint **k_special; AtomKokkos(class LAMMPS *lmp) : Atom(lmp) {} - ~AtomKokkos() {} void sync(const ExecutionSpace /*space*/, unsigned int /*mask*/) {} void modified(const ExecutionSpace /*space*/, unsigned int /*mask*/) {} }; @@ -74,39 +73,33 @@ class AtomKokkos : public Atom { class CommKokkos : public CommBrick { public: CommKokkos(class LAMMPS *lmp) : CommBrick(lmp) {} - ~CommKokkos() {} }; class CommTiledKokkos : public CommTiled { public: CommTiledKokkos(class LAMMPS *lmp) : CommTiled(lmp) {} CommTiledKokkos(class LAMMPS *lmp, Comm *oldcomm) : CommTiled(lmp, oldcomm) {} - ~CommTiledKokkos() {} }; class DomainKokkos : public Domain { public: DomainKokkos(class LAMMPS *lmp) : Domain(lmp) {} - ~DomainKokkos() {} }; class NeighborKokkos : public Neighbor { public: NeighborKokkos(class LAMMPS *lmp) : Neighbor(lmp) {} - ~NeighborKokkos() {} }; class MemoryKokkos : public Memory { public: MemoryKokkos(class LAMMPS *lmp) : Memory(lmp) {} - ~MemoryKokkos() {} void grow_kokkos(tagint **, tagint **, int, int, const char *) {} }; class ModifyKokkos : public Modify { public: ModifyKokkos(class LAMMPS *lmp) : Modify(lmp) {} - ~ModifyKokkos() {} }; class DAT { diff --git a/src/angle.h b/src/angle.h index 3a6521003e..12443fa4f3 100644 --- a/src/angle.h +++ b/src/angle.h @@ -43,7 +43,7 @@ class Angle : protected Pointers { int copymode; Angle(class LAMMPS *); - virtual ~Angle(); + ~Angle() override; virtual void init(); virtual void compute(int, int) = 0; virtual void settings(int, char **) {} diff --git a/src/angle_deprecated.h b/src/angle_deprecated.h index ba94e0ef10..70e834bf9e 100644 --- a/src/angle_deprecated.h +++ b/src/angle_deprecated.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class AngleDeprecated : public Angle { public: AngleDeprecated(class LAMMPS *lmp) : Angle(lmp) {} - virtual ~AngleDeprecated() {} - virtual void compute(int, int) {} - virtual void settings(int, char **); - virtual void coeff(int, char **) {} - virtual double equilibrium_angle(int) { return 0.0; } - virtual void write_restart(FILE *) {} - virtual void read_restart(FILE *) {} - virtual double single(int, int, int, int) { return 0.0; } + void compute(int, int) override {} + void settings(int, char **) override; + void coeff(int, char **) override {} + double equilibrium_angle(int) override { return 0.0; } + void write_restart(FILE *) override {} + void read_restart(FILE *) override {} + double single(int, int, int, int) override { return 0.0; } }; } // namespace LAMMPS_NS diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 12bc9aa97a..41f46ae878 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -240,7 +240,7 @@ void AngleHybrid::settings(int narg, char **arg) error->all(FLERR, "Angle style hybrid cannot have none as an argument"); styles[nstyles] = force->new_angle(arg[i], 1, dummy); - force->store_style(keywords[nstyles], arg[i], 0); + keywords[nstyles] = force->store_style(arg[i], 0); istyle = i; if (strcmp(arg[i], "table") == 0) i++; diff --git a/src/angle_hybrid.h b/src/angle_hybrid.h index f0286af6f5..1deb9a6a14 100644 --- a/src/angle_hybrid.h +++ b/src/angle_hybrid.h @@ -31,16 +31,16 @@ class AngleHybrid : public Angle { char **keywords; // keyword for each Angle style AngleHybrid(class LAMMPS *); - ~AngleHybrid(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - double single(int, int, int, int); - double memory_usage(); + ~AngleHybrid() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double single(int, int, int, int) override; + double memory_usage() override; private: int *map; // which style each angle type points to diff --git a/src/angle_zero.h b/src/angle_zero.h index c41fc1a6ff..47bc4aac4f 100644 --- a/src/angle_zero.h +++ b/src/angle_zero.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class AngleZero : public Angle { public: AngleZero(class LAMMPS *); - virtual ~AngleZero(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void settings(int, char **); + ~AngleZero() override; + void compute(int, int) override; + void coeff(int, char **) override; + void settings(int, char **) override; - double equilibrium_angle(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + double equilibrium_angle(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; - double single(int, int, int, int); + double single(int, int, int, int) override; protected: double *theta0; diff --git a/src/atom.cpp b/src/atom.cpp index 79bf5de23a..f4eb56930a 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -54,6 +54,15 @@ using namespace MathConst; #define DELTA_PERATOM 64 #define EPSILON 1.0e-6 +/* ---------------------------------------------------------------------- + one instance per AtomVec style in style_atom.h +------------------------------------------------------------------------- */ + +template static AtomVec *avec_creator(LAMMPS *lmp) +{ + return new T(lmp); +} + /* ---------------------------------------------------------------------- */ /** \class LAMMPS_NS::Atom @@ -747,16 +756,6 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag) return nullptr; } -/* ---------------------------------------------------------------------- - one instance per AtomVec style in style_atom.h -------------------------------------------------------------------------- */ - -template -AtomVec *Atom::avec_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- */ void Atom::init() @@ -1056,7 +1055,7 @@ void Atom::deallocate_topology() void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, int type_offset, int shiftflag, double *shift) { - int m,xptr,iptr; + int xptr,iptr; imageint imagedata; double xdata[3],lamda[3]; double *coord; @@ -1143,7 +1142,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, next = strchr(buf,'\n'); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - if (values.size() != nwords) + if ((int)values.size() != nwords) error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf)); int imx = 0, imy = 0, imz = 0; @@ -1201,7 +1200,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, void Atom::data_vels(int n, char *buf, tagint id_offset) { - int j,m; + int m; char *next; next = strchr(buf,'\n'); @@ -1220,7 +1219,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) next = strchr(buf,'\n'); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - if (values.size() != nwords) + if ((int)values.size() != nwords) error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf)); tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; @@ -1580,7 +1579,7 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset, void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) { - int j,m; + int m; char *next; next = strchr(buf,'\n'); @@ -1599,7 +1598,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) next = strchr(buf,'\n'); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - if (values.size() != nwords) + if ((int)values.size() != nwords) error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf)); tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; diff --git a/src/atom.h b/src/atom.h index d771df8212..d412881ea3 100644 --- a/src/atom.h +++ b/src/atom.h @@ -285,7 +285,7 @@ class Atom : protected Pointers { // functions Atom(class LAMMPS *); - virtual ~Atom(); + ~Atom() override; void settings(class Atom *); void peratom_create(); @@ -417,9 +417,6 @@ class Atom : protected Pointers { void set_atomflag_defaults(); void setup_sort_bins(); int next_prime(int); - - private: - template static AtomVec *avec_creator(LAMMPS *); }; } // namespace LAMMPS_NS diff --git a/src/atom_vec.h b/src/atom_vec.h index 6bc7f23532..ad1c7f3315 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -68,7 +68,7 @@ class AtomVec : protected Pointers { // methods AtomVec(class LAMMPS *); - virtual ~AtomVec(); + ~AtomVec() override; void store_args(int, char **); virtual void process_args(int, char **); diff --git a/src/atom_vec_atomic.h b/src/atom_vec_atomic.h index c4132f8201..28d773a30a 100644 --- a/src/atom_vec_atomic.h +++ b/src/atom_vec_atomic.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class AtomVecAtomic : public AtomVec { public: AtomVecAtomic(class LAMMPS *); - ~AtomVecAtomic() {} }; } // namespace LAMMPS_NS diff --git a/src/atom_vec_body.h b/src/atom_vec_body.h index 3168c5d23a..89137cc2b6 100644 --- a/src/atom_vec_body.h +++ b/src/atom_vec_body.h @@ -40,31 +40,31 @@ class AtomVecBody : public AtomVec { struct Bonus *bonus; AtomVecBody(class LAMMPS *); - ~AtomVecBody(); - void process_args(int, char **); + ~AtomVecBody() override; + void process_args(int, char **) override; - void grow_pointers(); - void copy_bonus(int, int, int); - void clear_bonus(); - int pack_comm_bonus(int, int *, double *); - void unpack_comm_bonus(int, int, double *); - int pack_border_bonus(int, int *, double *); - int unpack_border_bonus(int, int, double *); - int pack_exchange_bonus(int, double *); - int unpack_exchange_bonus(int, double *); - int size_restart_bonus(); - int pack_restart_bonus(int, double *); - int unpack_restart_bonus(int, double *); - void data_body(int, int, int, int *, double *); - double memory_usage_bonus(); + void grow_pointers() override; + void copy_bonus(int, int, int) override; + void clear_bonus() override; + int pack_comm_bonus(int, int *, double *) override; + void unpack_comm_bonus(int, int, double *) override; + int pack_border_bonus(int, int *, double *) override; + int unpack_border_bonus(int, int, double *) override; + int pack_exchange_bonus(int, double *) override; + int unpack_exchange_bonus(int, double *) override; + int size_restart_bonus() override; + int pack_restart_bonus(int, double *) override; + int unpack_restart_bonus(int, double *) override; + void data_body(int, int, int, int *, double *) override; + double memory_usage_bonus() override; - void create_atom_post(int); - void data_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); + void create_atom_post(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; - int pack_data_bonus(double *, int); - void write_data_bonus(FILE *, int, double *, int); + int pack_data_bonus(double *, int) override; + void write_data_bonus(FILE *, int, double *, int) override; // methods used by other classes to query/set body info diff --git a/src/atom_vec_ellipsoid.h b/src/atom_vec_ellipsoid.h index bb50944f30..1d344b8b60 100644 --- a/src/atom_vec_ellipsoid.h +++ b/src/atom_vec_ellipsoid.h @@ -34,30 +34,30 @@ class AtomVecEllipsoid : public AtomVec { struct Bonus *bonus; AtomVecEllipsoid(class LAMMPS *); - ~AtomVecEllipsoid(); + ~AtomVecEllipsoid() override; - void grow_pointers(); - void copy_bonus(int, int, int); - void clear_bonus(); - int pack_comm_bonus(int, int *, double *); - void unpack_comm_bonus(int, int, double *); - int pack_border_bonus(int, int *, double *); - int unpack_border_bonus(int, int, double *); - int pack_exchange_bonus(int, double *); - int unpack_exchange_bonus(int, double *); - int size_restart_bonus(); - int pack_restart_bonus(int, double *); - int unpack_restart_bonus(int, double *); - void data_atom_bonus(int, const std::vector &); - double memory_usage_bonus(); + void grow_pointers() override; + void copy_bonus(int, int, int) override; + void clear_bonus() override; + int pack_comm_bonus(int, int *, double *) override; + void unpack_comm_bonus(int, int, double *) override; + int pack_border_bonus(int, int *, double *) override; + int unpack_border_bonus(int, int, double *) override; + int pack_exchange_bonus(int, double *) override; + int unpack_exchange_bonus(int, double *) override; + int size_restart_bonus() override; + int pack_restart_bonus(int, double *) override; + int unpack_restart_bonus(int, double *) override; + void data_atom_bonus(int, const std::vector &) override; + double memory_usage_bonus() override; - void create_atom_post(int); - void data_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); + void create_atom_post(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; - int pack_data_bonus(double *, int); - void write_data_bonus(FILE *, int, double *, int); + int pack_data_bonus(double *, int) override; + void write_data_bonus(FILE *, int, double *, int) override; // unique to AtomVecEllipsoid diff --git a/src/atom_vec_hybrid.h b/src/atom_vec_hybrid.h index 949ae37319..8d1a791044 100644 --- a/src/atom_vec_hybrid.h +++ b/src/atom_vec_hybrid.h @@ -31,41 +31,41 @@ class AtomVecHybrid : public AtomVec { char **keywords; AtomVecHybrid(class LAMMPS *); - ~AtomVecHybrid(); - void process_args(int, char **); - void init(); + ~AtomVecHybrid() override; + void process_args(int, char **) override; + void init() override; - void grow_pointers(); - void force_clear(int, size_t); - void copy_bonus(int, int, int); - void clear_bonus(); - int pack_comm_bonus(int, int *, double *); - void unpack_comm_bonus(int, int, double *); - int pack_border_bonus(int, int *, double *); - int unpack_border_bonus(int, int, double *); - int pack_exchange_bonus(int, double *); - int unpack_exchange_bonus(int, double *); - int size_restart_bonus(); - int pack_restart_bonus(int, double *); - int unpack_restart_bonus(int, double *); - double memory_usage_bonus(); + void grow_pointers() override; + void force_clear(int, size_t) override; + void copy_bonus(int, int, int) override; + void clear_bonus() override; + int pack_comm_bonus(int, int *, double *) override; + void unpack_comm_bonus(int, int, double *) override; + int pack_border_bonus(int, int *, double *) override; + int unpack_border_bonus(int, int, double *) override; + int pack_exchange_bonus(int, double *) override; + int unpack_exchange_bonus(int, double *) override; + int size_restart_bonus() override; + int pack_restart_bonus(int, double *) override; + int unpack_restart_bonus(int, double *) override; + double memory_usage_bonus() override; - void pack_restart_pre(int); - void pack_restart_post(int); - void unpack_restart_init(int); - void create_atom_post(int); - void data_atom_post(int); + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void create_atom_post(int) override; + void data_atom_post(int) override; - void data_bonds_post(int, int, tagint, tagint, tagint); + void data_bonds_post(int, int, tagint, tagint, tagint) override; - void pack_data_pre(int); - void pack_data_post(int); + void pack_data_pre(int) override; + void pack_data_post(int) override; - int pack_data_bonus(double *, int); - void write_data_bonus(FILE *, int, double *, int); + int pack_data_bonus(double *, int) override; + void write_data_bonus(FILE *, int, double *, int) override; - int property_atom(char *); - void pack_property_atom(int, double *, int, int); + int property_atom(char *) override; + void pack_property_atom(int, double *, int, int) override; private: int nallstyles; diff --git a/src/atom_vec_line.h b/src/atom_vec_line.h index 5903349700..1af2f7ee2d 100644 --- a/src/atom_vec_line.h +++ b/src/atom_vec_line.h @@ -33,31 +33,31 @@ class AtomVecLine : public AtomVec { struct Bonus *bonus; AtomVecLine(class LAMMPS *); - ~AtomVecLine(); - void init(); + ~AtomVecLine() override; + void init() override; - void grow_pointers(); - void copy_bonus(int, int, int); - void clear_bonus(); - int pack_comm_bonus(int, int *, double *); - void unpack_comm_bonus(int, int, double *); - int pack_border_bonus(int, int *, double *); - int unpack_border_bonus(int, int, double *); - int pack_exchange_bonus(int, double *); - int unpack_exchange_bonus(int, double *); - int size_restart_bonus(); - int pack_restart_bonus(int, double *); - int unpack_restart_bonus(int, double *); - void data_atom_bonus(int, const std::vector &); - double memory_usage_bonus(); + void grow_pointers() override; + void copy_bonus(int, int, int) override; + void clear_bonus() override; + int pack_comm_bonus(int, int *, double *) override; + void unpack_comm_bonus(int, int, double *) override; + int pack_border_bonus(int, int *, double *) override; + int unpack_border_bonus(int, int, double *) override; + int pack_exchange_bonus(int, double *) override; + int unpack_exchange_bonus(int, double *) override; + int size_restart_bonus() override; + int pack_restart_bonus(int, double *) override; + int unpack_restart_bonus(int, double *) override; + void data_atom_bonus(int, const std::vector &) override; + double memory_usage_bonus() override; - void create_atom_post(int); - void data_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); + void create_atom_post(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; - int pack_data_bonus(double *, int); - void write_data_bonus(FILE *, int, double *, int); + int pack_data_bonus(double *, int) override; + void write_data_bonus(FILE *, int, double *, int) override; // unique to AtomVecLine diff --git a/src/atom_vec_sphere.h b/src/atom_vec_sphere.h index cf33bea364..2c3fdd84bc 100644 --- a/src/atom_vec_sphere.h +++ b/src/atom_vec_sphere.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class AtomVecSphere : public AtomVec { public: AtomVecSphere(class LAMMPS *); - void process_args(int, char **); - void init(); + void process_args(int, char **) override; + void init() override; - void grow_pointers(); - void create_atom_post(int); - void data_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); + void grow_pointers() override; + void create_atom_post(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; private: double *radius, *rmass; diff --git a/src/atom_vec_tri.h b/src/atom_vec_tri.h index f9f0bae386..76f0d29207 100644 --- a/src/atom_vec_tri.h +++ b/src/atom_vec_tri.h @@ -35,31 +35,31 @@ class AtomVecTri : public AtomVec { struct Bonus *bonus; AtomVecTri(class LAMMPS *); - ~AtomVecTri(); - void init(); + ~AtomVecTri() override; + void init() override; - void grow_pointers(); - void copy_bonus(int, int, int); - void clear_bonus(); - int pack_comm_bonus(int, int *, double *); - void unpack_comm_bonus(int, int, double *); - int pack_border_bonus(int, int *, double *); - int unpack_border_bonus(int, int, double *); - int pack_exchange_bonus(int, double *); - int unpack_exchange_bonus(int, double *); - int size_restart_bonus(); - int pack_restart_bonus(int, double *); - int unpack_restart_bonus(int, double *); - void data_atom_bonus(int, const std::vector &); - double memory_usage_bonus(); + void grow_pointers() override; + void copy_bonus(int, int, int) override; + void clear_bonus() override; + int pack_comm_bonus(int, int *, double *) override; + void unpack_comm_bonus(int, int, double *) override; + int pack_border_bonus(int, int *, double *) override; + int unpack_border_bonus(int, int, double *) override; + int pack_exchange_bonus(int, double *) override; + int unpack_exchange_bonus(int, double *) override; + int size_restart_bonus() override; + int pack_restart_bonus(int, double *) override; + int unpack_restart_bonus(int, double *) override; + void data_atom_bonus(int, const std::vector &) override; + double memory_usage_bonus() override; - void create_atom_post(int); - void data_atom_post(int); - void pack_data_pre(int); - void pack_data_post(int); + void create_atom_post(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; - int pack_data_bonus(double *, int); - void write_data_bonus(FILE *, int, double *, int); + int pack_data_bonus(double *, int) override; + void write_data_bonus(FILE *, int, double *, int) override; // unique to AtomVecTri diff --git a/src/balance.h b/src/balance.h index df8ac307b4..f7a3c60df5 100644 --- a/src/balance.h +++ b/src/balance.h @@ -33,8 +33,8 @@ class Balance : public Command { int outflag; // 1 for output of balance results to file Balance(class LAMMPS *); - ~Balance(); - void command(int, char **); + ~Balance() override; + void command(int, char **) override; void options(int, int, char **); void weight_storage(char *); void init_imbalance(int); diff --git a/src/body.h b/src/body.h index 27832d2eda..b2cbbee345 100644 --- a/src/body.h +++ b/src/body.h @@ -32,7 +32,7 @@ class Body : protected Pointers { AtomVecBody *avec; // ptr to class that stores body bonus info Body(class LAMMPS *, int, char **); - virtual ~Body(); + ~Body() override; // methods implemented by child classes diff --git a/src/bond.h b/src/bond.h index e0550ead95..47c8687f50 100644 --- a/src/bond.h +++ b/src/bond.h @@ -46,7 +46,7 @@ class Bond : protected Pointers { int copymode; Bond(class LAMMPS *); - virtual ~Bond(); + ~Bond() override; virtual void init(); virtual void init_style() {} virtual void compute(int, int) = 0; diff --git a/src/bond_deprecated.h b/src/bond_deprecated.h index 43f58da093..cfc770cf20 100644 --- a/src/bond_deprecated.h +++ b/src/bond_deprecated.h @@ -27,15 +27,14 @@ namespace LAMMPS_NS { class BondDeprecated : public Bond { public: BondDeprecated(class LAMMPS *lmp) : Bond(lmp) {} - virtual ~BondDeprecated() {} - virtual void compute(int, int) {} - virtual void settings(int, char **); - virtual void coeff(int, char **) {} - virtual double equilibrium_distance(int) { return 0.0; } - virtual void write_restart(FILE *) {} - virtual void read_restart(FILE *) {} - virtual double single(int, double, int, int, double &) { return 0.0; } + void compute(int, int) override {} + void settings(int, char **) override; + void coeff(int, char **) override {} + double equilibrium_distance(int) override { return 0.0; } + void write_restart(FILE *) override {} + void read_restart(FILE *) override {} + double single(int, double, int, int, double &) override { return 0.0; } }; } // namespace LAMMPS_NS diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index dad1010a1e..3139d9ecd8 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -242,7 +242,7 @@ void BondHybrid::settings(int narg, char **arg) if (strncmp(arg[i], "quartic", 7) == 0) has_quartic = m; styles[nstyles] = force->new_bond(arg[i], 1, dummy); - force->store_style(keywords[nstyles], arg[i], 0); + keywords[nstyles] = force->store_style(arg[i], 0); istyle = i; if (strcmp(arg[i], "table") == 0) i++; diff --git a/src/bond_hybrid.h b/src/bond_hybrid.h index d5e059b317..ba795c2867 100644 --- a/src/bond_hybrid.h +++ b/src/bond_hybrid.h @@ -33,16 +33,16 @@ class BondHybrid : public Bond { char **keywords; // keyword for each Bond style BondHybrid(class LAMMPS *); - ~BondHybrid(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - double single(int, double, int, int, double &); - double memory_usage(); + ~BondHybrid() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double single(int, double, int, int, double &) override; + double memory_usage() override; private: int *map; // which style each bond type points to diff --git a/src/bond_zero.h b/src/bond_zero.h index c8ed3a666e..050b4f1a9b 100644 --- a/src/bond_zero.h +++ b/src/bond_zero.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class BondZero : public Bond { public: BondZero(class LAMMPS *); - virtual ~BondZero(); - virtual void compute(int, int); - virtual void settings(int, char **); + ~BondZero() override; + void compute(int, int) override; + void settings(int, char **) override; - void coeff(int, char **); - double equilibrium_distance(int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void coeff(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; - double single(int, double, int, int, double &); - virtual void *extract(const char *, int &); + double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *r0; diff --git a/src/change_box.h b/src/change_box.h index cfa3a2f3e1..772a8150e5 100644 --- a/src/change_box.h +++ b/src/change_box.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class ChangeBox : public Command { public: ChangeBox(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; private: int scaleflag; diff --git a/src/citeme.h b/src/citeme.h index 8f0e6c4bca..0d9f40f57f 100644 --- a/src/citeme.h +++ b/src/citeme.h @@ -22,7 +22,7 @@ namespace LAMMPS_NS { class CiteMe : protected Pointers { public: CiteMe(class LAMMPS *, int, int, const char *); - virtual ~CiteMe(); + ~CiteMe() override; void add(const std::string &); // register publication for output void flush(); // flush buffers to screen and logfile enum { VERBOSE, TERSE }; diff --git a/src/comm.h b/src/comm.h index eee23abe73..c9939c8128 100644 --- a/src/comm.h +++ b/src/comm.h @@ -63,7 +63,7 @@ class Comm : protected Pointers { // methods Comm(class LAMMPS *); - virtual ~Comm(); + ~Comm() override; // NOTE: copy_arrays is called from a constructor and must not be made virtual void copy_arrays(class Comm *); virtual void init(); diff --git a/src/comm_brick.h b/src/comm_brick.h index 4c565c6479..73c9ec447e 100644 --- a/src/comm_brick.h +++ b/src/comm_brick.h @@ -22,34 +22,35 @@ class CommBrick : public Comm { public: CommBrick(class LAMMPS *); CommBrick(class LAMMPS *, class Comm *); - virtual ~CommBrick(); - virtual void init(); - virtual void setup(); // setup 3d comm pattern - virtual void forward_comm(int dummy = 0); // forward comm of atom coords - virtual void reverse_comm(); // reverse comm of forces - virtual void exchange(); // move atoms to new procs - virtual void borders(); // setup list of atoms to comm + ~CommBrick() override; - virtual void forward_comm_pair(class Pair *); // forward comm from a Pair - virtual void reverse_comm_pair(class Pair *); // reverse comm from a Pair - virtual void forward_comm_bond(class Bond *); // forward comm from a Bond - virtual void reverse_comm_bond(class Bond *); // reverse comm from a Bond - virtual void forward_comm_fix(class Fix *, int size = 0); + void init() override; + void setup() override; // setup 3d comm pattern + void forward_comm(int dummy = 0) override; // forward comm of atom coords + void reverse_comm() override; // reverse comm of forces + void exchange() override; // move atoms to new procs + void borders() override; // setup list of atoms to comm + + void forward_comm_pair(class Pair *) override; // forward comm from a Pair + void reverse_comm_pair(class Pair *) override; // reverse comm from a Pair + virtual void forward_comm_bond(class Bond *) override; // forward comm from a Bond + virtual void reverse_comm_bond(class Bond *) override; // reverse comm from a Bond + void forward_comm_fix(class Fix *, int size = 0) override; // forward comm from a Fix - virtual void reverse_comm_fix(class Fix *, int size = 0); + void reverse_comm_fix(class Fix *, int size = 0) override; // reverse comm from a Fix - virtual void reverse_comm_fix_variable(class Fix *); + void reverse_comm_fix_variable(class Fix *) override; // variable size reverse comm from a Fix - virtual void forward_comm_compute(class Compute *); // forward from a Compute - virtual void reverse_comm_compute(class Compute *); // reverse from a Compute - virtual void forward_comm_dump(class Dump *); // forward comm from a Dump - virtual void reverse_comm_dump(class Dump *); // reverse comm from a Dump + void forward_comm_compute(class Compute *) override; // forward from a Compute + void reverse_comm_compute(class Compute *) override; // reverse from a Compute + void forward_comm_dump(class Dump *) override; // forward comm from a Dump + void reverse_comm_dump(class Dump *) override; // reverse comm from a Dump - virtual void forward_comm_array(int, double **); // forward comm of array - int exchange_variable(int, double *, double *&); // exchange on neigh stencil - void *extract(const char *, int &); - virtual double memory_usage(); + void forward_comm_array(int, double **) override; // forward comm of array + int exchange_variable(int, double *, double *&) override; // exchange on neigh stencil + void *extract(const char *, int &) override; + double memory_usage() override; protected: int nswap; // # of swaps to perform = sum of maxneed diff --git a/src/comm_tiled.h b/src/comm_tiled.h index ec43b50787..68a98ccf30 100644 --- a/src/comm_tiled.h +++ b/src/comm_tiled.h @@ -22,37 +22,38 @@ class CommTiled : public Comm { public: CommTiled(class LAMMPS *); CommTiled(class LAMMPS *, class Comm *); - virtual ~CommTiled(); - void init(); - void setup(); // setup comm pattern - virtual void forward_comm(int dummy = 0); // forward comm of atom coords - virtual void reverse_comm(); // reverse comm of forces - virtual void exchange(); // move atoms to new procs - virtual void borders(); // setup list of atoms to comm + ~CommTiled() override; - virtual void forward_comm_pair(class Pair *); // forward comm from a Pair - virtual void reverse_comm_pair(class Pair *); // reverse comm from a Pair - virtual void forward_comm_bond(class Bond *); // forward comm from a Bond - virtual void reverse_comm_bond(class Bond *); // reverse comm from a Bond - virtual void forward_comm_fix(class Fix *, int size = 0); + void init() override; + void setup() override; // setup comm pattern + void forward_comm(int dummy = 0) override; // forward comm of atom coords + void reverse_comm() override; // reverse comm of forces + void exchange() override; // move atoms to new procs + void borders() override; // setup list of atoms to comm + + void forward_comm_pair(class Pair *) override; // forward comm from a Pair + void reverse_comm_pair(class Pair *) override; // reverse comm from a Pair + virtual void forward_comm_bond(class Bond *) override; // forward comm from a Bond + virtual void reverse_comm_bond(class Bond *) override; // reverse comm from a Bond + void forward_comm_fix(class Fix *, int size = 0) override; // forward comm from a Fix - virtual void reverse_comm_fix(class Fix *, int size = 0); + void reverse_comm_fix(class Fix *, int size = 0) override; // reverse comm from a Fix - virtual void reverse_comm_fix_variable(class Fix *); + void reverse_comm_fix_variable(class Fix *) override; // variable size reverse comm from a Fix - virtual void forward_comm_compute(class Compute *); // forward from a Compute - virtual void reverse_comm_compute(class Compute *); // reverse from a Compute - virtual void forward_comm_dump(class Dump *); // forward comm from a Dump - virtual void reverse_comm_dump(class Dump *); // reverse comm from a Dump + void forward_comm_compute(class Compute *) override; // forward from a Compute + void reverse_comm_compute(class Compute *) override; // reverse from a Compute + void forward_comm_dump(class Dump *) override; // forward comm from a Dump + void reverse_comm_dump(class Dump *) override; // reverse comm from a Dump - virtual void forward_comm_array(int, double **); // forward comm of array - virtual int exchange_variable(int, double *, double *&); // exchange on neigh stencil + void forward_comm_array(int, double **) override; // forward comm of array + int exchange_variable(int, double *, double *&) override; // exchange on neigh stencil - void coord2proc_setup(); - int coord2proc(double *, int &, int &, int &); + void coord2proc_setup() override; + int coord2proc(double *, int &, int &, int &) override; - double memory_usage(); + double memory_usage() override; private: int nswap; // # of swaps to perform = 2*dim diff --git a/src/command.h b/src/command.h index 5e5f9d45bd..f1e754325e 100644 --- a/src/command.h +++ b/src/command.h @@ -14,7 +14,7 @@ #ifndef LMP_COMMAND_H #define LMP_COMMAND_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: keep namespace LAMMPS_NS { diff --git a/src/compute.h b/src/compute.h index 05fded9b44..ef57754b18 100644 --- a/src/compute.h +++ b/src/compute.h @@ -104,7 +104,7 @@ class Compute : protected Pointers { int copymode, kokkosable; Compute(class LAMMPS *, int, char **); - virtual ~Compute(); + ~Compute() override; void modify_params(int, char **); void reset_extra_dof(); diff --git a/src/compute_aggregate_atom.h b/src/compute_aggregate_atom.h index 9bacf37ae1..dc044c0b1a 100644 --- a/src/compute_aggregate_atom.h +++ b/src/compute_aggregate_atom.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class ComputeAggregateAtom : public Compute { public: ComputeAggregateAtom(class LAMMPS *, int, char **); - ~ComputeAggregateAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeAggregateAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int nmax, commflag; diff --git a/src/compute_angle.h b/src/compute_angle.h index efdbebee10..62a5ea1fdf 100644 --- a/src/compute_angle.h +++ b/src/compute_angle.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeAngle : public Compute { public: ComputeAngle(class LAMMPS *, int, char **); - ~ComputeAngle(); - void init(); - void compute_vector(); + ~ComputeAngle() override; + void init() override; + void compute_vector() override; private: int nsub; diff --git a/src/compute_angle_local.h b/src/compute_angle_local.h index 3aebfae0a8..bea7b0c682 100644 --- a/src/compute_angle_local.h +++ b/src/compute_angle_local.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeAngleLocal : public Compute { public: ComputeAngleLocal(class LAMMPS *, int, char **); - ~ComputeAngleLocal(); - void init(); - void compute_local(); - double memory_usage(); + ~ComputeAngleLocal() override; + void init() override; + void compute_local() override; + double memory_usage() override; private: int nvalues, nvar, ncount, setflag, tflag; diff --git a/src/compute_angmom_chunk.h b/src/compute_angmom_chunk.h index 384de5cc33..f401b8abd0 100644 --- a/src/compute_angmom_chunk.h +++ b/src/compute_angmom_chunk.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class ComputeAngmomChunk : public Compute { public: ComputeAngmomChunk(class LAMMPS *, int, char **); - ~ComputeAngmomChunk(); - void init(); - void compute_array(); + ~ComputeAngmomChunk() override; + void init() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_bond.h b/src/compute_bond.h index 174fcb06f3..4981782972 100644 --- a/src/compute_bond.h +++ b/src/compute_bond.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeBond : public Compute { public: ComputeBond(class LAMMPS *, int, char **); - ~ComputeBond(); - void init(); - void compute_vector(); + ~ComputeBond() override; + void init() override; + void compute_vector() override; private: int nsub; diff --git a/src/compute_bond_local.h b/src/compute_bond_local.h index 5ecbaac2a0..0f028f05e8 100644 --- a/src/compute_bond_local.h +++ b/src/compute_bond_local.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeBondLocal : public Compute { public: ComputeBondLocal(class LAMMPS *, int, char **); - ~ComputeBondLocal(); - void init(); - void compute_local(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~ComputeBondLocal() override; + void init() override; + void compute_local() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: int nvalues, nvar, ncount, setflag; diff --git a/src/compute_centro_atom.h b/src/compute_centro_atom.h index c7e66cfad1..8eb1df696b 100644 --- a/src/compute_centro_atom.h +++ b/src/compute_centro_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeCentroAtom : public Compute { public: ComputeCentroAtom(class LAMMPS *, int, char **); - ~ComputeCentroAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeCentroAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax, maxneigh, nnn; diff --git a/src/compute_centroid_stress_atom.h b/src/compute_centroid_stress_atom.h index d332788aa4..429d565419 100644 --- a/src/compute_centroid_stress_atom.h +++ b/src/compute_centroid_stress_atom.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeCentroidStressAtom : public Compute { public: ComputeCentroidStressAtom(class LAMMPS *, int, char **); - ~ComputeCentroidStressAtom(); - void init(); - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeCentroidStressAtom() override; + void init() override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int keflag, pairflag, bondflag, angleflag, dihedralflag, improperflag; diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index e2c3ebe96b..528829f9a5 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -35,16 +35,16 @@ class ComputeChunkAtom : public Compute { int *ichunk, *chunkID; ComputeChunkAtom(class LAMMPS *, int, char **); - ~ComputeChunkAtom(); - void init(); - void setup(); - void compute_peratom(); - double compute_scalar(); - void set_arrays(int); - double memory_usage(); + ~ComputeChunkAtom() override; + void init() override; + void setup() override; + void compute_peratom() override; + double compute_scalar() override; + void set_arrays(int) override; + double memory_usage() override; - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; int setup_chunks(); void compute_ichunk(); diff --git a/src/compute_chunk_spread_atom.h b/src/compute_chunk_spread_atom.h index b7cc1d4739..e1e2a2a584 100644 --- a/src/compute_chunk_spread_atom.h +++ b/src/compute_chunk_spread_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeChunkSpreadAtom : public Compute { public: ComputeChunkSpreadAtom(class LAMMPS *, int, char **); - ~ComputeChunkSpreadAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeChunkSpreadAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; protected: int mode, nvalues; diff --git a/src/compute_cluster_atom.h b/src/compute_cluster_atom.h index 2f9bd8955c..1d5c03277d 100644 --- a/src/compute_cluster_atom.h +++ b/src/compute_cluster_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeClusterAtom : public Compute { public: ComputeClusterAtom(class LAMMPS *, int, char **); - ~ComputeClusterAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~ComputeClusterAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: int nmax, commflag; diff --git a/src/compute_cna_atom.h b/src/compute_cna_atom.h index 4546a3f66e..eab6fae0f3 100644 --- a/src/compute_cna_atom.h +++ b/src/compute_cna_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeCNAAtom : public Compute { public: ComputeCNAAtom(class LAMMPS *, int, char **); - ~ComputeCNAAtom(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - double memory_usage(); + ~ComputeCNAAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/compute_com.h b/src/compute_com.h index 73cd0739e9..762e63d84a 100644 --- a/src/compute_com.h +++ b/src/compute_com.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeCOM : public Compute { public: ComputeCOM(class LAMMPS *, int, char **); - ~ComputeCOM(); - void init(); - void compute_vector(); + ~ComputeCOM() override; + void init() override; + void compute_vector() override; private: double masstotal; diff --git a/src/compute_com_chunk.h b/src/compute_com_chunk.h index c2aedaabed..78a74a1937 100644 --- a/src/compute_com_chunk.h +++ b/src/compute_com_chunk.h @@ -30,18 +30,18 @@ class ComputeCOMChunk : public Compute { double *masstotal; ComputeCOMChunk(class LAMMPS *, int, char **); - ~ComputeCOMChunk(); - void init(); - void setup(); - void compute_array(); + ~ComputeCOMChunk() override; + void init() override; + void setup() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_coord_atom.h b/src/compute_coord_atom.h index 9ac0a8c3b3..563baef973 100644 --- a/src/compute_coord_atom.h +++ b/src/compute_coord_atom.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class ComputeCoordAtom : public Compute { public: ComputeCoordAtom(class LAMMPS *, int, char **); - virtual ~ComputeCoordAtom(); - virtual void init(); - void init_list(int, class NeighList *); - virtual void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~ComputeCoordAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; enum { NONE, CUTOFF, ORIENT }; protected: diff --git a/src/compute_deprecated.h b/src/compute_deprecated.h index 74dd997f2a..3770a9978e 100644 --- a/src/compute_deprecated.h +++ b/src/compute_deprecated.h @@ -28,8 +28,7 @@ namespace LAMMPS_NS { class ComputeDeprecated : public Compute { public: ComputeDeprecated(class LAMMPS *, int, char **); - ~ComputeDeprecated() {} - void init() {} + void init() override {} }; } // namespace LAMMPS_NS diff --git a/src/compute_dihedral.h b/src/compute_dihedral.h index f5bf756d0e..d7e7662ec9 100644 --- a/src/compute_dihedral.h +++ b/src/compute_dihedral.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeDihedral : public Compute { public: ComputeDihedral(class LAMMPS *, int, char **); - ~ComputeDihedral(); - void init(); - void compute_vector(); + ~ComputeDihedral() override; + void init() override; + void compute_vector() override; private: int nsub; diff --git a/src/compute_dihedral_local.h b/src/compute_dihedral_local.h index a74d277776..99274a7265 100644 --- a/src/compute_dihedral_local.h +++ b/src/compute_dihedral_local.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeDihedralLocal : public Compute { public: ComputeDihedralLocal(class LAMMPS *, int, char **); - ~ComputeDihedralLocal(); - void init(); - void compute_local(); - double memory_usage(); + ~ComputeDihedralLocal() override; + void init() override; + void compute_local() override; + double memory_usage() override; private: int nvalues, nvar, ncount, setflag; diff --git a/src/compute_dipole.h b/src/compute_dipole.h index 39dcd929e9..9e16f6c998 100644 --- a/src/compute_dipole.h +++ b/src/compute_dipole.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeDipole : public Compute { public: ComputeDipole(class LAMMPS *, int, char **); - virtual ~ComputeDipole(); - void init(){}; - void compute_vector(); - double compute_scalar(); + ~ComputeDipole() override; + void init() override{}; + void compute_vector() override; + double compute_scalar() override; private: int usecenter; diff --git a/src/compute_dipole_chunk.h b/src/compute_dipole_chunk.h index b44852d543..fbe97c481b 100644 --- a/src/compute_dipole_chunk.h +++ b/src/compute_dipole_chunk.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class ComputeDipoleChunk : public Compute { public: ComputeDipoleChunk(class LAMMPS *, int, char **); - ~ComputeDipoleChunk(); - void init(); - void compute_array(); + ~ComputeDipoleChunk() override; + void init() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_displace_atom.h b/src/compute_displace_atom.h index 79e0a67f7a..4eac39d5b0 100644 --- a/src/compute_displace_atom.h +++ b/src/compute_displace_atom.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeDisplaceAtom : public Compute { public: ComputeDisplaceAtom(class LAMMPS *, int, char **); - ~ComputeDisplaceAtom(); - void init(); - void compute_peratom(); - void set_arrays(int); - void refresh(); - double memory_usage(); + ~ComputeDisplaceAtom() override; + void init() override; + void compute_peratom() override; + void set_arrays(int) override; + void refresh() override; + double memory_usage() override; private: int nmax; diff --git a/src/compute_erotate_sphere.h b/src/compute_erotate_sphere.h index 09f0604dbd..29906b852f 100644 --- a/src/compute_erotate_sphere.h +++ b/src/compute_erotate_sphere.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeERotateSphere : public Compute { public: ComputeERotateSphere(class LAMMPS *, int, char **); - ~ComputeERotateSphere() {} - void init(); - double compute_scalar(); + + void init() override; + double compute_scalar() override; private: double pfactor; diff --git a/src/compute_erotate_sphere_atom.h b/src/compute_erotate_sphere_atom.h index b44576d523..5ec58d44be 100644 --- a/src/compute_erotate_sphere_atom.h +++ b/src/compute_erotate_sphere_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeErotateSphereAtom : public Compute { public: ComputeErotateSphereAtom(class LAMMPS *, int, char **); - ~ComputeErotateSphereAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeErotateSphereAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/compute_fragment_atom.h b/src/compute_fragment_atom.h index 4cf7478d61..5ba430ee30 100644 --- a/src/compute_fragment_atom.h +++ b/src/compute_fragment_atom.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeFragmentAtom : public Compute { public: ComputeFragmentAtom(class LAMMPS *, int, char **); - ~ComputeFragmentAtom(); - void init(); - void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - double memory_usage(); + ~ComputeFragmentAtom() override; + void init() override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: int nmax, commflag, singleflag; diff --git a/src/compute_global_atom.h b/src/compute_global_atom.h index 4f5d5ea00d..1cf9a7322a 100644 --- a/src/compute_global_atom.h +++ b/src/compute_global_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeGlobalAtom : public Compute { public: ComputeGlobalAtom(class LAMMPS *, int, char **); - virtual ~ComputeGlobalAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeGlobalAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; protected: int whichref, indexref, ref2index; diff --git a/src/compute_group_group.h b/src/compute_group_group.h index 1a34a19fe6..c5505f51ee 100644 --- a/src/compute_group_group.h +++ b/src/compute_group_group.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeGroupGroup : public Compute { public: ComputeGroupGroup(class LAMMPS *, int, char **); - ~ComputeGroupGroup(); - void init(); - void init_list(int, class NeighList *); - double compute_scalar(); - void compute_vector(); + ~ComputeGroupGroup() override; + void init() override; + void init_list(int, class NeighList *) override; + double compute_scalar() override; + void compute_vector() override; private: char *group2; diff --git a/src/compute_gyration.h b/src/compute_gyration.h index 2eccb46409..f6dd748640 100644 --- a/src/compute_gyration.h +++ b/src/compute_gyration.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeGyration : public Compute { public: ComputeGyration(class LAMMPS *, int, char **); - ~ComputeGyration(); - void init(); - double compute_scalar(); - void compute_vector(); + ~ComputeGyration() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; private: double masstotal; diff --git a/src/compute_gyration_chunk.h b/src/compute_gyration_chunk.h index 1ac6fec341..ce990c9416 100644 --- a/src/compute_gyration_chunk.h +++ b/src/compute_gyration_chunk.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class ComputeGyrationChunk : public Compute { public: ComputeGyrationChunk(class LAMMPS *, int, char **); - ~ComputeGyrationChunk(); - void init(); - void compute_vector(); - void compute_array(); + ~ComputeGyrationChunk() override; + void init() override; + void compute_vector() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_heat_flux.h b/src/compute_heat_flux.h index d8466106e3..bdfc8252a3 100644 --- a/src/compute_heat_flux.h +++ b/src/compute_heat_flux.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeHeatFlux : public Compute { public: ComputeHeatFlux(class LAMMPS *, int, char **); - ~ComputeHeatFlux(); - void init(); - void compute_vector(); + ~ComputeHeatFlux() override; + void init() override; + void compute_vector() override; private: char *id_ke, *id_pe, *id_stress; diff --git a/src/compute_improper.h b/src/compute_improper.h index 4d7597bcd2..ddafc50e4e 100644 --- a/src/compute_improper.h +++ b/src/compute_improper.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class ComputeImproper : public Compute { public: ComputeImproper(class LAMMPS *, int, char **); - ~ComputeImproper(); - void init(); - void compute_vector(); + ~ComputeImproper() override; + void init() override; + void compute_vector() override; private: int nsub; diff --git a/src/compute_improper_local.h b/src/compute_improper_local.h index 7fe64d12c3..ff27dde4e9 100644 --- a/src/compute_improper_local.h +++ b/src/compute_improper_local.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeImproperLocal : public Compute { public: ComputeImproperLocal(class LAMMPS *, int, char **); - ~ComputeImproperLocal(); - void init(); - void compute_local(); - double memory_usage(); + ~ComputeImproperLocal() override; + void init() override; + void compute_local() override; + double memory_usage() override; private: int nvalues, cflag; diff --git a/src/compute_inertia_chunk.h b/src/compute_inertia_chunk.h index 8f8a1c522d..87e6bedb78 100644 --- a/src/compute_inertia_chunk.h +++ b/src/compute_inertia_chunk.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class ComputeInertiaChunk : public Compute { public: ComputeInertiaChunk(class LAMMPS *, int, char **); - ~ComputeInertiaChunk(); - void init(); - void compute_array(); + ~ComputeInertiaChunk() override; + void init() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_ke.h b/src/compute_ke.h index f9043e2a84..b84ffde1ef 100644 --- a/src/compute_ke.h +++ b/src/compute_ke.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class ComputeKE : public Compute { public: ComputeKE(class LAMMPS *, int, char **); - void init(); - double compute_scalar(); + void init() override; + double compute_scalar() override; private: double pfactor; diff --git a/src/compute_ke_atom.h b/src/compute_ke_atom.h index e676dec920..8b773f7f24 100644 --- a/src/compute_ke_atom.h +++ b/src/compute_ke_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeKEAtom : public Compute { public: ComputeKEAtom(class LAMMPS *, int, char **); - ~ComputeKEAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputeKEAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nmax; diff --git a/src/compute_msd.h b/src/compute_msd.h index 9649559756..33338b86d4 100644 --- a/src/compute_msd.h +++ b/src/compute_msd.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeMSD : public Compute { public: ComputeMSD(class LAMMPS *, int, char **); - virtual ~ComputeMSD(); - void init(); - virtual void compute_vector(); - void set_arrays(int); + ~ComputeMSD() override; + void init() override; + void compute_vector() override; + void set_arrays(int) override; protected: int comflag; // comflag = 1 if reference moves with center of mass diff --git a/src/compute_msd_chunk.h b/src/compute_msd_chunk.h index 3dbf994909..18fd91b6d5 100644 --- a/src/compute_msd_chunk.h +++ b/src/compute_msd_chunk.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class ComputeMSDChunk : public Compute { public: ComputeMSDChunk(class LAMMPS *, int, char **); - ~ComputeMSDChunk(); - void init(); - void setup(); - void compute_array(); + ~ComputeMSDChunk() override; + void init() override; + void setup() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk; diff --git a/src/compute_omega_chunk.h b/src/compute_omega_chunk.h index f1fc87f0ed..b058796067 100644 --- a/src/compute_omega_chunk.h +++ b/src/compute_omega_chunk.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class ComputeOmegaChunk : public Compute { public: ComputeOmegaChunk(class LAMMPS *, int, char **); - ~ComputeOmegaChunk(); - void init(); - void compute_array(); + ~ComputeOmegaChunk() override; + void init() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_orientorder_atom.h b/src/compute_orientorder_atom.h index 3394feb4ab..b88b01fbc9 100644 --- a/src/compute_orientorder_atom.h +++ b/src/compute_orientorder_atom.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeOrientOrderAtom : public Compute { public: ComputeOrientOrderAtom(class LAMMPS *, int, char **); - ~ComputeOrientOrderAtom(); - virtual void init(); - void init_list(int, class NeighList *); - virtual void compute_peratom(); - double memory_usage(); + ~ComputeOrientOrderAtom() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + double memory_usage() override; double cutsq; int iqlcomp, qlcomp, qlcompflag, wlflag, wlhatflag; int *qlist; diff --git a/src/compute_pair.h b/src/compute_pair.h index c2de4b7bc4..5918f89111 100644 --- a/src/compute_pair.h +++ b/src/compute_pair.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputePair : public Compute { public: ComputePair(class LAMMPS *, int, char **); - ~ComputePair(); - void init(); - double compute_scalar(); - void compute_vector(); + ~ComputePair() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; private: int evalue, npair, nsub; diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index ff9acdc4ef..3dc37707c6 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -226,13 +226,13 @@ int ComputePairLocal::compute_pairs(int flag) factor_lj = special_lj[sbmask(j)]; factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; + jtag = tag[j]; if (!(mask[j] & groupbit)) continue; // itag = jtag is possible for long cutoffs that include images of self if (newton_pair == 0 && j >= nlocal) { - jtag = tag[j]; if (itag > jtag) { if ((itag+jtag) % 2 == 0) continue; } else if (itag < jtag) { @@ -277,10 +277,13 @@ int ComputePairLocal::compute_pairs(int flag) break; case DX: ptr[n] = delx*directionCorrection; + break; case DY: ptr[n] = dely*directionCorrection; + break; case DZ: ptr[n] = delz*directionCorrection; + break; case ENG: ptr[n] = eng; break; diff --git a/src/compute_pair_local.h b/src/compute_pair_local.h index 8a3f5860fd..1d356c71a2 100644 --- a/src/compute_pair_local.h +++ b/src/compute_pair_local.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputePairLocal : public Compute { public: ComputePairLocal(class LAMMPS *, int, char **); - ~ComputePairLocal(); - void init(); - void init_list(int, class NeighList *); - void compute_local(); - double memory_usage(); + ~ComputePairLocal() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_local() override; + double memory_usage() override; private: int nvalues, ncount, cutstyle; diff --git a/src/compute_pe.h b/src/compute_pe.h index 7dbced863d..31e4747850 100644 --- a/src/compute_pe.h +++ b/src/compute_pe.h @@ -27,9 +27,8 @@ namespace LAMMPS_NS { class ComputePE : public Compute { public: ComputePE(class LAMMPS *, int, char **); - ~ComputePE() {} - void init() {} - double compute_scalar(); + void init() override {} + double compute_scalar() override; private: int pairflag, bondflag, angleflag, dihedralflag, improperflag, kspaceflag, fixflag; diff --git a/src/compute_pe_atom.h b/src/compute_pe_atom.h index 57015550ac..b89be3e853 100644 --- a/src/compute_pe_atom.h +++ b/src/compute_pe_atom.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputePEAtom : public Compute { public: ComputePEAtom(class LAMMPS *, int, char **); - ~ComputePEAtom(); - void init() {} - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputePEAtom() override; + void init() override {} + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int pairflag, bondflag, angleflag, dihedralflag, improperflag; diff --git a/src/compute_pressure.h b/src/compute_pressure.h index f0dcda7330..ebffd3a4fc 100644 --- a/src/compute_pressure.h +++ b/src/compute_pressure.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputePressure : public Compute { public: ComputePressure(class LAMMPS *, int, char **); - virtual ~ComputePressure(); - virtual void init(); - virtual double compute_scalar(); - virtual void compute_vector(); - void reset_extra_compute_fix(const char *); + ~ComputePressure() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; + void reset_extra_compute_fix(const char *) override; protected: double boltz, nktv2p, inv_volume; diff --git a/src/compute_property_atom.h b/src/compute_property_atom.h index 5a7fe787bd..903fece488 100644 --- a/src/compute_property_atom.h +++ b/src/compute_property_atom.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputePropertyAtom : public Compute { public: ComputePropertyAtom(class LAMMPS *, int, char **); - ~ComputePropertyAtom(); - void init(); - void compute_peratom(); - double memory_usage(); + ~ComputePropertyAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; private: int nvalues; diff --git a/src/compute_property_chunk.h b/src/compute_property_chunk.h index 2f882f1930..83db5d6256 100644 --- a/src/compute_property_chunk.h +++ b/src/compute_property_chunk.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class ComputePropertyChunk : public Compute { public: ComputePropertyChunk(class LAMMPS *, int, char **); - ~ComputePropertyChunk(); - void init(); - void compute_vector(); - void compute_array(); + ~ComputePropertyChunk() override; + void init() override; + void compute_vector() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_property_local.h b/src/compute_property_local.h index 419c31eeb2..eec8e8ce94 100644 --- a/src/compute_property_local.h +++ b/src/compute_property_local.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputePropertyLocal : public Compute { public: ComputePropertyLocal(class LAMMPS *, int, char **); - ~ComputePropertyLocal(); - void init(); - void init_list(int, class NeighList *); - void compute_local(); - double memory_usage(); + ~ComputePropertyLocal() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_local() override; + double memory_usage() override; private: int nvalues, kindflag, cutstyle; diff --git a/src/compute_rdf.h b/src/compute_rdf.h index 4a0de6522f..77dd0cc0c7 100644 --- a/src/compute_rdf.h +++ b/src/compute_rdf.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeRDF : public Compute { public: ComputeRDF(class LAMMPS *, int, char **); - ~ComputeRDF(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); + ~ComputeRDF() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_array() override; private: int nbin; // # of rdf bins diff --git a/src/compute_reduce.h b/src/compute_reduce.h index 24745a456a..ac2b1e60a2 100644 --- a/src/compute_reduce.h +++ b/src/compute_reduce.h @@ -30,11 +30,11 @@ class ComputeReduce : public Compute { enum { PERATOM, LOCAL }; ComputeReduce(class LAMMPS *, int, char **); - virtual ~ComputeReduce(); - void init(); - double compute_scalar(); - void compute_vector(); - double memory_usage(); + ~ComputeReduce() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; + double memory_usage() override; protected: int me; diff --git a/src/compute_reduce_chunk.h b/src/compute_reduce_chunk.h index 350db72df7..b595558bc7 100644 --- a/src/compute_reduce_chunk.h +++ b/src/compute_reduce_chunk.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class ComputeReduceChunk : public Compute { public: ComputeReduceChunk(class LAMMPS *, int, char **); - ~ComputeReduceChunk(); - void init(); - void compute_vector(); - void compute_array(); + ~ComputeReduceChunk() override; + void init() override; + void compute_vector() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int mode, nvalues; diff --git a/src/compute_reduce_region.h b/src/compute_reduce_region.h index 08d7e9a55f..04dd8b82e8 100644 --- a/src/compute_reduce_region.h +++ b/src/compute_reduce_region.h @@ -27,11 +27,10 @@ namespace LAMMPS_NS { class ComputeReduceRegion : public ComputeReduce { public: ComputeReduceRegion(class LAMMPS *, int, char **); - ~ComputeReduceRegion() {} private: - double compute_one(int, int); - bigint count(int); + double compute_one(int, int) override; + bigint count(int) override; }; } // namespace LAMMPS_NS diff --git a/src/compute_slice.h b/src/compute_slice.h index cd70516f11..742f5a9b10 100644 --- a/src/compute_slice.h +++ b/src/compute_slice.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeSlice : public Compute { public: ComputeSlice(class LAMMPS *, int, char **); - virtual ~ComputeSlice(); - void init(); - void compute_vector(); - void compute_array(); + ~ComputeSlice() override; + void init() override; + void compute_vector() override; + void compute_array() override; private: int me; diff --git a/src/compute_stress_atom.h b/src/compute_stress_atom.h index 4d126df0b4..4f636ed9bd 100644 --- a/src/compute_stress_atom.h +++ b/src/compute_stress_atom.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class ComputeStressAtom : public Compute { public: ComputeStressAtom(class LAMMPS *, int, char **); - ~ComputeStressAtom(); - void init(); - void compute_peratom(); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - double memory_usage(); + ~ComputeStressAtom() override; + void init() override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: int keflag, pairflag, bondflag, angleflag, dihedralflag, improperflag; diff --git a/src/compute_temp.h b/src/compute_temp.h index efc7ff2ab0..674144be83 100644 --- a/src/compute_temp.h +++ b/src/compute_temp.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class ComputeTemp : public Compute { public: ComputeTemp(class LAMMPS *, int, char **); - virtual ~ComputeTemp(); - void init() {} - void setup(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputeTemp() override; + void init() override {} + void setup() override; + double compute_scalar() override; + void compute_vector() override; protected: double tfactor; diff --git a/src/compute_temp_chunk.h b/src/compute_temp_chunk.h index 7a84cad902..b283de9dbc 100644 --- a/src/compute_temp_chunk.h +++ b/src/compute_temp_chunk.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class ComputeTempChunk : public Compute { public: ComputeTempChunk(class LAMMPS *, int, char **); - ~ComputeTempChunk(); - void init(); - double compute_scalar(); - void compute_vector(); - void compute_array(); + ~ComputeTempChunk() override; + void init() override; + double compute_scalar() override; + void compute_vector() override; + void compute_array() override; - void remove_bias(int, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); + void remove_bias(int, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk, comflag, biasflag; diff --git a/src/compute_temp_com.h b/src/compute_temp_com.h index 3887bcdbd2..595c50502d 100644 --- a/src/compute_temp_com.h +++ b/src/compute_temp_com.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class ComputeTempCOM : public Compute { public: ComputeTempCOM(class LAMMPS *, int, char **); - ~ComputeTempCOM(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempCOM() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); - void restore_bias_thr(int, double *, double *); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; + void restore_bias_thr(int, double *, double *) override; private: double tfactor, masstotal; diff --git a/src/compute_temp_deform.h b/src/compute_temp_deform.h index 572d09d041..a120108669 100644 --- a/src/compute_temp_deform.h +++ b/src/compute_temp_deform.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class ComputeTempDeform : public Compute { public: ComputeTempDeform(class LAMMPS *, int, char **); - virtual ~ComputeTempDeform(); - void init(); - void setup(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputeTempDeform() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_thr(int, double *, double *); - void restore_bias_all(); - double memory_usage(); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_thr(int, double *, double *) override; + void restore_bias_all() override; + double memory_usage() override; protected: double tfactor; diff --git a/src/compute_temp_partial.h b/src/compute_temp_partial.h index 8021e8cc57..55c7ceb5e8 100644 --- a/src/compute_temp_partial.h +++ b/src/compute_temp_partial.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class ComputeTempPartial : public Compute { public: ComputeTempPartial(class LAMMPS *, int, char **); - virtual ~ComputeTempPartial(); - void init() {} - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempPartial() override; + void init() override {} + void setup() override; + double compute_scalar() override; + void compute_vector() override; - int dof_remove(int); - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void reapply_bias_all(); - void restore_bias(int, double *); - void restore_bias_thr(int, double *, double *); - void restore_bias_all(); - double memory_usage(); + int dof_remove(int) override; + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void reapply_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_thr(int, double *, double *) override; + void restore_bias_all() override; + double memory_usage() override; protected: int xflag, yflag, zflag; diff --git a/src/compute_temp_profile.h b/src/compute_temp_profile.h index 9cad1f26ec..f9f2e42156 100644 --- a/src/compute_temp_profile.h +++ b/src/compute_temp_profile.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class ComputeTempProfile : public Compute { public: ComputeTempProfile(class LAMMPS *, int, char **); - ~ComputeTempProfile(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); - void compute_array(); + ~ComputeTempProfile() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; + void compute_array() override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_thr(int, double *, double *); - void restore_bias_all(); - double memory_usage(); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_thr(int, double *, double *) override; + void restore_bias_all() override; + double memory_usage() override; private: int xflag, yflag, zflag, ncount, outflag; diff --git a/src/compute_temp_ramp.h b/src/compute_temp_ramp.h index 55fc989c3c..e2d790fff1 100644 --- a/src/compute_temp_ramp.h +++ b/src/compute_temp_ramp.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class ComputeTempRamp : public Compute { public: ComputeTempRamp(class LAMMPS *, int, char **); - ~ComputeTempRamp(); - void init() {} - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempRamp() override; + void init() override {} + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_all(); - void remove_bias_thr(int, double *, double *); - void restore_bias(int, double *); - void restore_bias_thr(int, double *, double *); - void restore_bias_all(); - double memory_usage(); + void remove_bias(int, double *) override; + void remove_bias_all() override; + void remove_bias_thr(int, double *, double *) override; + void restore_bias(int, double *) override; + void restore_bias_thr(int, double *, double *) override; + void restore_bias_all() override; + double memory_usage() override; private: int coord_dim; diff --git a/src/compute_temp_region.h b/src/compute_temp_region.h index ba730f91ab..8129f01023 100644 --- a/src/compute_temp_region.h +++ b/src/compute_temp_region.h @@ -27,22 +27,22 @@ namespace LAMMPS_NS { class ComputeTempRegion : public Compute { public: ComputeTempRegion(class LAMMPS *, int, char **); - virtual ~ComputeTempRegion(); - void init(); - void setup(); - virtual double compute_scalar(); - virtual void compute_vector(); + ~ComputeTempRegion() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void dof_remove_pre(); - int dof_remove(int); + void dof_remove_pre() override; + int dof_remove(int) override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void remove_bias_all(); - void restore_bias(int, double *); - void restore_bias_all(); - void restore_bias_thr(int, double *, double *); - double memory_usage(); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void remove_bias_all() override; + void restore_bias(int, double *) override; + void restore_bias_all() override; + void restore_bias_thr(int, double *, double *) override; + double memory_usage() override; protected: int iregion; diff --git a/src/compute_temp_sphere.h b/src/compute_temp_sphere.h index 0e0ae0bc59..7b91a890a2 100644 --- a/src/compute_temp_sphere.h +++ b/src/compute_temp_sphere.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class ComputeTempSphere : public Compute { public: ComputeTempSphere(class LAMMPS *, int, char **); - ~ComputeTempSphere(); - void init(); - void setup(); - double compute_scalar(); - void compute_vector(); + ~ComputeTempSphere() override; + void init() override; + void setup() override; + double compute_scalar() override; + void compute_vector() override; - void remove_bias(int, double *); - void remove_bias_thr(int, double *, double *); - void restore_bias(int, double *); - void restore_bias_thr(int, double *, double *); + void remove_bias(int, double *) override; + void remove_bias_thr(int, double *, double *) override; + void restore_bias(int, double *) override; + void restore_bias_thr(int, double *, double *) override; private: int mode; diff --git a/src/compute_torque_chunk.h b/src/compute_torque_chunk.h index 928af35236..a1fce2d0d4 100644 --- a/src/compute_torque_chunk.h +++ b/src/compute_torque_chunk.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class ComputeTorqueChunk : public Compute { public: ComputeTorqueChunk(class LAMMPS *, int, char **); - ~ComputeTorqueChunk(); - void init(); - void compute_array(); + ~ComputeTorqueChunk() override; + void init() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/compute_vacf.h b/src/compute_vacf.h index bb318a2b1a..7bc93dbaaa 100644 --- a/src/compute_vacf.h +++ b/src/compute_vacf.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class ComputeVACF : public Compute { public: ComputeVACF(class LAMMPS *, int, char **); - ~ComputeVACF(); - void init(); - virtual void compute_vector(); - void set_arrays(int); + ~ComputeVACF() override; + void init() override; + void compute_vector() override; + void set_arrays(int) override; protected: bigint nvacf; diff --git a/src/compute_vcm_chunk.h b/src/compute_vcm_chunk.h index 3f25a73585..42ae0de7ef 100644 --- a/src/compute_vcm_chunk.h +++ b/src/compute_vcm_chunk.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class ComputeVCMChunk : public Compute { public: ComputeVCMChunk(class LAMMPS *, int, char **); - ~ComputeVCMChunk(); - void init(); - void setup(); - void compute_array(); + ~ComputeVCMChunk() override; + void init() override; + void setup() override; + void compute_array() override; - void lock_enable(); - void lock_disable(); - int lock_length(); - void lock(class Fix *, bigint, bigint); - void unlock(class Fix *); + void lock_enable() override; + void lock_disable() override; + int lock_length() override; + void lock(class Fix *, bigint, bigint) override; + void unlock(class Fix *) override; - double memory_usage(); + double memory_usage() override; private: int nchunk, maxchunk; diff --git a/src/create_atoms.h b/src/create_atoms.h index 1d62c801e8..5b71394447 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class CreateAtoms : public Command { public: CreateAtoms(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; private: int me, nprocs; diff --git a/src/create_bonds.h b/src/create_bonds.h index eae90bef7f..aec0f14c6a 100644 --- a/src/create_bonds.h +++ b/src/create_bonds.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class CreateBonds : public Command { public: CreateBonds(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; private: int igroup, group1bit, group2bit; diff --git a/src/create_box.h b/src/create_box.h index c5a24f280a..dd74755cf8 100644 --- a/src/create_box.h +++ b/src/create_box.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class CreateBox : public Command { public: CreateBox(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/delete_atoms.h b/src/delete_atoms.h index 07d1b1352a..161427e4ef 100644 --- a/src/delete_atoms.h +++ b/src/delete_atoms.h @@ -28,7 +28,7 @@ namespace LAMMPS_NS { class DeleteAtoms : public Command { public: DeleteAtoms(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; private: int *dlist; diff --git a/src/delete_bonds.h b/src/delete_bonds.h index 6146104161..aff891e1ca 100644 --- a/src/delete_bonds.h +++ b/src/delete_bonds.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DeleteBonds : public Command { public: DeleteBonds(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/deprecated.h b/src/deprecated.h index b06599edf4..609d0f9326 100644 --- a/src/deprecated.h +++ b/src/deprecated.h @@ -33,7 +33,7 @@ namespace LAMMPS_NS { class Deprecated : public Command { public: Deprecated(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/dihedral.h b/src/dihedral.h index 81daeef201..7bb7eb2650 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -43,7 +43,7 @@ class Dihedral : protected Pointers { int copymode; Dihedral(class LAMMPS *); - virtual ~Dihedral(); + ~Dihedral() override; virtual void init(); virtual void init_style() {} virtual void compute(int, int) = 0; diff --git a/src/dihedral_deprecated.h b/src/dihedral_deprecated.h index a0a287931e..2ee1544743 100644 --- a/src/dihedral_deprecated.h +++ b/src/dihedral_deprecated.h @@ -27,13 +27,12 @@ namespace LAMMPS_NS { class DihedralDeprecated : public Dihedral { public: DihedralDeprecated(class LAMMPS *lmp) : Dihedral(lmp) {} - virtual ~DihedralDeprecated() {} - virtual void compute(int, int) {} - virtual void settings(int, char **); - virtual void coeff(int, char **) {} - virtual void write_restart(FILE *) {} - virtual void read_restart(FILE *) {} + void compute(int, int) override {} + void settings(int, char **) override; + void coeff(int, char **) override {} + void write_restart(FILE *) override {} + void read_restart(FILE *) override {} }; } // namespace LAMMPS_NS diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 24a18e6783..0f72f999c9 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -241,7 +241,7 @@ void DihedralHybrid::settings(int narg, char **arg) error->all(FLERR, "Dihedral style hybrid cannot have none as an argument"); styles[nstyles] = force->new_dihedral(arg[i], 1, dummy); - force->store_style(keywords[nstyles], arg[i], 0); + keywords[nstyles] = force->store_style(arg[i], 0); istyle = i; if (strcmp(arg[i], "table") == 0) i++; diff --git a/src/dihedral_hybrid.h b/src/dihedral_hybrid.h index 04a88e7651..bbdeb526b3 100644 --- a/src/dihedral_hybrid.h +++ b/src/dihedral_hybrid.h @@ -31,14 +31,14 @@ class DihedralHybrid : public Dihedral { char **keywords; // keyword for each dihedral style DihedralHybrid(class LAMMPS *); - ~DihedralHybrid(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - void write_restart(FILE *); - void read_restart(FILE *); - double memory_usage(); + ~DihedralHybrid() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double memory_usage() override; private: int *map; // which style each dihedral type points to diff --git a/src/dihedral_zero.h b/src/dihedral_zero.h index 7349f95130..6428834a54 100644 --- a/src/dihedral_zero.h +++ b/src/dihedral_zero.h @@ -31,14 +31,14 @@ namespace LAMMPS_NS { class DihedralZero : public Dihedral { public: DihedralZero(class LAMMPS *); - virtual ~DihedralZero(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void settings(int, char **); + ~DihedralZero() override; + void compute(int, int) override; + void coeff(int, char **) override; + void settings(int, char **) override; - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int coeffflag; diff --git a/src/displace_atoms.h b/src/displace_atoms.h index e1a0947125..3d04262a73 100644 --- a/src/displace_atoms.h +++ b/src/displace_atoms.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class DisplaceAtoms : public Command { public: DisplaceAtoms(class LAMMPS *); - ~DisplaceAtoms(); - void command(int, char **); + ~DisplaceAtoms() override; + void command(int, char **) override; private: int igroup, groupbit; diff --git a/src/domain.cpp b/src/domain.cpp index 22c38c977a..29244dff6a 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -47,6 +47,15 @@ using namespace LAMMPS_NS; #define DELTAREGION 4 #define BONDSTRETCH 1.1 +/* ---------------------------------------------------------------------- + one instance per region style in style_region.h +------------------------------------------------------------------------- */ + +template static Region *region_creator(LAMMPS *lmp, int narg, char ** arg) +{ + return new T(lmp, narg, arg); +} + /* ---------------------------------------------------------------------- default is periodic ------------------------------------------------------------------------- */ @@ -1797,16 +1806,6 @@ void Domain::add_region(int narg, char **arg) nregion++; } -/* ---------------------------------------------------------------------- - one instance per region style in style_region.h -------------------------------------------------------------------------- */ - -template -Region *Domain::region_creator(LAMMPS *lmp, int narg, char ** arg) -{ - return new T(lmp, narg, arg); -} - /* ---------------------------------------------------------------------- delete a region ------------------------------------------------------------------------- */ diff --git a/src/domain.h b/src/domain.h index 234bdbb837..68ff5aece5 100644 --- a/src/domain.h +++ b/src/domain.h @@ -110,7 +110,7 @@ class Domain : protected Pointers { RegionCreatorMap *region_map; Domain(class LAMMPS *); - virtual ~Domain(); + ~Domain() override; virtual void init(); void set_initial_box(int expandflag = 1); virtual void set_global_box(); @@ -175,9 +175,6 @@ class Domain : protected Pointers { protected: double small[3]; // fractions of box lengths - - private: - template static Region *region_creator(LAMMPS *, int, char **); }; } // namespace LAMMPS_NS diff --git a/src/dump.cpp b/src/dump.cpp index a1f905d974..6cee1c68d6 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -75,6 +75,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) clearstep = 0; sort_flag = 0; + balance_flag = 0; append_flag = 0; buffer_allow = 0; buffer_flag = 0; @@ -417,6 +418,7 @@ void Dump::write() if (sort_flag && sortcol == 0) pack(ids); else pack(nullptr); if (sort_flag) sort(); + if (balance_flag) balance(); // write timestep header // for multiproc, @@ -888,6 +890,151 @@ int Dump::bufcompare_reverse(const int i, const int j, void *ptr) #endif +/* ---------------------------------------------------------------------- + parallel load balance of buf across all procs + must come after sort +------------------------------------------------------------------------- */ + +void Dump::balance() +{ + bigint *proc_offsets,*proc_new_offsets; + memory->create(proc_offsets,nprocs+1,"dump:proc_offsets"); + memory->create(proc_new_offsets,nprocs+1,"dump:proc_new_offsets"); + + // compute atom offset for this proc + + bigint offset; + bigint bnme = nme; + MPI_Scan(&bnme,&offset,1,MPI_LMP_BIGINT,MPI_SUM,world); + + // gather atom offsets for all procs + + MPI_Allgather(&offset,1,MPI_LMP_BIGINT,&proc_offsets[1],1,MPI_LMP_BIGINT,world); + + proc_offsets[0] = 0; + + // how many atoms should I own after balance + + int nme_balance = static_cast(ntotal/nprocs); + + // include remainder atoms on first procs + + int remainder = ntotal % nprocs; + if (me < remainder) nme_balance += 1; + + // compute new atom offset for this proc + + bigint offset_balance; + bigint bnme_balance = nme_balance; + MPI_Scan(&bnme_balance,&offset_balance,1,MPI_LMP_BIGINT,MPI_SUM,world); + + // gather new atom offsets for all procs + + MPI_Allgather(&offset_balance,1,MPI_LMP_BIGINT,&proc_new_offsets[1],1,MPI_LMP_BIGINT,world); + + proc_new_offsets[0] = 0; + + // reset buf size to largest of any post-balance nme values + // this insures proc 0 can receive everyone's info + // cannot shrink buf to nme_balance, must use previous maxbuf value + + int nmax; + MPI_Allreduce(&nme_balance,&nmax,1,MPI_INT,MPI_MAX,world); + if (nmax > maxbuf) maxbuf = nmax; + + // allocate a second buffer for balanced data + + double* buf_balance; + memory->create(buf_balance,maxbuf*size_one,"dump:buf_balance"); + + // compute from which procs I am receiving atoms + // post recvs first + + int nswap = 0; + MPI_Request *request = new MPI_Request[nprocs]; + + // find which proc starting atom belongs to + + int startproc = me; + while (proc_new_offsets[me] < proc_offsets[startproc]) startproc--; + while (proc_new_offsets[me] > proc_offsets[startproc+1]-1) startproc++; + + // find which proc ending atom belongs to + + int endproc = me; + while (proc_new_offsets[me] + nme_balance-1 < proc_offsets[endproc]) endproc--; + while (proc_new_offsets[me] + nme_balance-1 > proc_offsets[endproc+1]-1) endproc++; + + // loop over procs + + for (int iproc = startproc; iproc <= endproc; iproc++) { + int istart = MAX(0, proc_offsets[iproc] - proc_new_offsets[me]); + int iend = MIN(nme_balance-1, proc_offsets[iproc+1]-1 - proc_new_offsets[me]); + int nrecv = iend - istart + 1; + if (nrecv == 0) continue; + + // post receive for this proc + + if (iproc != me) + MPI_Irecv(&buf_balance[istart*size_one],nrecv*size_one,MPI_DOUBLE, + iproc,0,world,&request[nswap++]); + } + + // compute which atoms I am sending and to which procs + + // find which proc starting atom belongs to + + startproc = me; + while (proc_offsets[me] < proc_new_offsets[startproc]) startproc--; + while (proc_offsets[me] > proc_new_offsets[startproc+1]-1) startproc++; + + // find which proc ending atom belongs to + + endproc = me; + while (proc_offsets[me] + nme-1 < proc_new_offsets[endproc]) endproc--; + while (proc_offsets[me] + nme-1 > proc_new_offsets[endproc+1]-1) endproc++; + + // loop over procs + + for (int iproc = startproc; iproc <= endproc; iproc++) { + int istart = MAX(0,proc_new_offsets[iproc] - proc_offsets[me]); + int iend = MIN(nme-1,proc_new_offsets[iproc+1]-1 - proc_offsets[me]); + int nsend = iend - istart + 1; + if (nsend == 0) continue; + + // send for this proc + + if (iproc != me) { + MPI_Send(&buf[istart*size_one],nsend*size_one,MPI_DOUBLE,iproc,0,world); + } else { + + // sending to self, copy buffers + + int offset_me = proc_offsets[me] - proc_new_offsets[me]; + memcpy(&buf_balance[(offset_me + istart)*size_one],&buf[istart*size_one],sizeof(double)*nsend*size_one); + } + } + + // wait for all recvs + + for (int n = 0; n < nswap; n++) + MPI_Wait(&request[n],MPI_STATUS_IGNORE); + + nme = nme_balance; + + // swap buffers + + double *tmp = buf; + buf = buf_balance; + + // cleanup + + memory->destroy(tmp); + memory->destroy(proc_offsets); + memory->destroy(proc_new_offsets); + delete [] request; +} + /* ---------------------------------------------------------------------- process params common to all dumps here if unknown param, call modify_param specific to the dump @@ -1108,6 +1255,12 @@ void Dump::modify_params(int narg, char **arg) } iarg += 2; + } else if (strcmp(arg[iarg],"balance") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); + if (nprocs > 1) + balance_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + iarg += 2; + } else if (strcmp(arg[iarg],"time") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); time_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); diff --git a/src/dump.h b/src/dump.h index 35da154d7c..bce32c9d65 100644 --- a/src/dump.h +++ b/src/dump.h @@ -19,6 +19,7 @@ namespace LAMMPS_NS { class Dump : protected Pointers { + friend class Output; public: char *id; // user-defined name of Dump char *style; // style of Dump @@ -37,7 +38,7 @@ class Dump : protected Pointers { #endif Dump(class LAMMPS *, int, char **); - virtual ~Dump(); + ~Dump() override; void init(); virtual void write(); @@ -66,6 +67,7 @@ class Dump : protected Pointers { int header_flag; // 0 = item, 2 = xyz int flush_flag; // 0 if no flush, 1 if flush every dump int sort_flag; // 1 if sorted output + int balance_flag; // 1 if load balanced output int append_flag; // 1 if open file in append mode, 0 if not int buffer_allow; // 1 if style allows for buffer_flag, 0 if not int buffer_flag; // 1 if buffer output as one big string, 0 if not @@ -160,6 +162,7 @@ class Dump : protected Pointers { static int bufcompare(const int, const int, void *); static int bufcompare_reverse(const int, const int, void *); #endif + void balance(); }; } // namespace LAMMPS_NS diff --git a/src/dump_atom.h b/src/dump_atom.h index b960bf3665..1e1a9315d7 100644 --- a/src/dump_atom.h +++ b/src/dump_atom.h @@ -38,12 +38,12 @@ class DumpAtom : public Dump { char *columns; // column labels - void init_style(); - int modify_param(int, char **); - void write_header(bigint); - void pack(tagint *); - int convert_string(int, double *); - void write_data(int, double *); + void init_style() override; + int modify_param(int, char **) override; + void write_header(bigint) override; + void pack(tagint *) override; + int convert_string(int, double *) override; + void write_data(int, double *) override; void header_format_binary(); void header_unit_style_binary(); diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index 8e87f4104e..d52dac745f 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -167,16 +167,13 @@ int DumpCFG::convert_string(int n, double *mybuf) offset += sprintf(&sbuf[offset],"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2) { if (vtype[j] == Dump::INT) - offset += - sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); else if (vtype[j] == Dump::STRING) - offset += - sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); + offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) - offset += - sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); } m++; } diff --git a/src/dump_cfg.h b/src/dump_cfg.h index 49699a2789..21b5396677 100644 --- a/src/dump_cfg.h +++ b/src/dump_cfg.h @@ -29,16 +29,16 @@ class DumpCFG : public DumpCustom { int multifile_override; // used by write_dump command DumpCFG(class LAMMPS *, int, char **); - virtual ~DumpCFG(); + ~DumpCFG() override; protected: char **auxname; // name strings of auxiliary properties int unwrapflag; // 1 if unwrapped coordinates are requested - void init_style(); - virtual void write_header(bigint); - int convert_string(int, double *); - virtual void write_data(int, double *); + void init_style() override; + void write_header(bigint) override; + int convert_string(int, double *) override; + void write_data(int, double *) override; typedef void (DumpCFG::*FnPtrWrite)(int, double *); FnPtrWrite write_choice; // ptr to write data functions diff --git a/src/dump_custom.h b/src/dump_custom.h index 4209d8e46f..5a99cca009 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpCustom : public Dump { public: DumpCustom(class LAMMPS *, int, char **); - virtual ~DumpCustom(); + ~DumpCustom() override; const char *MAGIC_STRING = "DUMPCUSTOM"; const int FORMAT_REVISION = 0x0002; @@ -97,20 +97,20 @@ class DumpCustom : public Dump { // private methods - virtual void init_style(); - virtual void write_header(bigint); - int count(); - void pack(tagint *); - virtual int convert_string(int, double *); - virtual void write_data(int, double *); - double memory_usage(); + void init_style() override; + void write_header(bigint) override; + int count() override; + void pack(tagint *) override; + int convert_string(int, double *) override; + void write_data(int, double *) override; + double memory_usage() override; int parse_fields(int, char **); int add_compute(const char *); int add_fix(const char *); int add_variable(const char *); int add_custom(const char *, int); - virtual int modify_param(int, char **); + int modify_param(int, char **) override; void header_format_binary(); void header_unit_style_binary(); diff --git a/src/dump_deprecated.h b/src/dump_deprecated.h index 811fde2edb..f8d0c58234 100644 --- a/src/dump_deprecated.h +++ b/src/dump_deprecated.h @@ -28,11 +28,11 @@ namespace LAMMPS_NS { class DumpDeprecated : public Dump { public: DumpDeprecated(class LAMMPS *, int, char **); - ~DumpDeprecated() {} - virtual void init_style() {} - virtual void write_header(bigint) {} - virtual void pack(tagint *) {} - virtual void write_data(int, double *) {} + + void init_style() override {} + void write_header(bigint) override {} + void pack(tagint *) override {} + void write_data(int, double *) override {} }; } // namespace LAMMPS_NS diff --git a/src/dump_image.cpp b/src/dump_image.cpp index c073d152f8..9aecb58120 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1200,11 +1200,11 @@ int DumpImage::modify_param(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); // get list of colors + // assign colors in round-robin fashion to types + auto colors = Tokenizer(arg[2],"/").as_vector(); const int ncolors = colors.size(); - // assign colors in round-robin fashion to types - int m = 0; for (int i = nlo; i <= nhi; i++) { colortype[i] = image->color2rgb(colors[m%ncolors].c_str()); @@ -1249,32 +1249,19 @@ int DumpImage::modify_param(int narg, char **arg) int nlo,nhi; utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); - // ptrs = list of ncount colornames separated by '/' + // process list of ncount colornames separated by '/' + // assign colors in round-robin fashion to bond types - int ncount = 1; - char *nextptr; - char *ptr = arg[2]; - while ((nextptr = strchr(ptr,'/'))) { - ptr = nextptr + 1; - ncount++; - } - char **ptrs = new char*[ncount+1]; - ncount = 0; - ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(nullptr,"/"))); - ncount--; - - // assign each of ncount colors in round-robin fashion to types + auto colors = Tokenizer(arg[2],"/").as_vector(); + const int ncolors = colors.size(); int m = 0; for (int i = nlo; i <= nhi; i++) { - bcolortype[i] = image->color2rgb(ptrs[m%ncount]); + bcolortype[i] = image->color2rgb(colors[m%ncolors].c_str()); if (bcolortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } - - delete [] ptrs; return 3; } diff --git a/src/dump_image.h b/src/dump_image.h index e3bf1a9183..6c2f419f2e 100644 --- a/src/dump_image.h +++ b/src/dump_image.h @@ -29,9 +29,9 @@ class DumpImage : public DumpCustom { int multifile_override; // used by write_dump command DumpImage(class LAMMPS *, int, char **); - virtual ~DumpImage(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); + ~DumpImage() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; protected: int filetype; @@ -91,9 +91,9 @@ class DumpImage : public DumpCustom { double **bufcopy; // buffer for communicating bond/atom info int maxbufcopy; - virtual void init_style(); - int modify_param(int, char **); - void write(); + void init_style() override; + int modify_param(int, char **) override; + void write() override; void box_center(); void view_params(); diff --git a/src/dump_local.h b/src/dump_local.h index 1bbdbb1db7..7cd441c8e7 100644 --- a/src/dump_local.h +++ b/src/dump_local.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpLocal : public Dump { public: DumpLocal(LAMMPS *, int, char **); - virtual ~DumpLocal(); + ~DumpLocal() override; protected: int nevery; // dump frequency to check Fix against @@ -53,13 +53,13 @@ class DumpLocal : public Dump { char **id_fix; // their IDs class Fix **fix; // list of ptrs to the Fix objects - void init_style(); - int modify_param(int, char **); - virtual void write_header(bigint); - int count(); - void pack(tagint *); - int convert_string(int, double *); - virtual void write_data(int, double *); + void init_style() override; + int modify_param(int, char **) override; + void write_header(bigint) override; + int count() override; + void pack(tagint *) override; + int convert_string(int, double *) override; + void write_data(int, double *) override; void parse_fields(int, char **); int add_compute(const char *); diff --git a/src/dump_movie.h b/src/dump_movie.h index 770193e039..dd302d40b3 100644 --- a/src/dump_movie.h +++ b/src/dump_movie.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class DumpMovie : public DumpImage { public: DumpMovie(LAMMPS *, int, char **); - virtual ~DumpMovie(); + ~DumpMovie() override; - virtual void openfile(); - virtual void init_style(); - virtual int modify_param(int, char **); + void openfile() override; + void init_style() override; + int modify_param(int, char **) override; protected: double framerate; // frame rate of animation diff --git a/src/dump_xyz.h b/src/dump_xyz.h index b517a1db13..e9d43a5d91 100644 --- a/src/dump_xyz.h +++ b/src/dump_xyz.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class DumpXYZ : public Dump { public: DumpXYZ(class LAMMPS *, int, char **); - virtual ~DumpXYZ(); + ~DumpXYZ() override; protected: int ntypes; char **typenames; - void init_style(); - void write_header(bigint); - void pack(tagint *); - int convert_string(int, double *); - void write_data(int, double *); - int modify_param(int, char **); + void init_style() override; + void write_header(bigint) override; + void pack(tagint *) override; + int convert_string(int, double *) override; + void write_data(int, double *) override; + int modify_param(int, char **) override; typedef void (DumpXYZ::*FnPtrWrite)(int, double *); FnPtrWrite write_choice; // ptr to write data functions diff --git a/src/error.cpp b/src/error.cpp index e2162cf661..912093c865 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -213,8 +213,7 @@ void Error::one(const std::string &file, int line, const std::string &str) throw LAMMPSAbortException(mesg, world); #else - if (screen) fflush(screen); - if (logfile) fflush(logfile); + utils::flush_buffers(lmp); KokkosLMP::finalize(); MPI_Abort(world,1); exit(1); // to trick "smart" compilers into believing this does not return diff --git a/src/exceptions.h b/src/exceptions.h index 1c9d8c8daf..f10f4ecf89 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -26,9 +26,7 @@ class LAMMPSException : public std::exception { LAMMPSException(const std::string &msg) : message(msg) {} - ~LAMMPSException() noexcept {} - - virtual const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; class LAMMPSAbortException : public LAMMPSException { diff --git a/src/file_writer.h b/src/file_writer.h index 42e636d16f..3b34fb1f17 100644 --- a/src/file_writer.h +++ b/src/file_writer.h @@ -39,9 +39,7 @@ class FileWriterException : public std::exception { public: FileWriterException(const std::string &msg) : message(msg) {} - ~FileWriterException() noexcept {} - - virtual const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; } // namespace LAMMPS_NS diff --git a/src/fix.h b/src/fix.h index 339da03734..a83b032172 100644 --- a/src/fix.h +++ b/src/fix.h @@ -130,7 +130,7 @@ class Fix : protected Pointers { unsigned int datamask_read, datamask_modify; Fix(class LAMMPS *, int, char **); - virtual ~Fix(); + ~Fix() override; void modify_params(int, char **); virtual int setmask() = 0; diff --git a/src/fix_adapt.h b/src/fix_adapt.h index db3dcf269c..939f46f8a2 100644 --- a/src/fix_adapt.h +++ b/src/fix_adapt.h @@ -30,18 +30,18 @@ class FixAdapt : public Fix { int chgflag; FixAdapt(class LAMMPS *, int, char **); - ~FixAdapt(); - int setmask(); - void post_constructor(); - void init(); - void setup_pre_force(int); - void pre_force(int); - void post_run(); - void setup_pre_force_respa(int, int); - void pre_force_respa(int, int, int); - void set_arrays(int); - void write_restart(FILE *); - void restart(char *); + ~FixAdapt() override; + int setmask() override; + void post_constructor() override; + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; + void post_run() override; + void setup_pre_force_respa(int, int) override; + void pre_force_respa(int, int, int) override; + void set_arrays(int) override; + void write_restart(FILE *) override; + void restart(char *) override; private: int nadapt, resetflag, scaleflag, massflag; diff --git a/src/fix_addforce.h b/src/fix_addforce.h index 507bb26acb..a3d579c495 100644 --- a/src/fix_addforce.h +++ b/src/fix_addforce.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixAddForce : public Fix { public: FixAddForce(class LAMMPS *, int, char **); - ~FixAddForce(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); - double memory_usage(); + ~FixAddForce() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; + double memory_usage() override; private: double xvalue, yvalue, zvalue; diff --git a/src/fix_ave_atom.h b/src/fix_ave_atom.h index 0cb1ad80bc..f55f8abdd1 100644 --- a/src/fix_ave_atom.h +++ b/src/fix_ave_atom.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixAveAtom : public Fix { public: FixAveAtom(class LAMMPS *, int, char **); - ~FixAveAtom(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); + ~FixAveAtom() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: int nvalues; diff --git a/src/fix_ave_chunk.h b/src/fix_ave_chunk.h index 69fdea0f06..b0089e3871 100644 --- a/src/fix_ave_chunk.h +++ b/src/fix_ave_chunk.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixAveChunk : public Fix { public: FixAveChunk(class LAMMPS *, int, char **); - ~FixAveChunk(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); - double compute_array(int, int); - double memory_usage(); + ~FixAveChunk() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_array(int, int) override; + double memory_usage() override; private: int nvalues; diff --git a/src/fix_ave_correlate.h b/src/fix_ave_correlate.h index 6dde75c0d3..46781da8c5 100644 --- a/src/fix_ave_correlate.h +++ b/src/fix_ave_correlate.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixAveCorrelate : public Fix { public: FixAveCorrelate(class LAMMPS *, int, char **); - ~FixAveCorrelate(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); - double compute_array(int, int); + ~FixAveCorrelate() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_array(int, int) override; private: int me, nvalues; diff --git a/src/fix_ave_histo.h b/src/fix_ave_histo.h index ef64ad74ff..cf9f11a8e5 100644 --- a/src/fix_ave_histo.h +++ b/src/fix_ave_histo.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixAveHisto : public Fix { public: FixAveHisto(class LAMMPS *, int, char **); - virtual ~FixAveHisto(); - int setmask(); - void init(); - void setup(int); - virtual void end_of_step(); - double compute_vector(int); - double compute_array(int, int); + ~FixAveHisto() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_vector(int) override; + double compute_array(int, int) override; protected: int me, nvalues; diff --git a/src/fix_ave_histo_weight.h b/src/fix_ave_histo_weight.h index cd1d1c0465..95a96b13bb 100644 --- a/src/fix_ave_histo_weight.h +++ b/src/fix_ave_histo_weight.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixAveHistoWeight : public FixAveHisto { public: FixAveHistoWeight(class LAMMPS *, int, char **); - ~FixAveHistoWeight() {} - void end_of_step(); + + void end_of_step() override; private: void bin_one_weights(double, double); diff --git a/src/fix_ave_time.h b/src/fix_ave_time.h index 3a26dd6d70..01b6440e5c 100644 --- a/src/fix_ave_time.h +++ b/src/fix_ave_time.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixAveTime : public Fix { public: FixAveTime(class LAMMPS *, int, char **); - ~FixAveTime(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); - double compute_scalar(); - double compute_vector(int); - double compute_array(int, int); + ~FixAveTime() 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: int me, nvalues; diff --git a/src/fix_aveforce.h b/src/fix_aveforce.h index c9e7735a42..88c83064b0 100644 --- a/src/fix_aveforce.h +++ b/src/fix_aveforce.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixAveForce : public Fix { public: FixAveForce(class LAMMPS *, int, char **); - ~FixAveForce(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_vector(int); + ~FixAveForce() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_vector(int) override; private: double xvalue, yvalue, zvalue; diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 2c76f13bf0..6b5c4b6ab1 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -13,20 +13,22 @@ ------------------------------------------------------------------------- */ #include "fix_balance.h" -#include -#include "balance.h" -#include "update.h" + #include "atom.h" +#include "balance.h" #include "comm.h" #include "domain.h" -#include "neighbor.h" -#include "irregular.h" +#include "error.h" +#include "fix_store.h" #include "force.h" +#include "irregular.h" #include "kspace.h" #include "modify.h" -#include "fix_store.h" +#include "neighbor.h" #include "rcb.h" -#include "error.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_balance.h b/src/fix_balance.h index 02e4a159a9..f74ae2dc69 100644 --- a/src/fix_balance.h +++ b/src/fix_balance.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixBalance : public Fix { public: FixBalance(class LAMMPS *, int, char **); - ~FixBalance(); - int setmask(); - void post_constructor(); - void init(); - void setup(int); - void setup_pre_exchange(); - void pre_exchange(); - void pre_neighbor(); - double compute_scalar(); - double compute_vector(int); - double memory_usage(); + ~FixBalance() override; + int setmask() override; + void post_constructor() override; + void init() override; + void setup(int) override; + void setup_pre_exchange() override; + void pre_exchange() override; + void pre_neighbor() override; + double compute_scalar() override; + double compute_vector(int) override; + double memory_usage() override; private: int nevery, lbstyle, nitermax; diff --git a/src/fix_bond_history.h b/src/fix_bond_history.h index 6d686b1fb6..66ccdf1f97 100644 --- a/src/fix_bond_history.h +++ b/src/fix_bond_history.h @@ -32,15 +32,15 @@ class FixBondHistory : public Fix { public: FixBondHistory(class LAMMPS *, int, char **); - ~FixBondHistory(); - int setmask(); - void post_constructor(); - void setup_post_neighbor(); - void post_neighbor(); - void pre_exchange(); - double memory_usage(); - void write_restart(FILE *fp); - void restart(char *buf); + ~FixBondHistory() override; + int setmask() override; + void post_constructor() override; + void setup_post_neighbor() override; + void post_neighbor() override; + void pre_exchange() override; + double memory_usage() override; + void write_restart(FILE *fp) override; + void restart(char *buf) override; void set_arrays(int); void update_atom_value(int, int, int, double); diff --git a/src/fix_box_relax.h b/src/fix_box_relax.h index 228f1ad88a..00fd77d9a2 100644 --- a/src/fix_box_relax.h +++ b/src/fix_box_relax.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class FixBoxRelax : public Fix { public: FixBoxRelax(class LAMMPS *, int, char **); - ~FixBoxRelax(); - int setmask(); - void init(); + ~FixBoxRelax() override; + int setmask() override; + void init() override; - double min_energy(double *); - void min_store(); - void min_clearstore(); - void min_pushstore(); - void min_popstore(); - int min_reset_ref(); - void min_step(double, double *); - double max_alpha(double *); - int min_dof(); + double min_energy(double *) override; + void min_store() override; + void min_clearstore() override; + void min_pushstore() override; + void min_popstore() override; + int min_reset_ref() override; + void min_step(double, double *) override; + double max_alpha(double *) override; + int min_dof() override; - int modify_param(int, char **); + int modify_param(int, char **) override; private: int p_flag[6]; @@ -89,7 +89,7 @@ class FixBoxRelax : public Fix { void compute_deviatoric(); double compute_strain_energy(); void compute_press_target(); - double compute_scalar(); + double compute_scalar() override; }; } // namespace LAMMPS_NS diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 71429ac0f8..de24d9d652 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -45,7 +45,7 @@ enum{ONE_FROM_ONE,ONE_FROM_TWO,TWO_FROM_ONE}; /* ---------------------------------------------------------------------- */ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -rfix(nullptr), irregular(nullptr), set(nullptr) +irregular(nullptr), set(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix deform command"); @@ -127,8 +127,8 @@ rfix(nullptr), irregular(nullptr), set(nullptr) error->all(FLERR,"Illegal fix deform command"); if (strstr(arg[iarg+3],"v_") != arg[iarg+3]) error->all(FLERR,"Illegal fix deform command"); - delete [] set[index].hstr; - delete [] set[index].hratestr; + delete[] set[index].hstr; + delete[] set[index].hratestr; set[index].hstr = utils::strdup(&arg[iarg+2][2]); set[index].hratestr = utils::strdup(&arg[iarg+3][2]); iarg += 4; @@ -185,8 +185,8 @@ rfix(nullptr), irregular(nullptr), set(nullptr) error->all(FLERR,"Illegal fix deform command"); if (strstr(arg[iarg+3],"v_") != arg[iarg+3]) error->all(FLERR,"Illegal fix deform command"); - delete [] set[index].hstr; - delete [] set[index].hratestr; + delete[] set[index].hstr; + delete[] set[index].hratestr; set[index].hstr = utils::strdup(&arg[iarg+2][2]); set[index].hratestr = utils::strdup(&arg[iarg+3][2]); iarg += 4; @@ -344,7 +344,6 @@ rfix(nullptr), irregular(nullptr), set(nullptr) force_reneighbor = 1; next_reneighbor = -1; - nrigid = 0; flip = 0; if (force_reneighbor) irregular = new Irregular(lmp); @@ -359,12 +358,11 @@ FixDeform::~FixDeform() { if (set) { for (int i = 0; i < 6; i++) { - delete [] set[i].hstr; - delete [] set[i].hratestr; + delete[] set[i].hstr; + delete[] set[i].hratestr; } } - delete [] set; - delete [] rfix; + delete[] set; delete irregular; @@ -395,10 +393,8 @@ void FixDeform::init() // error if more than one fix deform // domain, fix nvt/sllod, compute temp/deform only work on single h_rate - int count = 0; - for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"deform") == 0) count++; - if (count > 1) error->all(FLERR,"More than one fix deform"); + if (modify->get_fix_by_style("deform").size() > 1) + error->all(FLERR,"More than one fix deform"); // Kspace setting @@ -609,20 +605,12 @@ void FixDeform::init() } // detect if any rigid fixes exist so rigid bodies can be rescaled - // rfix[] = indices to each fix rigid + // rfix[] = vector with pointers to each fix rigid - delete [] rfix; - nrigid = 0; - rfix = nullptr; + rfix.clear(); - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->rigid_flag) nrigid++; - if (nrigid) { - rfix = new int[nrigid]; - nrigid = 0; - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->rigid_flag) rfix[nrigid++] = i; - } + for (auto ifix : modify->get_fix_list()) + if (ifix->rigid_flag) rfix.push_back(ifix); } /* ---------------------------------------------------------------------- @@ -894,9 +882,8 @@ void FixDeform::end_of_step() if (mask[i] & groupbit) domain->x2lamda(x[i],x[i]); - if (nrigid) - for (i = 0; i < nrigid; i++) - modify->fix[rfix[i]]->deform(0); + for (auto ifix : rfix) + ifix->deform(0); } // reset global and local box to new size/shape @@ -934,9 +921,8 @@ void FixDeform::end_of_step() if (mask[i] & groupbit) domain->lamda2x(x[i],x[i]); - if (nrigid) - for (i = 0; i < nrigid; i++) - modify->fix[rfix[i]]->deform(1); + for (auto ifix : rfix) + ifix->deform(1); } // redo KSpace coeffs since box has changed diff --git a/src/fix_deform.h b/src/fix_deform.h index c1becf58f9..9d7ddc4683 100644 --- a/src/fix_deform.h +++ b/src/fix_deform.h @@ -30,14 +30,14 @@ class FixDeform : public Fix { int dimflag[6]; // which dims are deformed FixDeform(class LAMMPS *, int, char **); - virtual ~FixDeform(); - int setmask(); - void init(); - virtual void pre_exchange(); - virtual void end_of_step(); - virtual void write_restart(FILE *); - virtual void restart(char *buf); - double memory_usage(); + ~FixDeform() override; + int setmask() override; + void init() override; + void pre_exchange() override; + void end_of_step() override; + void write_restart(FILE *) override; + void restart(char *buf) override; + double memory_usage() override; protected: int triclinic, scaleflag, flipflag; @@ -45,8 +45,7 @@ class FixDeform : public Fix { double *h_rate, *h_ratelo; int varflag; // 1 if VARIABLE option is used, 0 if not int kspace_flag; // 1 if KSpace invoked, 0 if not - int nrigid; // number of rigid fixes - int *rfix; // indices of rigid fixes + std::vector rfix; // pointers to rigid fixes class Irregular *irregular; // for migrating atoms after box flips double TWOPI; diff --git a/src/fix_deposit.h b/src/fix_deposit.h index cc7d482fb0..29f7cbfa43 100644 --- a/src/fix_deposit.h +++ b/src/fix_deposit.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixDeposit : public Fix { public: FixDeposit(class LAMMPS *, int, char **); - ~FixDeposit(); - int setmask(); - void init(); - void setup_pre_exchange(); - void pre_exchange(); - void write_restart(FILE *); - void restart(char *); - void *extract(const char *, int &); + ~FixDeposit() override; + int setmask() override; + void init() override; + void setup_pre_exchange() override; + void pre_exchange() override; + void write_restart(FILE *) override; + void restart(char *) override; + void *extract(const char *, int &) override; private: int ninsert, ntype, nfreq, seed; diff --git a/src/fix_deprecated.h b/src/fix_deprecated.h index a2260ad652..7bbaef4d54 100644 --- a/src/fix_deprecated.h +++ b/src/fix_deprecated.h @@ -30,9 +30,9 @@ namespace LAMMPS_NS { class FixDeprecated : public Fix { public: FixDeprecated(class LAMMPS *, int, char **); - ~FixDeprecated() {} - int setmask() { return 0; } - void init() {} + + int setmask() override { return 0; } + void init() override {} }; } // namespace LAMMPS_NS diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index adb0082fc8..2c73cc07ce 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -14,9 +14,7 @@ #include "fix_dt_reset.h" #include "atom.h" -#include "comm.h" #include "domain.h" -#include "dump.h" #include "error.h" #include "fix.h" #include "force.h" diff --git a/src/fix_dt_reset.h b/src/fix_dt_reset.h index 01cca3b41f..533e94b80c 100644 --- a/src/fix_dt_reset.h +++ b/src/fix_dt_reset.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixDtReset : public Fix { public: FixDtReset(class LAMMPS *, int, char **); - ~FixDtReset() {} - int setmask(); - void init(); - void setup(int); - void end_of_step(); - double compute_scalar(); + + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_scalar() override; private: bigint laststep; diff --git a/src/fix_dummy.h b/src/fix_dummy.h index 970e9fb23a..05be520a32 100644 --- a/src/fix_dummy.h +++ b/src/fix_dummy.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixDummy : public Fix { public: FixDummy(class LAMMPS *, int, char **); - virtual ~FixDummy() {} - int setmask(); + + int setmask() override; protected: int initial_integrate_flag, final_integrate_flag; diff --git a/src/fix_efield.h b/src/fix_efield.h index 20201518ab..9148a94d99 100644 --- a/src/fix_efield.h +++ b/src/fix_efield.h @@ -28,17 +28,17 @@ class FixEfield : public Fix { friend class FixQEqReaxFF; public: FixEfield(class LAMMPS *, int, char **); - ~FixEfield(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double memory_usage(); - double compute_scalar(); - double compute_vector(int); + ~FixEfield() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double memory_usage() override; + double compute_scalar() override; + double compute_vector(int) override; enum { NONE, CONSTANT, EQUAL, ATOM }; diff --git a/src/fix_enforce2d.h b/src/fix_enforce2d.h index afaa28f06f..5826657f40 100644 --- a/src/fix_enforce2d.h +++ b/src/fix_enforce2d.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixEnforce2D : public Fix { public: FixEnforce2D(class LAMMPS *, int, char **); - ~FixEnforce2D(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); + ~FixEnforce2D() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; protected: int nfixlist; diff --git a/src/fix_evaporate.h b/src/fix_evaporate.h index 6005a80257..e350c91608 100644 --- a/src/fix_evaporate.h +++ b/src/fix_evaporate.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixEvaporate : public Fix { public: FixEvaporate(class LAMMPS *, int, char **); - ~FixEvaporate(); - int setmask(); - void init(); - void pre_exchange(); - double compute_scalar(); - double memory_usage(); + ~FixEvaporate() override; + int setmask() override; + void init() override; + void pre_exchange() override; + double compute_scalar() override; + double memory_usage() override; private: int nevery, nflux, iregion; diff --git a/src/fix_external.h b/src/fix_external.h index 16db5d5015..efc017708c 100644 --- a/src/fix_external.h +++ b/src/fix_external.h @@ -29,17 +29,17 @@ class FixExternal : public Fix { double **fexternal; FixExternal(class LAMMPS *, int, char **); - ~FixExternal(); - int setmask(); - void init(); - void setup(int); - void setup_pre_reverse(int, int); - void min_setup(int); - void pre_reverse(int, int); - void post_force(int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixExternal() override; + int setmask() override; + void init() override; + void setup(int) override; + void setup_pre_reverse(int, int) override; + void min_setup(int) override; + void pre_reverse(int, int) override; + void post_force(int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; void set_energy_global(double); void set_virial_global(double *); @@ -48,16 +48,16 @@ class FixExternal : public Fix { void set_vector_length(int); void set_vector(int, double); - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; typedef void (*FnPtr)(void *, bigint, int, tagint *, double **, double **); void set_callback(FnPtr, void *); - void *extract(const char *, int &); + void *extract(const char *, int &) override; private: int mode, ncall, napply, eflag_caller; diff --git a/src/fix_gravity.h b/src/fix_gravity.h index 389c5a1af1..e4309501ef 100644 --- a/src/fix_gravity.h +++ b/src/fix_gravity.h @@ -29,14 +29,14 @@ class FixGravity : public Fix { public: FixGravity(class LAMMPS *, int, char **); - virtual ~FixGravity(); - int setmask(); - void init(); - void setup(int); - virtual void post_force(int); - virtual void post_force_respa(int, int, int); - double compute_scalar(); - void *extract(const char *, int &); + ~FixGravity() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + double compute_scalar() override; + void *extract(const char *, int &) override; enum { CONSTANT, EQUAL }; protected: diff --git a/src/fix_group.h b/src/fix_group.h index b94cb1ee21..ffa2afcfc3 100644 --- a/src/fix_group.h +++ b/src/fix_group.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixGroup : public Fix { public: FixGroup(class LAMMPS *, int, char **); - ~FixGroup(); - int setmask(); - void init(); - void setup(int); - void post_integrate(); - void post_integrate_respa(int, int); - void *extract(const char *, int &); + ~FixGroup() override; + int setmask() override; + void init() override; + void setup(int) override; + void post_integrate() override; + void post_integrate_respa(int, int) override; + void *extract(const char *, int &) override; private: int gbit, gbitinverse; diff --git a/src/fix_halt.h b/src/fix_halt.h index 73eab2d930..1776e029e9 100644 --- a/src/fix_halt.h +++ b/src/fix_halt.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixHalt : public Fix { public: FixHalt(class LAMMPS *, int, char **); - ~FixHalt(); - int setmask(); - void init(); - void end_of_step(); - void min_post_force(int); - void post_run(); + ~FixHalt() override; + int setmask() override; + void init() override; + void end_of_step() override; + void min_post_force(int) override; + void post_run() override; private: int attribute, operation, eflag, msgflag, ivar; diff --git a/src/fix_heat.h b/src/fix_heat.h index a6a0e00813..5d1d9a5dfd 100644 --- a/src/fix_heat.h +++ b/src/fix_heat.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixHeat : public Fix { public: FixHeat(class LAMMPS *, int, char **); - ~FixHeat(); - int setmask(); - void init(); - void end_of_step(); - double compute_scalar(); - double memory_usage(); + ~FixHeat() override; + int setmask() override; + void init() override; + void end_of_step() override; + double compute_scalar() override; + double memory_usage() override; private: int iregion; diff --git a/src/fix_indent.h b/src/fix_indent.h index e8b9d7055f..1fbfb2a785 100644 --- a/src/fix_indent.h +++ b/src/fix_indent.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixIndent : public Fix { public: FixIndent(class LAMMPS *, int, char **); - ~FixIndent(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixIndent() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; private: int istyle, scaleflag, side; diff --git a/src/fix_langevin.h b/src/fix_langevin.h index 2c881d9329..ca8ded2d0f 100644 --- a/src/fix_langevin.h +++ b/src/fix_langevin.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class FixLangevin : public Fix { public: FixLangevin(class LAMMPS *, int, char **); - virtual ~FixLangevin(); - int setmask(); - void init(); - void setup(int); - virtual void initial_integrate(int); - virtual void post_force(int); - void post_force_respa(int, int, int); - virtual void end_of_step(); - void reset_target(double); - void reset_dt(); - int modify_param(int, char **); - virtual double compute_scalar(); - double memory_usage(); - virtual void *extract(const char *, int &); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + ~FixLangevin() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void end_of_step() override; + void reset_target(double) override; + void reset_dt() override; + int modify_param(int, char **) override; + double compute_scalar() override; + double memory_usage() override; + void *extract(const char *, int &) override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; protected: int gjfflag, nvalues, osflag, oflag, tallyflag, zeroflag, tbiasflag; diff --git a/src/fix_lineforce.h b/src/fix_lineforce.h index 8151fc86db..b5564a521d 100644 --- a/src/fix_lineforce.h +++ b/src/fix_lineforce.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixLineForce : public Fix { public: FixLineForce(class LAMMPS *, int, char **); - int setmask(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); + int setmask() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; private: double xdir, ydir, zdir; diff --git a/src/fix_minimize.h b/src/fix_minimize.h index 690b2790de..8b5536dc68 100644 --- a/src/fix_minimize.h +++ b/src/fix_minimize.h @@ -29,15 +29,15 @@ class FixMinimize : public Fix { public: FixMinimize(class LAMMPS *, int, char **); - virtual ~FixMinimize(); - int setmask(); - virtual void init() {} + ~FixMinimize() override; + int setmask() override; + void init() override {} - double memory_usage(); - virtual void grow_arrays(int); - virtual void copy_arrays(int, int, int); - virtual int pack_exchange(int, double *); - virtual int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; virtual void add_vector(int); double *request_vector(int); diff --git a/src/fix_momentum.h b/src/fix_momentum.h index 43d3d174be..4adbf80be8 100644 --- a/src/fix_momentum.h +++ b/src/fix_momentum.h @@ -27,9 +27,9 @@ namespace LAMMPS_NS { class FixMomentum : public Fix { public: FixMomentum(class LAMMPS *, int, char **); - int setmask(); - void init(); - void end_of_step(); + int setmask() override; + void init() override; + void end_of_step() override; protected: int linear, angular, rescale; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 72fd9b75d2..f7bc4d3640 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -522,7 +522,7 @@ void FixMove::initial_integrate(int /*vflag*/) } } - // for wiggle: X = X0 + A sin(w*dt) + // for wiggle: X = X0 + A sin(w*dt) } else if (mstyle == WIGGLE) { double arg = omega_rotate * delta; @@ -578,19 +578,19 @@ void FixMove::initial_integrate(int /*vflag*/) } } - // for rotate by right-hand rule around omega: - // P = point = vector = point of rotation - // R = vector = axis of rotation - // w = omega of rotation (from period) - // X0 = xoriginal = initial coord of atom - // R0 = runit = unit vector for R - // D = X0 - P = vector from P to X0 - // C = (D dot R0) R0 = projection of atom coord onto R line - // A = D - C = vector from R line to X0 - // B = R0 cross A = vector perp to A in plane of rotation - // A,B define plane of circular rotation around R line - // X = P + C + A cos(w*dt) + B sin(w*dt) - // V = w R0 cross (A cos(w*dt) + B sin(w*dt)) + // for rotate by right-hand rule around omega: + // P = point = vector = point of rotation + // R = vector = axis of rotation + // w = omega of rotation (from period) + // X0 = xoriginal = initial coord of atom + // R0 = runit = unit vector for R + // D = X0 - P = vector from P to X0 + // C = (D dot R0) R0 = projection of atom coord onto R line + // A = D - C = vector from R line to X0 + // B = R0 cross A = vector perp to A in plane of rotation + // A,B define plane of circular rotation around R line + // X = P + C + A cos(w*dt) + B sin(w*dt) + // V = w R0 cross (A cos(w*dt) + B sin(w*dt)) } else if (mstyle == ROTATE) { double arg = omega_rotate * delta; @@ -707,10 +707,10 @@ void FixMove::initial_integrate(int /*vflag*/) } } - // for variable: compute x,v from variables - // NOTE: also allow for changes to extra attributes? - // omega, angmom, theta, quat - // only necessary if prescribed motion involves rotation + // for variable: compute x,v from variables + // NOTE: also allow for changes to extra attributes? + // omega, angmom, theta, quat + // only necessary if prescribed motion involves rotation } else if (mstyle == VARIABLE) { @@ -778,21 +778,16 @@ void FixMove::initial_integrate(int /*vflag*/) } else if (vxvarstr) { if (vxvarstyle == EQUAL) v[i][0] = vx; else v[i][0] = velocity[i][0]; - if (rmass) { - x[i][0] += dtv * v[i][0]; - } else { - x[i][0] += dtv * v[i][0]; - } + x[i][0] += dtv * v[i][0]; } else { if (rmass) { dtfm = dtf / rmass[i]; v[i][0] += dtfm * f[i][0]; - x[i][0] += dtv * v[i][0]; } else { dtfm = dtf / mass[type[i]]; v[i][0] += dtfm * f[i][0]; - x[i][0] += dtv * v[i][0]; } + x[i][0] += dtv * v[i][0]; } if (yvarstr && vyvarstr) { @@ -806,21 +801,16 @@ void FixMove::initial_integrate(int /*vflag*/) } else if (vyvarstr) { if (vyvarstyle == EQUAL) v[i][1] = vy; else v[i][1] = velocity[i][1]; - if (rmass) { - x[i][1] += dtv * v[i][1]; - } else { - x[i][1] += dtv * v[i][1]; - } + x[i][1] += dtv * v[i][1]; } else { if (rmass) { dtfm = dtf / rmass[i]; v[i][1] += dtfm * f[i][1]; - x[i][1] += dtv * v[i][1]; } else { dtfm = dtf / mass[type[i]]; v[i][1] += dtfm * f[i][1]; - x[i][1] += dtv * v[i][1]; } + x[i][1] += dtv * v[i][1]; } if (zvarstr && vzvarstr) { @@ -834,21 +824,16 @@ void FixMove::initial_integrate(int /*vflag*/) } else if (vzvarstr) { if (vzvarstyle == EQUAL) v[i][2] = vz; else v[i][2] = velocity[i][2]; - if (rmass) { - x[i][2] += dtv * v[i][2]; - } else { - x[i][2] += dtv * v[i][2]; - } + x[i][2] += dtv * v[i][2]; } else { if (rmass) { dtfm = dtf / rmass[i]; v[i][2] += dtfm * f[i][2]; - x[i][2] += dtv * v[i][2]; } else { dtfm = dtf / mass[type[i]]; v[i][2] += dtfm * f[i][2]; - x[i][2] += dtv * v[i][2]; } + x[i][2] += dtv * v[i][2]; } domain->remap_near(x[i],xold); diff --git a/src/fix_move.h b/src/fix_move.h index 02f573e000..b3579db0b7 100644 --- a/src/fix_move.h +++ b/src/fix_move.h @@ -27,28 +27,28 @@ namespace LAMMPS_NS { class FixMove : public Fix { public: FixMove(class LAMMPS *, int, char **); - ~FixMove(); - int setmask(); - void init(); - void initial_integrate(int); - void final_integrate(); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); + ~FixMove() override; + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; - double memory_usage(); - void write_restart(FILE *); - void restart(char *); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int maxsize_restart(); - int size_restart(int); + double memory_usage() override; + void write_restart(FILE *) override; + void restart(char *) override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int maxsize_restart() override; + int size_restart(int) override; - void reset_dt(); + void reset_dt() override; private: char *xvarstr, *yvarstr, *zvarstr, *vxvarstr, *vyvarstr, *vzvarstr; diff --git a/src/fix_neigh_history.h b/src/fix_neigh_history.h index f382207541..f932b174e9 100644 --- a/src/fix_neigh_history.h +++ b/src/fix_neigh_history.h @@ -34,31 +34,31 @@ class FixNeighHistory : public Fix { class Pair *pair; // ptr to pair style that uses neighbor history FixNeighHistory(class LAMMPS *, int, char **); - ~FixNeighHistory(); - int setmask(); - void init(); - void setup_post_neighbor(); - void pre_exchange(); - void min_pre_exchange(); - virtual void post_neighbor(); - void min_post_neighbor(); - void post_run(); + ~FixNeighHistory() override; + int setmask() override; + void init() override; + void setup_post_neighbor() override; + void pre_exchange() override; + void min_pre_exchange() override; + void post_neighbor() override; + void min_post_neighbor() override; + void post_run() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; - int pack_reverse_comm_size(int, int); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void write_restart(FILE *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + int pack_reverse_comm_size(int, int) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void write_restart(FILE *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; protected: int newton_pair; // same as force setting diff --git a/src/fix_nh.h b/src/fix_nh.h index 1ec6bec2f8..53fc815bab 100644 --- a/src/fix_nh.h +++ b/src/fix_nh.h @@ -21,26 +21,26 @@ namespace LAMMPS_NS { class FixNH : public Fix { public: FixNH(class LAMMPS *, int, char **); - virtual ~FixNH(); - int setmask(); - virtual void init(); - virtual void setup(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - void initial_integrate_respa(int, int, int); - void pre_force_respa(int, int, int); - void final_integrate_respa(int, int); - virtual void pre_exchange(); - double compute_scalar(); - virtual double compute_vector(int); - void write_restart(FILE *); + ~FixNH() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void pre_force_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void pre_exchange() override; + double compute_scalar() override; + double compute_vector(int) override; + void write_restart(FILE *) override; virtual int pack_restart_data(double *); // pack restart data - virtual void restart(char *); - int modify_param(int, char **); - void reset_target(double); - void reset_dt(); - virtual void *extract(const char *, int &); - double memory_usage(); + void restart(char *) override; + int modify_param(int, char **) override; + void reset_target(double) override; + void reset_dt() override; + void *extract(const char *, int &) override; + double memory_usage() override; protected: int dimension, which; diff --git a/src/fix_nh_sphere.h b/src/fix_nh_sphere.h index d07e63fb77..5e14bf466c 100644 --- a/src/fix_nh_sphere.h +++ b/src/fix_nh_sphere.h @@ -21,15 +21,15 @@ namespace LAMMPS_NS { class FixNHSphere : public FixNH { public: FixNHSphere(class LAMMPS *, int, char **); - virtual ~FixNHSphere() {} - void init(); + + void init() override; protected: double inertia; - void nve_v(); - void nve_x(); - void nh_v_temp(); + void nve_v() override; + void nve_x() override; + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/fix_nph.h b/src/fix_nph.h index f485bd9b81..576b1afea1 100644 --- a/src/fix_nph.h +++ b/src/fix_nph.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPH : public FixNH { public: FixNPH(class LAMMPS *, int, char **); - ~FixNPH() {} }; } // namespace LAMMPS_NS diff --git a/src/fix_nph_sphere.h b/src/fix_nph_sphere.h index 6376176b20..32a65b66ae 100644 --- a/src/fix_nph_sphere.h +++ b/src/fix_nph_sphere.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPHSphere : public FixNHSphere { public: FixNPHSphere(class LAMMPS *, int, char **); - ~FixNPHSphere() {} }; } // namespace LAMMPS_NS diff --git a/src/fix_npt.h b/src/fix_npt.h index 582467c4d0..9d7b5ad49e 100644 --- a/src/fix_npt.h +++ b/src/fix_npt.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPT : public FixNH { public: FixNPT(class LAMMPS *, int, char **); - ~FixNPT() {} }; } // namespace LAMMPS_NS diff --git a/src/fix_npt_sphere.h b/src/fix_npt_sphere.h index b53328b5f8..59f66f47f3 100644 --- a/src/fix_npt_sphere.h +++ b/src/fix_npt_sphere.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNPTSphere : public FixNHSphere { public: FixNPTSphere(class LAMMPS *, int, char **); - ~FixNPTSphere() {} }; } // namespace LAMMPS_NS diff --git a/src/fix_nve.h b/src/fix_nve.h index 864da8596c..01e52413fa 100644 --- a/src/fix_nve.h +++ b/src/fix_nve.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixNVE : public Fix { public: FixNVE(class LAMMPS *, int, char **); - virtual ~FixNVE() {} - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); - virtual void initial_integrate_respa(int, int, int); - virtual void final_integrate_respa(int, int); - virtual void reset_dt(); + + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; protected: double dtv, dtf; diff --git a/src/fix_nve_limit.h b/src/fix_nve_limit.h index d23b680796..bb548d7004 100644 --- a/src/fix_nve_limit.h +++ b/src/fix_nve_limit.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixNVELimit : public Fix { public: FixNVELimit(class LAMMPS *, int, char **); - int setmask(); - void init(); - void initial_integrate(int); - void final_integrate(); - void initial_integrate_respa(int, int, int); - void final_integrate_respa(int, int); - void reset_dt(); - double compute_scalar(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + void initial_integrate_respa(int, int, int) override; + void final_integrate_respa(int, int) override; + void reset_dt() override; + double compute_scalar() override; private: double dtv, dtf; diff --git a/src/fix_nve_noforce.h b/src/fix_nve_noforce.h index fe3081aac2..362f62bb44 100644 --- a/src/fix_nve_noforce.h +++ b/src/fix_nve_noforce.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixNVENoforce : public Fix { public: FixNVENoforce(class LAMMPS *, int, char **); - int setmask(); - virtual void init(); - virtual void initial_integrate(int); - void initial_integrate_respa(int, int, int); - void reset_dt(); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void initial_integrate_respa(int, int, int) override; + void reset_dt() override; protected: double dtv; diff --git a/src/fix_nve_sphere.h b/src/fix_nve_sphere.h index 7eb6b39b35..86bcfb6b36 100644 --- a/src/fix_nve_sphere.h +++ b/src/fix_nve_sphere.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixNVESphere : public FixNVE { public: FixNVESphere(class LAMMPS *, int, char **); - virtual ~FixNVESphere() {} - void init(); - virtual void initial_integrate(int); - virtual void final_integrate(); + + void init() override; + void initial_integrate(int) override; + void final_integrate() override; protected: double inertia; diff --git a/src/fix_nvt.h b/src/fix_nvt.h index f6ab23b96b..375055ac6f 100644 --- a/src/fix_nvt.h +++ b/src/fix_nvt.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVT : public FixNH { public: FixNVT(class LAMMPS *, int, char **); - ~FixNVT() {} }; } // namespace LAMMPS_NS diff --git a/src/fix_nvt_sllod.h b/src/fix_nvt_sllod.h index dbd15458ca..57e17cf3b8 100644 --- a/src/fix_nvt_sllod.h +++ b/src/fix_nvt_sllod.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixNVTSllod : public FixNH { public: FixNVTSllod(class LAMMPS *, int, char **); - ~FixNVTSllod() {} - void init(); + + void init() override; private: int nondeformbias; - void nh_v_temp(); + void nh_v_temp() override; }; } // namespace LAMMPS_NS diff --git a/src/fix_nvt_sphere.h b/src/fix_nvt_sphere.h index e0d7716fdb..d2e89bdd0c 100644 --- a/src/fix_nvt_sphere.h +++ b/src/fix_nvt_sphere.h @@ -27,7 +27,6 @@ namespace LAMMPS_NS { class FixNVTSphere : public FixNHSphere { public: FixNVTSphere(class LAMMPS *, int, char **); - ~FixNVTSphere() {} }; } // namespace LAMMPS_NS diff --git a/src/fix_planeforce.h b/src/fix_planeforce.h index 12a8b3f34a..8253192777 100644 --- a/src/fix_planeforce.h +++ b/src/fix_planeforce.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixPlaneForce : public Fix { public: FixPlaneForce(class LAMMPS *, int, char **); - int setmask(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); + int setmask() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; private: double xdir, ydir, zdir; diff --git a/src/fix_press_berendsen.h b/src/fix_press_berendsen.h index 806e6698f7..33399605fd 100644 --- a/src/fix_press_berendsen.h +++ b/src/fix_press_berendsen.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixPressBerendsen : public Fix { public: FixPressBerendsen(class LAMMPS *, int, char **); - ~FixPressBerendsen(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); - int modify_param(int, char **); + ~FixPressBerendsen() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + int modify_param(int, char **) override; protected: int dimension, which; diff --git a/src/fix_print.h b/src/fix_print.h index 82e72d725a..079c339798 100644 --- a/src/fix_print.h +++ b/src/fix_print.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixPrint : public Fix { public: FixPrint(class LAMMPS *, int, char **); - ~FixPrint(); - void init(); - void setup(int); - int setmask(); - void end_of_step(); + ~FixPrint() override; + void init() override; + void setup(int) override; + int setmask() override; + void end_of_step() override; private: int me, screenflag; diff --git a/src/fix_property_atom.h b/src/fix_property_atom.h index 48472b8969..5e57ef9f91 100644 --- a/src/fix_property_atom.h +++ b/src/fix_property_atom.h @@ -27,29 +27,30 @@ namespace LAMMPS_NS { class FixPropertyAtom : public Fix { public: FixPropertyAtom(class LAMMPS *, int, char **); - virtual ~FixPropertyAtom(); - int setmask(); - void init(); - void read_data_section(char *, int, char *, tagint); - bigint read_data_skip_lines(char *); - void write_data_section_size(int, int &, int &); - void write_data_section_pack(int, double **); - void write_data_section_keyword(int, FILE *); - void write_data_section(int, FILE *, int, double **, int); + ~FixPropertyAtom() override; + int setmask() override; + void init() override; - virtual void grow_arrays(int); - void copy_arrays(int, int, int); - void set_arrays(int); - int pack_border(int, int *, double *); - int unpack_border(int, int, double *); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); - double memory_usage(); + void read_data_section(char *, int, char *, tagint) override; + bigint read_data_skip_lines(char *) override; + void write_data_section_size(int, int &, int &) override; + void write_data_section_pack(int, double **) override; + void write_data_section_keyword(int, FILE *) override; + void write_data_section(int, FILE *, int, double **, int) override; + + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void set_arrays(int) override; + int pack_border(int, int *, double *) override; + int unpack_border(int, int, double *) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; + double memory_usage() override; protected: int nvalue, border; diff --git a/src/fix_read_restart.h b/src/fix_read_restart.h index 8431803f05..49d03db052 100644 --- a/src/fix_read_restart.h +++ b/src/fix_read_restart.h @@ -30,14 +30,14 @@ class FixReadRestart : public Fix { double **extra; FixReadRestart(class LAMMPS *, int, char **); - ~FixReadRestart(); - int setmask(); + ~FixReadRestart() override; + int setmask() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: int nextra; // max number of extra values for any atom diff --git a/src/fix_recenter.h b/src/fix_recenter.h index 53fe65100b..a2c7c9866d 100644 --- a/src/fix_recenter.h +++ b/src/fix_recenter.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class FixRecenter : public Fix { public: FixRecenter(class LAMMPS *, int, char **); - int setmask(); - void init(); - void initial_integrate(int); - void initial_integrate_respa(int, int, int); - double compute_scalar(); - double compute_vector(int); + int setmask() override; + void init() override; + void initial_integrate(int) override; + void initial_integrate_respa(int, int, int) override; + double compute_scalar() override; + double compute_vector(int) override; private: int group2bit, scaleflag; diff --git a/src/fix_respa.h b/src/fix_respa.h index a1c477c6d7..b6b80711de 100644 --- a/src/fix_respa.h +++ b/src/fix_respa.h @@ -31,15 +31,15 @@ class FixRespa : public Fix { public: FixRespa(class LAMMPS *, int, char **); - ~FixRespa(); - int setmask(); - void init() {} + ~FixRespa() override; + int setmask() override; + void init() override {} - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; private: int nlevels; diff --git a/src/fix_restrain.h b/src/fix_restrain.h index d42d639204..607927a5fb 100644 --- a/src/fix_restrain.h +++ b/src/fix_restrain.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixRestrain : public Fix { public: FixRestrain(class LAMMPS *, int, char **); - ~FixRestrain(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixRestrain() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; private: int ilevel_respa; diff --git a/src/fix_setforce.h b/src/fix_setforce.h index aed39abaf0..ea242ba954 100644 --- a/src/fix_setforce.h +++ b/src/fix_setforce.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixSetForce : public Fix { public: FixSetForce(class LAMMPS *, int, char **); - virtual ~FixSetForce(); - int setmask(); - virtual void init(); - void setup(int); - void min_setup(int); - virtual void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_vector(int); + ~FixSetForce() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_vector(int) override; - double memory_usage(); + double memory_usage() override; protected: double xvalue, yvalue, zvalue; diff --git a/src/fix_spring.h b/src/fix_spring.h index d8a2a30307..4180658a2f 100644 --- a/src/fix_spring.h +++ b/src/fix_spring.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixSpring : public Fix { public: FixSpring(class LAMMPS *, int, char **); - ~FixSpring(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixSpring() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; private: double xc, yc, zc, r0; diff --git a/src/fix_spring_chunk.h b/src/fix_spring_chunk.h index 53f4c67810..181bced917 100644 --- a/src/fix_spring_chunk.h +++ b/src/fix_spring_chunk.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class FixSpringChunk : public Fix { public: FixSpringChunk(class LAMMPS *, int, char **); - ~FixSpringChunk(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - void write_restart(FILE *); - void restart(char *); - double compute_scalar(); + ~FixSpringChunk() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + void write_restart(FILE *) override; + void restart(char *) override; + double compute_scalar() override; private: int ilevel_respa; diff --git a/src/fix_spring_self.h b/src/fix_spring_self.h index 03c12ca13b..ca957fd845 100644 --- a/src/fix_spring_self.h +++ b/src/fix_spring_self.h @@ -27,25 +27,25 @@ namespace LAMMPS_NS { class FixSpringSelf : public Fix { public: FixSpringSelf(class LAMMPS *, int, char **); - ~FixSpringSelf(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); + ~FixSpringSelf() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; private: double k, espring; diff --git a/src/fix_store.h b/src/fix_store.h index a30e2d5c1f..d1b58db155 100644 --- a/src/fix_store.h +++ b/src/fix_store.h @@ -33,23 +33,23 @@ class FixStore : public Fix { int disable; // 1 if operations (except grow) are currently disabled FixStore(class LAMMPS *, int, char **); - ~FixStore(); - int setmask(); + ~FixStore() override; + int setmask() override; void reset_global(int, int); - void write_restart(FILE *); - void restart(char *); + void write_restart(FILE *) override; + void restart(char *) override; - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; - double memory_usage(); + double memory_usage() override; private: int flavor; // GLOBAL or PERATOM diff --git a/src/fix_store_force.h b/src/fix_store_force.h index 31b042b5ca..adbd3573c4 100644 --- a/src/fix_store_force.h +++ b/src/fix_store_force.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixStoreForce : public Fix { public: FixStoreForce(class LAMMPS *, int, char **); - ~FixStoreForce(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double memory_usage(); + ~FixStoreForce() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double memory_usage() override; private: int nlevels_respa; diff --git a/src/fix_store_local.h b/src/fix_store_local.h index 591ead9486..dc9d83b9dd 100644 --- a/src/fix_store_local.h +++ b/src/fix_store_local.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class FixStoreLocal : public Fix { public: FixStoreLocal(class LAMMPS *, int, char **); - ~FixStoreLocal(); - int setmask(); - void post_force(int); - double memory_usage(); + ~FixStoreLocal() override; + int setmask() override; + void post_force(int) override; + double memory_usage() override; void add_data(double *, int, int); int nvalues; @@ -65,7 +65,7 @@ Self-explanatory. E: Unused instance of fix store/local -Instance of fix store/local is not associated with any other LAMMPS +Instance of fix store/local is not associated with any other LAMMPS class such as a bond style, pair style, etc. */ diff --git a/src/fix_store_state.h b/src/fix_store_state.h index 59c17341f1..b7237dbc14 100644 --- a/src/fix_store_state.h +++ b/src/fix_store_state.h @@ -27,21 +27,21 @@ namespace LAMMPS_NS { class FixStoreState : public Fix { public: FixStoreState(class LAMMPS *, int, char **); - ~FixStoreState(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); + ~FixStoreState() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; - double memory_usage(); - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - int pack_restart(int, double *); - void unpack_restart(int, int); - int size_restart(int); - int maxsize_restart(); + double memory_usage() override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + int pack_restart(int, double *) override; + void unpack_restart(int, int) override; + int size_restart(int) override; + int maxsize_restart() override; private: int nvalues; diff --git a/src/fix_temp_berendsen.h b/src/fix_temp_berendsen.h index f45a5e7f03..ec6381086a 100644 --- a/src/fix_temp_berendsen.h +++ b/src/fix_temp_berendsen.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixTempBerendsen : public Fix { public: FixTempBerendsen(class LAMMPS *, int, char **); - ~FixTempBerendsen(); - int setmask(); - void init(); - void end_of_step(); - int modify_param(int, char **); - void reset_target(double); - double compute_scalar(); - void write_restart(FILE *); - void restart(char *buf); - virtual void *extract(const char *, int &); + ~FixTempBerendsen() override; + int setmask() override; + void init() override; + void end_of_step() override; + int modify_param(int, char **) override; + void reset_target(double) override; + double compute_scalar() override; + void write_restart(FILE *) override; + void restart(char *buf) override; + void *extract(const char *, int &) override; private: int which; diff --git a/src/fix_temp_rescale.h b/src/fix_temp_rescale.h index c24f35eb34..058cf7cefe 100644 --- a/src/fix_temp_rescale.h +++ b/src/fix_temp_rescale.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixTempRescale : public Fix { public: FixTempRescale(class LAMMPS *, int, char **); - virtual ~FixTempRescale(); - int setmask(); - void init(); - virtual void end_of_step(); - int modify_param(int, char **); - void reset_target(double); - double compute_scalar(); - void write_restart(FILE *); - void restart(char *buf); - virtual void *extract(const char *, int &); + ~FixTempRescale() override; + int setmask() override; + void init() override; + void end_of_step() override; + int modify_param(int, char **) override; + void reset_target(double) override; + double compute_scalar() override; + void write_restart(FILE *) override; + void restart(char *buf) override; + void *extract(const char *, int &) override; protected: int which; diff --git a/src/fix_thermal_conductivity.h b/src/fix_thermal_conductivity.h index 3f598bce5b..e502e8496a 100644 --- a/src/fix_thermal_conductivity.h +++ b/src/fix_thermal_conductivity.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class FixThermalConductivity : public Fix { public: FixThermalConductivity(class LAMMPS *, int, char **); - ~FixThermalConductivity(); - int setmask(); - void init(); - void end_of_step(); - double compute_scalar(); + ~FixThermalConductivity() override; + int setmask() override; + void init() override; + void end_of_step() override; + double compute_scalar() override; private: int me; diff --git a/src/fix_vector.h b/src/fix_vector.h index 2d82a22d9d..c43e287b4c 100644 --- a/src/fix_vector.h +++ b/src/fix_vector.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class FixVector : public Fix { public: FixVector(class LAMMPS *, int, char **); - ~FixVector(); - int setmask(); - void init(); - void setup(int); - void end_of_step(); - double compute_vector(int); - double compute_array(int, int); + ~FixVector() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_vector(int) override; + double compute_array(int, int) override; private: int nvalues; diff --git a/src/fix_viscous.h b/src/fix_viscous.h index 08970094bc..0353004911 100644 --- a/src/fix_viscous.h +++ b/src/fix_viscous.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class FixViscous : public Fix { public: FixViscous(class LAMMPS *, int, char **); - virtual ~FixViscous(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); + ~FixViscous() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; protected: double *gamma; diff --git a/src/fix_wall.h b/src/fix_wall.h index 9d44ff4e4c..99086aac6c 100644 --- a/src/fix_wall.h +++ b/src/fix_wall.h @@ -29,17 +29,17 @@ class FixWall : public Fix { char *xstr[6]; FixWall(class LAMMPS *, int, char **); - virtual ~FixWall(); - int setmask(); - virtual void init(); - void setup(int); - void min_setup(int); - void pre_force(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixWall() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void pre_force(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; virtual void precompute(int) = 0; virtual void wall_particle(int, int, double) = 0; diff --git a/src/fix_wall_harmonic.h b/src/fix_wall_harmonic.h index 473504d47d..629f4eede9 100644 --- a/src/fix_wall_harmonic.h +++ b/src/fix_wall_harmonic.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixWallHarmonic : public FixWall { public: FixWallHarmonic(class LAMMPS *, int, char **); - void precompute(int) {} - void wall_particle(int, int, double); + void precompute(int) override {} + void wall_particle(int, int, double) override; }; } // namespace LAMMPS_NS diff --git a/src/fix_wall_lj1043.h b/src/fix_wall_lj1043.h index 17d5836302..9e09a4b6b9 100644 --- a/src/fix_wall_lj1043.h +++ b/src/fix_wall_lj1043.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixWallLJ1043 : public FixWall { public: FixWallLJ1043(class LAMMPS *, int, char **); - void precompute(int); - void wall_particle(int, int, double); + void precompute(int) override; + void wall_particle(int, int, double) override; private: double coeff1[6], coeff2[6], coeff3[6], coeff4[6], coeff5[6], coeff6[6], coeff7[6], offset[6]; diff --git a/src/fix_wall_lj126.h b/src/fix_wall_lj126.h index 2ea768ba65..9f9e870fd5 100644 --- a/src/fix_wall_lj126.h +++ b/src/fix_wall_lj126.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixWallLJ126 : public FixWall { public: FixWallLJ126(class LAMMPS *, int, char **); - void precompute(int); - void wall_particle(int, int, double); + void precompute(int) override; + void wall_particle(int, int, double) override; private: double coeff1[6], coeff2[6], coeff3[6], coeff4[6], offset[6]; diff --git a/src/fix_wall_lj93.h b/src/fix_wall_lj93.h index 4326e7acc0..5f0a90773d 100644 --- a/src/fix_wall_lj93.h +++ b/src/fix_wall_lj93.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixWallLJ93 : public FixWall { public: FixWallLJ93(class LAMMPS *, int, char **); - void precompute(int); - virtual void wall_particle(int, int, double); + void precompute(int) override; + void wall_particle(int, int, double) override; protected: double coeff1[6], coeff2[6], coeff3[6], coeff4[6], offset[6]; diff --git a/src/fix_wall_morse.h b/src/fix_wall_morse.h index 55ab2c0cd8..973adfeaf8 100644 --- a/src/fix_wall_morse.h +++ b/src/fix_wall_morse.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class FixWallMorse : public FixWall { public: FixWallMorse(class LAMMPS *, int, char **); - void precompute(int); - void wall_particle(int, int, double); + void precompute(int) override; + void wall_particle(int, int, double) override; private: double coeff1[6], offset[6]; diff --git a/src/fix_wall_reflect.h b/src/fix_wall_reflect.h index 45b5c8d2d2..d708c07180 100644 --- a/src/fix_wall_reflect.h +++ b/src/fix_wall_reflect.h @@ -30,10 +30,10 @@ class FixWallReflect : public Fix { enum { NONE = 0, EDGE, CONSTANT, VARIABLE }; FixWallReflect(class LAMMPS *, int, char **); - virtual ~FixWallReflect(); - int setmask(); - void init(); - void post_integrate(); + ~FixWallReflect() override; + int setmask() override; + void init() override; + void post_integrate() override; protected: int nwall; diff --git a/src/fix_wall_region.h b/src/fix_wall_region.h index e72ada5301..5da19f6698 100644 --- a/src/fix_wall_region.h +++ b/src/fix_wall_region.h @@ -27,16 +27,16 @@ namespace LAMMPS_NS { class FixWallRegion : public Fix { public: FixWallRegion(class LAMMPS *, int, char **); - ~FixWallRegion(); - int setmask(); - void init(); - void setup(int); - void min_setup(int); - void post_force(int); - void post_force_respa(int, int, int); - void min_post_force(int); - double compute_scalar(); - double compute_vector(int); + ~FixWallRegion() override; + int setmask() override; + void init() override; + void setup(int) override; + void min_setup(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void min_post_force(int) override; + double compute_scalar() override; + double compute_vector(int) override; private: int style, iregion; diff --git a/src/force.cpp b/src/force.cpp index 6b7e9033ca..35bd8644ee 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -25,8 +24,8 @@ #include "bond_hybrid.h" #include "dihedral_hybrid.h" #include "improper_hybrid.h" -#include "pair_hybrid.h" #include "kspace.h" +#include "pair_hybrid.h" #include "atom.h" #include "comm.h" @@ -36,6 +35,14 @@ using namespace LAMMPS_NS; +// template for factory functions: +// there will be one instance for each style keyword in the respective style_xxx.h files + +template static S *style_creator(LAMMPS *lmp) +{ + return new T(lmp); +} + /* ---------------------------------------------------------------------- */ Force::Force(LAMMPS *lmp) : Pointers(lmp) @@ -49,8 +56,8 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) special_extra = 0; dielectric = 1.0; - qqr2e_lammps_real = 332.06371; // these constants are toggled - qqr2e_charmm_real = 332.0716; // by new CHARMM pair styles + qqr2e_lammps_real = 332.06371; // these constants are toggled + qqr2e_charmm_real = 332.0716; // by new CHARMM pair styles pair = nullptr; bond = nullptr; @@ -77,54 +84,48 @@ void _noopt Force::create_factories() pair_map = new PairCreatorMap(); #define PAIR_CLASS -#define PairStyle(key,Class) \ - (*pair_map)[#key] = &pair_creator; -#include "style_pair.h" // IWYU pragma: keep +#define PairStyle(key, Class) (*pair_map)[#key] = &style_creator; +#include "style_pair.h" // IWYU pragma: keep #undef PairStyle #undef PAIR_CLASS bond_map = new BondCreatorMap(); #define BOND_CLASS -#define BondStyle(key,Class) \ - (*bond_map)[#key] = &bond_creator; -#include "style_bond.h" // IWYU pragma: keep +#define BondStyle(key, Class) (*bond_map)[#key] = &style_creator; +#include "style_bond.h" // IWYU pragma: keep #undef BondStyle #undef BOND_CLASS angle_map = new AngleCreatorMap(); #define ANGLE_CLASS -#define AngleStyle(key,Class) \ - (*angle_map)[#key] = &angle_creator; -#include "style_angle.h" // IWYU pragma: keep +#define AngleStyle(key, Class) (*angle_map)[#key] = &style_creator; +#include "style_angle.h" // IWYU pragma: keep #undef AngleStyle #undef ANGLE_CLASS dihedral_map = new DihedralCreatorMap(); #define DIHEDRAL_CLASS -#define DihedralStyle(key,Class) \ - (*dihedral_map)[#key] = &dihedral_creator; -#include "style_dihedral.h" // IWYU pragma: keep +#define DihedralStyle(key, Class) (*dihedral_map)[#key] = &style_creator; +#include "style_dihedral.h" // IWYU pragma: keep #undef DihedralStyle #undef DIHEDRAL_CLASS improper_map = new ImproperCreatorMap(); #define IMPROPER_CLASS -#define ImproperStyle(key,Class) \ - (*improper_map)[#key] = &improper_creator; -#include "style_improper.h" // IWYU pragma: keep +#define ImproperStyle(key, Class) (*improper_map)[#key] = &style_creator; +#include "style_improper.h" // IWYU pragma: keep #undef ImproperStyle #undef IMPROPER_CLASS kspace_map = new KSpaceCreatorMap(); #define KSPACE_CLASS -#define KSpaceStyle(key,Class) \ - (*kspace_map)[#key] = &kspace_creator; -#include "style_kspace.h" // IWYU pragma: keep +#define KSpaceStyle(key, Class) (*kspace_map)[#key] = &style_creator; +#include "style_kspace.h" // IWYU pragma: keep #undef KSpaceStyle #undef KSPACE_CLASS } @@ -133,14 +134,14 @@ void _noopt Force::create_factories() Force::~Force() { - delete [] pair_style; - delete [] bond_style; - delete [] angle_style; - delete [] dihedral_style; - delete [] improper_style; - delete [] kspace_style; + delete[] pair_style; + delete[] bond_style; + delete[] angle_style; + delete[] dihedral_style; + delete[] improper_style; + delete[] kspace_style; - delete [] pair_restart; + delete[] pair_restart; if (pair) delete pair; if (bond) delete bond; @@ -168,17 +169,17 @@ Force::~Force() void Force::init() { - qqrd2e = qqr2e/dielectric; + qqrd2e = qqr2e / dielectric; // check if pair style must be specified after restart if (pair_restart) { if (!pair) - error->all(FLERR,"Must re-specify non-restarted pair style " - "({}) after read_restart", pair_restart); + error->all(FLERR, "Must re-specify non-restarted pair style ({}) after read_restart", + pair_restart); } - if (kspace) kspace->init(); // kspace must come before pair - if (pair) pair->init(); // so g_ewald is defined + if (kspace) kspace->init(); // kspace must come before pair + if (pair) pair->init(); // so g_ewald is defined if (bond) bond->init(); if (angle) angle->init(); if (dihedral) dihedral->init(); @@ -188,22 +189,22 @@ void Force::init() if (comm->me == 0) { if (!bond && (atom->nbonds > 0)) { - error->warning(FLERR,"Bonds are defined but no bond style is set"); + error->warning(FLERR, "Bonds are defined but no bond style is set"); if ((special_lj[1] != 1.0) || (special_coul[1] != 1.0)) - error->warning(FLERR,"Likewise 1-2 special neighbor interactions != 1.0"); + error->warning(FLERR, "Likewise 1-2 special neighbor interactions != 1.0"); } if (!angle && (atom->nangles > 0)) { - error->warning(FLERR,"Angles are defined but no angle style is set"); + error->warning(FLERR, "Angles are defined but no angle style is set"); if ((special_lj[2] != 1.0) || (special_coul[2] != 1.0)) - error->warning(FLERR,"Likewise 1-3 special neighbor interactions != 1.0"); + error->warning(FLERR, "Likewise 1-3 special neighbor interactions != 1.0"); } if (!dihedral && (atom->ndihedrals > 0)) { - error->warning(FLERR,"Dihedrals are defined but no dihedral style is set"); + error->warning(FLERR, "Dihedrals are defined but no dihedral style is set"); if ((special_lj[3] != 1.0) || (special_coul[3] != 1.0)) - error->warning(FLERR,"Likewise 1-4 special neighbor interactions != 1.0"); + error->warning(FLERR, "Likewise 1-4 special neighbor interactions != 1.0"); } if (!improper && (atom->nimpropers > 0)) - error->warning(FLERR,"Impropers are defined but no improper style is set"); + error->warning(FLERR, "Impropers are defined but no improper style is set"); } } @@ -220,16 +221,16 @@ void Force::setup() void Force::create_pair(const std::string &style, int trysuffix) { - delete [] pair_style; + delete[] pair_style; if (pair) delete pair; - if (pair_restart) delete [] pair_restart; + if (pair_restart) delete[] pair_restart; pair_style = nullptr; pair = nullptr; pair_restart = nullptr; int sflag; - pair = new_pair(style,trysuffix,sflag); - store_style(pair_style,style,sflag); + pair = new_pair(style, trysuffix, sflag); + pair_style = store_style(style, sflag); } /* ---------------------------------------------------------------------- @@ -275,21 +276,11 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) return pair_creator(lmp); } - error->all(FLERR,utils::check_packages_for_style("pair",style,lmp)); + error->all(FLERR, utils::check_packages_for_style("pair", style, lmp)); return nullptr; } -/* ---------------------------------------------------------------------- - one instance per pair style in style_pair.h -------------------------------------------------------------------------- */ - -template -Pair *Force::pair_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- return ptr to Pair class if matches word or matches hybrid sub-style if exact, then style name must be exact match to word @@ -300,16 +291,18 @@ Pair *Force::pair_creator(LAMMPS *lmp) Pair *Force::pair_match(const std::string &word, int exact, int nsub) { - int iwhich,count; + int iwhich, count; - if (exact && (word == pair_style)) return pair; - else if (!exact && utils::strmatch(pair_style,word)) return pair; - else if (utils::strmatch(pair_style,"^hybrid")) { + if (exact && (word == pair_style)) + return pair; + else if (!exact && utils::strmatch(pair_style, word)) + return pair; + else if (utils::strmatch(pair_style, "^hybrid")) { PairHybrid *hybrid = (PairHybrid *) pair; count = 0; for (int i = 0; i < hybrid->nstyles; i++) if ((exact && (word == hybrid->keywords[i])) || - (!exact && utils::strmatch(hybrid->keywords[i],word))) { + (!exact && utils::strmatch(hybrid->keywords[i], word))) { iwhich = i; count++; if (nsub == count) return hybrid->styles[iwhich]; @@ -330,7 +323,7 @@ char *Force::pair_match_ptr(Pair *ptr) { if (ptr == pair) return pair_style; - if (utils::strmatch(pair_style,"^hybrid")) { + if (utils::strmatch(pair_style, "^hybrid")) { PairHybrid *hybrid = (PairHybrid *) pair; for (int i = 0; i < hybrid->nstyles; i++) if (ptr == hybrid->styles[i]) return hybrid->keywords[i]; @@ -345,12 +338,12 @@ char *Force::pair_match_ptr(Pair *ptr) void Force::create_bond(const std::string &style, int trysuffix) { - delete [] bond_style; + delete[] bond_style; if (bond) delete bond; int sflag; - bond = new_bond(style,trysuffix,sflag); - store_style(bond_style,style,sflag); + bond = new_bond(style, trysuffix, sflag); + bond_style = store_style(style, sflag); } /* ---------------------------------------------------------------------- @@ -386,29 +379,20 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) return bond_creator(lmp); } - error->all(FLERR,utils::check_packages_for_style("bond",style,lmp)); + error->all(FLERR, utils::check_packages_for_style("bond", style, lmp)); return nullptr; } -/* ---------------------------------------------------------------------- - one instance per bond style in style_bond.h -------------------------------------------------------------------------- */ - -template -Bond *Force::bond_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- return ptr to current bond class or hybrid sub-class if matches style ------------------------------------------------------------------------- */ Bond *Force::bond_match(const std::string &style) { - if (style == bond_style) return bond; - else if (strcmp(bond_style,"hybrid") == 0) { + if (style == bond_style) + return bond; + else if (strcmp(bond_style, "hybrid") == 0) { BondHybrid *hybrid = (BondHybrid *) bond; for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; @@ -422,12 +406,12 @@ Bond *Force::bond_match(const std::string &style) void Force::create_angle(const std::string &style, int trysuffix) { - delete [] angle_style; + delete[] angle_style; if (angle) delete angle; int sflag; - angle = new_angle(style,trysuffix,sflag); - store_style(angle_style,style,sflag); + angle = new_angle(style, trysuffix, sflag); + angle_style = store_style(style, sflag); } /* ---------------------------------------------------------------------- @@ -463,29 +447,20 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) return angle_creator(lmp); } - error->all(FLERR,utils::check_packages_for_style("angle",style,lmp)); + error->all(FLERR, utils::check_packages_for_style("angle", style, lmp)); return nullptr; } -/* ---------------------------------------------------------------------- - one instance per angle style in style_angle.h -------------------------------------------------------------------------- */ - -template -Angle *Force::angle_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- return ptr to current angle class or hybrid sub-class if matches style ------------------------------------------------------------------------- */ Angle *Force::angle_match(const std::string &style) { - if (style == angle_style) return angle; - else if (utils::strmatch(angle_style,"^hybrid")) { + if (style == angle_style) + return angle; + else if (utils::strmatch(angle_style, "^hybrid")) { AngleHybrid *hybrid = (AngleHybrid *) angle; for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; @@ -499,12 +474,12 @@ Angle *Force::angle_match(const std::string &style) void Force::create_dihedral(const std::string &style, int trysuffix) { - delete [] dihedral_style; + delete[] dihedral_style; if (dihedral) delete dihedral; int sflag; - dihedral = new_dihedral(style,trysuffix,sflag); - store_style(dihedral_style,style,sflag); + dihedral = new_dihedral(style, trysuffix, sflag); + dihedral_style = store_style(style, sflag); } /* ---------------------------------------------------------------------- @@ -540,29 +515,20 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla return dihedral_creator(lmp); } - error->all(FLERR,utils::check_packages_for_style("dihedral",style,lmp)); + error->all(FLERR, utils::check_packages_for_style("dihedral", style, lmp)); return nullptr; } -/* ---------------------------------------------------------------------- - one instance per dihedral style in style_dihedral.h -------------------------------------------------------------------------- */ - -template -Dihedral *Force::dihedral_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- return ptr to current angle class or hybrid sub-class if matches style ------------------------------------------------------------------------- */ Dihedral *Force::dihedral_match(const std::string &style) { - if (style == dihedral_style) return dihedral; - else if (utils::strmatch(dihedral_style,"^hybrid")) { + if (style == dihedral_style) + return dihedral; + else if (utils::strmatch(dihedral_style, "^hybrid")) { DihedralHybrid *hybrid = (DihedralHybrid *) dihedral; for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; @@ -576,12 +542,12 @@ Dihedral *Force::dihedral_match(const std::string &style) void Force::create_improper(const std::string &style, int trysuffix) { - delete [] improper_style; + delete[] improper_style; if (improper) delete improper; int sflag; - improper = new_improper(style,trysuffix,sflag); - store_style(improper_style,style,sflag); + improper = new_improper(style, trysuffix, sflag); + improper_style = store_style(style, sflag); } /* ---------------------------------------------------------------------- @@ -617,29 +583,20 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla return improper_creator(lmp); } - error->all(FLERR,utils::check_packages_for_style("improper",style,lmp)); + error->all(FLERR, utils::check_packages_for_style("improper", style, lmp)); return nullptr; } -/* ---------------------------------------------------------------------- - one instance per improper style in style_improper.h -------------------------------------------------------------------------- */ - -template -Improper *Force::improper_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- return ptr to current improper class or hybrid sub-class if matches style ------------------------------------------------------------------------- */ Improper *Force::improper_match(const std::string &style) { - if (style == improper_style) return improper; - else if (utils::strmatch(improper_style,"^hybrid")) { + if (style == improper_style) + return improper; + else if (utils::strmatch(improper_style, "^hybrid")) { ImproperHybrid *hybrid = (ImproperHybrid *) improper; for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; @@ -653,12 +610,12 @@ Improper *Force::improper_match(const std::string &style) void Force::create_kspace(const std::string &style, int trysuffix) { - delete [] kspace_style; + delete[] kspace_style; if (kspace) delete kspace; int sflag; - kspace = new_kspace(style,trysuffix,sflag); - store_style(kspace_style,style,sflag); + kspace = new_kspace(style, trysuffix, sflag); + kspace_style = store_style(style, sflag); } /* ---------------------------------------------------------------------- @@ -694,21 +651,11 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) return kspace_creator(lmp); } - error->all(FLERR,utils::check_packages_for_style("kspace",style,lmp)); + error->all(FLERR, utils::check_packages_for_style("kspace", style, lmp)); return nullptr; } -/* ---------------------------------------------------------------------- - one instance per kspace style in style_kspace.h -------------------------------------------------------------------------- */ - -template -KSpace *Force::kspace_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- return ptr to Kspace class if matches word if exact, then style name must be exact match to word @@ -718,8 +665,10 @@ KSpace *Force::kspace_creator(LAMMPS *lmp) KSpace *Force::kspace_match(const std::string &word, int exact) { - if (exact && (word == kspace_style)) return kspace; - else if (!exact && utils::strmatch(kspace_style,word)) return kspace; + if (exact && (word == kspace_style)) + return kspace; + else if (!exact && utils::strmatch(kspace_style, word)) + return kspace; return nullptr; } @@ -729,14 +678,17 @@ KSpace *Force::kspace_match(const std::string &word, int exact) if sflag = 1/2/3, append suffix or suffix2 or suffixp to style ------------------------------------------------------------------------- */ -void Force::store_style(char *&str, const std::string &style, int sflag) +char *Force::store_style(const std::string &style, int sflag) { std::string estyle = style; - if (sflag == 1) estyle += std::string("/") + lmp->suffix; - else if (sflag == 2) estyle += std::string("/") + lmp->suffix2; - else if (sflag == 3) estyle += std::string("/") + lmp->suffixp; - str = utils::strdup(estyle); + if (sflag == 1) + estyle += std::string("/") + lmp->suffix; + else if (sflag == 2) + estyle += std::string("/") + lmp->suffix2; + else if (sflag == 3) + estyle += std::string("/") + lmp->suffixp; + return utils::strdup(estyle); } /* ---------------------------------------------------------------------- @@ -745,7 +697,7 @@ void Force::store_style(char *&str, const std::string &style, int sflag) void Force::set_special(int narg, char **arg) { - if (narg == 0) error->all(FLERR,"Illegal special_bonds command"); + if (narg == 0) error->all(FLERR, "Illegal special_bonds command"); // defaults, but do not reset special_extra @@ -755,17 +707,17 @@ void Force::set_special(int narg, char **arg) int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"amber") == 0) { - if (iarg+1 > narg) error->all(FLERR,"Illegal special_bonds command"); + if (strcmp(arg[iarg], "amber") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal special_bonds command"); special_lj[1] = 0.0; special_lj[2] = 0.0; special_lj[3] = 0.5; special_coul[1] = 0.0; special_coul[2] = 0.0; - special_coul[3] = 5.0/6.0; + special_coul[3] = 5.0 / 6.0; iarg += 1; - } else if (strcmp(arg[iarg],"charmm") == 0) { - if (iarg+1 > narg) error->all(FLERR,"Illegal special_bonds command"); + } else if (strcmp(arg[iarg], "charmm") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal special_bonds command"); special_lj[1] = 0.0; special_lj[2] = 0.0; special_lj[3] = 0.0; @@ -773,8 +725,8 @@ void Force::set_special(int narg, char **arg) special_coul[2] = 0.0; special_coul[3] = 0.0; iarg += 1; - } else if (strcmp(arg[iarg],"dreiding") == 0) { - if (iarg+1 > narg) error->all(FLERR,"Illegal special_bonds command"); + } else if (strcmp(arg[iarg], "dreiding") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal special_bonds command"); special_lj[1] = 0.0; special_lj[2] = 0.0; special_lj[3] = 1.0; @@ -782,8 +734,8 @@ void Force::set_special(int narg, char **arg) special_coul[2] = 0.0; special_coul[3] = 1.0; iarg += 1; - } else if (strcmp(arg[iarg],"fene") == 0) { - if (iarg+1 > narg) error->all(FLERR,"Illegal special_bonds command"); + } else if (strcmp(arg[iarg], "fene") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal special_bonds command"); special_lj[1] = 0.0; special_lj[2] = 1.0; special_lj[3] = 1.0; @@ -791,39 +743,40 @@ void Force::set_special(int narg, char **arg) special_coul[2] = 1.0; special_coul[3] = 1.0; iarg += 1; - } else if (strcmp(arg[iarg],"lj/coul") == 0) { - if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_lj[1] = special_coul[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); - special_lj[2] = special_coul[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - special_lj[3] = special_coul[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + } else if (strcmp(arg[iarg], "lj/coul") == 0) { + if (iarg + 4 > narg) error->all(FLERR, "Illegal special_bonds command"); + special_lj[1] = special_coul[1] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + special_lj[2] = special_coul[2] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + special_lj[3] = special_coul[3] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); iarg += 4; - } else if (strcmp(arg[iarg],"lj") == 0) { - if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_lj[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); - special_lj[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - special_lj[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + } else if (strcmp(arg[iarg], "lj") == 0) { + if (iarg + 4 > narg) error->all(FLERR, "Illegal special_bonds command"); + special_lj[1] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + special_lj[2] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + special_lj[3] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); iarg += 4; - } else if (strcmp(arg[iarg],"coul") == 0) { - if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_coul[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); - special_coul[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - special_coul[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + } else if (strcmp(arg[iarg], "coul") == 0) { + if (iarg + 4 > narg) error->all(FLERR, "Illegal special_bonds command"); + special_coul[1] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + special_coul[2] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + special_coul[3] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); iarg += 4; - } else if (strcmp(arg[iarg],"angle") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_angle = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "angle") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal special_bonds command"); + special_angle = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"dihedral") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_dihedral = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "dihedral") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal special_bonds command"); + special_dihedral = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal special_bonds command"); + } else + error->all(FLERR, "Illegal special_bonds command"); } for (int i = 1; i <= 3; i++) - if (special_lj[i] < 0.0 || special_lj[i] > 1.0 || - special_coul[i] < 0.0 || special_coul[i] > 1.0) - error->all(FLERR,"Illegal special_bonds command"); + if (special_lj[i] < 0.0 || special_lj[i] > 1.0 || special_coul[i] < 0.0 || + special_coul[i] > 1.0) + error->all(FLERR, "Illegal special_bonds command"); } /* ---------------------------------------------------------------------- diff --git a/src/force.h b/src/force.h index 09e13c7bd1..677817f4b3 100644 --- a/src/force.h +++ b/src/force.h @@ -117,7 +117,7 @@ class Force : protected Pointers { int special_extra; // extra space for added bonds Force(class LAMMPS *); - ~Force(); + ~Force() override; void init(); void setup(); @@ -146,19 +146,13 @@ class Force : protected Pointers { KSpace *new_kspace(const std::string &, int, int &); KSpace *kspace_match(const std::string &, int); - void store_style(char *&, const std::string &, int); + char *store_style(const std::string &, int); void set_special(int, char **); double memory_usage(); private: void create_factories(); - template static Pair *pair_creator(LAMMPS *); - template static Bond *bond_creator(LAMMPS *); - template static Angle *angle_creator(LAMMPS *); - template static Dihedral *dihedral_creator(LAMMPS *); - template static Improper *improper_creator(LAMMPS *); - template static KSpace *kspace_creator(LAMMPS *); }; } // namespace LAMMPS_NS diff --git a/src/gridcomm.h b/src/gridcomm.h index 37751a88a7..dec43a789a 100644 --- a/src/gridcomm.h +++ b/src/gridcomm.h @@ -26,7 +26,7 @@ class GridComm : protected Pointers { int, int, int); GridComm(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); - virtual ~GridComm(); + ~GridComm() override; void setup(int &, int &); int ghost_adjacent(); void forward_comm(int, void *, int, int, int, void *, void *, MPI_Datatype); diff --git a/src/group.h b/src/group.h index 8d4270bbad..8c4d10a24f 100644 --- a/src/group.h +++ b/src/group.h @@ -29,7 +29,7 @@ class Group : protected Pointers { int *dynamic; // 1 if dynamic, 0 if not Group(class LAMMPS *); - ~Group(); + ~Group() override; void assign(int, char **); // assign atoms to a group void assign(const std::string &); // convenience function void create(const std::string &, int *); // add flagged atoms to a group diff --git a/src/image.h b/src/image.h index f9937cacfa..9eb5c899cb 100644 --- a/src/image.h +++ b/src/image.h @@ -35,7 +35,7 @@ class Image : protected Pointers { int background[3]; // RGB values of background Image(class LAMMPS *, int); - ~Image(); + ~Image() override; void buffers(); void clear(); void merge(); @@ -150,7 +150,7 @@ class ColorMap : protected Pointers { int dynamic; // 0/1 if lo/hi bounds are static/dynamic ColorMap(class LAMMPS *, class Image *); - ~ColorMap(); + ~ColorMap() override; int reset(int, char **); int minmax(double, double); double *value2color(double); diff --git a/src/imbalance.h b/src/imbalance.h index 06cbc97933..72037d110c 100644 --- a/src/imbalance.h +++ b/src/imbalance.h @@ -22,7 +22,6 @@ namespace LAMMPS_NS { class Imbalance : protected Pointers { public: Imbalance(class LAMMPS *); - virtual ~Imbalance(){}; // parse options. return number of arguments consumed (required) virtual int options(int, char **) = 0; diff --git a/src/imbalance_group.h b/src/imbalance_group.h index 0a8eab4363..7d459491a7 100644 --- a/src/imbalance_group.h +++ b/src/imbalance_group.h @@ -21,14 +21,14 @@ namespace LAMMPS_NS { class ImbalanceGroup : public Imbalance { public: ImbalanceGroup(class LAMMPS *); - virtual ~ImbalanceGroup(); + ~ImbalanceGroup() override; // parse options, return number of arguments consumed - virtual int options(int, char **) override; + int options(int, char **) override; // compute and apply weight factors to local atom array - virtual void compute(double *) override; + void compute(double *) override; // print information about the state of this imbalance compute - virtual std::string info() override; + std::string info() override; private: int num; // number of groups with weights diff --git a/src/imbalance_neigh.h b/src/imbalance_neigh.h index e5422076fa..1d9ddfb7a3 100644 --- a/src/imbalance_neigh.h +++ b/src/imbalance_neigh.h @@ -21,15 +21,14 @@ namespace LAMMPS_NS { class ImbalanceNeigh : public Imbalance { public: ImbalanceNeigh(class LAMMPS *); - virtual ~ImbalanceNeigh() {} public: // parse options, return number of arguments consumed - virtual int options(int, char **) override; + int options(int, char **) override; // compute and apply weight factors to local atom array - virtual void compute(double *) override; + void compute(double *) override; // print information about the state of this imbalance compute - virtual std::string info() override; + std::string info() override; private: double factor; // weight factor for neighbor imbalance diff --git a/src/imbalance_store.h b/src/imbalance_store.h index 55f6873645..aa7b80bb1c 100644 --- a/src/imbalance_store.h +++ b/src/imbalance_store.h @@ -21,15 +21,15 @@ namespace LAMMPS_NS { class ImbalanceStore : public Imbalance { public: ImbalanceStore(class LAMMPS *); - virtual ~ImbalanceStore(); + ~ImbalanceStore() override; public: // parse options, return number of arguments consumed - virtual int options(int, char **) override; + int options(int, char **) override; // compute per-atom imbalance and apply to weight array - virtual void compute(double *) override; + void compute(double *) override; // print information about the state of this imbalance compute (required) - virtual std::string info() override; + std::string info() override; private: char *name; // property name diff --git a/src/imbalance_time.h b/src/imbalance_time.h index cd000a6c4f..078124853a 100644 --- a/src/imbalance_time.h +++ b/src/imbalance_time.h @@ -21,17 +21,16 @@ namespace LAMMPS_NS { class ImbalanceTime : public Imbalance { public: ImbalanceTime(class LAMMPS *); - virtual ~ImbalanceTime() {} public: // parse options, return number of arguments consumed - virtual int options(int, char **) override; + int options(int, char **) override; // reinitialize internal data - virtual void init(int) override; + void init(int) override; // compute and apply weight factors to local atom array - virtual void compute(double *) override; + void compute(double *) override; // print information about the state of this imbalance compute - virtual std::string info() override; + std::string info() override; private: double factor; // weight factor for time imbalance diff --git a/src/imbalance_var.h b/src/imbalance_var.h index d1959f311d..dff399dee9 100644 --- a/src/imbalance_var.h +++ b/src/imbalance_var.h @@ -21,17 +21,17 @@ namespace LAMMPS_NS { class ImbalanceVar : public Imbalance { public: ImbalanceVar(class LAMMPS *); - virtual ~ImbalanceVar(); + ~ImbalanceVar() override; public: // parse options. return number of arguments consumed. - virtual int options(int, char **) override; + int options(int, char **) override; // re-initialize internal data, e.g. variable ID - virtual void init(int) override; + void init(int) override; // compute per-atom imbalance and apply to weight array - virtual void compute(double *) override; + void compute(double *) override; // print information about the state of this imbalance compute (required) - virtual std::string info() override; + std::string info() override; private: char *name; // variable name diff --git a/src/improper.h b/src/improper.h index 1f88204a6b..dbe8bee3f1 100644 --- a/src/improper.h +++ b/src/improper.h @@ -43,7 +43,7 @@ class Improper : protected Pointers { int copymode; Improper(class LAMMPS *); - virtual ~Improper(); + ~Improper() override; virtual void init(); virtual void init_style() {} virtual void compute(int, int) = 0; diff --git a/src/improper_deprecated.h b/src/improper_deprecated.h index ea080ba3cb..d2f0be0dc3 100644 --- a/src/improper_deprecated.h +++ b/src/improper_deprecated.h @@ -27,13 +27,12 @@ namespace LAMMPS_NS { class ImproperDeprecated : public Improper { public: ImproperDeprecated(class LAMMPS *lmp) : Improper(lmp) {} - virtual ~ImproperDeprecated() {} - virtual void compute(int, int) {} - virtual void settings(int, char **); - virtual void coeff(int, char **) {} - virtual void write_restart(FILE *) {} - virtual void read_restart(FILE *) {} + void compute(int, int) override {} + void settings(int, char **) override; + void coeff(int, char **) override {} + void write_restart(FILE *) override {} + void read_restart(FILE *) override {} }; } // namespace LAMMPS_NS diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index d3a9403a6b..0354f8e92e 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -241,7 +241,7 @@ void ImproperHybrid::settings(int narg, char **arg) error->all(FLERR, "Improper style hybrid cannot have none as an argument"); styles[nstyles] = force->new_improper(arg[i], 1, dummy); - force->store_style(keywords[nstyles], arg[i], 0); + keywords[nstyles] = force->store_style(arg[i], 0); istyle = i; if (strcmp(arg[i], "table") == 0) i++; diff --git a/src/improper_hybrid.h b/src/improper_hybrid.h index e680ec9119..caa9e0b762 100644 --- a/src/improper_hybrid.h +++ b/src/improper_hybrid.h @@ -31,14 +31,14 @@ class ImproperHybrid : public Improper { char **keywords; // keyword for each improper style ImproperHybrid(class LAMMPS *); - ~ImproperHybrid(); - void init_style(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - double memory_usage(); + ~ImproperHybrid() override; + void init_style() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double memory_usage() override; private: int *map; // which style each improper type points to diff --git a/src/improper_zero.h b/src/improper_zero.h index 9b1dfa4e73..5acf34c6d4 100644 --- a/src/improper_zero.h +++ b/src/improper_zero.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class ImproperZero : public Improper { public: ImproperZero(class LAMMPS *); - virtual ~ImproperZero(); - virtual void compute(int, int); - virtual void coeff(int, char **); - virtual void settings(int, char **); + ~ImproperZero() override; + void compute(int, int) override; + void coeff(int, char **) override; + void settings(int, char **) override; - void write_restart(FILE *); - void read_restart(FILE *); - void write_data(FILE *); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; protected: int coeffflag; diff --git a/src/info.cpp b/src/info.cpp index 297633cd9d..1beadff753 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -40,7 +40,6 @@ #include "pair.h" #include "pair_hybrid.h" #include "region.h" -#include "text_file_reader.h" #include "update.h" #include "variable.h" #include "fmt/chrono.h" @@ -49,7 +48,6 @@ #include #include #include -#include #include #ifdef _WIN32 @@ -62,7 +60,6 @@ #include #else #include -#include #endif #if defined(__linux__) @@ -278,9 +275,9 @@ void Info::command(int narg, char **arg) fmt::print(out,"\nLAMMPS version: {} / {}\n", lmp->version, lmp->num_ver); - if (lmp->has_git_info) + if (lmp->has_git_info()) fmt::print(out,"Git info: {} / {} / {}\n", - lmp->git_branch, lmp->git_descriptor,lmp->git_commit); + lmp->git_branch(), lmp->git_descriptor(),lmp->git_commit()); fmt::print(out,"\nOS information: {}\n\n",platform::os_info()); diff --git a/src/info.h b/src/info.h index c1e10a2336..8c2ebb1167 100644 --- a/src/info.h +++ b/src/info.h @@ -29,7 +29,7 @@ namespace LAMMPS_NS { class Info : public Command { public: Info(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; bool is_active(const char *, const char *); bool is_defined(const char *, const char *); diff --git a/src/input.cpp b/src/input.cpp index 990d0562e5..b829d7eb5d 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -50,13 +50,21 @@ #include #include #include -#include using namespace LAMMPS_NS; #define DELTALINE 256 #define DELTA 4 +/* ---------------------------------------------------------------------- + one instance per command in style_command.h +------------------------------------------------------------------------- */ + +template static Command *command_creator(LAMMPS *lmp) +{ + return new T(lmp); +} + /* ---------------------------------------------------------------------- */ /** \class LAMMPS_NS::Input @@ -784,9 +792,21 @@ int Input::execute_command() if (flag) return 0; // invoke commands added via style_command.h + // try suffixed version first - if (command_map->find(command) != command_map->end()) { - CommandCreator &command_creator = (*command_map)[command]; + std::string mycmd = command; + if (lmp->suffix_enable) { + mycmd = command + std::string("/") + lmp->suffix; + if (command_map->find(mycmd) == command_map->end()) { + if (lmp->suffix2) { + mycmd = command + std::string("/") + lmp->suffix2; + if (command_map->find(mycmd) == command_map->end()) + mycmd = command; + } else mycmd = command; + } + } + if (command_map->find(mycmd) != command_map->end()) { + CommandCreator &command_creator = (*command_map)[mycmd]; Command *cmd = command_creator(lmp); cmd->command(narg,arg); delete cmd; @@ -798,16 +818,6 @@ int Input::execute_command() return -1; } -/* ---------------------------------------------------------------------- - one instance per command in style_command.h -------------------------------------------------------------------------- */ - -template -Command *Input::command_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ @@ -966,10 +976,15 @@ void Input::include() if (nfile == maxfile) error->one(FLERR,"Too many nested levels of input scripts"); - infile = fopen(arg[0],"r"); + // expand variables + int n = strlen(arg[0]) + 1; + if (n > maxline) reallocate(line,maxline,n); + strcpy(line,arg[0]); + substitute(line,work,maxline,maxwork,0); + + infile = fopen(line,"r"); if (infile == nullptr) - error->one(FLERR,"Cannot open input script {}: {}", - arg[0], utils::getsyserror()); + error->one(FLERR,"Cannot open input script {}: {}", line, utils::getsyserror()); infiles[nfile++] = infile; } diff --git a/src/input.h b/src/input.h index faf45ab305..3e9edfe0a6 100644 --- a/src/input.h +++ b/src/input.h @@ -33,7 +33,7 @@ class Input : protected Pointers { class Variable *variable; // defined variables Input(class LAMMPS *, int, char **); - ~Input(); + ~Input() override; void file(); // process all input void file(const char *); // process an input script char *one(const std::string &); // process a single command @@ -64,9 +64,6 @@ class Input : protected Pointers { typedef std::map CommandCreatorMap; CommandCreatorMap *command_map; - protected: - template static Command *command_creator(LAMMPS *); - private: void parse(); // parse an input text line char *nextword(char *, char **); // find next word in string with quotes diff --git a/src/integrate.h b/src/integrate.h index e38fad79dc..e2bf3d33e1 100644 --- a/src/integrate.h +++ b/src/integrate.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class Integrate : protected Pointers { public: Integrate(class LAMMPS *, int, char **); - virtual ~Integrate(); + ~Integrate() override; virtual void init(); virtual void setup(int flag) = 0; virtual void setup_minimal(int) = 0; diff --git a/src/irregular.h b/src/irregular.h index f874a82c57..b1abab67f1 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -27,7 +27,7 @@ class Irregular : protected Pointers { #endif Irregular(class LAMMPS *); - ~Irregular(); + ~Irregular() override; void migrate_atoms(int sortflag = 0, int preassign = 0, int *procassign = nullptr); int migrate_check(); int create_data(int, int *, int sortflag = 0); diff --git a/src/kspace.h b/src/kspace.h index 22453d51a8..68d169ea97 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -100,7 +100,7 @@ class KSpace : protected Pointers { double splittol; // tolerance for when to truncate splitting KSpace(class LAMMPS *); - virtual ~KSpace(); + ~KSpace() override; void two_charge(); void triclinic_check(); void modify_params(int, char **); diff --git a/src/kspace_deprecated.h b/src/kspace_deprecated.h index 09c3a90e33..cfd1af66de 100644 --- a/src/kspace_deprecated.h +++ b/src/kspace_deprecated.h @@ -27,12 +27,11 @@ namespace LAMMPS_NS { class KSpaceDeprecated : public KSpace { public: KSpaceDeprecated(class LAMMPS *lmp) : KSpace(lmp) {} - virtual ~KSpaceDeprecated() {} - virtual void init() {} - virtual void settings(int, char **); - virtual void setup() {} - virtual void compute(int, int) {} + void init() override {} + void settings(int, char **) override; + void setup() override {} + void compute(int, int) override {} }; } // namespace LAMMPS_NS diff --git a/src/lammps.cpp b/src/lammps.cpp index 55b7755c83..e6ff6efb23 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -1149,9 +1149,9 @@ void _noopt LAMMPS::help() // general help message about command line and flags - if (has_git_info) { + if (has_git_info()) { fprintf(fp,"\nLarge-scale Atomic/Molecular Massively Parallel Simulator - " - LAMMPS_VERSION UPDATE_STRING "\nGit info (%s / %s)\n\n",git_branch, git_descriptor); + LAMMPS_VERSION UPDATE_STRING "\nGit info (%s / %s)\n\n",git_branch(), git_descriptor()); } else { fprintf(fp,"\nLarge-scale Atomic/Molecular Massively Parallel Simulator - " LAMMPS_VERSION UPDATE_STRING "\n\n"); diff --git a/src/lammps.h b/src/lammps.h index 71b731204c..5ccc1a90a9 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -73,10 +73,10 @@ class LAMMPS { static const char *installed_packages[]; static bool is_installed_pkg(const char *pkg); - static const bool has_git_info; - static const char git_commit[]; - static const char git_branch[]; - static const char git_descriptor[]; + static bool has_git_info(); + static const char *git_commit(); + static const char *git_branch(); + static const char *git_descriptor(); LAMMPS(int, char **, MPI_Comm); ~LAMMPS(); diff --git a/src/lattice.h b/src/lattice.h index 07df77e630..1e81401240 100644 --- a/src/lattice.h +++ b/src/lattice.h @@ -30,7 +30,7 @@ class Lattice : protected Pointers { // within unit cell (0 <= coord < 1) Lattice(class LAMMPS *, int, char **); - ~Lattice(); + ~Lattice() override; void lattice2box(double &, double &, double &); void box2lattice(double &, double &, double &); void bbox(int, double, double, double, double &, double &, double &, double &, double &, diff --git a/src/library.cpp b/src/library.cpp index a27da0d478..af5fe36dd0 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -5439,6 +5439,21 @@ void lammps_fix_external_set_vector(void *handle, const char *id, int idx, doubl /* ---------------------------------------------------------------------- */ +/** Flush output buffers + +\verbatim embed:rst +This function can be used to flush buffered output to be written to screen +and logfile pointers to simplify capturing output from LAMMPS library calls. +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + */ +void lammps_flush_buffers(void *handle) { + utils::flush_buffers((LAMMPS *) handle); +} + +/* ---------------------------------------------------------------------- */ + /** Free memory buffer allocated by LAMMPS. * \verbatim embed:rst diff --git a/src/library.h b/src/library.h index 1605267818..94fd7f7380 100644 --- a/src/library.h +++ b/src/library.h @@ -246,6 +246,8 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double void lammps_fix_external_set_vector_length(void *handle, const char *id, int len); void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val); +void lammps_flush_buffers(void *ptr); + void lammps_free(void *ptr); int lammps_is_running(void *handle); diff --git a/src/lmppython.h b/src/lmppython.h index 3f0ebecae5..e923b38808 100644 --- a/src/lmppython.h +++ b/src/lmppython.h @@ -34,7 +34,7 @@ class PythonInterface { class Python : protected Pointers { public: Python(class LAMMPS *); - ~Python(); + ~Python() override; void command(int, char **); void invoke_function(int, char *); diff --git a/src/min.h b/src/min.h index 61af3e23b3..82e14910d7 100644 --- a/src/min.h +++ b/src/min.h @@ -29,7 +29,7 @@ class Min : protected Pointers { int searchflag; // 0 if damped dynamics, 1 if sub-cycles on local search Min(class LAMMPS *); - virtual ~Min(); + ~Min() override; virtual void init(); virtual void setup(int flag = 1); virtual void setup_minimal(int); diff --git a/src/min_cg.h b/src/min_cg.h index 9b50068509..f203c0fbd6 100644 --- a/src/min_cg.h +++ b/src/min_cg.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class MinCG : public MinLineSearch { public: MinCG(class LAMMPS *); - int iterate(int); + int iterate(int) override; }; } // namespace LAMMPS_NS diff --git a/src/min_fire.h b/src/min_fire.h index 7e961b766a..c415ec8fb9 100644 --- a/src/min_fire.h +++ b/src/min_fire.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class MinFire : public Min { public: MinFire(class LAMMPS *); - ~MinFire() {} - void init(); - void setup_style(); - void reset_vectors(); - int iterate(int); + + void init() override; + void setup_style() override; + void reset_vectors() override; + int iterate(int) override; private: double dt, dtmax, dtmin; diff --git a/src/min_fire_old.h b/src/min_fire_old.h index 06fe13daec..0d9d7ee2ec 100644 --- a/src/min_fire_old.h +++ b/src/min_fire_old.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class MinFireOld : public Min { public: MinFireOld(class LAMMPS *); - ~MinFireOld() {} - void init(); - void setup_style(); - void reset_vectors(); - int iterate(int); + + void init() override; + void setup_style() override; + void reset_vectors() override; + int iterate(int) override; private: double dt, dtmax; diff --git a/src/min_hftn.h b/src/min_hftn.h index 4b909c3112..360f52a03d 100644 --- a/src/min_hftn.h +++ b/src/min_hftn.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class MinHFTN : public Min { public: MinHFTN(LAMMPS *); - ~MinHFTN(); - void init(); - void setup_style(); - void reset_vectors(); - int iterate(int); + ~MinHFTN() override; + void init() override; + void setup_style() override; + void reset_vectors() override; + int iterate(int) override; private: //---- THE ALGORITHM NEEDS TO STORE THIS MANY ATOM-BASED VECTORS, diff --git a/src/min_linesearch.h b/src/min_linesearch.h index 505de7494e..ff8a24fab0 100644 --- a/src/min_linesearch.h +++ b/src/min_linesearch.h @@ -21,10 +21,10 @@ namespace LAMMPS_NS { class MinLineSearch : public Min { public: MinLineSearch(class LAMMPS *); - ~MinLineSearch(); - void init(); - void setup_style(); - void reset_vectors(); + ~MinLineSearch() override; + void init() override; + void setup_style() override; + void reset_vectors() override; protected: // vectors needed by linesearch minimizers diff --git a/src/min_quickmin.h b/src/min_quickmin.h index 89022aa95b..d1b415313b 100644 --- a/src/min_quickmin.h +++ b/src/min_quickmin.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class MinQuickMin : public Min { public: MinQuickMin(class LAMMPS *); - ~MinQuickMin() {} - void init(); - void setup_style(); - void reset_vectors(); - int iterate(int); + + void init() override; + void setup_style() override; + void reset_vectors() override; + int iterate(int) override; private: double dt; diff --git a/src/min_sd.h b/src/min_sd.h index 2ccc1ba698..39d2c5f529 100644 --- a/src/min_sd.h +++ b/src/min_sd.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class MinSD : public MinLineSearch { public: MinSD(class LAMMPS *); - int iterate(int); + int iterate(int) override; }; } // namespace LAMMPS_NS diff --git a/src/minimize.h b/src/minimize.h index f1dc539388..8fa1e6170b 100644 --- a/src/minimize.h +++ b/src/minimize.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Minimize : public Command { public: Minimize(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/modify.cpp b/src/modify.cpp index 2f7abe27fa..7c6f8e4ae3 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "modify.h" -#include "style_compute.h" // IWYU pragma: keep -#include "style_fix.h" // IWYU pragma: keep +#include "style_compute.h" // IWYU pragma: keep +#include "style_fix.h" // IWYU pragma: keep #include "atom.h" #include "comm.h" -#include "compute.h" // IWYU pragma: keep +#include "compute.h" // IWYU pragma: keep #include "domain.h" #include "error.h" -#include "fix.h" // IWYU pragma: keep +#include "fix.h" // IWYU pragma: keep #include "group.h" #include "input.h" #include "memory.h" @@ -37,6 +36,14 @@ using namespace FixConst; #define DELTA 4 #define BIG 1.0e20 +// template for factory function: +// there will be one instance for each style keyword in the respective style_xxx.h files + +template static S *style_creator(LAMMPS *lmp, int narg, char **arg) +{ + return new T(lmp, narg, arg); +} + /* ---------------------------------------------------------------------- */ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) @@ -92,9 +99,8 @@ void _noopt Modify::create_factories() fix_map = new FixCreatorMap(); #define FIX_CLASS -#define FixStyle(key,Class) \ - (*fix_map)[#key] = &fix_creator; -#include "style_fix.h" // IWYU pragma: keep +#define FixStyle(key, Class) (*fix_map)[#key] = &style_creator; +#include "style_fix.h" // IWYU pragma: keep #undef FixStyle #undef FIX_CLASS @@ -103,9 +109,8 @@ void _noopt Modify::create_factories() compute_map = new ComputeCreatorMap(); #define COMPUTE_CLASS -#define ComputeStyle(key,Class) \ - (*compute_map)[#key] = &compute_creator; -#include "style_compute.h" // IWYU pragma: keep +#define ComputeStyle(key, Class) (*compute_map)[#key] = &style_creator; +#include "style_compute.h" // IWYU pragma: keep #undef ComputeStyle #undef COMPUTE_CLASS } @@ -126,34 +131,34 @@ Modify::~Modify() for (int i = 0; i < ncompute; i++) delete compute[i]; memory->sfree(compute); - delete [] list_initial_integrate; - delete [] list_post_integrate; - delete [] list_pre_exchange; - delete [] list_pre_neighbor; - delete [] list_post_neighbor; - delete [] list_pre_force; - delete [] list_pre_reverse; - delete [] list_post_force; - delete [] list_final_integrate; - delete [] list_end_of_step; - delete [] list_energy_couple; - delete [] list_energy_global; - delete [] list_energy_atom; - delete [] list_initial_integrate_respa; - delete [] list_post_integrate_respa; - delete [] list_pre_force_respa; - delete [] list_post_force_respa; - delete [] list_final_integrate_respa; - delete [] list_min_pre_exchange; - delete [] list_min_pre_neighbor; - delete [] list_min_post_neighbor; - delete [] list_min_pre_force; - delete [] list_min_pre_reverse; - delete [] list_min_post_force; - delete [] list_min_energy; + delete[] list_initial_integrate; + delete[] list_post_integrate; + delete[] list_pre_exchange; + delete[] list_pre_neighbor; + delete[] list_post_neighbor; + delete[] list_pre_force; + delete[] list_pre_reverse; + delete[] list_post_force; + delete[] list_final_integrate; + delete[] list_end_of_step; + delete[] list_energy_couple; + delete[] list_energy_global; + delete[] list_energy_atom; + delete[] list_initial_integrate_respa; + delete[] list_post_integrate_respa; + delete[] list_pre_force_respa; + delete[] list_post_force_respa; + delete[] list_final_integrate_respa; + delete[] list_min_pre_exchange; + delete[] list_min_pre_neighbor; + delete[] list_min_post_neighbor; + delete[] list_min_pre_force; + delete[] list_min_pre_reverse; + delete[] list_min_post_force; + delete[] list_min_energy; - delete [] end_of_step_every; - delete [] list_timeflag; + delete[] end_of_step_every; + delete[] list_timeflag; restart_deallocate(0); @@ -167,7 +172,7 @@ Modify::~Modify() void Modify::init() { - int i,j; + int i, j; // delete storage of restart info since it is not valid after 1st run @@ -208,33 +213,33 @@ void Modify::init() // needs to happen after init() of computes // b/c a compute::init() can delete a fix, e.g. compute chunk/atom - list_init(INITIAL_INTEGRATE,n_initial_integrate,list_initial_integrate); - list_init(POST_INTEGRATE,n_post_integrate,list_post_integrate); - list_init(PRE_EXCHANGE,n_pre_exchange,list_pre_exchange); - list_init(PRE_NEIGHBOR,n_pre_neighbor,list_pre_neighbor); - list_init(POST_NEIGHBOR,n_post_neighbor,list_post_neighbor); - list_init(PRE_FORCE,n_pre_force,list_pre_force); - list_init(PRE_REVERSE,n_pre_reverse,list_pre_reverse); - list_init(POST_FORCE,n_post_force,list_post_force); - list_init(FINAL_INTEGRATE,n_final_integrate,list_final_integrate); - list_init_end_of_step(END_OF_STEP,n_end_of_step,list_end_of_step); - list_init_energy_couple(n_energy_couple,list_energy_couple); - list_init_energy_global(n_energy_global,list_energy_global); - list_init_energy_atom(n_energy_atom,list_energy_atom); + list_init(INITIAL_INTEGRATE, n_initial_integrate, list_initial_integrate); + list_init(POST_INTEGRATE, n_post_integrate, list_post_integrate); + list_init(PRE_EXCHANGE, n_pre_exchange, list_pre_exchange); + list_init(PRE_NEIGHBOR, n_pre_neighbor, list_pre_neighbor); + list_init(POST_NEIGHBOR, n_post_neighbor, list_post_neighbor); + list_init(PRE_FORCE, n_pre_force, list_pre_force); + list_init(PRE_REVERSE, n_pre_reverse, list_pre_reverse); + list_init(POST_FORCE, n_post_force, list_post_force); + list_init(FINAL_INTEGRATE, n_final_integrate, list_final_integrate); + list_init_end_of_step(END_OF_STEP, n_end_of_step, list_end_of_step); + list_init_energy_couple(n_energy_couple, list_energy_couple); + list_init_energy_global(n_energy_global, list_energy_global); + list_init_energy_atom(n_energy_atom, list_energy_atom); - list_init(INITIAL_INTEGRATE_RESPA,n_initial_integrate_respa,list_initial_integrate_respa); - list_init(POST_INTEGRATE_RESPA,n_post_integrate_respa,list_post_integrate_respa); - list_init(POST_FORCE_RESPA,n_post_force_respa,list_post_force_respa); - list_init(PRE_FORCE_RESPA,n_pre_force_respa,list_pre_force_respa); - list_init(FINAL_INTEGRATE_RESPA,n_final_integrate_respa,list_final_integrate_respa); + list_init(INITIAL_INTEGRATE_RESPA, n_initial_integrate_respa, list_initial_integrate_respa); + list_init(POST_INTEGRATE_RESPA, n_post_integrate_respa, list_post_integrate_respa); + list_init(POST_FORCE_RESPA, n_post_force_respa, list_post_force_respa); + list_init(PRE_FORCE_RESPA, n_pre_force_respa, list_pre_force_respa); + list_init(FINAL_INTEGRATE_RESPA, n_final_integrate_respa, list_final_integrate_respa); - list_init(MIN_PRE_EXCHANGE,n_min_pre_exchange,list_min_pre_exchange); - list_init(MIN_PRE_NEIGHBOR,n_min_pre_neighbor,list_min_pre_neighbor); - list_init(MIN_POST_NEIGHBOR,n_min_post_neighbor,list_min_post_neighbor); - list_init(MIN_PRE_FORCE,n_min_pre_force,list_min_pre_force); - list_init(MIN_PRE_REVERSE,n_min_pre_reverse,list_min_pre_reverse); - list_init(MIN_POST_FORCE,n_min_post_force,list_min_post_force); - list_init(MIN_ENERGY,n_min_energy,list_min_energy); + list_init(MIN_PRE_EXCHANGE, n_min_pre_exchange, list_min_pre_exchange); + list_init(MIN_PRE_NEIGHBOR, n_min_pre_neighbor, list_min_pre_neighbor); + list_init(MIN_POST_NEIGHBOR, n_min_post_neighbor, list_min_post_neighbor); + list_init(MIN_PRE_FORCE, n_min_pre_force, list_min_pre_force); + list_init(MIN_PRE_REVERSE, n_min_pre_reverse, list_min_pre_reverse); + list_init(MIN_POST_FORCE, n_min_post_force, list_min_post_force); + list_init(MIN_ENERGY, n_min_energy, list_min_energy); // create list of computes that store invocation times @@ -244,14 +249,11 @@ void Modify::init() for (i = 0; i < nfix; i++) if (!fix[i]->dynamic_group_allow && group->dynamic[fix[i]->igroup]) - error->all(FLERR,"Fix {} does not allow use with a " - "dynamic group",fix[i]->id); + error->all(FLERR, "Fix {} does not allow use with a dynamic group", fix[i]->id); for (i = 0; i < ncompute; i++) - if (!compute[i]->dynamic_group_allow && - group->dynamic[compute[i]->igroup]) - error->all(FLERR,"Compute {} does not allow use with a " - "dynamic group",compute[i]->id); + if (!compute[i]->dynamic_group_allow && group->dynamic[compute[i]->igroup]) + error->all(FLERR, "Compute {} does not allow use with a dynamic group", compute[i]->id); // warn if any particle is time integrated more than once @@ -273,13 +275,12 @@ void Modify::init() for (i = 0; i < nlocal; i++) if (flag[i] > 1) check = 1; - delete [] flag; + delete[] flag; int checkall; - MPI_Allreduce(&check,&checkall,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&check, &checkall, 1, MPI_INT, MPI_SUM, world); if (comm->me == 0 && checkall) - error->warning(FLERR, - "One or more atoms are time integrated more than once"); + error->warning(FLERR, "One or more atoms are time integrated more than once"); } /* ---------------------------------------------------------------------- @@ -295,7 +296,7 @@ void Modify::setup(int vflag) // needs to be done before temperature compute setup for (int i = 0; i < nfix; i++) - if (strcmp(fix[i]->style,"GROUP") == 0) fix[i]->setup(vflag); + if (strcmp(fix[i]->style, "GROUP") == 0) fix[i]->setup(vflag); for (int i = 0; i < ncompute; i++) compute[i]->setup(); @@ -313,8 +314,7 @@ void Modify::setup(int vflag) void Modify::setup_pre_exchange() { if (update->whichflag <= 1) - for (int i = 0; i < n_pre_exchange; i++) - fix[list_pre_exchange[i]]->setup_pre_exchange(); + for (int i = 0; i < n_pre_exchange; i++) fix[list_pre_exchange[i]]->setup_pre_exchange(); else if (update->whichflag == 2) for (int i = 0; i < n_min_pre_exchange; i++) fix[list_min_pre_exchange[i]]->setup_pre_exchange(); @@ -328,8 +328,7 @@ void Modify::setup_pre_exchange() void Modify::setup_pre_neighbor() { if (update->whichflag == 1) - for (int i = 0; i < n_pre_neighbor; i++) - fix[list_pre_neighbor[i]]->setup_pre_neighbor(); + for (int i = 0; i < n_pre_neighbor; i++) fix[list_pre_neighbor[i]]->setup_pre_neighbor(); else if (update->whichflag == 2) for (int i = 0; i < n_min_pre_neighbor; i++) fix[list_min_pre_neighbor[i]]->setup_pre_neighbor(); @@ -343,8 +342,7 @@ void Modify::setup_pre_neighbor() void Modify::setup_post_neighbor() { if (update->whichflag == 1) - for (int i = 0; i < n_post_neighbor; i++) - fix[list_post_neighbor[i]]->setup_post_neighbor(); + for (int i = 0; i < n_post_neighbor; i++) fix[list_post_neighbor[i]]->setup_post_neighbor(); else if (update->whichflag == 2) for (int i = 0; i < n_min_post_neighbor; i++) fix[list_min_post_neighbor[i]]->setup_post_neighbor(); @@ -358,11 +356,9 @@ void Modify::setup_post_neighbor() void Modify::setup_pre_force(int vflag) { if (update->whichflag == 1) - for (int i = 0; i < n_pre_force; i++) - fix[list_pre_force[i]]->setup_pre_force(vflag); + for (int i = 0; i < n_pre_force; i++) fix[list_pre_force[i]]->setup_pre_force(vflag); else if (update->whichflag == 2) - for (int i = 0; i < n_min_pre_force; i++) - fix[list_min_pre_force[i]]->setup_pre_force(vflag); + for (int i = 0; i < n_min_pre_force; i++) fix[list_min_pre_force[i]]->setup_pre_force(vflag); } /* ---------------------------------------------------------------------- @@ -374,10 +370,10 @@ void Modify::setup_pre_reverse(int eflag, int vflag) { if (update->whichflag == 1) for (int i = 0; i < n_pre_reverse; i++) - fix[list_pre_reverse[i]]->setup_pre_reverse(eflag,vflag); + fix[list_pre_reverse[i]]->setup_pre_reverse(eflag, vflag); else if (update->whichflag == 2) for (int i = 0; i < n_min_pre_reverse; i++) - fix[list_min_pre_reverse[i]]->setup_pre_reverse(eflag,vflag); + fix[list_min_pre_reverse[i]]->setup_pre_reverse(eflag, vflag); } /* ---------------------------------------------------------------------- @@ -396,8 +392,7 @@ void Modify::initial_integrate(int vflag) void Modify::post_integrate() { - for (int i = 0; i < n_post_integrate; i++) - fix[list_post_integrate[i]]->post_integrate(); + for (int i = 0; i < n_post_integrate; i++) fix[list_post_integrate[i]]->post_integrate(); } /* ---------------------------------------------------------------------- @@ -406,8 +401,7 @@ void Modify::post_integrate() void Modify::pre_exchange() { - for (int i = 0; i < n_pre_exchange; i++) - fix[list_pre_exchange[i]]->pre_exchange(); + for (int i = 0; i < n_pre_exchange; i++) fix[list_pre_exchange[i]]->pre_exchange(); } /* ---------------------------------------------------------------------- @@ -416,8 +410,7 @@ void Modify::pre_exchange() void Modify::pre_neighbor() { - for (int i = 0; i < n_pre_neighbor; i++) - fix[list_pre_neighbor[i]]->pre_neighbor(); + for (int i = 0; i < n_pre_neighbor; i++) fix[list_pre_neighbor[i]]->pre_neighbor(); } /* ---------------------------------------------------------------------- @@ -426,8 +419,7 @@ void Modify::pre_neighbor() void Modify::post_neighbor() { - for (int i = 0; i < n_post_neighbor; i++) - fix[list_post_neighbor[i]]->post_neighbor(); + for (int i = 0; i < n_post_neighbor; i++) fix[list_post_neighbor[i]]->post_neighbor(); } /* ---------------------------------------------------------------------- @@ -436,8 +428,7 @@ void Modify::post_neighbor() void Modify::pre_force(int vflag) { - for (int i = 0; i < n_pre_force; i++) - fix[list_pre_force[i]]->pre_force(vflag); + for (int i = 0; i < n_pre_force; i++) fix[list_pre_force[i]]->pre_force(vflag); } /* ---------------------------------------------------------------------- pre_reverse call, only for relevant fixes @@ -445,8 +436,7 @@ void Modify::pre_force(int vflag) void Modify::pre_reverse(int eflag, int vflag) { - for (int i = 0; i < n_pre_reverse; i++) - fix[list_pre_reverse[i]]->pre_reverse(eflag,vflag); + for (int i = 0; i < n_pre_reverse; i++) fix[list_pre_reverse[i]]->pre_reverse(eflag, vflag); } /* ---------------------------------------------------------------------- @@ -455,8 +445,7 @@ void Modify::pre_reverse(int eflag, int vflag) void Modify::post_force(int vflag) { - for (int i = 0; i < n_post_force; i++) - fix[list_post_force[i]]->post_force(vflag); + for (int i = 0; i < n_post_force; i++) fix[list_post_force[i]]->post_force(vflag); } /* ---------------------------------------------------------------------- @@ -465,8 +454,7 @@ void Modify::post_force(int vflag) void Modify::final_integrate() { - for (int i = 0; i < n_final_integrate; i++) - fix[list_final_integrate[i]]->final_integrate(); + for (int i = 0; i < n_final_integrate; i++) fix[list_final_integrate[i]]->final_integrate(); } /* ---------------------------------------------------------------------- @@ -477,8 +465,7 @@ void Modify::final_integrate() void Modify::end_of_step() { for (int i = 0; i < n_end_of_step; i++) - if (update->ntimestep % end_of_step_every[i] == 0) - fix[list_end_of_step[i]]->end_of_step(); + if (update->ntimestep % end_of_step_every[i] == 0) fix[list_end_of_step[i]]->end_of_step(); } /* ---------------------------------------------------------------------- @@ -490,8 +477,7 @@ void Modify::end_of_step() double Modify::energy_couple() { double energy = 0.0; - for (int i = 0; i < n_energy_couple; i++) - energy += fix[list_energy_couple[i]]->compute_scalar(); + for (int i = 0; i < n_energy_couple; i++) energy += fix[list_energy_couple[i]]->compute_scalar(); return energy; } @@ -504,8 +490,7 @@ double Modify::energy_couple() double Modify::energy_global() { double energy = 0.0; - for (int i = 0; i < n_energy_global; i++) - energy += fix[list_energy_global[i]]->compute_scalar(); + for (int i = 0; i < n_energy_global; i++) energy += fix[list_energy_global[i]]->compute_scalar(); return energy; } @@ -516,7 +501,7 @@ double Modify::energy_global() void Modify::energy_atom(int nlocal, double *energy) { - int i,j; + int i, j; double *eatom; for (i = 0; i < n_energy_atom; i++) { @@ -565,7 +550,7 @@ void Modify::create_attribute(int n) void Modify::setup_pre_force_respa(int vflag, int ilevel) { for (int i = 0; i < n_pre_force_respa; i++) - fix[list_pre_force_respa[i]]->setup_pre_force_respa(vflag,ilevel); + fix[list_pre_force_respa[i]]->setup_pre_force_respa(vflag, ilevel); } /* ---------------------------------------------------------------------- @@ -575,8 +560,7 @@ void Modify::setup_pre_force_respa(int vflag, int ilevel) void Modify::initial_integrate_respa(int vflag, int ilevel, int iloop) { for (int i = 0; i < n_initial_integrate_respa; i++) - fix[list_initial_integrate_respa[i]]-> - initial_integrate_respa(vflag,ilevel,iloop); + fix[list_initial_integrate_respa[i]]->initial_integrate_respa(vflag, ilevel, iloop); } /* ---------------------------------------------------------------------- @@ -586,7 +570,7 @@ void Modify::initial_integrate_respa(int vflag, int ilevel, int iloop) void Modify::post_integrate_respa(int ilevel, int iloop) { for (int i = 0; i < n_post_integrate_respa; i++) - fix[list_post_integrate_respa[i]]->post_integrate_respa(ilevel,iloop); + fix[list_post_integrate_respa[i]]->post_integrate_respa(ilevel, iloop); } /* ---------------------------------------------------------------------- @@ -596,7 +580,7 @@ void Modify::post_integrate_respa(int ilevel, int iloop) void Modify::pre_force_respa(int vflag, int ilevel, int iloop) { for (int i = 0; i < n_pre_force_respa; i++) - fix[list_pre_force_respa[i]]->pre_force_respa(vflag,ilevel,iloop); + fix[list_pre_force_respa[i]]->pre_force_respa(vflag, ilevel, iloop); } /* ---------------------------------------------------------------------- @@ -606,7 +590,7 @@ void Modify::pre_force_respa(int vflag, int ilevel, int iloop) void Modify::post_force_respa(int vflag, int ilevel, int iloop) { for (int i = 0; i < n_post_force_respa; i++) - fix[list_post_force_respa[i]]->post_force_respa(vflag,ilevel,iloop); + fix[list_post_force_respa[i]]->post_force_respa(vflag, ilevel, iloop); } /* ---------------------------------------------------------------------- @@ -616,7 +600,7 @@ void Modify::post_force_respa(int vflag, int ilevel, int iloop) void Modify::final_integrate_respa(int ilevel, int iloop) { for (int i = 0; i < n_final_integrate_respa; i++) - fix[list_final_integrate_respa[i]]->final_integrate_respa(ilevel,iloop); + fix[list_final_integrate_respa[i]]->final_integrate_respa(ilevel, iloop); } /* ---------------------------------------------------------------------- @@ -625,8 +609,7 @@ void Modify::final_integrate_respa(int ilevel, int iloop) void Modify::min_pre_exchange() { - for (int i = 0; i < n_min_pre_exchange; i++) - fix[list_min_pre_exchange[i]]->min_pre_exchange(); + for (int i = 0; i < n_min_pre_exchange; i++) fix[list_min_pre_exchange[i]]->min_pre_exchange(); } /* ---------------------------------------------------------------------- @@ -635,8 +618,7 @@ void Modify::min_pre_exchange() void Modify::min_pre_neighbor() { - for (int i = 0; i < n_min_pre_neighbor; i++) - fix[list_min_pre_neighbor[i]]->min_pre_neighbor(); + for (int i = 0; i < n_min_pre_neighbor; i++) fix[list_min_pre_neighbor[i]]->min_pre_neighbor(); } /* ---------------------------------------------------------------------- @@ -645,8 +627,7 @@ void Modify::min_pre_neighbor() void Modify::min_post_neighbor() { - for (int i = 0; i < n_min_post_neighbor; i++) - fix[list_min_post_neighbor[i]]->min_post_neighbor(); + for (int i = 0; i < n_min_post_neighbor; i++) fix[list_min_post_neighbor[i]]->min_post_neighbor(); } /* ---------------------------------------------------------------------- @@ -655,8 +636,7 @@ void Modify::min_post_neighbor() void Modify::min_pre_force(int vflag) { - for (int i = 0; i < n_min_pre_force; i++) - fix[list_min_pre_force[i]]->min_pre_force(vflag); + for (int i = 0; i < n_min_pre_force; i++) fix[list_min_pre_force[i]]->min_pre_force(vflag); } /* ---------------------------------------------------------------------- @@ -666,7 +646,7 @@ void Modify::min_pre_force(int vflag) void Modify::min_pre_reverse(int eflag, int vflag) { for (int i = 0; i < n_min_pre_reverse; i++) - fix[list_min_pre_reverse[i]]->min_pre_reverse(eflag,vflag); + fix[list_min_pre_reverse[i]]->min_pre_reverse(eflag, vflag); } /* ---------------------------------------------------------------------- @@ -675,8 +655,7 @@ void Modify::min_pre_reverse(int eflag, int vflag) void Modify::min_post_force(int vflag) { - for (int i = 0; i < n_min_post_force; i++) - fix[list_min_post_force[i]]->min_post_force(vflag); + for (int i = 0; i < n_min_post_force; i++) fix[list_min_post_force[i]]->min_post_force(vflag); } /* ---------------------------------------------------------------------- @@ -686,7 +665,7 @@ void Modify::min_post_force(int vflag) double Modify::min_energy(double *fextra) { - int ifix,index; + int ifix, index; index = 0; double eng = 0.0; @@ -704,8 +683,7 @@ double Modify::min_energy(double *fextra) void Modify::min_store() { - for (int i = 0; i < n_min_energy; i++) - fix[list_min_energy[i]]->min_store(); + for (int i = 0; i < n_min_energy; i++) fix[list_min_energy[i]]->min_store(); } /* ---------------------------------------------------------------------- @@ -714,20 +692,17 @@ void Modify::min_store() void Modify::min_clearstore() { - for (int i = 0; i < n_min_energy; i++) - fix[list_min_energy[i]]->min_clearstore(); + for (int i = 0; i < n_min_energy; i++) fix[list_min_energy[i]]->min_clearstore(); } void Modify::min_pushstore() { - for (int i = 0; i < n_min_energy; i++) - fix[list_min_energy[i]]->min_pushstore(); + for (int i = 0; i < n_min_energy; i++) fix[list_min_energy[i]]->min_pushstore(); } void Modify::min_popstore() { - for (int i = 0; i < n_min_energy; i++) - fix[list_min_energy[i]]->min_popstore(); + for (int i = 0; i < n_min_energy; i++) fix[list_min_energy[i]]->min_popstore(); } /* ---------------------------------------------------------------------- @@ -736,12 +711,12 @@ void Modify::min_popstore() void Modify::min_step(double alpha, double *hextra) { - int ifix,index; + int ifix, index; index = 0; for (int i = 0; i < n_min_energy; i++) { ifix = list_min_energy[i]; - fix[ifix]->min_step(alpha,&hextra[index]); + fix[ifix]->min_step(alpha, &hextra[index]); index += fix[ifix]->min_dof(); } } @@ -752,14 +727,14 @@ void Modify::min_step(double alpha, double *hextra) double Modify::max_alpha(double *hextra) { - int ifix,index; + int ifix, index; double alpha = BIG; index = 0; for (int i = 0; i < n_min_energy; i++) { ifix = list_min_energy[i]; double alpha_one = fix[ifix]->max_alpha(&hextra[index]); - alpha = MIN(alpha,alpha_one); + alpha = MIN(alpha, alpha_one); index += fix[ifix]->min_dof(); } return alpha; @@ -772,8 +747,7 @@ double Modify::max_alpha(double *hextra) int Modify::min_dof() { int ndof = 0; - for (int i = 0; i < n_min_energy; i++) - ndof += fix[list_min_energy[i]]->min_dof(); + for (int i = 0; i < n_min_energy; i++) ndof += fix[list_min_energy[i]]->min_dof(); return ndof; } @@ -783,7 +757,7 @@ int Modify::min_dof() int Modify::min_reset_ref() { - int itmp,itmpall; + int itmp, itmpall; itmpall = 0; for (int i = 0; i < n_min_energy; i++) { itmp = fix[list_min_energy[i]]->min_reset_ref(); @@ -798,7 +772,7 @@ int Modify::min_reset_ref() Fix *Modify::add_fix(int narg, char **arg, int trysuffix) { - if (narg < 3) error->all(FLERR,"Illegal fix command"); + if (narg < 3) error->all(FLERR, "Illegal fix command"); // cannot define fix before box exists unless style is in exception list // don't like this way of checking for exceptions by adding fixes to list, @@ -807,21 +781,20 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) // since some fixes access domain settings in their constructor // nullptr must be last entry in this list - const char *exceptions[] = {"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx", - "deprecated", "STORE/KIM", nullptr}; + const char *exceptions[] = {"GPU", "OMP", "INTEL", "property/atom", "cmap", + "cmap3", "rx", "deprecated", "STORE/KIM", nullptr}; if (domain->box_exist == 0) { int m; for (m = 0; exceptions[m] != nullptr; m++) - if (strcmp(arg[2],exceptions[m]) == 0) break; - if (exceptions[m] == nullptr) - error->all(FLERR,"Fix command before simulation box is defined"); + if (strcmp(arg[2], exceptions[m]) == 0) break; + if (exceptions[m] == nullptr) error->all(FLERR, "Fix command before simulation box is defined"); } // check group ID int igroup = group->find(arg[1]); - if (igroup == -1) error->all(FLERR,"Could not find fix group ID {}", arg[1]); + if (igroup == -1) error->all(FLERR, "Could not find fix group ID {}", arg[1]); // if fix ID exists: // set newflag = 0 so create new fix in same location in fix list @@ -836,15 +809,15 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) // set newflag = 1 so create new fix // extend fix and fmask lists as necessary - int ifix,newflag; + int ifix, newflag; for (ifix = 0; ifix < nfix; ifix++) - if (strcmp(arg[0],fix[ifix]->id) == 0) break; + if (strcmp(arg[0], fix[ifix]->id) == 0) break; if (ifix < nfix) { newflag = 0; int match = 0; - if (strcmp(arg[2],fix[ifix]->style) == 0) match = 1; + if (strcmp(arg[2], fix[ifix]->style) == 0) match = 1; if (!match && trysuffix && lmp->suffix_enable) { if (lmp->suffix) { std::string estyle = arg[2] + std::string("/") + lmp->suffix; @@ -855,10 +828,10 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) if (estyle == fix[ifix]->style) match = 1; } } - if (!match) error->all(FLERR,"Replacing a fix, but new style != old style"); + if (!match) error->all(FLERR, "Replacing a fix, but new style != old style"); if (fix[ifix]->igroup != igroup && comm->me == 0) - error->warning(FLERR,"Replacing a fix, but new group != old group"); + error->warning(FLERR, "Replacing a fix, but new group != old group"); delete fix[ifix]; fix[ifix] = nullptr; @@ -866,8 +839,8 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) newflag = 1; if (nfix == maxfix) { maxfix += DELTA; - fix = (Fix **) memory->srealloc(fix,maxfix*sizeof(Fix *),"modify:fix"); - memory->grow(fmask,maxfix,"modify:fmask"); + fix = (Fix **) memory->srealloc(fix, maxfix * sizeof(Fix *), "modify:fix"); + memory->grow(fmask, maxfix, "modify:fmask"); } } @@ -881,7 +854,7 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) std::string estyle = arg[2] + std::string("/") + lmp->suffix; if (fix_map->find(estyle) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[estyle]; - fix[ifix] = fix_creator(lmp,narg,arg); + fix[ifix] = fix_creator(lmp, narg, arg); delete[] fix[ifix]->style; fix[ifix]->style = utils::strdup(estyle); } @@ -890,7 +863,7 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (fix_map->find(estyle) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[estyle]; - fix[ifix] = fix_creator(lmp,narg,arg); + fix[ifix] = fix_creator(lmp, narg, arg); delete[] fix[ifix]->style; fix[ifix]->style = utils::strdup(estyle); } @@ -899,17 +872,16 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) if (fix[ifix] == nullptr && fix_map->find(arg[2]) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[arg[2]]; - fix[ifix] = fix_creator(lmp,narg,arg); + fix[ifix] = fix_creator(lmp, narg, arg); } - if (fix[ifix] == nullptr) - error->all(FLERR,utils::check_packages_for_style("fix",arg[2],lmp)); + if (fix[ifix] == nullptr) error->all(FLERR, utils::check_packages_for_style("fix", arg[2], lmp)); // increment nfix and update fix_list vector (if new) if (newflag) { nfix++; - fix_list = std::vector(fix, fix+nfix); + fix_list = std::vector(fix, fix + nfix); } // post_constructor() can call virtual methods in parent or child @@ -924,31 +896,32 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) // if yes, pass state info to the Fix so it can reset itself for (int i = 0; i < nfix_restart_global; i++) - if (strcmp(id_restart_global[i],fix[ifix]->id) == 0 && - strcmp(style_restart_global[i],fix[ifix]->style) == 0) { + if (strcmp(id_restart_global[i], fix[ifix]->id) == 0 && + strcmp(style_restart_global[i], fix[ifix]->style) == 0) { fix[ifix]->restart(state_restart_global[i]); used_restart_global[i] = 1; fix[ifix]->restart_reset = 1; if (comm->me == 0) - utils::logmesg(lmp,"Resetting global fix info from restart file:\n" + utils::logmesg(lmp, + "Resetting global fix info from restart file:\n" " fix style: {}, fix ID: {}\n", - fix[ifix]->style,fix[ifix]->id); + fix[ifix]->style, fix[ifix]->id); } // check if Fix is in restart_peratom list // if yes, loop over atoms so they can extract info from atom->extra array for (int i = 0; i < nfix_restart_peratom; i++) - if (strcmp(id_restart_peratom[i],fix[ifix]->id) == 0 && - strcmp(style_restart_peratom[i],fix[ifix]->style) == 0) { + if (strcmp(id_restart_peratom[i], fix[ifix]->id) == 0 && + strcmp(style_restart_peratom[i], fix[ifix]->style) == 0) { used_restart_peratom[i] = 1; - for (int j = 0; j < atom->nlocal; j++) - fix[ifix]->unpack_restart(j,index_restart_peratom[i]); + for (int j = 0; j < atom->nlocal; j++) fix[ifix]->unpack_restart(j, index_restart_peratom[i]); fix[ifix]->restart_reset = 1; if (comm->me == 0) - utils::logmesg(lmp,"Resetting peratom fix info from restart file:\n" + utils::logmesg(lmp, + "Resetting peratom fix info from restart file:\n" " fix style: {}, fix ID: {}\n", - fix[ifix]->style,fix[ifix]->id); + fix[ifix]->style, fix[ifix]->id); } // set fix mask values @@ -969,10 +942,8 @@ Fix *Modify::add_fix(const std::string &fixcmd, int trysuffix) auto args = utils::split_words(fixcmd); std::vector newarg(args.size()); int i = 0; - for (const auto &arg : args) { - newarg[i++] = (char *)arg.c_str(); - } - return add_fix(args.size(),newarg.data(),trysuffix); + for (const auto &arg : args) { newarg[i++] = (char *) arg.c_str(); } + return add_fix(args.size(), newarg.data(), trysuffix); } /* ---------------------------------------------------------------------- @@ -985,19 +956,19 @@ Fix *Modify::add_fix(const std::string &fixcmd, int trysuffix) Fix *Modify::replace_fix(const char *replaceID, int narg, char **arg, int trysuffix) { auto oldfix = get_fix_by_id(replaceID); - if (!oldfix) error->all(FLERR,"Modify replace_fix ID {} could not be found", replaceID); + if (!oldfix) error->all(FLERR, "Modify replace_fix ID {} could not be found", replaceID); // change ID, igroup, style of fix being replaced to match new fix // requires some error checking on arguments for new fix - if (narg < 3) error->all(FLERR,"Illegal replace_fix invocation"); - if (get_fix_by_id(arg[0])) error->all(FLERR,"Replace_fix ID {} is already in use",arg[0]); + if (narg < 3) error->all(FLERR, "Illegal replace_fix invocation"); + if (get_fix_by_id(arg[0])) error->all(FLERR, "Replace_fix ID {} is already in use", arg[0]); delete[] oldfix->id; oldfix->id = utils::strdup(arg[0]); int jgroup = group->find(arg[1]); - if (jgroup == -1) error->all(FLERR,"Could not find replace_fix group ID {}", arg[1]); + if (jgroup == -1) error->all(FLERR, "Could not find replace_fix group ID {}", arg[1]); oldfix->igroup = jgroup; delete[] oldfix->style; @@ -1006,7 +977,7 @@ Fix *Modify::replace_fix(const char *replaceID, int narg, char **arg, int trysuf // invoke add_fix // it will find and overwrite the replaceID fix - return add_fix(narg,arg,trysuffix); + return add_fix(narg, arg, trysuffix); } /* ---------------------------------------------------------------------- @@ -1018,20 +989,8 @@ Fix *Modify::replace_fix(const std::string &oldfix, const std::string &fixcmd, i auto args = utils::split_words(fixcmd); std::vector newarg(args.size()); int i = 0; - for (const auto &arg : args) { - newarg[i++] = (char *)arg.c_str(); - } - return replace_fix(oldfix.c_str(),args.size(),newarg.data(),trysuffix); -} - -/* ---------------------------------------------------------------------- - one instance per fix in style_fix.h -------------------------------------------------------------------------- */ - -template -Fix *Modify::fix_creator(LAMMPS *lmp, int narg, char **arg) -{ - return new T(lmp,narg,arg); + for (const auto &arg : args) { newarg[i++] = (char *) arg.c_str(); } + return replace_fix(oldfix.c_str(), args.size(), newarg.data(), trysuffix); } /* ---------------------------------------------------------------------- @@ -1040,16 +999,16 @@ Fix *Modify::fix_creator(LAMMPS *lmp, int narg, char **arg) void Modify::modify_fix(int narg, char **arg) { - if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + if (narg < 2) error->all(FLERR, "Illegal fix_modify command"); // lookup Fix ID int ifix; for (ifix = 0; ifix < nfix; ifix++) - if (strcmp(arg[0],fix[ifix]->id) == 0) break; - if (ifix == nfix) error->all(FLERR,"Could not find fix_modify ID {}", arg[0]); + if (strcmp(arg[0], fix[ifix]->id) == 0) break; + if (ifix == nfix) error->all(FLERR, "Could not find fix_modify ID {}", arg[0]); - fix[ifix]->modify_params(narg-1,&arg[1]); + fix[ifix]->modify_params(narg - 1, &arg[1]); } /* ---------------------------------------------------------------------- @@ -1060,7 +1019,7 @@ void Modify::modify_fix(int narg, char **arg) void Modify::delete_fix(const std::string &id) { int ifix = find_fix(id); - if (ifix < 0) error->all(FLERR,"Could not find fix ID {} to delete", id); + if (ifix < 0) error->all(FLERR, "Could not find fix ID {} to delete", id); delete_fix(ifix); } @@ -1073,10 +1032,10 @@ void Modify::delete_fix(int ifix) delete fix[ifix]; atom->update_callback(ifix); - for (int i = ifix+1; i < nfix; i++) fix[i-1] = fix[i]; - for (int i = ifix+1; i < nfix; i++) fmask[i-1] = fmask[i]; + for (int i = ifix + 1; i < nfix; i++) fix[i - 1] = fix[i]; + for (int i = ifix + 1; i < nfix; i++) fmask[i - 1] = fmask[i]; nfix--; - fix_list = std::vector(fix, fix+nfix); + fix_list = std::vector(fix, fix + nfix); } /* ---------------------------------------------------------------------- @@ -1116,7 +1075,7 @@ const std::vector Modify::get_fix_by_style(const std::string &style) cons if (style.empty()) return matches; for (int ifix = 0; ifix < nfix; ifix++) - if (utils::strmatch(fix[ifix]->style,style)) matches.push_back(fix[ifix]); + if (utils::strmatch(fix[ifix]->style, style)) matches.push_back(fix[ifix]); return matches; } @@ -1127,7 +1086,7 @@ const std::vector Modify::get_fix_by_style(const std::string &style) cons const std::vector &Modify::get_fix_list() { - fix_list = std::vector(fix, fix+nfix); + fix_list = std::vector(fix, fix + nfix); return fix_list; } @@ -1151,23 +1110,23 @@ int Modify::check_package(const char *package_fix_name) int Modify::check_rigid_group_overlap(int groupbit) { - const int * const mask = atom->mask; + const int *const mask = atom->mask; const int nlocal = atom->nlocal; int dim; int n = 0; for (int ifix = 0; ifix < nfix; ifix++) { - if (utils::strmatch(fix[ifix]->style,"^rigid")) { - const int * const body = (const int *)fix[ifix]->extract("body",dim); + if (utils::strmatch(fix[ifix]->style, "^rigid")) { + const int *const body = (const int *) fix[ifix]->extract("body", dim); if ((body == nullptr) || (dim != 1)) break; - for (int i=0; (i < nlocal) && (n == 0); ++i) + for (int i = 0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0)) ++n; } } int n_all = 0; - MPI_Allreduce(&n,&n_all,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&n, &n_all, 1, MPI_INT, MPI_SUM, world); if (n_all > 0) return 1; return 0; @@ -1181,26 +1140,25 @@ int Modify::check_rigid_group_overlap(int groupbit) int Modify::check_rigid_region_overlap(int groupbit, Region *reg) { - const int * const mask = atom->mask; - const double * const * const x = atom->x; + const int *const mask = atom->mask; + const double *const *const x = atom->x; const int nlocal = atom->nlocal; int dim; int n = 0; reg->prematch(); for (int ifix = 0; ifix < nfix; ifix++) { - if (strncmp("rigid",fix[ifix]->style,5) == 0) { - const int * const body = (const int *)fix[ifix]->extract("body",dim); + if (strncmp("rigid", fix[ifix]->style, 5) == 0) { + const int *const body = (const int *) fix[ifix]->extract("body", dim); if ((body == nullptr) || (dim != 1)) break; - for (int i=0; (i < nlocal) && (n == 0); ++i) - if ((mask[i] & groupbit) && (body[i] >= 0) - && reg->match(x[i][0],x[i][1],x[i][2])) ++n; + for (int i = 0; (i < nlocal) && (n == 0); ++i) + if ((mask[i] & groupbit) && (body[i] >= 0) && reg->match(x[i][0], x[i][1], x[i][2])) ++n; } } int n_all = 0; - MPI_Allreduce(&n,&n_all,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&n, &n_all, 1, MPI_INT, MPI_SUM, world); if (n_all > 0) return 1; return 0; @@ -1219,17 +1177,17 @@ int Modify::check_rigid_list_overlap(int *select) int n = 0; for (int ifix = 0; ifix < nfix; ifix++) { - if (utils::strmatch(fix[ifix]->style,"^rigid")) { - const int * const body = (const int *)fix[ifix]->extract("body",dim); + if (utils::strmatch(fix[ifix]->style, "^rigid")) { + const int *const body = (const int *) fix[ifix]->extract("body", dim); if ((body == nullptr) || (dim != 1)) break; - for (int i=0; (i < nlocal) && (n == 0); ++i) + for (int i = 0; (i < nlocal) && (n == 0); ++i) if ((body[i] >= 0) && select[i]) ++n; } } int n_all = 0; - MPI_Allreduce(&n,&n_all,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&n, &n_all, 1, MPI_INT, MPI_SUM, world); if (n_all > 0) return 1; return 0; @@ -1241,19 +1199,20 @@ int Modify::check_rigid_list_overlap(int *select) Compute *Modify::add_compute(int narg, char **arg, int trysuffix) { - if (narg < 3) error->all(FLERR,"Illegal compute command"); + if (narg < 3) error->all(FLERR, "Illegal compute command"); // error check for (int icompute = 0; icompute < ncompute; icompute++) - if (strcmp(arg[0],compute[icompute]->id) == 0) - error->all(FLERR,"Reuse of compute ID '{}'",arg[0]); + if (strcmp(arg[0], compute[icompute]->id) == 0) + error->all(FLERR, "Reuse of compute ID '{}'", arg[0]); // extend Compute list if necessary if (ncompute == maxcompute) { maxcompute += DELTA; - compute = (Compute **) memory->srealloc(compute,maxcompute*sizeof(Compute *),"modify:compute"); + compute = + (Compute **) memory->srealloc(compute, maxcompute * sizeof(Compute *), "modify:compute"); } // create the Compute @@ -1266,7 +1225,7 @@ Compute *Modify::add_compute(int narg, char **arg, int trysuffix) std::string estyle = arg[2] + std::string("/") + lmp->suffix; if (compute_map->find(estyle) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[estyle]; - compute[ncompute] = compute_creator(lmp,narg,arg); + compute[ncompute] = compute_creator(lmp, narg, arg); delete[] compute[ncompute]->style; compute[ncompute]->style = utils::strdup(estyle); } @@ -1275,23 +1234,22 @@ Compute *Modify::add_compute(int narg, char **arg, int trysuffix) std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (compute_map->find(estyle) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[estyle]; - compute[ncompute] = compute_creator(lmp,narg,arg); + compute[ncompute] = compute_creator(lmp, narg, arg); delete[] compute[ncompute]->style; compute[ncompute]->style = utils::strdup(estyle); } } } - if (compute[ncompute] == nullptr && - compute_map->find(arg[2]) != compute_map->end()) { + if (compute[ncompute] == nullptr && compute_map->find(arg[2]) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[arg[2]]; - compute[ncompute] = compute_creator(lmp,narg,arg); + compute[ncompute] = compute_creator(lmp, narg, arg); } if (compute[ncompute] == nullptr) - error->all(FLERR,utils::check_packages_for_style("compute",arg[2],lmp)); + error->all(FLERR, utils::check_packages_for_style("compute", arg[2], lmp)); - compute_list = std::vector(compute, compute+ncompute+1); + compute_list = std::vector(compute, compute + ncompute + 1); return compute[ncompute++]; } @@ -1302,23 +1260,10 @@ Compute *Modify::add_compute(int narg, char **arg, int trysuffix) Compute *Modify::add_compute(const std::string &computecmd, int trysuffix) { auto args = utils::split_words(computecmd); - std::vectornewarg(args.size()); - int i=0; - for (const auto &arg : args) { - newarg[i++] = (char *)arg.c_str(); - } - return add_compute(args.size(),newarg.data(),trysuffix); -} - - -/* ---------------------------------------------------------------------- - one instance per compute in style_compute.h -------------------------------------------------------------------------- */ - -template -Compute *Modify::compute_creator(LAMMPS *lmp, int narg, char **arg) -{ - return new T(lmp,narg,arg); + std::vector newarg(args.size()); + int i = 0; + for (const auto &arg : args) { newarg[i++] = (char *) arg.c_str(); } + return add_compute(args.size(), newarg.data(), trysuffix); } /* ---------------------------------------------------------------------- @@ -1327,17 +1272,16 @@ Compute *Modify::compute_creator(LAMMPS *lmp, int narg, char **arg) void Modify::modify_compute(int narg, char **arg) { - if (narg < 2) error->all(FLERR,"Illegal compute_modify command"); + if (narg < 2) error->all(FLERR, "Illegal compute_modify command"); // lookup Compute ID int icompute; for (icompute = 0; icompute < ncompute; icompute++) - if (strcmp(arg[0],compute[icompute]->id) == 0) break; - if (icompute == ncompute) - error->all(FLERR,"Could not find compute_modify ID {}", arg[0]); + if (strcmp(arg[0], compute[icompute]->id) == 0) break; + if (icompute == ncompute) error->all(FLERR, "Could not find compute_modify ID {}", arg[0]); - compute[icompute]->modify_params(narg-1,&arg[1]); + compute[icompute]->modify_params(narg - 1, &arg[1]); } /* ---------------------------------------------------------------------- @@ -1347,7 +1291,7 @@ void Modify::modify_compute(int narg, char **arg) void Modify::delete_compute(const std::string &id) { int icompute = find_compute(id); - if (icompute < 0) error->all(FLERR,"Could not find compute ID {} to delete", id); + if (icompute < 0) error->all(FLERR, "Could not find compute ID {} to delete", id); delete_compute(icompute); } @@ -1358,9 +1302,9 @@ void Modify::delete_compute(int icompute) // delete and move other Computes down in list one slot delete compute[icompute]; - for (int i = icompute+1; i < ncompute; i++) compute[i-1] = compute[i]; + for (int i = icompute + 1; i < ncompute; i++) compute[i - 1] = compute[i]; ncompute--; - compute_list = std::vector(compute, compute+ncompute); + compute_list = std::vector(compute, compute + ncompute); } /* ---------------------------------------------------------------------- @@ -1400,7 +1344,7 @@ const std::vector Modify::get_compute_by_style(const std::string &sty if (style.empty()) return matches; for (int icompute = 0; icompute < ncompute; icompute++) - if (utils::strmatch(compute[icompute]->style,style)) matches.push_back(compute[icompute]); + if (utils::strmatch(compute[icompute]->style, style)) matches.push_back(compute[icompute]); return matches; } @@ -1411,7 +1355,7 @@ const std::vector Modify::get_compute_by_style(const std::string &sty const std::vector &Modify::get_compute_list() { - compute_list = std::vector(compute, compute+ncompute); + compute_list = std::vector(compute, compute + ncompute); return compute_list; } @@ -1440,8 +1384,8 @@ void Modify::addstep_compute(bigint newstep) // initialized, thus defer to addstep_compute_all() instead if (n_timeflag < 0) { - addstep_compute_all(newstep); - return; + addstep_compute_all(newstep); + return; } for (int icompute = 0; icompute < n_timeflag; icompute++) @@ -1476,18 +1420,18 @@ void Modify::write_restart(FILE *fp) for (int i = 0; i < nfix; i++) if (fix[i]->restart_global) count++; - if (me == 0) fwrite(&count,sizeof(int),1,fp); + if (me == 0) fwrite(&count, sizeof(int), 1, fp); int n; for (int i = 0; i < nfix; i++) if (fix[i]->restart_global) { if (me == 0) { n = strlen(fix[i]->id) + 1; - fwrite(&n,sizeof(int),1,fp); - fwrite(fix[i]->id,sizeof(char),n,fp); + fwrite(&n, sizeof(int), 1, fp); + fwrite(fix[i]->id, sizeof(char), n, fp); n = strlen(fix[i]->style) + 1; - fwrite(&n,sizeof(int),1,fp); - fwrite(fix[i]->style,sizeof(char),n,fp); + fwrite(&n, sizeof(int), 1, fp); + fwrite(fix[i]->style, sizeof(char), n, fp); } fix[i]->write_restart(fp); } @@ -1496,19 +1440,19 @@ void Modify::write_restart(FILE *fp) for (int i = 0; i < nfix; i++) if (fix[i]->restart_peratom) count++; - if (me == 0) fwrite(&count,sizeof(int),1,fp); + if (me == 0) fwrite(&count, sizeof(int), 1, fp); for (int i = 0; i < nfix; i++) if (fix[i]->restart_peratom) { int maxsize_restart = fix[i]->maxsize_restart(); if (me == 0) { n = strlen(fix[i]->id) + 1; - fwrite(&n,sizeof(int),1,fp); - fwrite(fix[i]->id,sizeof(char),n,fp); + fwrite(&n, sizeof(int), 1, fp); + fwrite(fix[i]->id, sizeof(char), n, fp); n = strlen(fix[i]->style) + 1; - fwrite(&n,sizeof(int),1,fp); - fwrite(fix[i]->style,sizeof(char),n,fp); - fwrite(&maxsize_restart,sizeof(int),1,fp); + fwrite(&n, sizeof(int), 1, fp); + fwrite(fix[i]->style, sizeof(char), n, fp); + fwrite(&maxsize_restart, sizeof(int), 1, fp); } } } @@ -1525,15 +1469,15 @@ int Modify::read_restart(FILE *fp) // nfix_restart_global = # of restart entries with global state info int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&nfix_restart_global,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &nfix_restart_global, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&nfix_restart_global, 1, MPI_INT, 0, world); // allocate space for each entry if (nfix_restart_global) { - id_restart_global = new char*[nfix_restart_global]; - style_restart_global = new char*[nfix_restart_global]; - state_restart_global = new char*[nfix_restart_global]; + id_restart_global = new char *[nfix_restart_global]; + style_restart_global = new char *[nfix_restart_global]; + state_restart_global = new char *[nfix_restart_global]; used_restart_global = new int[nfix_restart_global]; } @@ -1542,23 +1486,23 @@ int Modify::read_restart(FILE *fp) int n; for (int i = 0; i < nfix_restart_global; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&n,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&n, 1, MPI_INT, 0, world); id_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,nullptr,error); - MPI_Bcast(id_restart_global[i],n,MPI_CHAR,0,world); + if (me == 0) utils::sfread(FLERR, id_restart_global[i], sizeof(char), n, fp, nullptr, error); + MPI_Bcast(id_restart_global[i], n, MPI_CHAR, 0, world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&n,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&n, 1, MPI_INT, 0, world); style_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,nullptr,error); - MPI_Bcast(style_restart_global[i],n,MPI_CHAR,0,world); + if (me == 0) utils::sfread(FLERR, style_restart_global[i], sizeof(char), n, fp, nullptr, error); + MPI_Bcast(style_restart_global[i], n, MPI_CHAR, 0, world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&n,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&n, 1, MPI_INT, 0, world); state_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,nullptr,error); - MPI_Bcast(state_restart_global[i],n,MPI_CHAR,0,world); + if (me == 0) utils::sfread(FLERR, state_restart_global[i], sizeof(char), n, fp, nullptr, error); + MPI_Bcast(state_restart_global[i], n, MPI_CHAR, 0, world); used_restart_global[i] = 0; } @@ -1567,14 +1511,14 @@ int Modify::read_restart(FILE *fp) int maxsize = 0; - if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&nfix_restart_peratom,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &nfix_restart_peratom, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&nfix_restart_peratom, 1, MPI_INT, 0, world); // allocate space for each entry if (nfix_restart_peratom) { - id_restart_peratom = new char*[nfix_restart_peratom]; - style_restart_peratom = new char*[nfix_restart_peratom]; + id_restart_peratom = new char *[nfix_restart_peratom]; + style_restart_peratom = new char *[nfix_restart_peratom]; index_restart_peratom = new int[nfix_restart_peratom]; used_restart_peratom = new int[nfix_restart_peratom]; } @@ -1584,20 +1528,21 @@ int Modify::read_restart(FILE *fp) // set index = which set of extra data this fix represents for (int i = 0; i < nfix_restart_peratom; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&n,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&n, 1, MPI_INT, 0, world); id_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,nullptr,error); - MPI_Bcast(id_restart_peratom[i],n,MPI_CHAR,0,world); + if (me == 0) utils::sfread(FLERR, id_restart_peratom[i], sizeof(char), n, fp, nullptr, error); + MPI_Bcast(id_restart_peratom[i], n, MPI_CHAR, 0, world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&n,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&n, 1, MPI_INT, 0, world); style_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,nullptr,error); - MPI_Bcast(style_restart_peratom[i],n,MPI_CHAR,0,world); + if (me == 0) + utils::sfread(FLERR, style_restart_peratom[i], sizeof(char), n, fp, nullptr, error); + MPI_Bcast(style_restart_peratom[i], n, MPI_CHAR, 0, world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&n,1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&n, 1, MPI_INT, 0, world); maxsize += n; index_restart_peratom[i] = i; @@ -1620,26 +1565,26 @@ void Modify::restart_deallocate(int flag) for (i = 0; i < nfix_restart_global; i++) if (used_restart_global[i] == 0) break; if (i == nfix_restart_global) { - utils::logmesg(lmp,"All restart file global fix info was re-assigned\n"); + utils::logmesg(lmp, "All restart file global fix info was re-assigned\n"); } else { - utils::logmesg(lmp,"Unused restart file global fix info:\n"); + utils::logmesg(lmp, "Unused restart file global fix info:\n"); for (i = 0; i < nfix_restart_global; i++) { if (used_restart_global[i]) continue; - utils::logmesg(lmp," fix style: {}, fix ID: {}\n", - style_restart_global[i],id_restart_global[i]); + utils::logmesg(lmp, " fix style: {}, fix ID: {}\n", style_restart_global[i], + id_restart_global[i]); } } } for (int i = 0; i < nfix_restart_global; i++) { - delete [] id_restart_global[i]; - delete [] style_restart_global[i]; - delete [] state_restart_global[i]; + delete[] id_restart_global[i]; + delete[] style_restart_global[i]; + delete[] state_restart_global[i]; } - delete [] id_restart_global; - delete [] style_restart_global; - delete [] state_restart_global; - delete [] used_restart_global; + delete[] id_restart_global; + delete[] style_restart_global; + delete[] state_restart_global; + delete[] used_restart_global; } if (nfix_restart_peratom) { @@ -1648,25 +1593,25 @@ void Modify::restart_deallocate(int flag) for (i = 0; i < nfix_restart_peratom; i++) if (used_restart_peratom[i] == 0) break; if (i == nfix_restart_peratom) { - utils::logmesg(lmp,"All restart file peratom fix info was re-assigned\n"); + utils::logmesg(lmp, "All restart file peratom fix info was re-assigned\n"); } else { - utils::logmesg(lmp,"Unused restart file peratom fix info:\n"); + utils::logmesg(lmp, "Unused restart file peratom fix info:\n"); for (i = 0; i < nfix_restart_peratom; i++) { if (used_restart_peratom[i]) continue; - utils::logmesg(lmp," fix style: {}, fix ID: {}\n", - style_restart_peratom[i],id_restart_peratom[i]); + utils::logmesg(lmp, " fix style: {}, fix ID: {}\n", style_restart_peratom[i], + id_restart_peratom[i]); } } } for (int i = 0; i < nfix_restart_peratom; i++) { - delete [] id_restart_peratom[i]; - delete [] style_restart_peratom[i]; + delete[] id_restart_peratom[i]; + delete[] style_restart_peratom[i]; } - delete [] id_restart_peratom; - delete [] style_restart_peratom; - delete [] index_restart_peratom; - delete [] used_restart_peratom; + delete[] id_restart_peratom; + delete[] style_restart_peratom; + delete[] index_restart_peratom; + delete[] used_restart_peratom; } nfix_restart_global = nfix_restart_peratom = 0; @@ -1678,14 +1623,16 @@ void Modify::restart_deallocate(int flag) void Modify::list_init(int mask, int &n, int *&list) { - delete [] list; + delete[] list; n = 0; - for (int i = 0; i < nfix; i++) if (fmask[i] & mask) n++; + for (int i = 0; i < nfix; i++) + if (fmask[i] & mask) n++; list = new int[n]; n = 0; - for (int i = 0; i < nfix; i++) if (fmask[i] & mask) list[n++] = i; + for (int i = 0; i < nfix; i++) + if (fmask[i] & mask) list[n++] = i; } /* ---------------------------------------------------------------------- @@ -1695,11 +1642,12 @@ void Modify::list_init(int mask, int &n, int *&list) void Modify::list_init_end_of_step(int mask, int &n, int *&list) { - delete [] list; - delete [] end_of_step_every; + delete[] list; + delete[] end_of_step_every; n = 0; - for (int i = 0; i < nfix; i++) if (fmask[i] & mask) n++; + for (int i = 0; i < nfix; i++) + if (fmask[i] & mask) n++; list = new int[n]; end_of_step_every = new int[n]; @@ -1718,7 +1666,7 @@ void Modify::list_init_end_of_step(int mask, int &n, int *&list) void Modify::list_init_energy_couple(int &n, int *&list) { - delete [] list; + delete[] list; n = 0; for (int i = 0; i < nfix; i++) @@ -1737,7 +1685,7 @@ void Modify::list_init_energy_couple(int &n, int *&list) void Modify::list_init_energy_global(int &n, int *&list) { - delete [] list; + delete[] list; n = 0; for (int i = 0; i < nfix; i++) @@ -1756,7 +1704,7 @@ void Modify::list_init_energy_global(int &n, int *&list) void Modify::list_init_energy_atom(int &n, int *&list) { - delete [] list; + delete[] list; n = 0; for (int i = 0; i < nfix; i++) @@ -1774,7 +1722,7 @@ void Modify::list_init_energy_atom(int &n, int *&list) void Modify::list_init_compute() { - delete [] list_timeflag; + delete[] list_timeflag; n_timeflag = 0; for (int i = 0; i < ncompute; i++) @@ -1793,9 +1741,7 @@ void Modify::list_init_compute() double Modify::memory_usage() { double bytes = 0; - for (int i = 0; i < nfix; i++) - bytes += fix[i]->memory_usage(); - for (int i = 0; i < ncompute; i++) - bytes += compute[i]->memory_usage(); + for (int i = 0; i < nfix; i++) bytes += fix[i]->memory_usage(); + for (int i = 0; i < ncompute; i++) bytes += compute[i]->memory_usage(); return bytes; } diff --git a/src/modify.h b/src/modify.h index c4f8c2ef02..df8e52752f 100644 --- a/src/modify.h +++ b/src/modify.h @@ -53,7 +53,7 @@ class Modify : protected Pointers { Compute **compute; // list of computes Modify(class LAMMPS *); - virtual ~Modify(); + ~Modify() override; virtual void init(); virtual void setup(int); virtual void setup_pre_exchange(); @@ -201,8 +201,6 @@ class Modify : protected Pointers { protected: void create_factories(); - template static Compute *compute_creator(LAMMPS *, int, char **); - template static Fix *fix_creator(LAMMPS *, int, char **); }; } // namespace LAMMPS_NS diff --git a/src/molecule.cpp b/src/molecule.cpp index 40ca218ecc..d6c839dfc4 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -57,8 +57,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : id = utils::strdup(arg[0]); if (!utils::is_id(id)) - error->all(FLERR,"Molecule template ID must have only " - "alphanumeric or underscore characters"); + error->all(FLERR,"Molecule template ID must have only alphanumeric or underscore characters"); // parse args until reach unknown arg (next file) @@ -130,8 +129,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : if (me == 0) { fp = fopen(arg[ifile],"r"); if (fp == nullptr) - error->one(FLERR,"Cannot open molecule file {}: {}", - arg[ifile], utils::getsyserror()); + error->one(FLERR,"Cannot open molecule file {}: {}",arg[ifile], utils::getsyserror()); } read(0); if (me == 0) fclose(fp); @@ -496,8 +494,7 @@ void Molecule::read(int flag) if (nmatch != nwant) error->one(FLERR,"Invalid header line format in molecule file"); } catch (TokenizerException &e) { - error->one(FLERR, "Invalid header in molecule file\n" - "{}", e.what()); + error->one(FLERR,"Invalid header in molecule file: {}", e.what()); } } @@ -618,11 +615,9 @@ void Molecule::read(int flag) // Error: Either a too long/short section or a typo in the keyword if (utils::strmatch(keyword,"^[A-Za-z ]+$")) - error->one(FLERR,"Unknown section '{}' in molecule " - "file\n",keyword); + error->one(FLERR,"Unknown section '{}' in molecule file\n",keyword); else error->one(FLERR,"Unexpected line in molecule file " - "while looking for the next " - "section:\n{}",line); + "while looking for the next section:\n{}",line); } keyword = parse_keyword(1,line); } @@ -648,8 +643,7 @@ void Molecule::read(int flag) if (bondflag && specialflag == 0) { if (domain->box_exist == 0) - error->all(FLERR,"Cannot auto-generate special bonds before " - "simulation box is defined"); + error->all(FLERR,"Cannot auto-generate special bonds before simulation box is defined"); if (flag) { special_generate(); @@ -691,8 +685,7 @@ void Molecule::coords(char *line) ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 4) - error->all(FLERR,"Invalid line in Coords section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Coords section of molecule file: {}",line); int iatom = values.next_int() - 1; if (iatom < 0 || iatom >= natoms) @@ -707,19 +700,16 @@ void Molecule::coords(char *line) x[iatom][2] *= sizescale; } } catch (TokenizerException &e) { - error->all(FLERR,"Invalid line in Coords section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Coords section of molecule file: {}\n{}",e.what(),line); } for (int i = 0; i < natoms; i++) - if (count[i] == 0) error->all(FLERR,"Atom {} missing in Coords " - "section of molecule file",i+1); + if (count[i] == 0) error->all(FLERR,"Atom {} missing in Coords section of molecule file",i+1); if (domain->dimension == 2) { for (int i = 0; i < natoms; i++) if (x[i][2] != 0.0) - error->all(FLERR,"Z coord in molecule file for atom {} " - "must be 0.0 for 2d-simulation.",i+1); + error->all(FLERR,"Z coord in molecule file for atom {} must be 0.0 for 2d-simulation",i+1); } } @@ -737,8 +727,7 @@ void Molecule::types(char *line) ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 2) - error->all(FLERR,"Invalid line in Types section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Types section of molecule file: {}",line); int iatom = values.next_int() - 1; if (iatom < 0 || iatom >= natoms) @@ -748,17 +737,14 @@ void Molecule::types(char *line) type[iatom] += toffset; } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Types section of " - "molecule file: {}\n{}", e.what(),line); + error->all(FLERR,"Invalid line in Types section of molecule file: {}\n{}",e.what(),line); } for (int i = 0; i < natoms; i++) { - if (count[i] == 0) error->all(FLERR,"Atom {} missing in Types " - "section of molecule file",i+1); + if (count[i] == 0) error->all(FLERR,"Atom {} missing in Types section of molecule file",i+1); if ((type[i] <= 0) || (domain->box_exist && (type[i] > atom->ntypes))) - error->all(FLERR,"Invalid atom type {} for atom {} " - "in molecule file",type[i],i+1); + error->all(FLERR,"Invalid atom type {} for atom {} in molecule file",type[i],i+1); ntypes = MAX(ntypes,type[i]); } @@ -777,8 +763,7 @@ void Molecule::molecules(char *line) readline(line); ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 2) - error->all(FLERR,"Invalid line in Molecules section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Molecules section of molecule file: {}",line); int iatom = values.next_int() - 1; if (iatom < 0 || iatom >= natoms) @@ -788,19 +773,17 @@ void Molecule::molecules(char *line) // molecule[iatom] += moffset; // placeholder for possible molecule offset } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Molecules section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Molecules section of molecule file: {}\n{}",e.what(),line); } - for (int i = 0; i < natoms; i++) - if (count[i] == 0) error->all(FLERR,"Atom {} missing in Molecules " - "section of molecule file",i+1); - - for (int i = 0; i < natoms; i++) + for (int i = 0; i < natoms; i++) { + if (count[i] == 0) + error->all(FLERR,"Atom {} missing in Molecules section of molecule file",i+1); + } + for (int i = 0; i < natoms; i++) { if (molecule[i] < 0) - error->all(FLERR,"Invalid molecule ID {} for atom {} " - "in molecule file",molecule[i],i+1); - + error->all(FLERR,"Invalid molecule ID {} for atom {} in molecule file",molecule[i],i+1); + } for (int i = 0; i < natoms; i++) nmolecules = MAX(nmolecules,molecule[i]); } @@ -818,23 +801,21 @@ void Molecule::fragments(char *line) ValueTokenizer values(utils::trim_comment(line)); if ((int)values.count() > natoms+1) - error->all(FLERR,"Too many atoms per fragment in Fragments " - "section of molecule file"); + error->all(FLERR,"Too many atoms per fragment in Fragments section of molecule file"); fragmentnames[i] = values.next_string(); while (values.has_next()) { int iatom = values.next_int()-1; if (iatom < 0 || iatom >= natoms) - error->all(FLERR,"Invalid atom ID {} for fragment {} in " - "Fragments section of molecule file", - iatom+1, fragmentnames[i]); + error->all(FLERR,"Invalid atom ID {} for fragment {} in Fragments section of " + "molecule file", iatom+1, fragmentnames[i]); fragmentmask[i][iatom] = 1; } } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid atom ID in Fragments section of " - "molecule file: {}\n{}", e.what(),line); + error->all(FLERR,"Invalid atom ID in Fragments section of " + "molecule file: {}\n{}", e.what(),line); } } @@ -851,8 +832,7 @@ void Molecule::charges(char *line) ValueTokenizer values(utils::trim_comment(line)); if ((int)values.count() != 2) - error->all(FLERR,"Invalid line in Charges section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Charges section of molecule file: {}",line); int iatom = values.next_int() - 1; if (iatom < 0 || iatom >= natoms) @@ -862,13 +842,13 @@ void Molecule::charges(char *line) q[iatom] = values.next_double(); } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Charges section of " - "molecule file: {}.\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Charges section of molecule file: {}\n{}",e.what(),line); } - for (int i = 0; i < natoms; i++) - if (count[i] == 0) error->all(FLERR,"Atom {} missing in Charges " - "section of molecule file",i+1); + for (int i = 0; i < natoms; i++) { + if (count[i] == 0) + error->all(FLERR,"Atom {} missing in Charges section of molecule file",i+1); + } } /* ---------------------------------------------------------------------- @@ -885,8 +865,7 @@ void Molecule::diameters(char *line) ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 2) - error->all(FLERR,"Invalid line in Diameters section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Diameters section of molecule file: {}",line); int iatom = values.next_int() - 1; if (iatom < 0 || iatom >= natoms) error->all(FLERR,"Invalid atom index in Diameters section of molecule file"); @@ -897,16 +876,14 @@ void Molecule::diameters(char *line) maxradius = MAX(maxradius,radius[iatom]); } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Diameters section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Diameters section of molecule file: {}\n{}",e.what(),line); } for (int i = 0; i < natoms; i++) { - if (count[i] == 0) error->all(FLERR,"Atom {} missing in Diameters " - "section of molecule file",i+1); + if (count[i] == 0) + error->all(FLERR,"Atom {} missing in Diameters section of molecule file",i+1); if (radius[i] < 0.0) - error->all(FLERR,"Invalid atom diameter {} for atom {} " - "in molecule file", radius[i], i+1); + error->all(FLERR,"Invalid atom diameter {} for atom {} in molecule file", radius[i], i+1); } } @@ -923,8 +900,7 @@ void Molecule::masses(char *line) ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 2) - error->all(FLERR,"Invalid line in Masses section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Masses section of molecule file: {}",line); int iatom = values.next_int() - 1; if (iatom < 0 || iatom >= natoms) @@ -934,8 +910,7 @@ void Molecule::masses(char *line) rmass[iatom] *= sizescale*sizescale*sizescale; } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Masses section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Masses section of molecule file: {}\n{}",e.what(),line); } for (int i = 0; i < natoms; i++) { @@ -972,15 +947,13 @@ void Molecule::bonds(int flag, char *line) try { ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 4) - error->all(FLERR,"Invalid line in Bonds section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Bonds section of molecule file: {}",line); values.next_int(); itype = values.next_int(); atom1 = values.next_tagint(); atom2 = values.next_tagint(); } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Bonds section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Bonds section of molecule file: {}\n{}",e.what(),line); } itype += boffset; @@ -1042,16 +1015,14 @@ void Molecule::angles(int flag, char *line) try { ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 5) - error->all(FLERR,"Invalid line in Angles section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Angles section of molecule file: {}",line); values.next_int(); itype = values.next_int(); atom1 = values.next_tagint(); atom2 = values.next_tagint(); atom3 = values.next_tagint(); } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Angles section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Angles section of molecule file: {}\n{}",e.what(),line); } itype += aoffset; @@ -1128,8 +1099,7 @@ void Molecule::dihedrals(int flag, char *line) try { ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 6) - error->all(FLERR,"Invalid line in Dihedrals section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Dihedrals section of molecule file: {}",line); values.next_int(); itype = values.next_int(); @@ -1138,8 +1108,7 @@ void Molecule::dihedrals(int flag, char *line) atom3 = values.next_tagint(); atom4 = values.next_tagint(); } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Dihedrals section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Dihedrals section of molecule file: {}\n{}",e.what(),line); } itype += doffset; @@ -1150,8 +1119,7 @@ void Molecule::dihedrals(int flag, char *line) (atom4 <= 0) || (atom4 > natoms) || (atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) || (atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4)) - error->all(FLERR, - "Invalid atom ID in dihedrals section of molecule file"); + error->all(FLERR,"Invalid atom ID in dihedrals section of molecule file"); if ((itype <= 0) || (domain->box_exist && (itype > atom->ndihedraltypes))) error->all(FLERR,"Invalid dihedral type in Dihedrals section of molecule file"); @@ -1230,8 +1198,7 @@ void Molecule::impropers(int flag, char *line) try { ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 6) - error->all(FLERR,"Invalid line in Impropers section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Impropers section of molecule file: {}",line); values.next_int(); itype = values.next_int(); atom1 = values.next_tagint(); @@ -1239,8 +1206,7 @@ void Molecule::impropers(int flag, char *line) atom3 = values.next_tagint(); atom4 = values.next_tagint(); } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Impropers section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Impropers section of molecule file: {}\n{}",e.what(),line); } itype += ioffset; @@ -1251,8 +1217,7 @@ void Molecule::impropers(int flag, char *line) (atom4 <= 0) || (atom4 > natoms) || (atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) || (atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4)) - error->all(FLERR, - "Invalid atom ID in impropers section of molecule file"); + error->all(FLERR,"Invalid atom ID in impropers section of molecule file"); if ((itype <= 0) || (domain->box_exist && (itype > atom->nimpropertypes))) error->all(FLERR,"Invalid improper type in Impropers section of molecule file"); @@ -1325,15 +1290,14 @@ void Molecule::nspecial_read(int flag, char *line) try { ValueTokenizer values(utils::trim_comment(line)); if (values.count() != 4) - error->all(FLERR,"Invalid line in Special Bond Counts section of " - "molecule file: {}",line); + error->all(FLERR,"Invalid line in Special Bond Counts section of molecule file: {}",line); values.next_int(); c1 = values.next_tagint(); c2 = values.next_tagint(); c3 = values.next_tagint(); } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Special Bond Counts section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Special Bond Counts section of " + "molecule file: {}\n{}",e.what(),line); } if (flag) { @@ -1358,8 +1322,7 @@ void Molecule::special_read(char *line) int nwords = values.count(); if (nwords != nspecial[i][2]+1) - error->all(FLERR,"Molecule file special list " - "does not match special count"); + error->all(FLERR,"Molecule file special list does not match special count"); values.next_int(); // ignore @@ -1367,13 +1330,12 @@ void Molecule::special_read(char *line) special[i][m-1] = values.next_tagint(); if (special[i][m-1] <= 0 || special[i][m-1] > natoms || special[i][m-1] == i+1) - error->all(FLERR,"Invalid atom index in Special Bonds " - "section of molecule file"); + error->all(FLERR,"Invalid atom index in Special Bonds section of molecule file"); } } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid line in Special Bonds section of " - "molecule file: {}\n{}",e.what(),line); + error->all(FLERR,"Invalid line in Special Bonds section of " + "molecule file: {}\n{}",e.what(),line); } } @@ -1502,8 +1464,7 @@ void Molecule::shakeflag_read(char *line) shake_flag[i] = values.next_int(); } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid Shake Flags section in molecule file\n" - "{}", e.what()); + error->all(FLERR,"Invalid Shake Flags section in molecule file: {}", e.what()); } for (int i = 0; i < natoms; i++) @@ -1572,8 +1533,7 @@ void Molecule::shakeatom_read(char *line) } } catch (TokenizerException &e) { - error->all(FLERR,"Invalid shake atom in molecule file\n" - "{}", e.what()); + error->all(FLERR,"Invalid shake atom in molecule file: {}", e.what()); } for (int i = 0; i < natoms; i++) { @@ -1642,8 +1602,7 @@ void Molecule::shaketype_read(char *line) error->all(FLERR,"Invalid shake type data in molecule file"); } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid shake type data in molecule file\n", - "{}", e.what()); + error->all(FLERR,"Invalid shake type data in molecule file: {}",e.what()); } for (int i = 0; i < natoms; i++) { @@ -1695,8 +1654,7 @@ void Molecule::body(int flag, int pflag, char *line) } else nword += ncount; } } catch (TokenizerException &e) { - error->all(FLERR, "Invalid body params in molecule file\n", - "{}", e.what()); + error->all(FLERR,"Invalid body params in molecule file: {}", e.what()); } } @@ -1735,8 +1693,7 @@ void Molecule::check_attributes(int flag) if (onemol->rmassflag && !atom->rmass_flag) mismatch = 1; if (mismatch && me == 0) - error->warning(FLERR, - "Molecule attributes do not match system attributes"); + error->warning(FLERR,"Molecule attributes do not match system attributes"); // for all atom styles, check nbondtype,etc @@ -1770,8 +1727,7 @@ void Molecule::check_attributes(int flag) // warn if molecule topology defined but no special settings if (onemol->bondflag && !onemol->specialflag) - if (me == 0) error->warning(FLERR,"Molecule has bond topology " - "but no special bond settings"); + if (me == 0) error->warning(FLERR,"Molecule has bond topology but no special bond settings"); } } @@ -1878,47 +1834,31 @@ void Molecule::allocate() memory->create(special,natoms,maxspecial,"molecule:special"); if (bondflag) { - memory->create(bond_type,natoms,bond_per_atom, - "molecule:bond_type"); - memory->create(bond_atom,natoms,bond_per_atom, - "molecule:bond_atom"); + memory->create(bond_type,natoms,bond_per_atom,"molecule:bond_type"); + memory->create(bond_atom,natoms,bond_per_atom,"molecule:bond_atom"); } if (angleflag) { - memory->create(angle_type,natoms,angle_per_atom, - "molecule:angle_type"); - memory->create(angle_atom1,natoms,angle_per_atom, - "molecule:angle_atom1"); - memory->create(angle_atom2,natoms,angle_per_atom, - "molecule:angle_atom2"); - memory->create(angle_atom3,natoms,angle_per_atom, - "molecule:angle_atom3"); + memory->create(angle_type,natoms,angle_per_atom,"molecule:angle_type"); + memory->create(angle_atom1,natoms,angle_per_atom,"molecule:angle_atom1"); + memory->create(angle_atom2,natoms,angle_per_atom,"molecule:angle_atom2"); + memory->create(angle_atom3,natoms,angle_per_atom,"molecule:angle_atom3"); } if (dihedralflag) { - memory->create(dihedral_type,natoms,dihedral_per_atom, - "molecule:dihedral_type"); - memory->create(dihedral_atom1,natoms,dihedral_per_atom, - "molecule:dihedral_atom1"); - memory->create(dihedral_atom2,natoms,dihedral_per_atom, - "molecule:dihedral_atom2"); - memory->create(dihedral_atom3,natoms,dihedral_per_atom, - "molecule:dihedral_atom3"); - memory->create(dihedral_atom4,natoms,dihedral_per_atom, - "molecule:dihedral_atom4"); + memory->create(dihedral_type,natoms,dihedral_per_atom,"molecule:dihedral_type"); + memory->create(dihedral_atom1,natoms,dihedral_per_atom,"molecule:dihedral_atom1"); + memory->create(dihedral_atom2,natoms,dihedral_per_atom,"molecule:dihedral_atom2"); + memory->create(dihedral_atom3,natoms,dihedral_per_atom,"molecule:dihedral_atom3"); + memory->create(dihedral_atom4,natoms,dihedral_per_atom,"molecule:dihedral_atom4"); } if (improperflag) { - memory->create(improper_type,natoms,improper_per_atom, - "molecule:improper_type"); - memory->create(improper_atom1,natoms,improper_per_atom, - "molecule:improper_atom1"); - memory->create(improper_atom2,natoms,improper_per_atom, - "molecule:improper_atom2"); - memory->create(improper_atom3,natoms,improper_per_atom, - "molecule:improper_atom3"); - memory->create(improper_atom4,natoms,improper_per_atom, - "molecule:improper_atom4"); + memory->create(improper_type,natoms,improper_per_atom,"molecule:improper_type"); + memory->create(improper_atom1,natoms,improper_per_atom,"molecule:improper_atom1"); + memory->create(improper_atom2,natoms,improper_per_atom,"molecule:improper_atom2"); + memory->create(improper_atom3,natoms,improper_per_atom,"molecule:improper_atom3"); + memory->create(improper_atom4,natoms,improper_per_atom,"molecule:improper_atom4"); } if (shakeflag) { @@ -2058,7 +1998,7 @@ void Molecule::skip_lines(int n, char *line, const std::string §ion) readline(line); if (utils::strmatch(utils::trim(utils::trim_comment(line)),"^[A-Za-z ]+$")) error->one(FLERR,"Unexpected line in molecule file while " - "skipping {} section:\n{}",section,line); + "skipping {} section:\n{}",section,line); } } diff --git a/src/molecule.h b/src/molecule.h index 14db9f3197..c1334f6488 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -119,7 +119,7 @@ class Molecule : protected Pointers { // e.g. FixPour or CreateAtoms Molecule(class LAMMPS *, int, char **, int &); - ~Molecule(); + ~Molecule() override; void compute_center(); void compute_mass(); void compute_com(); diff --git a/src/nbin.h b/src/nbin.h index 6755158bc2..40a749fb34 100644 --- a/src/nbin.h +++ b/src/nbin.h @@ -14,7 +14,7 @@ #ifndef LMP_NBIN_H #define LMP_NBIN_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: keep namespace LAMMPS_NS { @@ -50,7 +50,7 @@ class NBin : protected Pointers { int **binhead_multi; NBin(class LAMMPS *); - ~NBin(); + ~NBin() override; void post_constructor(class NeighRequest *); virtual void copy_neighbor_info(); diff --git a/src/nbin_multi.h b/src/nbin_multi.h index cc58ee0649..ca2e66c28b 100644 --- a/src/nbin_multi.h +++ b/src/nbin_multi.h @@ -29,11 +29,11 @@ namespace LAMMPS_NS { class NBinMulti : public NBin { public: NBinMulti(class LAMMPS *); - ~NBinMulti() {} - void bin_atoms_setup(int); - void setup_bins(int); - void bin_atoms(); - double memory_usage(); + + void bin_atoms_setup(int) override; + void setup_bins(int) override; + void bin_atoms() override; + double memory_usage() override; }; } // namespace LAMMPS_NS diff --git a/src/nbin_standard.h b/src/nbin_standard.h index 405c7c88f1..ebd7d37024 100644 --- a/src/nbin_standard.h +++ b/src/nbin_standard.h @@ -29,11 +29,11 @@ namespace LAMMPS_NS { class NBinStandard : public NBin { public: NBinStandard(class LAMMPS *); - ~NBinStandard() {} - void bin_atoms_setup(int); - void setup_bins(int); - void bin_atoms(); - double memory_usage(); + + void bin_atoms_setup(int) override; + void setup_bins(int) override; + void bin_atoms() override; + double memory_usage() override; }; } // namespace LAMMPS_NS diff --git a/src/neigh_list.h b/src/neigh_list.h index 8b920bbe50..abd9b8205e 100644 --- a/src/neigh_list.h +++ b/src/neigh_list.h @@ -102,7 +102,7 @@ class NeighList : protected Pointers { // methods NeighList(class LAMMPS *); - virtual ~NeighList(); + ~NeighList() override; void post_constructor(class NeighRequest *); void setup_pages(int, int); // setup page data structures void grow(int, int); // grow all data structs diff --git a/src/neigh_request.h b/src/neigh_request.h index 4bdc368317..ff86cfa7fe 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -112,7 +112,7 @@ class NeighRequest : protected Pointers { // methods NeighRequest(class LAMMPS *); - ~NeighRequest(); + ~NeighRequest() override; void archive(); int identical(NeighRequest *); int same_skip(NeighRequest *); diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 1ba3a61ad1..6d4e502239 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -101,6 +101,14 @@ static const char cite_neigh_multi[] = " year = {2020}\n" "}\n\n"; +// template for factory functions: +// there will be one instance for each style keyword in the respective style_xxx.h files + +template static S *style_creator(LAMMPS *lmp) +{ + return new T(lmp); +} + //#define NEIGH_LIST_DEBUG 1 /* ---------------------------------------------------------------------- */ @@ -694,7 +702,7 @@ void Neighbor::init_styles() #define NBIN_CLASS #define NBinStyle(key,Class,bitmasks) \ binnames[nbclass] = (char *) #key; \ - binclass[nbclass] = &bin_creator; \ + binclass[nbclass] = &style_creator; \ binmasks[nbclass++] = bitmasks; #include "style_nbin.h" // IWYU pragma: keep #undef NBinStyle @@ -718,7 +726,7 @@ void Neighbor::init_styles() #define NSTENCIL_CLASS #define NStencilStyle(key,Class,bitmasks) \ stencilnames[nsclass] = (char *) #key; \ - stencilclass[nsclass] = &stencil_creator; \ + stencilclass[nsclass] = &style_creator; \ stencilmasks[nsclass++] = bitmasks; #include "style_nstencil.h" // IWYU pragma: keep #undef NStencilStyle @@ -742,7 +750,7 @@ void Neighbor::init_styles() #define NPAIR_CLASS #define NPairStyle(key,Class,bitmasks) \ pairnames[npclass] = (char *) #key; \ - pairclass[npclass] = &pair_creator; \ + pairclass[npclass] = &style_creator; \ pairmasks[npclass++] = bitmasks; #include "style_npair.h" // IWYU pragma: keep #undef NPairStyle @@ -2031,36 +2039,6 @@ int Neighbor::request(void *requestor, int instance) return nrequest-1; } -/* ---------------------------------------------------------------------- - one instance per entry in style_neigh_bin.h -------------------------------------------------------------------------- */ - -template -NBin *Neighbor::bin_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - -/* ---------------------------------------------------------------------- - one instance per entry in style_neigh_stencil.h -------------------------------------------------------------------------- */ - -template -NStencil *Neighbor::stencil_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - -/* ---------------------------------------------------------------------- - one instance per entry in style_neigh_pair.h -------------------------------------------------------------------------- */ - -template -NPair *Neighbor::pair_creator(LAMMPS *lmp) -{ - return new T(lmp); -} - /* ---------------------------------------------------------------------- setup neighbor binning and neighbor stencils called before run and every reneighbor if box size/shape changes diff --git a/src/neighbor.h b/src/neighbor.h index a64e52fdbb..45468c0c9b 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -117,7 +117,7 @@ class Neighbor : protected Pointers { // public methods Neighbor(class LAMMPS *); - virtual ~Neighbor(); + ~Neighbor() override; virtual void init(); int request(void *, int instance = 0); int decide(); // decide whether to build or not @@ -231,10 +231,6 @@ class Neighbor : protected Pointers { int choose_stencil(class NeighRequest *); int choose_pair(class NeighRequest *); - template static NBin *bin_creator(class LAMMPS *); - template static NStencil *stencil_creator(class LAMMPS *); - template static NPair *pair_creator(class LAMMPS *); - // dummy functions provided by NeighborKokkos, called in init() // otherwise NeighborKokkos would have to overwrite init() diff --git a/src/npair.h b/src/npair.h index 35e08786ef..b35f93d22b 100644 --- a/src/npair.h +++ b/src/npair.h @@ -14,7 +14,7 @@ #ifndef LMP_NPAIR_H #define LMP_NPAIR_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: keep namespace LAMMPS_NS { @@ -28,7 +28,7 @@ class NPair : protected Pointers { double cutoff_custom; // cutoff set by requestor NPair(class LAMMPS *); - virtual ~NPair(); + ~NPair() override; void post_constructor(class NeighRequest *); virtual void copy_neighbor_info(); void build_setup(); diff --git a/src/npair_copy.h b/src/npair_copy.h index d21b6610bd..36b80f83d9 100644 --- a/src/npair_copy.h +++ b/src/npair_copy.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairCopy : public NPair { public: NPairCopy(class LAMMPS *); - ~NPairCopy() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_bin.h b/src/npair_full_bin.h index 7bc1c11fa9..4d40763271 100644 --- a/src/npair_full_bin.h +++ b/src/npair_full_bin.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullBin : public NPair { public: NPairFullBin(class LAMMPS *); - ~NPairFullBin() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_bin_atomonly.h b/src/npair_full_bin_atomonly.h index a348f4f734..8e3f96e59b 100644 --- a/src/npair_full_bin_atomonly.h +++ b/src/npair_full_bin_atomonly.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullBinAtomonly : public NPair { public: NPairFullBinAtomonly(class LAMMPS *); - ~NPairFullBinAtomonly() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_bin_ghost.h b/src/npair_full_bin_ghost.h index 215ee75703..4b7e08a0e1 100644 --- a/src/npair_full_bin_ghost.h +++ b/src/npair_full_bin_ghost.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullBinGhost : public NPair { public: NPairFullBinGhost(class LAMMPS *); - ~NPairFullBinGhost() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_multi.h b/src/npair_full_multi.h index 4a1aa09fa1..dcd1b5d8a9 100644 --- a/src/npair_full_multi.h +++ b/src/npair_full_multi.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairFullMulti : public NPair { public: NPairFullMulti(class LAMMPS *); - ~NPairFullMulti() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_multi_old.h b/src/npair_full_multi_old.h index cd94eb9c9f..0dd825fcce 100644 --- a/src/npair_full_multi_old.h +++ b/src/npair_full_multi_old.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairFullMultiOld : public NPair { public: NPairFullMultiOld(class LAMMPS *); - ~NPairFullMultiOld() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_nsq.h b/src/npair_full_nsq.h index a3fdc498f1..0e65fcd027 100644 --- a/src/npair_full_nsq.h +++ b/src/npair_full_nsq.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairFullNsq : public NPair { public: NPairFullNsq(class LAMMPS *); - ~NPairFullNsq() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_full_nsq_ghost.h b/src/npair_full_nsq_ghost.h index 5b5e86fe9f..6ae517ccf7 100644 --- a/src/npair_full_nsq_ghost.h +++ b/src/npair_full_nsq_ghost.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairFullNsqGhost : public NPair { public: NPairFullNsqGhost(class LAMMPS *); - ~NPairFullNsqGhost() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_bin_atomonly_newton.h b/src/npair_half_bin_atomonly_newton.h index 68c51ebcdb..7a3eaf34bc 100644 --- a/src/npair_half_bin_atomonly_newton.h +++ b/src/npair_half_bin_atomonly_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinAtomonlyNewton : public NPair { public: NPairHalfBinAtomonlyNewton(class LAMMPS *); - ~NPairHalfBinAtomonlyNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_bin_newtoff.h b/src/npair_half_bin_newtoff.h index fd1b9d6cdf..db240f8bd9 100644 --- a/src/npair_half_bin_newtoff.h +++ b/src/npair_half_bin_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtoff : public NPair { public: NPairHalfBinNewtoff(class LAMMPS *); - ~NPairHalfBinNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_bin_newtoff_ghost.h b/src/npair_half_bin_newtoff_ghost.h index 1abc3e0c0a..b11e0f4802 100644 --- a/src/npair_half_bin_newtoff_ghost.h +++ b/src/npair_half_bin_newtoff_ghost.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtoffGhost : public NPair { public: NPairHalfBinNewtoffGhost(class LAMMPS *); - ~NPairHalfBinNewtoffGhost() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_bin_newton.h b/src/npair_half_bin_newton.h index 7849aa741f..19f7b93ae4 100644 --- a/src/npair_half_bin_newton.h +++ b/src/npair_half_bin_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewton : public NPair { public: NPairHalfBinNewton(class LAMMPS *); - ~NPairHalfBinNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_bin_newton_tri.h b/src/npair_half_bin_newton_tri.h index d90cf41023..ad270ae173 100644 --- a/src/npair_half_bin_newton_tri.h +++ b/src/npair_half_bin_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfBinNewtonTri : public NPair { public: NPairHalfBinNewtonTri(class LAMMPS *); - ~NPairHalfBinNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_multi_newtoff.h b/src/npair_half_multi_newtoff.h index 4837108667..3142587da6 100644 --- a/src/npair_half_multi_newtoff.h +++ b/src/npair_half_multi_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiNewtoff : public NPair { public: NPairHalfMultiNewtoff(class LAMMPS *); - ~NPairHalfMultiNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_multi_newton.h b/src/npair_half_multi_newton.h index 15cf6ee9c8..55439eacca 100644 --- a/src/npair_half_multi_newton.h +++ b/src/npair_half_multi_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiNewton : public NPair { public: NPairHalfMultiNewton(class LAMMPS *); - ~NPairHalfMultiNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_multi_newton_tri.h b/src/npair_half_multi_newton_tri.h index 4c4f920718..2b6d69f332 100644 --- a/src/npair_half_multi_newton_tri.h +++ b/src/npair_half_multi_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiNewtonTri : public NPair { public: NPairHalfMultiNewtonTri(class LAMMPS *); - ~NPairHalfMultiNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_multi_old_newtoff.h b/src/npair_half_multi_old_newtoff.h index 97d6a7ea69..9418cf5a4c 100644 --- a/src/npair_half_multi_old_newtoff.h +++ b/src/npair_half_multi_old_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiOldNewtoff : public NPair { public: NPairHalfMultiOldNewtoff(class LAMMPS *); - ~NPairHalfMultiOldNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_multi_old_newton.h b/src/npair_half_multi_old_newton.h index c689aea70b..5c84b8ef98 100644 --- a/src/npair_half_multi_old_newton.h +++ b/src/npair_half_multi_old_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiOldNewton : public NPair { public: NPairHalfMultiOldNewton(class LAMMPS *); - ~NPairHalfMultiOldNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_multi_old_newton_tri.h b/src/npair_half_multi_old_newton_tri.h index 6fc2c49f11..016746cf12 100644 --- a/src/npair_half_multi_old_newton_tri.h +++ b/src/npair_half_multi_old_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfMultiOldNewtonTri : public NPair { public: NPairHalfMultiOldNewtonTri(class LAMMPS *); - ~NPairHalfMultiOldNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_nsq_newtoff.h b/src/npair_half_nsq_newtoff.h index 26a50c2f11..45bef5b0b0 100644 --- a/src/npair_half_nsq_newtoff.h +++ b/src/npair_half_nsq_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfNsqNewtoff : public NPair { public: NPairHalfNsqNewtoff(class LAMMPS *); - ~NPairHalfNsqNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_nsq_newtoff_ghost.h b/src/npair_half_nsq_newtoff_ghost.h index 034b452540..5d6cb69450 100644 --- a/src/npair_half_nsq_newtoff_ghost.h +++ b/src/npair_half_nsq_newtoff_ghost.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfNsqNewtoffGhost : public NPair { public: NPairHalfNsqNewtoffGhost(class LAMMPS *); - ~NPairHalfNsqNewtoffGhost() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_nsq_newton.h b/src/npair_half_nsq_newton.h index 11170cec18..6b7ec89b82 100644 --- a/src/npair_half_nsq_newton.h +++ b/src/npair_half_nsq_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfNsqNewton : public NPair { public: NPairHalfNsqNewton(class LAMMPS *); - ~NPairHalfNsqNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_respa_bin_newtoff.h b/src/npair_half_respa_bin_newtoff.h index 7c8f592645..2782ae239e 100644 --- a/src/npair_half_respa_bin_newtoff.h +++ b/src/npair_half_respa_bin_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaBinNewtoff : public NPair { public: NPairHalfRespaBinNewtoff(class LAMMPS *); - ~NPairHalfRespaBinNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_respa_bin_newton.h b/src/npair_half_respa_bin_newton.h index 5483e946a1..c83ca89891 100644 --- a/src/npair_half_respa_bin_newton.h +++ b/src/npair_half_respa_bin_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaBinNewton : public NPair { public: NPairHalfRespaBinNewton(class LAMMPS *); - ~NPairHalfRespaBinNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_respa_bin_newton_tri.h b/src/npair_half_respa_bin_newton_tri.h index a45e89dff1..a5b573103c 100644 --- a/src/npair_half_respa_bin_newton_tri.h +++ b/src/npair_half_respa_bin_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaBinNewtonTri : public NPair { public: NPairHalfRespaBinNewtonTri(class LAMMPS *); - ~NPairHalfRespaBinNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_respa_nsq_newtoff.h b/src/npair_half_respa_nsq_newtoff.h index 5bdd0f0abe..d13fb810da 100644 --- a/src/npair_half_respa_nsq_newtoff.h +++ b/src/npair_half_respa_nsq_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaNsqNewtoff : public NPair { public: NPairHalfRespaNsqNewtoff(class LAMMPS *); - ~NPairHalfRespaNsqNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_respa_nsq_newton.h b/src/npair_half_respa_nsq_newton.h index bfa27fbfef..9050ca0fde 100644 --- a/src/npair_half_respa_nsq_newton.h +++ b/src/npair_half_respa_nsq_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfRespaNsqNewton : public NPair { public: NPairHalfRespaNsqNewton(class LAMMPS *); - ~NPairHalfRespaNsqNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_bin_newtoff.h b/src/npair_half_size_bin_newtoff.h index 6f2cb2424c..f1f9b2a34b 100644 --- a/src/npair_half_size_bin_newtoff.h +++ b/src/npair_half_size_bin_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeBinNewtoff : public NPair { public: NPairHalfSizeBinNewtoff(class LAMMPS *); - ~NPairHalfSizeBinNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_bin_newton.h b/src/npair_half_size_bin_newton.h index 8023361a29..a592969c46 100644 --- a/src/npair_half_size_bin_newton.h +++ b/src/npair_half_size_bin_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeBinNewton : public NPair { public: NPairHalfSizeBinNewton(class LAMMPS *); - ~NPairHalfSizeBinNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_bin_newton_tri.h b/src/npair_half_size_bin_newton_tri.h index 86ce3a2b7d..50861d560e 100644 --- a/src/npair_half_size_bin_newton_tri.h +++ b/src/npair_half_size_bin_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeBinNewtonTri : public NPair { public: NPairHalfSizeBinNewtonTri(class LAMMPS *); - ~NPairHalfSizeBinNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_multi_newtoff.h b/src/npair_half_size_multi_newtoff.h index ccb395b24b..b33634e5be 100644 --- a/src/npair_half_size_multi_newtoff.h +++ b/src/npair_half_size_multi_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiNewtoff : public NPair { public: NPairHalfSizeMultiNewtoff(class LAMMPS *); - ~NPairHalfSizeMultiNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_multi_newton.h b/src/npair_half_size_multi_newton.h index 4584dd9f62..32139136e6 100644 --- a/src/npair_half_size_multi_newton.h +++ b/src/npair_half_size_multi_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiNewton : public NPair { public: NPairHalfSizeMultiNewton(class LAMMPS *); - ~NPairHalfSizeMultiNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_multi_newton_tri.h b/src/npair_half_size_multi_newton_tri.h index 789c4c3dac..10e7a90d16 100644 --- a/src/npair_half_size_multi_newton_tri.h +++ b/src/npair_half_size_multi_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiNewtonTri : public NPair { public: NPairHalfSizeMultiNewtonTri(class LAMMPS *); - ~NPairHalfSizeMultiNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_multi_old_newtoff.h b/src/npair_half_size_multi_old_newtoff.h index 743ef3225d..c2ca814129 100644 --- a/src/npair_half_size_multi_old_newtoff.h +++ b/src/npair_half_size_multi_old_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiOldNewtoff : public NPair { public: NPairHalfSizeMultiOldNewtoff(class LAMMPS *); - ~NPairHalfSizeMultiOldNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_multi_old_newton.h b/src/npair_half_size_multi_old_newton.h index 749275814e..2322b5bc42 100644 --- a/src/npair_half_size_multi_old_newton.h +++ b/src/npair_half_size_multi_old_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiOldNewton : public NPair { public: NPairHalfSizeMultiOldNewton(class LAMMPS *); - ~NPairHalfSizeMultiOldNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_multi_old_newton_tri.h b/src/npair_half_size_multi_old_newton_tri.h index e4099e655f..1658abc717 100644 --- a/src/npair_half_size_multi_old_newton_tri.h +++ b/src/npair_half_size_multi_old_newton_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeMultiOldNewtonTri : public NPair { public: NPairHalfSizeMultiOldNewtonTri(class LAMMPS *); - ~NPairHalfSizeMultiOldNewtonTri() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_nsq_newtoff.h b/src/npair_half_size_nsq_newtoff.h index dbfdadd5a8..b263a907ed 100644 --- a/src/npair_half_size_nsq_newtoff.h +++ b/src/npair_half_size_nsq_newtoff.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeNsqNewtoff : public NPair { public: NPairHalfSizeNsqNewtoff(class LAMMPS *); - ~NPairHalfSizeNsqNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_half_size_nsq_newton.h b/src/npair_half_size_nsq_newton.h index f3e6e7cdf8..17735ccc45 100644 --- a/src/npair_half_size_nsq_newton.h +++ b/src/npair_half_size_nsq_newton.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NPairHalfSizeNsqNewton : public NPair { public: NPairHalfSizeNsqNewton(class LAMMPS *); - ~NPairHalfSizeNsqNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_halffull_newtoff.h b/src/npair_halffull_newtoff.h index 7662ee42fc..0a00267449 100644 --- a/src/npair_halffull_newtoff.h +++ b/src/npair_halffull_newtoff.h @@ -45,8 +45,7 @@ namespace LAMMPS_NS { class NPairHalffullNewtoff : public NPair { public: NPairHalffullNewtoff(class LAMMPS *); - ~NPairHalffullNewtoff() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_halffull_newton.h b/src/npair_halffull_newton.h index 0dfe220972..95cc09ec0b 100644 --- a/src/npair_halffull_newton.h +++ b/src/npair_halffull_newton.h @@ -35,8 +35,7 @@ namespace LAMMPS_NS { class NPairHalffullNewton : public NPair { public: NPairHalffullNewton(class LAMMPS *); - ~NPairHalffullNewton() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_skip.h b/src/npair_skip.h index 5827d8a856..aa2b14e12a 100644 --- a/src/npair_skip.h +++ b/src/npair_skip.h @@ -37,8 +37,7 @@ namespace LAMMPS_NS { class NPairSkip : public NPair { public: NPairSkip(class LAMMPS *); - ~NPairSkip() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_skip_respa.h b/src/npair_skip_respa.h index 64b3f7c7da..b0938287b5 100644 --- a/src/npair_skip_respa.h +++ b/src/npair_skip_respa.h @@ -31,8 +31,7 @@ namespace LAMMPS_NS { class NPairSkipRespa : public NPair { public: NPairSkipRespa(class LAMMPS *); - ~NPairSkipRespa() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_skip_size.h b/src/npair_skip_size.h index 0864b568a1..df8d479185 100644 --- a/src/npair_skip_size.h +++ b/src/npair_skip_size.h @@ -30,8 +30,7 @@ namespace LAMMPS_NS { class NPairSkipSize : public NPair { public: NPairSkipSize(class LAMMPS *); - ~NPairSkipSize() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_skip_size_off2on.h b/src/npair_skip_size_off2on.h index a0205a3865..39aee76b09 100644 --- a/src/npair_skip_size_off2on.h +++ b/src/npair_skip_size_off2on.h @@ -31,8 +31,7 @@ namespace LAMMPS_NS { class NPairSkipSizeOff2on : public NPair { public: NPairSkipSizeOff2on(class LAMMPS *); - ~NPairSkipSizeOff2on() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/npair_skip_size_off2on_oneside.h b/src/npair_skip_size_off2on_oneside.h index 2c3ec6f4ca..3f1cd6ef34 100644 --- a/src/npair_skip_size_off2on_oneside.h +++ b/src/npair_skip_size_off2on_oneside.h @@ -31,8 +31,7 @@ namespace LAMMPS_NS { class NPairSkipSizeOff2onOneside : public NPair { public: NPairSkipSizeOff2onOneside(class LAMMPS *); - ~NPairSkipSizeOff2onOneside() {} - void build(class NeighList *); + void build(class NeighList *) override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil.h b/src/nstencil.h index d8febe356b..d16b10f1b8 100644 --- a/src/nstencil.h +++ b/src/nstencil.h @@ -14,7 +14,7 @@ #ifndef LMP_NSTENCIL_H #define LMP_NSTENCIL_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: keep namespace LAMMPS_NS { @@ -48,7 +48,7 @@ class NStencil : protected Pointers { int **bin_collection_multi; // what collection to use for bin information NStencil(class LAMMPS *); - virtual ~NStencil(); + ~NStencil() override; void post_constructor(class NeighRequest *); void copy_neighbor_info(); virtual void create_setup(); diff --git a/src/nstencil_full_bin_2d.h b/src/nstencil_full_bin_2d.h index fa691bba89..f4c630d3c2 100644 --- a/src/nstencil_full_bin_2d.h +++ b/src/nstencil_full_bin_2d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilFullBin2d : public NStencil { public: NStencilFullBin2d(class LAMMPS *); - ~NStencilFullBin2d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_bin_3d.h b/src/nstencil_full_bin_3d.h index 8753d10ed2..463dda1f62 100644 --- a/src/nstencil_full_bin_3d.h +++ b/src/nstencil_full_bin_3d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilFullBin3d : public NStencil { public: NStencilFullBin3d(class LAMMPS *); - ~NStencilFullBin3d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_ghost_bin_2d.h b/src/nstencil_full_ghost_bin_2d.h index 4a69f8accd..6326aae5ea 100644 --- a/src/nstencil_full_ghost_bin_2d.h +++ b/src/nstencil_full_ghost_bin_2d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilFullGhostBin2d : public NStencil { public: NStencilFullGhostBin2d(class LAMMPS *); - ~NStencilFullGhostBin2d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_ghost_bin_3d.h b/src/nstencil_full_ghost_bin_3d.h index 829bece6d0..eed98279aa 100644 --- a/src/nstencil_full_ghost_bin_3d.h +++ b/src/nstencil_full_ghost_bin_3d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilFullGhostBin3d : public NStencil { public: NStencilFullGhostBin3d(class LAMMPS *); - ~NStencilFullGhostBin3d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_multi_2d.h b/src/nstencil_full_multi_2d.h index cc50314f93..2ef43f1999 100644 --- a/src/nstencil_full_multi_2d.h +++ b/src/nstencil_full_multi_2d.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class NStencilFullMulti2d : public NStencil { public: NStencilFullMulti2d(class LAMMPS *); - ~NStencilFullMulti2d() {} - void create(); + void create() override; protected: - void set_stencil_properties(); + void set_stencil_properties() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_multi_3d.h b/src/nstencil_full_multi_3d.h index ba80d602ab..894c688a9f 100644 --- a/src/nstencil_full_multi_3d.h +++ b/src/nstencil_full_multi_3d.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class NStencilFullMulti3d : public NStencil { public: NStencilFullMulti3d(class LAMMPS *); - ~NStencilFullMulti3d() {} - void create(); + void create() override; protected: - void set_stencil_properties(); + void set_stencil_properties() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_multi_old_2d.h b/src/nstencil_full_multi_old_2d.h index 1929fa09e5..9b56be0793 100644 --- a/src/nstencil_full_multi_old_2d.h +++ b/src/nstencil_full_multi_old_2d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilFullMultiOld2d : public NStencil { public: NStencilFullMultiOld2d(class LAMMPS *); - ~NStencilFullMultiOld2d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_full_multi_old_3d.h b/src/nstencil_full_multi_old_3d.h index 33d4166251..d19da9c95f 100644 --- a/src/nstencil_full_multi_old_3d.h +++ b/src/nstencil_full_multi_old_3d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilFullMultiOld3d : public NStencil { public: NStencilFullMultiOld3d(class LAMMPS *); - ~NStencilFullMultiOld3d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_bin_2d.h b/src/nstencil_half_bin_2d.h index c7e07e1472..f11138dd54 100644 --- a/src/nstencil_half_bin_2d.h +++ b/src/nstencil_half_bin_2d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilHalfBin2d : public NStencil { public: NStencilHalfBin2d(class LAMMPS *); - ~NStencilHalfBin2d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_bin_2d_tri.h b/src/nstencil_half_bin_2d_tri.h index 9d980a5ed6..5088bc2edc 100644 --- a/src/nstencil_half_bin_2d_tri.h +++ b/src/nstencil_half_bin_2d_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilHalfBin2dTri : public NStencil { public: NStencilHalfBin2dTri(class LAMMPS *); - ~NStencilHalfBin2dTri() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_bin_3d.h b/src/nstencil_half_bin_3d.h index 10d4eaa44b..f235d6688b 100644 --- a/src/nstencil_half_bin_3d.h +++ b/src/nstencil_half_bin_3d.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilHalfBin3d : public NStencil { public: NStencilHalfBin3d(class LAMMPS *); - ~NStencilHalfBin3d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_bin_3d_tri.h b/src/nstencil_half_bin_3d_tri.h index 33158f32ae..fa2975ef0a 100644 --- a/src/nstencil_half_bin_3d_tri.h +++ b/src/nstencil_half_bin_3d_tri.h @@ -29,8 +29,7 @@ namespace LAMMPS_NS { class NStencilHalfBin3dTri : public NStencil { public: NStencilHalfBin3dTri(class LAMMPS *); - ~NStencilHalfBin3dTri() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_2d.h b/src/nstencil_half_multi_2d.h index be98e0a027..043d160b9e 100644 --- a/src/nstencil_half_multi_2d.h +++ b/src/nstencil_half_multi_2d.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class NStencilHalfMulti2d : public NStencil { public: NStencilHalfMulti2d(class LAMMPS *); - ~NStencilHalfMulti2d() {} - void create(); + void create() override; protected: - void set_stencil_properties(); + void set_stencil_properties() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_2d_tri.h b/src/nstencil_half_multi_2d_tri.h index 0404b8195b..1d1a469e72 100644 --- a/src/nstencil_half_multi_2d_tri.h +++ b/src/nstencil_half_multi_2d_tri.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class NStencilHalfMulti2dTri : public NStencil { public: NStencilHalfMulti2dTri(class LAMMPS *); - ~NStencilHalfMulti2dTri() {} - void create(); + void create() override; protected: - void set_stencil_properties(); + void set_stencil_properties() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_3d.h b/src/nstencil_half_multi_3d.h index 020bf1310f..246d71f3e4 100644 --- a/src/nstencil_half_multi_3d.h +++ b/src/nstencil_half_multi_3d.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class NStencilHalfMulti3d : public NStencil { public: NStencilHalfMulti3d(class LAMMPS *); - ~NStencilHalfMulti3d() {} - void create(); + void create() override; protected: - void set_stencil_properties(); + void set_stencil_properties() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_3d_tri.h b/src/nstencil_half_multi_3d_tri.h index 1e3058d50c..2ced4b0c20 100644 --- a/src/nstencil_half_multi_3d_tri.h +++ b/src/nstencil_half_multi_3d_tri.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class NStencilHalfMulti3dTri : public NStencil { public: NStencilHalfMulti3dTri(class LAMMPS *); - ~NStencilHalfMulti3dTri() {} - void create(); + void create() override; protected: - void set_stencil_properties(); + void set_stencil_properties() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_old_2d.h b/src/nstencil_half_multi_old_2d.h index 8d16b1a8f2..387429d160 100644 --- a/src/nstencil_half_multi_old_2d.h +++ b/src/nstencil_half_multi_old_2d.h @@ -28,8 +28,7 @@ namespace LAMMPS_NS { class NStencilHalfMultiOld2d : public NStencil { public: NStencilHalfMultiOld2d(class LAMMPS *); - ~NStencilHalfMultiOld2d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_old_2d_tri.h b/src/nstencil_half_multi_old_2d_tri.h index 72f9e41083..a81d37062c 100644 --- a/src/nstencil_half_multi_old_2d_tri.h +++ b/src/nstencil_half_multi_old_2d_tri.h @@ -28,8 +28,7 @@ namespace LAMMPS_NS { class NStencilHalfMultiOld2dTri : public NStencil { public: NStencilHalfMultiOld2dTri(class LAMMPS *); - ~NStencilHalfMultiOld2dTri() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_old_3d.h b/src/nstencil_half_multi_old_3d.h index 7b050f3538..d7d8157afa 100644 --- a/src/nstencil_half_multi_old_3d.h +++ b/src/nstencil_half_multi_old_3d.h @@ -28,8 +28,7 @@ namespace LAMMPS_NS { class NStencilHalfMultiOld3d : public NStencil { public: NStencilHalfMultiOld3d(class LAMMPS *); - ~NStencilHalfMultiOld3d() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/nstencil_half_multi_old_3d_tri.h b/src/nstencil_half_multi_old_3d_tri.h index 3ab71b5c61..2a7a5a22bb 100644 --- a/src/nstencil_half_multi_old_3d_tri.h +++ b/src/nstencil_half_multi_old_3d_tri.h @@ -28,8 +28,7 @@ namespace LAMMPS_NS { class NStencilHalfMultiOld3dTri : public NStencil { public: NStencilHalfMultiOld3dTri(class LAMMPS *); - ~NStencilHalfMultiOld3dTri() {} - void create(); + void create() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo.h b/src/ntopo.h index 9d8fe988fb..0cc1f79139 100644 --- a/src/ntopo.h +++ b/src/ntopo.h @@ -14,7 +14,7 @@ #ifndef LMP_NTOPO_H #define LMP_NTOPO_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: keep namespace LAMMPS_NS { @@ -24,7 +24,7 @@ class NTopo : protected Pointers { int **bondlist, **anglelist, **dihedrallist, **improperlist; NTopo(class LAMMPS *); - virtual ~NTopo(); + ~NTopo() override; virtual void build() = 0; diff --git a/src/ntopo_angle_all.h b/src/ntopo_angle_all.h index ec8d08dd1c..8ef0d17c3b 100644 --- a/src/ntopo_angle_all.h +++ b/src/ntopo_angle_all.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoAngleAll : public NTopo { public: NTopoAngleAll(class LAMMPS *); - ~NTopoAngleAll() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_angle_partial.h b/src/ntopo_angle_partial.h index ee29a9dd98..6d12975948 100644 --- a/src/ntopo_angle_partial.h +++ b/src/ntopo_angle_partial.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoAnglePartial : public NTopo { public: NTopoAnglePartial(class LAMMPS *); - ~NTopoAnglePartial() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_angle_template.h b/src/ntopo_angle_template.h index cfd48b0450..027659fde3 100644 --- a/src/ntopo_angle_template.h +++ b/src/ntopo_angle_template.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoAngleTemplate : public NTopo { public: NTopoAngleTemplate(class LAMMPS *); - ~NTopoAngleTemplate() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_bond_all.h b/src/ntopo_bond_all.h index de404446e8..a62fc5f43c 100644 --- a/src/ntopo_bond_all.h +++ b/src/ntopo_bond_all.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoBondAll : public NTopo { public: NTopoBondAll(class LAMMPS *); - ~NTopoBondAll() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_bond_partial.h b/src/ntopo_bond_partial.h index 4d334d1f0f..e0181e4491 100644 --- a/src/ntopo_bond_partial.h +++ b/src/ntopo_bond_partial.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoBondPartial : public NTopo { public: NTopoBondPartial(class LAMMPS *); - ~NTopoBondPartial() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_bond_template.h b/src/ntopo_bond_template.h index b725ac85f9..5899ded8b0 100644 --- a/src/ntopo_bond_template.h +++ b/src/ntopo_bond_template.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoBondTemplate : public NTopo { public: NTopoBondTemplate(class LAMMPS *); - ~NTopoBondTemplate() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_dihedral_all.h b/src/ntopo_dihedral_all.h index 0568bc9708..002c11a385 100644 --- a/src/ntopo_dihedral_all.h +++ b/src/ntopo_dihedral_all.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoDihedralAll : public NTopo { public: NTopoDihedralAll(class LAMMPS *); - ~NTopoDihedralAll() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_dihedral_partial.h b/src/ntopo_dihedral_partial.h index f439fe1dcd..c75b52fa44 100644 --- a/src/ntopo_dihedral_partial.h +++ b/src/ntopo_dihedral_partial.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoDihedralPartial : public NTopo { public: NTopoDihedralPartial(class LAMMPS *); - ~NTopoDihedralPartial() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_dihedral_template.h b/src/ntopo_dihedral_template.h index 67fe1c9072..e9bb1e355a 100644 --- a/src/ntopo_dihedral_template.h +++ b/src/ntopo_dihedral_template.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoDihedralTemplate : public NTopo { public: NTopoDihedralTemplate(class LAMMPS *); - ~NTopoDihedralTemplate() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_improper_all.h b/src/ntopo_improper_all.h index 26bbb1a642..af8d10cb44 100644 --- a/src/ntopo_improper_all.h +++ b/src/ntopo_improper_all.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoImproperAll : public NTopo { public: NTopoImproperAll(class LAMMPS *); - ~NTopoImproperAll() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_improper_partial.h b/src/ntopo_improper_partial.h index cc4baf1642..da88d81a41 100644 --- a/src/ntopo_improper_partial.h +++ b/src/ntopo_improper_partial.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoImproperPartial : public NTopo { public: NTopoImproperPartial(class LAMMPS *); - ~NTopoImproperPartial() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/ntopo_improper_template.h b/src/ntopo_improper_template.h index 510f067d66..1a1a4ade23 100644 --- a/src/ntopo_improper_template.h +++ b/src/ntopo_improper_template.h @@ -27,8 +27,7 @@ namespace LAMMPS_NS { class NTopoImproperTemplate : public NTopo { public: NTopoImproperTemplate(class LAMMPS *); - ~NTopoImproperTemplate() {} - void build(); + void build() override; }; } // namespace LAMMPS_NS diff --git a/src/output.cpp b/src/output.cpp index a8fda4173d..a3c79d4cda 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -41,6 +41,17 @@ using namespace LAMMPS_NS; #define DELTA 1 #define EPSDT 1.0e-6 +enum {SETUP, WRITE, RESET_DT}; + +/* ---------------------------------------------------------------------- + one instance per dump style in style_dump.h +------------------------------------------------------------------------- */ + +template static Dump *dump_creator(LAMMPS *lmp, int narg, char ** arg) +{ + return new T(lmp, narg, arg); +} + /* ---------------------------------------------------------------------- initialize all output ------------------------------------------------------------------------- */ @@ -232,7 +243,7 @@ void Output::setup(int memflag) // only do this if dump written or dump has not been written yet if (writeflag || last_dump[idump] < 0) - calculate_next_dump(0,idump,ntimestep); + calculate_next_dump(SETUP,idump,ntimestep); // if dump not written now, use addstep_compute_all() // since don't know what computes the dump will invoke @@ -361,7 +372,7 @@ void Output::setup(int memflag) dump[idump]->write(); last_dump[idump] = ntimestep; - calculate_next_dump(1,idump,ntimestep); + calculate_next_dump(WRITE,idump,ntimestep); if (mode_dump[idump] == 0 && (dump[idump]->clearstep || var_dump[idump])) @@ -468,12 +479,12 @@ void Output::setup(int memflag) for timestep mode, set next_dump for simulation time mode, set next_time_dump and next_dump which flag depends on caller - 0 = from setup() at start of run - 1 = from write() during run each time a dump file is written - 2 = from reset_dt() called from fix dt/reset when it changes timestep size + SETUP = from setup() at start of run + WRITE = from write() during run each time a dump file is written + RESET_DT = from reset_dt() called from fix dt/reset when it changes timestep size ------------------------------------------------------------------------- */ - void Output::calculate_next_dump(int which, int idump, bigint ntimestep) +void Output::calculate_next_dump(int which, int idump, bigint ntimestep) { // dump mode is by timestep // just set next_dump @@ -482,13 +493,13 @@ void Output::setup(int memflag) if (every_dump[idump]) { - // which = 0: nextdump = next multiple of every_dump - // which = 1: increment nextdump by every_dump + // which = SETUP: nextdump = next multiple of every_dump + // which = WRITE: increment nextdump by every_dump - if (which == 0) + if (which == SETUP) next_dump[idump] = (ntimestep/every_dump[idump])*every_dump[idump] + every_dump[idump]; - else if (which == 1) + else if (which == WRITE) next_dump[idump] += every_dump[idump]; } else { @@ -510,17 +521,28 @@ void Output::setup(int memflag) if (every_time_dump[idump] > 0.0) { - // which = 0: nexttime = next multiple of every_time_dump - // which = 1: increment nexttime by every_time_dump - // which = 2: no change to previous nexttime (only timestep has changed) + // which = SETUP: nexttime = next multiple of every_time_dump + // which = WRITE: increment nexttime by every_time_dump + // which = RESET_DT: no change to previous nexttime (only timestep has changed) - if (which == 0) + switch (which) { + case SETUP: nexttime = static_cast (tcurrent/every_time_dump[idump]) * every_time_dump[idump] + every_time_dump[idump]; - else if (which == 1) + break; + + case WRITE: nexttime = next_time_dump[idump] + every_time_dump[idump]; - else if (which == 2) + break; + + case RESET_DT: nexttime = next_time_dump[idump]; + break; + + default: + nexttime = 0; + error->all(FLERR,"Unexpected argument to calculate_next_dump"); + } nextdump = ntimestep + static_cast ((nexttime - tcurrent - EPSDT*update->dt) / @@ -541,10 +563,10 @@ void Output::setup(int memflag) } else { - // do not re-evaulate variable for which = 2, leave nexttime as-is + // do not re-evaulate variable for which = RESET_DT, leave nexttime as-is // unless next_time_dump < 0.0, which means variable never yet evaluated - if (which < 2 || next_time_dump[idump] < 0.0) { + if (which < RESET_DT || next_time_dump[idump] < 0.0) { nexttime = input->variable->compute_equal(ivar_dump[idump]); } else nexttime = next_time_dump[idump]; @@ -619,9 +641,8 @@ int Output::check_time_dumps(bigint ntimestep) { next_dump_any = MAXBIGINT; for (int idump = 0; idump < ndump; idump++) - if (last_dump[idump] >= 0) - error->all(FLERR, - "Cannot reset timestep with active dump - must undump first"); + if ((last_dump[idump] >= 0) && !update->whichflag && !dump[idump]->multifile) + error->all(FLERR, "Cannot reset timestep with active dump - must undump first"); if (restart_flag_single) { if (restart_every_single) { @@ -704,7 +725,7 @@ void Output::reset_dt() // since timestep change affects next step if (next_dump[idump] != ntimestep) - calculate_next_dump(2,idump,update->ntimestep); + calculate_next_dump(RESET_DT,idump,update->ntimestep); if (dump[idump]->clearstep || var_dump[idump]) next_time_dump_any = MIN(next_time_dump_any,next_dump[idump]); @@ -772,16 +793,6 @@ void Output::add_dump(int narg, char **arg) ndump++; } -/* ---------------------------------------------------------------------- - one instance per dump style in style_dump.h -------------------------------------------------------------------------- */ - -template -Dump *Output::dump_creator(LAMMPS *lmp, int narg, char ** arg) -{ - return new T(lmp, narg, arg); -} - /* ---------------------------------------------------------------------- modify parameters of a Dump ------------------------------------------------------------------------- */ diff --git a/src/output.h b/src/output.h index 3f557bdef5..54fc83c380 100644 --- a/src/output.h +++ b/src/output.h @@ -71,7 +71,7 @@ class Output : protected Pointers { DumpCreatorMap *dump_map; Output(class LAMMPS *); - ~Output(); + ~Output() override; void init(); void setup(int memflag = 1); // initial output before run/min void write(bigint); // output for current timestep @@ -93,7 +93,6 @@ class Output : protected Pointers { void memory_usage(); // print out memory usage private: - template static Dump *dump_creator(LAMMPS *, int, char **); void calculate_next_dump(int, int, bigint); }; diff --git a/src/pair.h b/src/pair.h index 00e6734773..a61af0c1da 100644 --- a/src/pair.h +++ b/src/pair.h @@ -123,7 +123,7 @@ class Pair : protected Pointers { int kokkosable; // 1 if Kokkos pair Pair(class LAMMPS *); - virtual ~Pair(); + ~Pair() override; // top-level Pair methods diff --git a/src/pair_born.h b/src/pair_born.h index 32f633f069..491989ee5c 100644 --- a/src/pair_born.h +++ b/src/pair_born.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairBorn : public Pair { public: PairBorn(class LAMMPS *); - virtual ~PairBorn(); + ~PairBorn() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/pair_buck.h b/src/pair_buck.h index 2be7ebabe9..b972125b06 100644 --- a/src/pair_buck.h +++ b/src/pair_buck.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairBuck : public Pair { public: PairBuck(class LAMMPS *); - virtual ~PairBuck(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairBuck() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/pair_buck_coul_cut.h b/src/pair_buck_coul_cut.h index b8a5178528..5cb128ad25 100644 --- a/src/pair_buck_coul_cut.h +++ b/src/pair_buck_coul_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairBuckCoulCut : public Pair { public: PairBuckCoulCut(class LAMMPS *); - virtual ~PairBuckCoulCut(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairBuckCoulCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/pair_coul_cut.h b/src/pair_coul_cut.h index 2d1f902e0f..f902ea735f 100644 --- a/src/pair_coul_cut.h +++ b/src/pair_coul_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairCoulCut : public Pair { public: PairCoulCut(class LAMMPS *); - virtual ~PairCoulCut(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + ~PairCoulCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/pair_coul_debye.h b/src/pair_coul_debye.h index cd10786d9f..917edef304 100644 --- a/src/pair_coul_debye.h +++ b/src/pair_coul_debye.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairCoulDebye : public PairCoulCut { public: PairCoulDebye(class LAMMPS *); - virtual void compute(int, int); - void settings(int, char **); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + void compute(int, int) override; + void settings(int, char **) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double kappa; diff --git a/src/pair_coul_dsf.h b/src/pair_coul_dsf.h index afbc573220..1011bac5e4 100644 --- a/src/pair_coul_dsf.h +++ b/src/pair_coul_dsf.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairCoulDSF : public Pair { public: PairCoulDSF(class LAMMPS *); - ~PairCoulDSF(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairCoulDSF() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_coul, cut_coulsq; diff --git a/src/pair_coul_wolf.h b/src/pair_coul_wolf.h index 1edb0deb31..508c74b21b 100644 --- a/src/pair_coul_wolf.h +++ b/src/pair_coul_wolf.h @@ -27,17 +27,17 @@ namespace LAMMPS_NS { class PairCoulWolf : public Pair { public: PairCoulWolf(class LAMMPS *); - virtual ~PairCoulWolf(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairCoulWolf() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_coul, cut_coulsq, alf; diff --git a/src/pair_deprecated.h b/src/pair_deprecated.h index 36af2e0aa0..5468b01259 100644 --- a/src/pair_deprecated.h +++ b/src/pair_deprecated.h @@ -28,11 +28,10 @@ namespace LAMMPS_NS { class PairDeprecated : public Pair { public: PairDeprecated(class LAMMPS *lmp) : Pair(lmp) {} - virtual ~PairDeprecated() {} - virtual void compute(int, int) {} - virtual void settings(int, char **); - virtual void coeff(int, char **) {} + void compute(int, int) override {} + void settings(int, char **) override; + void coeff(int, char **) override {} }; } // namespace LAMMPS_NS diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index e962e02c9e..6287fb97db 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -50,20 +50,20 @@ PairHybrid::~PairHybrid() if (nstyles > 0) { for (int m = 0; m < nstyles; m++) { delete styles[m]; - delete [] keywords[m]; - if (special_lj[m]) delete [] special_lj[m]; - if (special_coul[m]) delete [] special_coul[m]; + delete[] keywords[m]; + if (special_lj[m]) delete[] special_lj[m]; + if (special_coul[m]) delete[] special_coul[m]; } } - delete [] styles; - delete [] keywords; - delete [] multiple; + delete[] styles; + delete[] keywords; + delete[] multiple; - delete [] special_lj; - delete [] special_coul; - delete [] compute_tally; + delete[] special_lj; + delete[] special_coul; + delete[] compute_tally; - delete [] svector; + delete[] svector; if (allocated) { memory->destroy(setflag); @@ -187,7 +187,7 @@ void PairHybrid::compute(int eflag, int vflag) } - delete [] saved_special; + delete[] saved_special; if (vflag_fdotr) virial_fdotr_compute(); } @@ -274,9 +274,9 @@ void PairHybrid::settings(int narg, char **arg) if (nstyles > 0) { for (int m = 0; m < nstyles; m++) { delete styles[m]; - delete [] keywords[m]; - if (special_lj[m]) delete [] special_lj[m]; - if (special_coul[m]) delete [] special_coul[m]; + delete[] keywords[m]; + if (special_lj[m]) delete[] special_lj[m]; + if (special_coul[m]) delete[] special_coul[m]; } delete[] styles; delete[] keywords; @@ -297,8 +297,8 @@ void PairHybrid::settings(int narg, char **arg) // allocate list of sub-styles as big as possibly needed if no extra args - styles = new Pair*[narg]; - keywords = new char*[narg]; + styles = new Pair *[narg]; + keywords = new char *[narg]; multiple = new int[narg]; special_lj = new double*[narg]; @@ -322,7 +322,7 @@ void PairHybrid::settings(int narg, char **arg) error->all(FLERR,"Pair style hybrid cannot have none as an argument"); styles[nstyles] = force->new_pair(arg[iarg],1,dummy); - force->store_style(keywords[nstyles],arg[iarg],0); + keywords[nstyles] = force->store_style(arg[iarg],0); special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; @@ -454,7 +454,7 @@ void PairHybrid::init_svector() single_extra = MAX(single_extra,styles[m]->single_extra); if (single_extra) { - delete [] svector; + delete[] svector; svector = new double[single_extra]; } } @@ -667,7 +667,7 @@ void PairHybrid::init_style() neighbor->requests[i]->iskip = iskip; neighbor->requests[i]->ijskip = ijskip; } else { - delete [] iskip; + delete[] iskip; memory->destroy(ijskip); } } diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index ab696e279c..ee56783700 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -39,31 +39,31 @@ class PairHybrid : public Pair { public: PairHybrid(class LAMMPS *); - virtual ~PairHybrid(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); - void init_style(); - double init_one(int, int); - void setup(); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void modify_params(int narg, char **arg); - double memory_usage(); + ~PairHybrid() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void setup() override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void modify_params(int narg, char **arg) override; + double memory_usage() override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); - void *extract(const char *, int &); - void reset_dt(); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; + void *extract(const char *, int &) override; + void reset_dt() override; int check_ijtype(int, int, char *); - virtual void add_tally_callback(class Compute *); - virtual void del_tally_callback(class Compute *); - double atom2cut(int); - double radii2cut(double, double); + void add_tally_callback(class Compute *) override; + void del_tally_callback(class Compute *) override; + double atom2cut(int) override; + double radii2cut(double, double) override; protected: int nstyles; // # of sub-styles diff --git a/src/pair_hybrid_overlay.h b/src/pair_hybrid_overlay.h index a35261ede0..13b70fa042 100644 --- a/src/pair_hybrid_overlay.h +++ b/src/pair_hybrid_overlay.h @@ -27,11 +27,11 @@ namespace LAMMPS_NS { class PairHybridOverlay : public PairHybrid { public: PairHybridOverlay(class LAMMPS *); - virtual ~PairHybridOverlay() {} - void coeff(int, char **); - void init_svector(); - void copy_svector(int, int); + void coeff(int, char **) override; + + void init_svector() override; + void copy_svector(int, int) override; }; } // namespace LAMMPS_NS diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 5bf593d147..24158f46a0 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -68,14 +68,14 @@ void PairHybridScaled::compute(int eflag, int vflag) const int nvars = scalevars.size(); if (nvars > 0) { double *vals = new double[nvars]; - for (i = 0; i < nvars; ++i) { - j = input->variable->find(scalevars[i].c_str()); - if (j < 0) - error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]); - vals[i] = input->variable->compute_equal(j); + for (int k = 0; k < nvars; ++k) { + int m = input->variable->find(scalevars[k].c_str()); + if (m < 0) + error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]); + vals[k] = input->variable->compute_equal(m); } - for (i = 0; i < nstyles; ++i) { - if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]]; + for (int k = 0; k < nstyles; ++k) { + if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]]; } delete[] vals; } @@ -328,7 +328,7 @@ void PairHybridScaled::settings(int narg, char **arg) error->all(FLERR, "Pair style hybrid/scaled cannot have none as an argument"); styles[nstyles] = force->new_pair(arg[iarg], 1, dummy); - force->store_style(keywords[nstyles], arg[iarg], 0); + keywords[nstyles] = force->store_style(arg[iarg], 0); special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; @@ -386,14 +386,14 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, const int nvars = scalevars.size(); if (nvars > 0) { double *vals = new double[nvars]; - for (i = 0; i < nvars; ++i) { - j = input->variable->find(scalevars[i].c_str()); - if (j < 0) - error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]); - vals[i] = input->variable->compute_equal(j); + for (int k = 0; k < nvars; ++k) { + int m = input->variable->find(scalevars[k].c_str()); + if (m < 0) + error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]); + vals[k] = input->variable->compute_equal(m); } - for (i = 0; i < nstyles; ++i) { - if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]]; + for (int k = 0; k < nstyles; ++k) { + if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]]; } delete[] vals; } @@ -524,7 +524,7 @@ void PairHybridScaled::write_restart(FILE *fp) int n = scalevars.size(); fwrite(&n, sizeof(int), 1, fp); - for (auto var : scalevars) { + for (auto &var : scalevars) { n = var.size() + 1; fwrite(&n, sizeof(int), 1, fp); fwrite(var.c_str(), sizeof(char), n, fp); @@ -593,7 +593,7 @@ void PairHybridScaled::init_svector() void PairHybridScaled::copy_svector(int itype, int jtype) { int n = 0; - Pair *this_style; + Pair *this_style = nullptr; // fill svector array. // copy data from active styles and use 0.0 for inactive ones diff --git a/src/pair_hybrid_scaled.h b/src/pair_hybrid_scaled.h index 12db39ae84..9bb8901846 100644 --- a/src/pair_hybrid_scaled.h +++ b/src/pair_hybrid_scaled.h @@ -30,17 +30,17 @@ namespace LAMMPS_NS { class PairHybridScaled : public PairHybrid { public: PairHybridScaled(class LAMMPS *); - virtual ~PairHybridScaled(); - virtual void compute(int, int); - virtual void settings(int, char **); - virtual void coeff(int, char **); + ~PairHybridScaled() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + void write_restart(FILE *) override; + void read_restart(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; - void init_svector(); - void copy_svector(int, int); + void init_svector() override; + void copy_svector(int, int) override; protected: double **fsum, **tsum; diff --git a/src/pair_lj_cut.h b/src/pair_lj_cut.h index 15b1d92175..8ca9a14620 100644 --- a/src/pair_lj_cut.h +++ b/src/pair_lj_cut.h @@ -27,24 +27,24 @@ namespace LAMMPS_NS { class PairLJCut : public Pair { public: PairLJCut(class LAMMPS *); - virtual ~PairLJCut(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; - void compute_inner(); - void compute_middle(); - void compute_outer(int, int); + void compute_inner() override; + void compute_middle() override; + void compute_outer(int, int) override; protected: double cut_global; diff --git a/src/pair_lj_cut_coul_cut.h b/src/pair_lj_cut_coul_cut.h index e41d0ff20b..fd4cc22c28 100644 --- a/src/pair_lj_cut_coul_cut.h +++ b/src/pair_lj_cut_coul_cut.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJCutCoulCut : public Pair { public: PairLJCutCoulCut(class LAMMPS *); - virtual ~PairLJCutCoulCut(); - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + ~PairLJCutCoulCut() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_lj_global, cut_coul_global; diff --git a/src/pair_lj_expand.h b/src/pair_lj_expand.h index 0cf8323927..df31757ad0 100644 --- a/src/pair_lj_expand.h +++ b/src/pair_lj_expand.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairLJExpand : public Pair { public: PairLJExpand(class LAMMPS *); - virtual ~PairLJExpand(); + ~PairLJExpand() override; - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/pair_morse.h b/src/pair_morse.h index a85c47df8c..e1b9d4516c 100644 --- a/src/pair_morse.h +++ b/src/pair_morse.h @@ -27,20 +27,20 @@ namespace LAMMPS_NS { class PairMorse : public Pair { public: PairMorse(class LAMMPS *); - virtual ~PairMorse(); - virtual void compute(int, int); + ~PairMorse() override; + void compute(int, int) override; - virtual void settings(int, char **); - virtual void coeff(int, char **); - virtual double init_one(int, int); - virtual void write_restart(FILE *); - virtual void read_restart(FILE *); - virtual void write_restart_settings(FILE *); - virtual void read_restart_settings(FILE *); - virtual void write_data(FILE *); - virtual void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(const char *, int &); + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/pair_soft.h b/src/pair_soft.h index 1e024ec00c..c2e3044764 100644 --- a/src/pair_soft.h +++ b/src/pair_soft.h @@ -29,20 +29,20 @@ class PairSoft : public Pair { public: PairSoft(class LAMMPS *); - virtual ~PairSoft(); + ~PairSoft() override; - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; protected: double cut_global; diff --git a/src/pair_table.h b/src/pair_table.h index acfd75365e..87a2fbb055 100644 --- a/src/pair_table.h +++ b/src/pair_table.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairTable : public Pair { public: PairTable(class LAMMPS *); - virtual ~PairTable(); + ~PairTable() override; - virtual void compute(int, int); - virtual void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + void *extract(const char *, int &) override; enum { LOOKUP, LINEAR, SPLINE, BITMAP }; diff --git a/src/pair_yukawa.h b/src/pair_yukawa.h index 975bb3c2ac..bb50b42aab 100644 --- a/src/pair_yukawa.h +++ b/src/pair_yukawa.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class PairYukawa : public Pair { public: PairYukawa(class LAMMPS *); - virtual ~PairYukawa(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairYukawa() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/pair_zbl.h b/src/pair_zbl.h index f9d6d92472..5927f8e751 100644 --- a/src/pair_zbl.h +++ b/src/pair_zbl.h @@ -27,19 +27,19 @@ namespace LAMMPS_NS { class PairZBL : public Pair { public: PairZBL(class LAMMPS *); - virtual ~PairZBL(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairZBL() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global, cut_inner; diff --git a/src/pair_zero.h b/src/pair_zero.h index 3d59fcbd1a..e94d301f4e 100644 --- a/src/pair_zero.h +++ b/src/pair_zero.h @@ -37,19 +37,19 @@ namespace LAMMPS_NS { class PairZero : public Pair { public: PairZero(class LAMMPS *); - virtual ~PairZero(); - virtual void compute(int, int); - virtual void compute_outer(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - void write_data(FILE *); - void write_data_all(FILE *); - double single(int, int, int, int, double, double, double, double &); + ~PairZero() override; + void compute(int, int) override; + void compute_outer(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; protected: double cut_global; diff --git a/src/platform.cpp b/src/platform.cpp index 708a42be8a..976c0fdaeb 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -19,9 +19,8 @@ #include "text_file_reader.h" #include "utils.h" -#if HAVE_MPI #include -#endif +#include //////////////////////////////////////////////////////////////////////// // include system headers and tweak system settings @@ -50,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/src/platform.h b/src/platform.h index c079fd2cd1..5d1a7259e9 100644 --- a/src/platform.h +++ b/src/platform.h @@ -18,6 +18,7 @@ #include "lmptype.h" +#include #include #include @@ -277,19 +278,19 @@ namespace platform { int mkdir(const std::string &path); /*! Delete a directory - * - * \param path directory path - * \return -1 if unsuccessful, otherwise >= 0 */ - - int rmdir(const std::string &path); - - /*! Delete a directory and its contents * * Unlike the the ``rmdir()`` or ``_rmdir()`` function of the * C library, this function will check for the contents of the * folder and recurse into any sub-folders, if necessary and * delete all contained folders and their contents before * deleting the folder *path*. + * + * \param path directory path + * \return -1 if unsuccessful, otherwise >= 0 */ + + int rmdir(const std::string &path); + + /*! Delete a file * * \param path path to file to be deleted * \return 0 on success, -1 on error */ diff --git a/src/pointers.h b/src/pointers.h index 44820d06eb..5f82872514 100644 --- a/src/pointers.h +++ b/src/pointers.h @@ -91,7 +91,7 @@ class Pointers { atomKK(ptr->atomKK), memoryKK(ptr->memoryKK), python(ptr->python) {} - virtual ~Pointers() {} + virtual ~Pointers() = default; // remove default members execept for the copy constructor diff --git a/src/potential_file_reader.h b/src/potential_file_reader.h index c72bf6e48f..e7484a96ac 100644 --- a/src/potential_file_reader.h +++ b/src/potential_file_reader.h @@ -18,8 +18,8 @@ #ifndef LMP_POTENTIAL_FILE_READER_H #define LMP_POTENTIAL_FILE_READER_H -#include "pointers.h" // IWYU pragma: export -#include "tokenizer.h" +#include "pointers.h" // IWYU pragma: export +#include "tokenizer.h" // IWYU pragma: export namespace LAMMPS_NS { class TextFileReader; @@ -39,7 +39,7 @@ class PotentialFileReader : protected Pointers { PotentialFileReader(class LAMMPS *lmp, const std::string &filename, const std::string &potential_name, const std::string &name_suffix, const int auto_convert = 0); - virtual ~PotentialFileReader(); + ~PotentialFileReader() override; void ignore_comments(bool value); diff --git a/src/procmap.h b/src/procmap.h index 8cbf805f5a..f1ad4afc24 100644 --- a/src/procmap.h +++ b/src/procmap.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class ProcMap : protected Pointers { public: ProcMap(class LAMMPS *); - ~ProcMap() {} + void onelevel_grid(int, int *, int *, int, int, int *, int *); void twolevel_grid(int, int *, int *, int, int *, int *, int, int, int *, int *); void numa_grid(int, int *, int *, int *); diff --git a/src/random_mars.h b/src/random_mars.h index ea241d4501..f2b9e17e8b 100644 --- a/src/random_mars.h +++ b/src/random_mars.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class RanMars : protected Pointers { public: RanMars(class LAMMPS *, int); - ~RanMars(); + ~RanMars() override; double uniform(); double gaussian(); double gaussian(double mu, double sigma); diff --git a/src/rcb.h b/src/rcb.h index 4201247c59..e6f187799a 100644 --- a/src/rcb.h +++ b/src/rcb.h @@ -39,7 +39,7 @@ class RCB : protected Pointers { int *sendindex; // index of dot in receiver's nfinal list RCB(class LAMMPS *); - ~RCB(); + ~RCB() override; void compute(int, int, double **, double *, double *, double *); void compute_old(int, int, double **, double *, double *, double *); void invert(int sortflag = 0); diff --git a/src/read_data.cpp b/src/read_data.cpp index 89b3ecadec..a46602d84a 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -40,7 +40,6 @@ #include #include -#include #include using namespace LAMMPS_NS; @@ -903,23 +902,28 @@ void ReadData::command(int narg, char **arg) // restore old styles, when reading with nocoeff flag given if (coeffflag == 0) { - if (force->pair) delete force->pair; + delete force->pair; + delete[] force->pair_style; force->pair = saved_pair; force->pair_style = saved_pair_style; - if (force->bond) delete force->bond; + delete force->bond; + delete[] force->bond_style; force->bond = saved_bond; force->bond_style = saved_bond_style; - if (force->angle) delete force->angle; + delete force->angle; + delete[] force->angle_style; force->angle = saved_angle; force->angle_style = saved_angle_style; - if (force->dihedral) delete force->dihedral; + delete force->dihedral; + delete[] force->dihedral_style; force->dihedral = saved_dihedral; force->dihedral_style = saved_dihedral_style; - if (force->improper) delete force->improper; + delete force->improper; + delete[] force->improper_style; force->improper = saved_improper; force->improper_style = saved_improper_style; diff --git a/src/read_data.h b/src/read_data.h index 090e70484b..2466f2df19 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class ReadData : public Command { public: ReadData(class LAMMPS *); - ~ReadData(); - void command(int, char **); + ~ReadData() override; + void command(int, char **) override; static bool is_data_section(const std::string &); private: diff --git a/src/read_dump.h b/src/read_dump.h index 92e5e69c47..21c9f8d862 100644 --- a/src/read_dump.h +++ b/src/read_dump.h @@ -29,8 +29,8 @@ namespace LAMMPS_NS { class ReadDump : public Command { public: ReadDump(class LAMMPS *); - ~ReadDump(); - void command(int, char **); + ~ReadDump() override; + void command(int, char **) override; void store_files(int, char **); void setup_reader(int, char **); diff --git a/src/read_restart.h b/src/read_restart.h index 9de52a5f28..88b8709744 100644 --- a/src/read_restart.h +++ b/src/read_restart.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class ReadRestart : public Command { public: ReadRestart(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; private: int me, nprocs; diff --git a/src/reader.h b/src/reader.h index 097fa2526b..adc93c6d7c 100644 --- a/src/reader.h +++ b/src/reader.h @@ -23,7 +23,6 @@ namespace LAMMPS_NS { class Reader : protected Pointers { public: Reader(class LAMMPS *); - virtual ~Reader() {} virtual void settings(int, char **); diff --git a/src/reader_native.cpp b/src/reader_native.cpp index ba7a576a50..32b2279a60 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -130,6 +130,7 @@ void ReaderNative::skip() // read chunk and skip them read_buf(&nchunk, sizeof(int), 1); + if (nchunk < 0) error->one(FLERR,"Dump file is invalid or corrupted"); int n; for (int i = 0; i < nchunk; i++) { @@ -141,8 +142,7 @@ void ReaderNative::skip() read_lines(2); bigint natoms; int rv = sscanf(line,BIGINT_FORMAT,&natoms); - if (rv != 1) - error->one(FLERR,"Dump file is incorrectly formatted"); + if (rv != 1) error->one(FLERR,"Dump file is incorrectly formatted"); read_lines(5); @@ -163,20 +163,17 @@ void ReaderNative::skip_reading_magic_str() if (is_known_magic_str() && revision > 0x0001) { int len; read_buf(&len, sizeof(int), 1); + if (len < 0) error->one(FLERR,"Dump file is invalid or corrupted"); - if (len > 0) { - // has units - skip_buf(sizeof(char)*len); - } + // has units + if (len > 0) skip_buf(sizeof(char)*len); char flag = 0; read_buf(&flag, sizeof(char), 1); - - if (flag) { - skip_buf(sizeof(double)); - } + if (flag) skip_buf(sizeof(double)); read_buf(&len, sizeof(int), 1); + if (len < 0) error->one(FLERR,"Dump file is invalid or corrupted"); skip_buf(sizeof(char)*len); } } diff --git a/src/reader_native.h b/src/reader_native.h index f888509dfb..6566df0680 100644 --- a/src/reader_native.h +++ b/src/reader_native.h @@ -32,13 +32,13 @@ namespace LAMMPS_NS { class ReaderNative : public Reader { public: ReaderNative(class LAMMPS *); - ~ReaderNative(); + ~ReaderNative() override; - int read_time(bigint &); - void skip(); + int read_time(bigint &) override; + void skip() override; bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &, - int &, int &); - void read_atoms(int, int, double **); + int &, int &) override; + void read_atoms(int, int, double **) override; private: int revision; diff --git a/src/reader_xyz.h b/src/reader_xyz.h index 0807be719e..9a1478a0c6 100644 --- a/src/reader_xyz.h +++ b/src/reader_xyz.h @@ -29,13 +29,13 @@ namespace LAMMPS_NS { class ReaderXYZ : public Reader { public: ReaderXYZ(class LAMMPS *); - ~ReaderXYZ(); + ~ReaderXYZ() override; - int read_time(bigint &); - void skip(); + int read_time(bigint &) override; + void skip() override; bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &, - int &, int &); - void read_atoms(int, int, double **); + int &, int &) override; + void read_atoms(int, int, double **) override; private: char *line; // line read from dump file diff --git a/src/region.h b/src/region.h index 043d3bdd36..83810f5be3 100644 --- a/src/region.h +++ b/src/region.h @@ -69,7 +69,7 @@ class Region : protected Pointers { int *list; Region(class LAMMPS *, int, char **); - virtual ~Region(); + ~Region() override; virtual void init(); int dynamic_check(); diff --git a/src/region_block.h b/src/region_block.h index 943e6ce40f..bcd54b5849 100644 --- a/src/region_block.h +++ b/src/region_block.h @@ -29,10 +29,10 @@ class RegBlock : public Region { public: RegBlock(class LAMMPS *, int, char **); - ~RegBlock(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); + ~RegBlock() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; protected: double xlo, xhi, ylo, yhi, zlo, zhi; diff --git a/src/region_cone.h b/src/region_cone.h index 917144613f..ff03568ea9 100644 --- a/src/region_cone.h +++ b/src/region_cone.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class RegCone : public Region { public: RegCone(class LAMMPS *, int, char **); - ~RegCone(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); + ~RegCone() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; private: char axis; diff --git a/src/region_cylinder.h b/src/region_cylinder.h index 70635e0a3f..e293a4f1cc 100644 --- a/src/region_cylinder.h +++ b/src/region_cylinder.h @@ -29,14 +29,14 @@ class RegCylinder : public Region { public: RegCylinder(class LAMMPS *, int, char **); - ~RegCylinder(); - void init(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); - void shape_update(); - void set_velocity_shape(); - void velocity_contact_shape(double *, double *); + ~RegCylinder() override; + void init() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; + void shape_update() override; + void set_velocity_shape() override; + void velocity_contact_shape(double *, double *) override; private: char axis; diff --git a/src/region_deprecated.h b/src/region_deprecated.h index 2c473e05f0..6092328ad7 100644 --- a/src/region_deprecated.h +++ b/src/region_deprecated.h @@ -28,11 +28,11 @@ namespace LAMMPS_NS { class RegionDeprecated : public Region { public: RegionDeprecated(class LAMMPS *, int, char **); - ~RegionDeprecated() {} - virtual void init() {} - virtual int inside(double, double, double) { return 0; } - virtual int surface_interior(double *, double) { return 0; } - virtual int surface_exterior(double *, double) { return 0; } + + void init() override {} + int inside(double, double, double) override { return 0; } + int surface_interior(double *, double) override { return 0; } + int surface_exterior(double *, double) override { return 0; } }; } // namespace LAMMPS_NS diff --git a/src/region_intersect.h b/src/region_intersect.h index e1c35bb594..b5eafec861 100644 --- a/src/region_intersect.h +++ b/src/region_intersect.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class RegIntersect : public Region { public: RegIntersect(class LAMMPS *, int, char **); - ~RegIntersect(); - void init(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); - void shape_update(); - void pretransform(); - void set_velocity(); - void length_restart_string(int &); - void write_restart(FILE *); - int restart(char *, int &); - void reset_vel(); + ~RegIntersect() override; + void init() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; + void shape_update() override; + void pretransform() override; + void set_velocity() override; + void length_restart_string(int &) override; + void write_restart(FILE *) override; + int restart(char *, int &) override; + void reset_vel() override; private: char **idsub; diff --git a/src/region_plane.h b/src/region_plane.h index b327498363..a96353ff30 100644 --- a/src/region_plane.h +++ b/src/region_plane.h @@ -27,10 +27,10 @@ namespace LAMMPS_NS { class RegPlane : public Region { public: RegPlane(class LAMMPS *, int, char **); - ~RegPlane(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); + ~RegPlane() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; private: double xp, yp, zp; diff --git a/src/region_prism.h b/src/region_prism.h index 0bc02079e8..fe021f6dc3 100644 --- a/src/region_prism.h +++ b/src/region_prism.h @@ -29,10 +29,10 @@ class RegPrism : public Region { public: RegPrism(class LAMMPS *, int, char **); - ~RegPrism(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); + ~RegPrism() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; private: double xlo, xhi, ylo, yhi, zlo, zhi; diff --git a/src/region_sphere.h b/src/region_sphere.h index 3cec54512e..9139a07db7 100644 --- a/src/region_sphere.h +++ b/src/region_sphere.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class RegSphere : public Region { public: RegSphere(class LAMMPS *, int, char **); - ~RegSphere(); - void init(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); - void shape_update(); - void set_velocity_shape(); - void velocity_contact_shape(double *, double *); + ~RegSphere() override; + void init() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; + void shape_update() override; + void set_velocity_shape() override; + void velocity_contact_shape(double *, double *) override; private: double xc, yc, zc; diff --git a/src/region_union.h b/src/region_union.h index b9099d9f86..32a54b357c 100644 --- a/src/region_union.h +++ b/src/region_union.h @@ -27,18 +27,18 @@ namespace LAMMPS_NS { class RegUnion : public Region { public: RegUnion(class LAMMPS *, int, char **); - ~RegUnion(); - void init(); - int inside(double, double, double); - int surface_interior(double *, double); - int surface_exterior(double *, double); - void shape_update(); - void pretransform(); - void set_velocity(); - void length_restart_string(int &); - void write_restart(FILE *); - int restart(char *, int &); - void reset_vel(); + ~RegUnion() override; + void init() override; + int inside(double, double, double) override; + int surface_interior(double *, double) override; + int surface_exterior(double *, double) override; + void shape_update() override; + void pretransform() override; + void set_velocity() override; + void length_restart_string(int &) override; + void write_restart(FILE *) override; + int restart(char *, int &) override; + void reset_vel() override; private: char **idsub; diff --git a/src/replicate.h b/src/replicate.h index 48abd7b4be..9eaae1d763 100644 --- a/src/replicate.h +++ b/src/replicate.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Replicate : public Command { public: Replicate(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/rerun.h b/src/rerun.h index 272df6bb0a..a3474a1827 100644 --- a/src/rerun.h +++ b/src/rerun.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Rerun : public Command { public: Rerun(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/reset_atom_ids.h b/src/reset_atom_ids.h index b62dc25b77..abb20bae4f 100644 --- a/src/reset_atom_ids.h +++ b/src/reset_atom_ids.h @@ -43,7 +43,7 @@ class ResetIDs : public Command { #endif ResetIDs(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; private: bigint binlo, binhi; diff --git a/src/reset_mol_ids.h b/src/reset_mol_ids.h index 6fff49bb72..787edfc4f6 100644 --- a/src/reset_mol_ids.h +++ b/src/reset_mol_ids.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class ResetMolIDs : public Command { public: ResetMolIDs(class LAMMPS *); - ~ResetMolIDs(); - void command(int, char **); + ~ResetMolIDs() override; + void command(int, char **) override; void create_computes(char *, char *); void reset(); diff --git a/src/respa.h b/src/respa.h index 5b6b9140e7..ed3dfa4ba4 100644 --- a/src/respa.h +++ b/src/respa.h @@ -46,13 +46,13 @@ class Respa : public Integrate { int pair_compute; // 1 if pair force need to be computed Respa(class LAMMPS *, int, char **); - virtual ~Respa(); - virtual void init(); - virtual void setup(int); - virtual void setup_minimal(int); - virtual void run(int); - virtual void cleanup(); - virtual void reset_dt(); + ~Respa() override; + void init() override; + void setup(int) override; + void setup_minimal(int) override; + void run(int) override; + void cleanup() override; + void reset_dt() override; void copy_f_flevel(int); void copy_flevel_f(int); diff --git a/src/run.h b/src/run.h index 55af0cf6a0..6b0df49fff 100644 --- a/src/run.h +++ b/src/run.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Run : public Command { public: Run(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/set.h b/src/set.h index f3ccefbd9d..8831ad131c 100644 --- a/src/set.h +++ b/src/set.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Set : public Command { public: Set(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; private: char *id; diff --git a/src/special.h b/src/special.h index 8fb39ea563..58ee0cef3f 100644 --- a/src/special.h +++ b/src/special.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class Special : protected Pointers { public: Special(class LAMMPS *); - ~Special(); + ~Special() override; void build(); private: diff --git a/src/table_file_reader.h b/src/table_file_reader.h index 832e68a34f..51e10189ee 100644 --- a/src/table_file_reader.h +++ b/src/table_file_reader.h @@ -25,7 +25,6 @@ class TableFileReader : public PotentialFileReader { public: TableFileReader(class LAMMPS *lmp, const std::string &filename, const std::string &type, const int auto_convert = 0); - virtual ~TableFileReader() = default; char *find_section_start(const std::string &keyword); }; diff --git a/src/tabular_function.cpp b/src/tabular_function.cpp index a3a904d644..07df49729a 100644 --- a/src/tabular_function.cpp +++ b/src/tabular_function.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/ Sandia National Laboratories + https://www.lammps.org/, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract diff --git a/src/text_file_reader.h b/src/text_file_reader.h index 34556d7eb3..e5a743580f 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -52,9 +52,7 @@ class FileReaderException : public std::exception { public: FileReaderException(const std::string &msg) : message(msg) {} - ~FileReaderException() noexcept {} - - virtual const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; class EOFException : public FileReaderException { diff --git a/src/thermo.cpp b/src/thermo.cpp index e39d7d7c57..27d74c58b6 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -375,8 +375,7 @@ void Thermo::compute(int flag) if (me == 0) { utils::logmesg(lmp,line); - if (screen && flushflag) fflush(screen); - if (logfile && flushflag) fflush(logfile); + if (flushflag) utils::flush_buffers(lmp); } // set to 1, so that subsequent invocations of CPU time will be non-zero diff --git a/src/thermo.h b/src/thermo.h index 89678614a7..9eca4df18b 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -34,7 +34,7 @@ class Thermo : protected Pointers { enum { INT, FLOAT, BIGINT }; Thermo(class LAMMPS *, int, char **); - ~Thermo(); + ~Thermo() override; void init(); bigint lost_check(); void modify_params(int, char **); diff --git a/src/timer.h b/src/timer.h index a1fb592e43..1cd7b1ce05 100644 --- a/src/timer.h +++ b/src/timer.h @@ -44,7 +44,7 @@ class Timer : protected Pointers { enum tlevel { OFF = 0, LOOP, NORMAL, FULL }; Timer(class LAMMPS *); - ~Timer(){}; + void init(); // inline function to reduce overhead if we want no detailed timings diff --git a/src/tokenizer.h b/src/tokenizer.h index 060e1bf6e3..b267e89b23 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -52,24 +52,30 @@ class Tokenizer { std::vector as_vector(); }; +/** General Tokenizer exception class */ + class TokenizerException : public std::exception { std::string message; public: + // remove unused default constructor + TokenizerException() = delete; + /** Thrown during retrieving or skipping tokens * * \param msg String with error message * \param token String of the token/word that caused the error */ explicit TokenizerException(const std::string &msg, const std::string &token); - ~TokenizerException() noexcept {} - /** Retrieve message describing the thrown exception * \return string with error message */ - virtual const char *what() const noexcept { return message.c_str(); } + const char *what() const noexcept override { return message.c_str(); } }; +/** Exception thrown by ValueTokenizer when trying to convert an invalid integer string */ + class InvalidIntegerException : public TokenizerException { + public: /** Thrown during converting string to integer number * @@ -80,6 +86,8 @@ class InvalidIntegerException : public TokenizerException { } }; +/** Exception thrown by ValueTokenizer when trying to convert an floating point string */ + class InvalidFloatException : public TokenizerException { public: /** Thrown during converting string to floating point number diff --git a/src/universe.h b/src/universe.h index 30644dcd6d..3e5710a301 100644 --- a/src/universe.h +++ b/src/universe.h @@ -37,7 +37,7 @@ class Universe : protected Pointers { // proc uni2orig[I] in original communicator Universe(class LAMMPS *, MPI_Comm); - ~Universe(); + ~Universe() override; void reorder(char *, char *); void add_world(char *); int consistent(); diff --git a/src/update.cpp b/src/update.cpp index da412ee89e..c82a1ddc18 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -14,15 +13,15 @@ #include "update.h" -#include "style_integrate.h" // IWYU pragma: keep -#include "style_minimize.h" // IWYU pragma: keep +#include "style_integrate.h" // IWYU pragma: keep +#include "style_minimize.h" // IWYU pragma: keep #include "comm.h" #include "compute.h" -#include "integrate.h" #include "error.h" #include "fix.h" #include "force.h" +#include "integrate.h" #include "min.h" #include "modify.h" #include "neighbor.h" @@ -32,6 +31,19 @@ using namespace LAMMPS_NS; +// template for factory functions: +// there will be one instance for each style keyword in the respective style_xxx.h files + +template static Integrate *integrate_creator(LAMMPS *lmp, int narg, char **arg) +{ + return new T(lmp, narg, arg); +} + +template static Min *minimize_creator(LAMMPS *lmp) +{ + return new T(lmp); +} + /* ---------------------------------------------------------------------- */ Update::Update(LAMMPS *lmp) : Pointers(lmp) @@ -67,38 +79,36 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) integrate_map = new IntegrateCreatorMap(); #define INTEGRATE_CLASS -#define IntegrateStyle(key,Class) \ - (*integrate_map)[#key] = &integrate_creator; -#include "style_integrate.h" // IWYU pragma: keep +#define IntegrateStyle(key, Class) (*integrate_map)[#key] = &integrate_creator; +#include "style_integrate.h" // IWYU pragma: keep #undef IntegrateStyle #undef INTEGRATE_CLASS minimize_map = new MinimizeCreatorMap(); #define MINIMIZE_CLASS -#define MinimizeStyle(key,Class) \ - (*minimize_map)[#key] = &minimize_creator; +#define MinimizeStyle(key, Class) (*minimize_map)[#key] = &minimize_creator; #include "style_minimize.h" // IWYU pragma: keep #undef MinimizeStyle #undef MINIMIZE_CLASS str = (char *) "verlet"; - create_integrate(1,&str,1); + create_integrate(1, &str, 1); str = (char *) "cg"; - create_minimize(1,&str,1); + create_minimize(1, &str, 1); } /* ---------------------------------------------------------------------- */ Update::~Update() { - delete [] unit_style; + delete[] unit_style; - delete [] integrate_style; + delete[] integrate_style; delete integrate; - delete [] minimize_style; + delete[] minimize_style; delete minimize; delete integrate_map; @@ -113,8 +123,10 @@ void Update::init() // if neither (e.g. from write_restart) then just return if (whichflag == 0) return; - if (whichflag == 1) integrate->init(); - else if (whichflag == 2) minimize->init(); + if (whichflag == 1) + integrate->init(); + else if (whichflag == 2) + minimize->init(); // only set first_update if a run or minimize is being performed @@ -131,7 +143,7 @@ void Update::set_units(const char *style) double dt_old = dt; - if (strcmp(style,"lj") == 0) { + if (strcmp(style, "lj") == 0) { force->boltz = 1.0; force->hplanck = 1.0; force->mvv2e = 1.0; @@ -152,18 +164,18 @@ void Update::set_units(const char *style) dt = 0.005; neighbor->skin = 0.3; - } else if (strcmp(style,"real") == 0) { + } else if (strcmp(style, "real") == 0) { force->boltz = 0.0019872067; force->hplanck = 95.306976368; force->mvv2e = 48.88821291 * 48.88821291; force->ftm2v = 1.0 / 48.88821291 / 48.88821291; force->mv2d = 1.0 / 0.602214129; force->nktv2p = 68568.415; - force->qqr2e = 332.06371; // see also force->qqr2d_lammps_real + force->qqr2e = 332.06371; // see also force->qqr2d_lammps_real force->qe2f = 23.060549; force->vxmu2f = 1.4393264316e4; force->xxt2kmu = 0.1; - force->e_mass = 1.0/1836.1527556560675; + force->e_mass = 1.0 / 1836.1527556560675; force->hhmrr2e = 0.0957018663603261; force->mvh2r = 1.5339009481951; force->angstrom = 1.0; @@ -173,7 +185,7 @@ void Update::set_units(const char *style) dt = 1.0; neighbor->skin = 2.0; - } else if (strcmp(style,"metal") == 0) { + } else if (strcmp(style, "metal") == 0) { force->boltz = 8.617343e-5; force->hplanck = 4.135667403e-3; force->mvv2e = 1.0364269e-4; @@ -194,7 +206,7 @@ void Update::set_units(const char *style) dt = 0.001; neighbor->skin = 2.0; - } else if (strcmp(style,"si") == 0) { + } else if (strcmp(style, "si") == 0) { force->boltz = 1.3806504e-23; force->hplanck = 6.62606896e-34; force->mvv2e = 1.0; @@ -215,7 +227,7 @@ void Update::set_units(const char *style) dt = 1.0e-8; neighbor->skin = 0.001; - } else if (strcmp(style,"cgs") == 0) { + } else if (strcmp(style, "cgs") == 0) { force->boltz = 1.3806504e-16; force->hplanck = 6.62606896e-27; force->mvv2e = 1.0; @@ -236,7 +248,7 @@ void Update::set_units(const char *style) dt = 1.0e-8; neighbor->skin = 0.1; - } else if (strcmp(style,"electron") == 0) { + } else if (strcmp(style, "electron") == 0) { force->boltz = 3.16681534e-6; force->hplanck = 0.1519829846; force->mvv2e = 1.06657236; @@ -257,7 +269,7 @@ void Update::set_units(const char *style) dt = 0.001; neighbor->skin = 2.0; - } else if (strcmp(style,"micro") == 0) { + } else if (strcmp(style, "micro") == 0) { force->boltz = 1.3806504e-8; force->hplanck = 6.62606896e-13; force->mvv2e = 1.0; @@ -278,7 +290,7 @@ void Update::set_units(const char *style) dt = 2.0; neighbor->skin = 0.1; - } else if (strcmp(style,"nano") == 0) { + } else if (strcmp(style, "nano") == 0) { force->boltz = 0.013806504; force->hplanck = 6.62606896e-4; force->mvv2e = 1.0; @@ -299,15 +311,16 @@ void Update::set_units(const char *style) dt = 0.00045; neighbor->skin = 0.1; - } else error->all(FLERR,"Illegal units command"); + } else + error->all(FLERR, "Illegal units command"); - delete [] unit_style; + delete[] unit_style; unit_style = utils::strdup(style); // check if timestep was changed from default value if (!dt_default && (comm->me == 0)) { - error->warning(FLERR,"Changing timestep from {:.6} to {:.6} due to " - "changing units to {}", dt_old, dt, unit_style); + error->warning(FLERR, "Changing timestep from {:.6} to {:.6} due to changing units to {}", + dt_old, dt, unit_style); } dt_default = 1; } @@ -316,24 +329,26 @@ void Update::set_units(const char *style) void Update::create_integrate(int narg, char **arg, int trysuffix) { - if (narg < 1) error->all(FLERR,"Illegal run_style command"); + if (narg < 1) error->all(FLERR, "Illegal run_style command"); - delete [] integrate_style; + delete[] integrate_style; delete integrate; int sflag; - if (narg-1 > 0) { - new_integrate(arg[0],narg-1,&arg[1],trysuffix,sflag); + if (narg - 1 > 0) { + new_integrate(arg[0], narg - 1, &arg[1], trysuffix, sflag); } else { - new_integrate(arg[0],0,nullptr,trysuffix,sflag); + new_integrate(arg[0], 0, nullptr, trysuffix, sflag); } std::string estyle = arg[0]; if (sflag) { estyle += "/"; - if (sflag == 1) estyle += lmp->suffix; - else estyle += lmp->suffix2; + if (sflag == 1) + estyle += lmp->suffix; + else + estyle += lmp->suffix2; } integrate_style = utils::strdup(estyle); } @@ -342,8 +357,7 @@ void Update::create_integrate(int narg, char **arg, int trysuffix) create the Integrate style, first with suffix appended ------------------------------------------------------------------------- */ -void Update::new_integrate(char *style, int narg, char **arg, - int trysuffix, int &sflag) +void Update::new_integrate(char *style, int narg, char **arg, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -374,36 +388,28 @@ void Update::new_integrate(char *style, int narg, char **arg, return; } - error->all(FLERR,"Illegal integrate style"); -} - -/* ---------------------------------------------------------------------- - one instance per integrate style in style_integrate.h -------------------------------------------------------------------------- */ - -template -Integrate *Update::integrate_creator(LAMMPS *lmp, int narg, char ** arg) -{ - return new T(lmp, narg, arg); + error->all(FLERR, "Illegal integrate style"); } /* ---------------------------------------------------------------------- */ void Update::create_minimize(int narg, char **arg, int trysuffix) { - if (narg < 1) error->all(FLERR,"Illegal run_style command"); + if (narg < 1) error->all(FLERR, "Illegal run_style command"); - delete [] minimize_style; + delete[] minimize_style; delete minimize; int sflag; - new_minimize(arg[0],narg-1,&arg[1],trysuffix,sflag); + new_minimize(arg[0], narg - 1, &arg[1], trysuffix, sflag); std::string estyle = arg[0]; if (sflag) { estyle += "/"; - if (sflag == 1) estyle += lmp->suffix; - else estyle += lmp->suffix2; + if (sflag == 1) + estyle += lmp->suffix; + else + estyle += lmp->suffix2; } minimize_style = utils::strdup(estyle); } @@ -412,8 +418,7 @@ void Update::create_minimize(int narg, char **arg, int trysuffix) create the Minimize style, first with suffix appended ------------------------------------------------------------------------- */ -void Update::new_minimize(char *style, int /* narg */, char ** /* arg */, - int trysuffix, int &sflag) +void Update::new_minimize(char *style, int /* narg */, char ** /* arg */, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -444,17 +449,7 @@ void Update::new_minimize(char *style, int /* narg */, char ** /* arg */, return; } - error->all(FLERR,"Illegal minimize style"); -} - -/* ---------------------------------------------------------------------- - one instance per minimize style in style_minimize.h -------------------------------------------------------------------------- */ - -template -Min *Update::minimize_creator(LAMMPS *lmp) -{ - return new T(lmp); + error->all(FLERR, "Illegal minimize style"); } /* ---------------------------------------------------------------------- @@ -463,8 +458,8 @@ Min *Update::minimize_creator(LAMMPS *lmp) void Update::reset_timestep(int narg, char **arg) { - if (narg != 1) error->all(FLERR,"Illegal reset_timestep command"); - bigint newstep = utils::bnumeric(FLERR,arg[0],false,lmp); + if (narg != 1) error->all(FLERR, "Illegal reset_timestep command"); + bigint newstep = utils::bnumeric(FLERR, arg[0], false, lmp); reset_timestep(newstep); } @@ -475,7 +470,7 @@ void Update::reset_timestep(int narg, char **arg) void Update::reset_timestep(bigint newstep) { - if (newstep < 0) error->all(FLERR,"Timestep must be >= 0"); + if (newstep < 0) error->all(FLERR, "Timestep must be >= 0"); bigint oldstep = ntimestep; ntimestep = newstep; @@ -499,7 +494,7 @@ void Update::reset_timestep(bigint newstep) for (const auto &ifix : modify->get_fix_list()) if (ifix->time_depend) - error->all(FLERR, "Cannot reset timestep with time-dependent fix {} defined",ifix->style); + error->all(FLERR, "Cannot reset timestep with time-dependent fix {} defined", ifix->style); // reset eflag/vflag global so no commands will think eng/virial are current @@ -529,7 +524,7 @@ void Update::reset_timestep(bigint newstep) void Update::update_time() { - atime += (ntimestep-atimestep) * dt; + atime += (ntimestep - atimestep) * dt; atimestep = ntimestep; } @@ -540,7 +535,9 @@ void Update::update_time() double Update::memory_usage() { double bytes = 0; - if (whichflag == 1) bytes += integrate->memory_usage(); - else if (whichflag == 2) bytes += minimize->memory_usage(); + if (whichflag == 1) + bytes += integrate->memory_usage(); + else if (whichflag == 2) + bytes += minimize->memory_usage(); return bytes; } diff --git a/src/update.h b/src/update.h index b3fd1e4a3d..f763dfa559 100644 --- a/src/update.h +++ b/src/update.h @@ -60,7 +60,7 @@ class Update : protected Pointers { MinimizeCreatorMap *minimize_map; Update(class LAMMPS *); - ~Update(); + ~Update() override; void init(); void set_units(const char *); void create_integrate(int, char **, int); @@ -73,9 +73,6 @@ class Update : protected Pointers { private: void new_integrate(char *, int, char **, int, int &); void new_minimize(char *, int, char **, int, int &); - - template static Integrate *integrate_creator(LAMMPS *, int, char **); - template static Min *minimize_creator(LAMMPS *); }; } // namespace LAMMPS_NS diff --git a/src/utils.cpp b/src/utils.cpp index eabe86adbc..ed119db886 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -22,10 +22,9 @@ #include "memory.h" #include "modify.h" #include "text_file_reader.h" -#include "tokenizer.h" #include "update.h" +#include "universe.h" -#include #include #include #include @@ -138,6 +137,14 @@ void utils::fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_ar } } +void utils::flush_buffers(LAMMPS *lmp) +{ + if (lmp->screen) fflush(lmp->screen); + if (lmp->logfile) fflush(lmp->logfile); + if (lmp->universe->uscreen) fflush(lmp->universe->uscreen); + if (lmp->universe->ulogfile) fflush(lmp->universe->ulogfile); +} + /* define this here, so we won't have to include the headers everywhere and utils.h will more likely be included anyway. */ @@ -1028,7 +1035,7 @@ std::vector utils::split_words(const std::string &text) ------------------------------------------------------------------------- */ std::vector utils::split_lines(const std::string &text) { - return Tokenizer(text, "\n").as_vector(); + return Tokenizer(text, "\r\n").as_vector(); } /* ---------------------------------------------------------------------- diff --git a/src/utils.h b/src/utils.h index 47a4ace5f9..6811dbe874 100644 --- a/src/utils.h +++ b/src/utils.h @@ -74,6 +74,16 @@ namespace utils { void logmesg(LAMMPS *lmp, const std::string &mesg); + /*! Flush output buffers + * + * This function calls fflush() on screen and logfile FILE pointers + * if available and thus tells the operating system to output all + * currently buffered data. This is local operation and independent + * from buffering by a file system or an MPI library. + */ + + void flush_buffers(LAMMPS *lmp); + /*! Return a string representing the current system error status * * This is a wrapper around calling strerror(errno). diff --git a/src/variable.h b/src/variable.h index dbad793b57..7b51b45f38 100644 --- a/src/variable.h +++ b/src/variable.h @@ -23,7 +23,7 @@ class Variable : protected Pointers { public: Variable(class LAMMPS *); - ~Variable(); + ~Variable() override; void set(int, char **); void set(const std::string &); void set(char *, int, char **); @@ -152,7 +152,7 @@ class VarReader : protected Pointers { char *id_fix; VarReader(class LAMMPS *, char *, char *, int); - ~VarReader(); + ~VarReader() override; int read_scalar(char *); int read_peratom(); diff --git a/src/velocity.h b/src/velocity.h index cce8508021..2f27cd9152 100644 --- a/src/velocity.h +++ b/src/velocity.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class Velocity : public Command { public: Velocity(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; void init_external(const char *); void options(int, char **); void create(double, int); diff --git a/src/verlet.h b/src/verlet.h index 4348bcfa07..e93f5917de 100644 --- a/src/verlet.h +++ b/src/verlet.h @@ -27,12 +27,12 @@ namespace LAMMPS_NS { class Verlet : public Integrate { public: Verlet(class LAMMPS *, int, char **); - virtual ~Verlet() {} - virtual void init(); - virtual void setup(int flag); - virtual void setup_minimal(int); - virtual void run(int); - void cleanup(); + + void init() override; + void setup(int flag) override; + void setup_minimal(int) override; + void run(int) override; + void cleanup() override; protected: int triclinic; // 0 if domain is orthog, 1 if triclinic diff --git a/src/version.h b/src/version.h index c33ca6ee15..4dcabb6280 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "7 Jan 2022" +#define LAMMPS_VERSION "17 Feb 2022" diff --git a/src/write_coeff.h b/src/write_coeff.h index d6a447080f..5381a9fe0b 100644 --- a/src/write_coeff.h +++ b/src/write_coeff.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class WriteCoeff : public Command { public: WriteCoeff(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/write_data.h b/src/write_data.h index d62f048894..023d270b43 100644 --- a/src/write_data.h +++ b/src/write_data.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class WriteData : public Command { public: WriteData(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; void write(const std::string &); private: diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 53ab80149a..19826eba1b 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -68,6 +68,7 @@ void WriteDump::command(int narg, char **arg) #undef DUMP_CLASS } else error->all(FLERR,utils::check_packages_for_style("dump",arg[1],lmp)); + delete[] dumpargs; if (modindex < narg) dump->modify_params(narg-modindex-1,&arg[modindex+1]); @@ -89,5 +90,4 @@ void WriteDump::command(int narg, char **arg) // delete the Dump instance and local storage delete dump; - delete [] dumpargs; } diff --git a/src/write_dump.h b/src/write_dump.h index bea5660a29..c2e75b2484 100644 --- a/src/write_dump.h +++ b/src/write_dump.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class WriteDump : public Command { public: WriteDump(class LAMMPS *lmp) : Command(lmp){}; - void command(int, char **); + void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/write_restart.h b/src/write_restart.h index 54d90405b2..a01d61863c 100644 --- a/src/write_restart.h +++ b/src/write_restart.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class WriteRestart : public Command { public: WriteRestart(class LAMMPS *); - void command(int, char **); + void command(int, char **) override; void multiproc_options(int, int, int, char **); void write(const std::string &); diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index dfa81e8a6e..d3c5dba1b5 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -29,7 +29,6 @@ // g++ -g -DLAMMPS_BIGBIG binarytxt.o -o binary2txt // again -DLAMMPS_SMALLBIG is the default -#include #define __STDC_FORMAT_MACROS #include diff --git a/tools/eam_database/EAM_code b/tools/eam_database/EAM_code index 6968a03aff..d339c87ab4 100644 --- a/tools/eam_database/EAM_code +++ b/tools/eam_database/EAM_code @@ -446,3 +446,31 @@ Zr 1.0 0.85 1.15 +Cr +2.493879 +1.793835 +17.641302 +19.60545 +8.604593 +7.170494 +1.551848 +1.827556 +0.18533 +0.277995 +-2.022754 +0.039608 +-0.183611 +-2.245972 +-2.02 +0.00 +-0.056517 +0.439144 +0.456 +-2.020038 +24 +51.9961 +0.439144 +7.170494 +0.277995 +0.85 +1.15 diff --git a/tools/eam_database/README b/tools/eam_database/README index 8d42eb7a12..21f1fe15d1 100644 --- a/tools/eam_database/README +++ b/tools/eam_database/README @@ -1,22 +1,52 @@ EAM database tool -Xiaowang Zhou (Sandia), xzhou at sandia.gov -based on this paper: +Fortran version (create.f) by Xiaowang Zhou (Sandia), xzhou at sandia.gov +with revisions by Lucas Hale lucas.hale at nist.gov from https://www.ctcms.nist.gov/potentials/entry/2004--Zhou-X-W-Johnson-R-A-Wadley-H-N-G--Al/ + +Python version (create_eam.py) by Germain Clavier germain.clavier at gmail.com + +Most parameters based on this paper: X. W. Zhou, R. A. Johnson, and H. N. G. Wadley, Phys. Rev. B, 69, 144113 (2004). +Parameters for Cr were taken from: +Lin Z B, Johnson R A and Zhigilei L V, Phys. Rev. B 77 214108 (2008) + This tool can be used to create an DYNAMO-formatted EAM -setfl file for alloy systems, using any combination +setfl file for alloy systems, using any combination of the elements discussed in the paper and listed in the EAM_code file, namely: -Cu, Ag, Au, Ni, Pd, Pt, Al, Pb, Fe, Mo, Ta, W, Mg, Co, Ti, Zr +Cu, Ag, Au, Ni, Pd, Pt, Al, Pb, Fe, Mo, Ta, W, Mg, Co, Ti, Zr, Cr -Steps: +WARNING: Please note that the parameter sets used here are all optimized +for the pure metals of the individual elements and that mixing rules will +be applied for creating the inter-element interactions. Those are inferior +to models where the mixed terms were specifically optimized for particular +alloys. Thus any potential files created with this tool should be used +with care and test calculations (e.g. on multiple binary mixtures) performed +to gauge the error. + +Steps (create.f): 1) compile create.f -> a.out (e.g. gfortran create.f) 2) edit the input file EAM.input to list 2 or more desired elements to include -3) a.out < EAM.input will create an EAM *.set file -4) in DYNAMO or LAMMPS lingo, this is a setfl file - that can be used with the LAMMPS pair_style eam/alloy command +3) a.out < EAM.input will create an *.eam.alloy potential file + +Steps (create_eam.py): + +Usage: create_eam.py [-h] [-n NAME [NAME ...]] [-nr NR] [-nrho NRHO] + +options: + -n NAME [NAME ...], --names NAME [NAME ...] + Element names + -nr NR Number of point in r space [default 2000] + -nrho NRHO Number of point in rho space [default 2000] + +1) you must have numpy installed +2) run "python create_eam.py -n Ta Cu" with the list of desired elements +3) this will create an *.eam.alloy potential file + +in DYNAMO or LAMMPS context the created file is referred to as a setfl file + that can be used with the LAMMPS pair_style eam/alloy command diff --git a/tools/eam_database/create.f b/tools/eam_database/create.f index 528b4251db..54b0d55ab7 100644 --- a/tools/eam_database/create.f +++ b/tools/eam_database/create.f @@ -1,4 +1,5 @@ C author: X. W. Zhou, xzhou@sandia.gov +C updates by: Lucas Hale lucas.hale@nist.gov c open(unit=5,file='a.i') call inter c close(5) @@ -9,6 +10,8 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c main subroutine. c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine inter + implicit real*8 (a-h,o-z) + implicit integer (i-m) character*80 atomtype,atommatch,outfile,outelem namelist /funccard/ atomtype common /pass1/ re(16),fe(16),rhoe(16),alpha(16), @@ -17,9 +20,9 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc * Fm0(16),Fm1(16),Fm2(16),Fm3(16),Fm4(16), * fnn(16),Fn(16),rhoin(16),rhoout(16),rhol(16), * rhoh(16),rhos(16) - common /pass2/ ielement(16),amass(16),Fr(5000,16), - * rhor(5000,16),z2r(5000,16,16),ntypes,blat(16), - * nrho,drho,nr,dr,rc,outfile,outelem + common /pass2/ amass(16),Fr(5000,16),rhor(5000,16), + * z2r(5000,16,16),blat(16),drho,dr,rc,outfile,outelem + common /pass3/ ielement(16),ntypes,nrho,nr ntypes=0 10 continue atomtype='none' @@ -69,7 +72,7 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc read(10,*) ramda1(ntypes) read(10,*) rhol(ntypes) read(10,*) rhoh(ntypes) - blat(ntypes)=sqrt(2.0)*re(ntypes) + blat(ntypes)=sqrt(2.0_8)*re(ntypes) rhoin(ntypes)=rhol(ntypes)*rhoe(ntypes) rhoout(ntypes)=rhoh(ntypes)*rhoe(ntypes) else @@ -91,15 +94,15 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc if (alatmax .lt. blat(i)) alatmax=blat(i) if (rhoemax .lt. rhoe(i)) rhoemax=rhoe(i) 2 continue - rc=sqrt(10.0)/2.0*alatmax - rst=0.5 - dr=rc/(nr-1.0) - fmax=-1.0 + rc=sqrt(10.0_8)/2.0_8*alatmax + rst=0.5_8 + dr=rc/(nr-1.0_8) + fmax=-1.0_8 do i1=1,ntypes do i2=1,i1 if ( i1 .eq. i2) then do i=1,nr - r=(i-1.0)*dr + r=(i-1.0_8)*dr if (r .lt. rst) r=rst call prof(i1,r,fvalue) if (fmax .lt. fvalue) fmax=fvalue @@ -109,7 +112,7 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc end do else do i=1,nr - r=(i-1.0)*dr + r=(i-1.0_8)*dr if (r .lt. rst) r=rst call pair(i1,i2,r,psi) z2r(i,i1,i2)=r*psi @@ -119,12 +122,13 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc end do end do rhom=fmax - if (rhom .lt. 2.0*rhoemax) rhom=2.0*rhoemax - if (rhom .lt. 100.0) rhom=100.0 - drho=rhom/(nrho-1.0) + if (rhom .lt. 2.0_8*rhoemax) rhom=2.0_8*rhoemax + if (rhom .lt. 100.0_8) rhom=100.0_8 + drho=rhom/(nrho-1.0_8) do 6 it=1,ntypes do 7 i=1,nrho - rhoF=(i-1.0)*drho + rhoF=(i-1)*drho + if (i .eq. 1) rhoF=0.0_8 call embed(it,rhoF,emb) Fr(i,it)=emb 7 continue @@ -135,20 +139,24 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c This subroutine calculates the electron density. c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine prof(it,r,f) + implicit real*8 (a-h,o-z) + implicit integer (i-m) common /pass1/ re(16),fe(16),rhoe(16),alpha(16), * beta(16),beta1(16),A(16),B(16),cai(16),ramda(16), * ramda1(16),Fi0(16),Fi1(16),Fi2(16),Fi3(16), * Fm0(16),Fm1(16),Fm2(16),Fm3(16),Fm4(16), * fnn(16),Fn(16),rhoin(16),rhoout(16),rhol(16), * rhoh(16),rhos(16) - f=fe(it)*exp(-beta1(it)*(r/re(it)-1.0)) - f=f/(1.0+(r/re(it)-ramda1(it))**20) + f=fe(it)*exp(-beta1(it)*(r/re(it)-1.0_8)) + f=f/(1.0_8+(r/re(it)-ramda1(it))**20) return end ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c This subroutine calculates the pair potential. c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine pair(it1,it2,r,psi) + implicit real*8 (a-h,o-z) + implicit integer (i-m) common /pass1/ re(16),fe(16),rhoe(16),alpha(16), * beta(16),beta1(16),A(16),B(16),cai(16),ramda(16), * ramda1(16),Fi0(16),Fi1(16),Fi2(16),Fi3(16), @@ -156,25 +164,25 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc * fnn(16),Fn(16),rhoin(16),rhoout(16),rhol(16), * rhoh(16),rhos(16) if (it1 .eq. it2) then - psi1=A(it1)*exp(-alpha(it1)*(r/re(it1)-1.0)) - psi1=psi1/(1.0+(r/re(it1)-cai(it1))**20) - psi2=B(it1)*exp(-beta(it1)*(r/re(it1)-1.0)) - psi2=psi2/(1.0+(r/re(it1)-ramda(it1))**20) + psi1=A(it1)*exp(-alpha(it1)*(r/re(it1)-1.0_8)) + psi1=psi1/(1.0_8+(r/re(it1)-cai(it1))**20) + psi2=B(it1)*exp(-beta(it1)*(r/re(it1)-1.0_8)) + psi2=psi2/(1.0_8+(r/re(it1)-ramda(it1))**20) psi=psi1-psi2 else - psi1=A(it1)*exp(-alpha(it1)*(r/re(it1)-1.0)) - psi1=psi1/(1.0+(r/re(it1)-cai(it1))**20) - psi2=B(it1)*exp(-beta(it1)*(r/re(it1)-1.0)) - psi2=psi2/(1.0+(r/re(it1)-ramda(it1))**20) + psi1=A(it1)*exp(-alpha(it1)*(r/re(it1)-1.0_8)) + psi1=psi1/(1.0_8+(r/re(it1)-cai(it1))**20) + psi2=B(it1)*exp(-beta(it1)*(r/re(it1)-1.0_8)) + psi2=psi2/(1.0_8+(r/re(it1)-ramda(it1))**20) psia=psi1-psi2 - psi1=A(it2)*exp(-alpha(it2)*(r/re(it2)-1.0)) - psi1=psi1/(1.0+(r/re(it2)-cai(it2))**20) - psi2=B(it2)*exp(-beta(it2)*(r/re(it2)-1.0)) - psi2=psi2/(1.0+(r/re(it2)-ramda(it2))**20) + psi1=A(it2)*exp(-alpha(it2)*(r/re(it2)-1.0_8)) + psi1=psi1/(1.0_8+(r/re(it2)-cai(it2))**20) + psi2=B(it2)*exp(-beta(it2)*(r/re(it2)-1.0_8)) + psi2=psi2/(1.0_8+(r/re(it2)-ramda(it2))**20) psib=psi1-psi2 call prof(it1,r,f1) call prof(it2,r,f2) - psi=0.5*(f2/f1*psia+f1/f2*psib) + psi=0.5_8*(f2/f1*psia+f1/f2*psib) endif return end @@ -182,6 +190,8 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c This subroutine calculates the embedding energy. c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine embed(it,rho,emb) + implicit real*8 (a-h,o-z) + implicit integer (i-m) common /pass1/ re(16),fe(16),rhoe(16),alpha(16), * beta(16),beta1(16),A(16),B(16),cai(16),ramda(16), * ramda1(16),Fi0(16),Fi1(16),Fi2(16),Fi3(16), @@ -193,18 +203,20 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc else Fm33=Fm4(it) endif - if (rho .lt. rhoin(it)) then + if (rho .eq. 0.0_8) then + emb = 0.0_8 + else if (rho .lt. rhoin(it)) then emb=Fi0(it)+ - * Fi1(it)*(rho/rhoin(it)-1.0)+ - * Fi2(it)*(rho/rhoin(it)-1.0)**2+ - * Fi3(it)*(rho/rhoin(it)-1.0)**3 + * Fi1(it)*(rho/rhoin(it)-1.0_8)+ + * Fi2(it)*(rho/rhoin(it)-1.0_8)**2+ + * Fi3(it)*(rho/rhoin(it)-1.0_8)**3 else if (rho .lt. rhoout(it)) then emb=Fm0(it)+ - * Fm1(it)*(rho/rhoe(it)-1.0)+ - * Fm2(it)*(rho/rhoe(it)-1.0)**2+ - * Fm33*(rho/rhoe(it)-1.0)**3 + * Fm1(it)*(rho/rhoe(it)-1.0_8)+ + * Fm2(it)*(rho/rhoe(it)-1.0_8)**2+ + * Fm33*(rho/rhoe(it)-1.0_8)**3 else - emb=Fn(it)*(1.0-fnn(it)*log(rho/rhos(it)))* + emb=Fn(it)*(1.0_8-fnn(it)*log(rho/rhos(it)))* * (rho/rhos(it))**fnn(it) endif return @@ -213,6 +225,8 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c write out set file. c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine writeset + implicit real*8 (a-h,o-z) + implicit integer (i-m) character*80 outfile,outelem common /pass1/ re(16),fe(16),rhoe(16),alpha(16), * beta(16),beta1(16),A(16),B(16),cai(16),ramda(16), @@ -220,16 +234,21 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc * Fm0(16),Fm1(16),Fm2(16),Fm3(16),Fm4(16), * fnn(16),Fn(16),rhoin(16),rhoout(16),rhol(16), * rhoh(16),rhos(16) - common /pass2/ ielement(16),amass(16),Fr(5000,16), - * rhor(5000,16),z2r(5000,16,16),ntypes,blat(16), - * nrho,drho,nr,dr,rc,outfile,outelem + common /pass2/ amass(16),Fr(5000,16),rhor(5000,16), + * z2r(5000,16,16),blat(16),drho,dr,rc,outfile,outelem + common /pass3/ ielement(16),ntypes,nrho,nr character*80 struc + character(8) date struc='fcc' - outfile = outfile(1:index(outfile,' ')-1)//'.set' + outfile = outfile(1:index(outfile,' ')-1)//'.eam.alloy' open(unit=1,file=outfile) - write(1,*) - write(1,*) - write(1,*) + call date_and_time(DATE=date) + write(1,*) 'DATE: ',date(1:4),'-',date(5:6),'-',date(7:8), + * ' UNITS: metal CONTRIBUTOR: Xiaowang Zhou xzhou@sandia.gov and ', + * 'Lucas Hale lucas.hale@nist.gov ' + write(1,*) 'CITATION: X. W. Zhou, R. A. Johnson, ', + * 'H. N. G. Wadley, Phys. Rev. B, 69, 144113(2004)' + write(1,*) 'Generated by create.f' write(1,8)ntypes,outelem 8 format(i5,' ',a24) write(1,9)nrho,drho,nr,dr,rc diff --git a/tools/eam_database/create_eam.py b/tools/eam_database/create_eam.py new file mode 100644 index 0000000000..8b230b87b4 --- /dev/null +++ b/tools/eam_database/create_eam.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Python version of the code Zhou04_create_v2.f +original author: X. W. Zhou, xzhou@sandia.gov +based on updates by: Lucas Hale lucas.hale@nist.gov +written by: Germain Clavier g.m.g.c.clavier@tue.nl +This script requires the numpy library. +""" + +import sys +import argparse as ap +from datetime import date + +import numpy as np +from eamDatabase import Database + +def prof(at, r): + atom = Database[at] + f = np.zeros(r.shape) + f = atom.fe * np.exp(-atom.beta1 * (r[r >= 0.5] / atom.re - 1.0)) + f = f / (1.0 + (r / atom.re - atom.ramda1) ** 20) + return f + + +def pair(at1, at2, r): + atom = Database[at1] + psi1 = atom.A * np.exp(-atom.alpha * (r / atom.re - 1.0)) + psi1 /= 1.0 + (r / atom.re - atom.cai) ** 20 + psi2 = atom.B * np.exp(-atom.beta * (r / atom.re - 1.0)) + psi2 /= 1.0 + (r / atom.re - atom.ramda) ** 20 + if at1 == at2: + psi = psi1 - psi2 + else: + psia = psi1 - psi2 + atom2 = Database[at2] + psi1 = atom2.A * np.exp(-atom2.alpha * (r / atom2.re - 1.0)) + psi1 /= 1.0 + (r / atom2.re - atom2.cai) ** 20 + psi2 = atom2.B * np.exp(-atom2.beta * (r / atom2.re - 1.0)) + psi2 /= 1.0 + (r / atom2.re - atom2.ramda) ** 20 + psib = psi1 - psi2 + prof1 = prof(at1, r) + prof2 = prof(at2, r) + psi = 0.5 * (prof2 / prof1 * psia + prof1 / prof2 * psib) + return psi + + +def embed(at, rho): + atom = Database[at] + Fm33 = np.zeros(rho.shape) + Fm33[rho < atom.rhoe] = atom.Fm3 + Fm33[rho >= atom.rhoe] = atom.Fm4 + emb = np.zeros(rho.shape) + for i, r in enumerate(rho): + if r == 0: + emb[i] = 0 + elif r < atom.rhoin: + dr = r / atom.rhoin - 1 + emb[i] = atom.Fi0 + atom.Fi1 * dr + atom.Fi2 * dr**2 + atom.Fi3 * dr**3 + elif r < atom.rhoout: + dr = r / atom.rhoe - 1 + emb[i] = atom.Fm0 + atom.Fm1 * dr + atom.Fm2 * dr**2 + Fm33[i] * dr**3 + else: + dr = r / atom.rhos + emb[i] = atom.Fn * (1.0 - atom.fnn * np.log(dr)) * dr**atom.fnn + return emb + +def write_file(attypes, filename, Fr, rhor, z2r, nrho, drho, nr, dr, rc): + struc = "fcc" + with open(filename, "w") as f: + f.write("DATE: " + date.today().strftime("%Y-%m-%d") + " UNITS: metal") + f.write(" CONTRIBUTOR: Xiaowang Zhou xzhou@sandia.gov, Lucas Hale lucas.hale@nist.gov,") + f.write(" and Germain Clavier g.m.g.c.clavier@tue.nl/germain.clavier@gmail.com\n") + f.write(" CITATION: X. W. Zhou, R. A. Johnson, H. N. G. Wadley, Phys. Rev. B, 69, 144113(2004)\n") + f.write("Generated by create_eam.py\n") + f.write("{:<5d} {:<24}\n".format(len(attypes), " ".join(attypes))) + f.write("{:<5d} {:<24.16e} {:<5d} {:<24.16e} {:<24.16e}\n".format(nrho, drho, nr, dr, rc)) + for at in attypes: + atom = Database[at] + f.write( + "{:>5d} {:>15.5f} {:>15.5f} {:>8}\n".format( + atom.ielement, atom.amass, atom.blat, struc + ) + ) + for i, fr in enumerate(Fr[at]): + f.write(" {:>24.16E}".format(fr)) + if not (i + 1) % 5: + f.write("\n") + for i, rho in enumerate(rhor[at]): + f.write(" {:>24.16E}".format(rho)) + if not (i + 1) % 5: + f.write("\n") + for n1 in range(len(attypes)): + for n2 in range(n1 + 1): + for i, z in enumerate(z2r[n1, n2]): + f.write(" {:>24.16E}".format(z)) + if not (i + 1) % 5: + f.write("\n") + +def create_eam(argv=None): + parser = ap.ArgumentParser(description="Script to create EAM alloy potential files.") + + parser.add_argument("-n", "--names", dest="name", nargs="+", + help="Element names") + parser.add_argument("-nr", dest="nr", type=int, default=2000, + help="Number of point in r space [default 2000]") + parser.add_argument("-nrho", dest="nrho", type=int, default=2000, + help="Number of point in rho space [default 2000]") + args = parser.parse_args(argv) + if not args.name: + parser.print_help() + sys.exit("") + + atnames = args.name + nr = args.nr + nrho = args.nrho + + for n in atnames: + try: + Database[n] + except KeyError: + output = "Element {} not found in database.\n".format(n) + valid = "Supported elements are: {}".format(" ".join(Database.keys())) + sys.exit("".join([output, valid])) + + ntypes = len(atnames) + outfilename = "".join([*atnames, ".eam.alloy"]) + rhor = {} + Fr = {} + + alatmax = max([Database[at].blat for at in atnames]) + rhoemax = max([Database[at].rhoe for at in atnames]) + rc = np.sqrt(10.0) / 2.0 * alatmax + rst = 0.5 + r = np.linspace(0.0, rc, num=nr, dtype=np.double) + dr = r[1] - r[0] + r[r < rst] = rst + z2r = np.zeros([ntypes, ntypes, nr]) + rhomax = -np.inf + + for i, n1 in enumerate(atnames): + for j, n2 in enumerate(atnames): + if j > i: + continue + if i == j: + rhor[n1] = prof(n1, r) + rhomax = max(rhomax,np.max(rhor[n1])) + z2r[i, j, :] = r * pair(n1, n2, r) + else: + z2r[i, j, :] = r * pair(n1, n2, r) + z2r = np.where(z2r, z2r, z2r.transpose((1, 0, 2))) + rhomax = max(rhomax, 2.0 * rhoemax, 100.0) + rho = np.linspace(0.0, rhomax, num=nrho, dtype=np.double) + drho = rho[1] - rho[0] + for i, n1 in enumerate(atnames): + Fr[n1] = embed(n1, rho) + + write_file(atnames, outfilename, Fr, rhor, z2r, nrho, drho, nr, dr, rc) + +if __name__ == "__main__": + try: + create_eam(sys.argv[1:]) + except KeyboardInterrupt as exc: + raise SystemExit("User interruption.") from exc diff --git a/tools/eam_database/eamDatabase.py b/tools/eam_database/eamDatabase.py new file mode 100644 index 0000000000..db70b7d2b7 --- /dev/null +++ b/tools/eam_database/eamDatabase.py @@ -0,0 +1,640 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Python version of the code Zhou04_create_v2.f +original author: X. W. Zhou, xzhou@sandia.gov +based on updates by: Lucas Hale lucas.hale@nist.gov +written by: Germain Clavier g.m.g.c.clavier@tue.nl + +This file contains atom attributes for the EAM model and alloy combination. The +original file is EAM_code. It is designed to be used with create_eam.py script. +To add new contribution, just add new AtType instances. +""" + +import math + +class AtType: + def __init__( + self, + name, + re, + fe, + rhoe, + rhos, + alpha, + beta, + A, + B, + cai, + ramda, + Fi0, + Fi1, + Fi2, + Fi3, + Fm0, + Fm1, + Fm2, + Fm3, + fnn, + Fn, + ielement, + amass, + Fm4, + beta1, + ramda1, + rhol, + rhoh, + ): + self.name = name + self.re = re + self.fe = fe + self.rhoe = rhoe + self.rhos = rhos + self.alpha = alpha + self.beta = beta + self.A = A + self.B = B + self.cai = cai + self.ramda = ramda + self.Fi0 = Fi0 + self.Fi1 = Fi1 + self.Fi2 = Fi2 + self.Fi3 = Fi3 + self.Fm0 = Fm0 + self.Fm1 = Fm1 + self.Fm2 = Fm2 + self.Fm3 = Fm3 + self.fnn = fnn + self.Fn = Fn + self.ielement = ielement + self.amass = amass + self.Fm4 = Fm4 + self.beta1 = beta1 + self.ramda1 = ramda1 + self.rhol = rhol + self.rhoh = rhoh + self.blat = math.sqrt(2.0) * self.re + self.rhoin = self.rhol * self.rhoe + self.rhoout = self.rhoh * self.rhoe + + def __repr__(self): + output = """{}: + re = {}; fe = {} + rhoe = {}; rhos = {}; + alpha = {}; beta = {}; + A = {}; B = {} + cai = {}; ramda = {} + Fi0 = {}; Fi1 = {}; Fi2 = {}; Fi3 = {} + Fm0 = {}; Fm1 = {}; Fm2 = {}; Fm3 = {}; Fm4 = {} + fnn = {}; Fn = {} + ielement = {}; amass = {} + beta1 = {}; ramda1 = {} + rhol = {}; rhoh = {} + blat = {}; rhoin = {}; rhoout = {}""" + return output.format( + self.name, + self.re, + self.fe, + self.rhoe, + self.rhos, + self.alpha, + self.beta, + self.A, + self.B, + self.cai, + self.ramda, + self.Fi0, + self.Fi1, + self.Fi2, + self.Fi3, + self.Fm0, + self.Fm1, + self.Fm2, + self.Fm3, + self.Fm4, + self.fnn, + self.Fn, + self.ielement, + self.amass, + self.beta1, + self.ramda1, + self.rhol, + self.rhoh, + self.blat, + self.rhoin, + self.rhoout, + ) + + +Database = {} +Database["Cu"] = AtType( + "Cu", # Name + 2.556162, # re + 1.554485, # fe + 21.175871, # rhoe + 21.175395, # rhos + 8.127620, # alpha + 4.334731, # beta + 0.396620, # A + 0.548085, # B + 0.308782, # cai + 0.756515, # ramda + -2.170269, # Fi0 + -0.263788, # Fi1 + 1.088878, # Fi2 + -0.817603, # Fi3 + -2.19, # Fm0 + 0.00, # Fm1 + 0.561830, # Fm2 + -2.100595, # Fm3 + 0.310490, # fnn + -2.186568, # Fn + 29, # ielement + 63.546, # amass + -2.100595, # Fm4 + 4.334731, # beta1 + 0.756515, # ramda1 + 0.85, # rhol + 1.15, # rhoh +) +Database["Ag"] = AtType( + "Ag", + 2.891814, + 1.106232, + 14.604100, + 14.604144, + 9.132010, + 4.870405, + 0.277758, + 0.419611, + 0.339710, + 0.750758, + -1.729364, + -0.255882, + 0.912050, + -0.561432, + -1.75, + 0.00, + 0.744561, + -1.150650, + 0.783924, + -1.748423, + 47, + 107.8682, + -1.150650, + 4.870405, + 0.750758, + 0.85, + 1.15, +) +Database["Au"] = AtType( + "Au", + 2.885034, + 1.529021, + 19.991632, + 19.991509, + 9.516052, + 5.075228, + 0.229762, + 0.356666, + 0.356570, + 0.748798, + -2.937772, + -0.500288, + 1.601954, + -0.835530, + -2.98, + 0.00, + 1.706587, + -1.134778, + 1.021095, + -2.978815, + 79, + 196.96654, + -1.134778, + 5.075228, + 0.748798, + 0.85, + 1.15, +) +Database["Ni"] = AtType( + "Ni", + 2.488746, + 2.007018, + 27.562015, + 27.562031, + 8.383453, + 4.471175, + 0.429046, + 0.633531, + 0.443599, + 0.820658, + -2.693513, + -0.076445, + 0.241442, + -2.375626, + -2.70, + 0.00, + 0.265390, + -0.152856, + 0.445470, + -2.7, + 28, + 58.6934, + -0.152856, + 4.471175, + 0.820658, + 0.85, + 1.15, +) +Database["Pd"] = AtType( + "Pd", + 2.750897, + 1.595417, + 21.335246, + 21.940073, + 8.697397, + 4.638612, + 0.406763, + 0.598880, + 0.397263, + 0.754799, + -2.321006, + -0.473983, + 1.615343, + -0.231681, + -2.36, + 0.00, + 1.481742, + -1.675615, + 1.130000, + -2.352753, + 46, + 106.42, + -1.675615, + 4.638612, + 0.754799, + 0.85, + 1.15, +) +Database["Pt"] = AtType( + "Pt", + 2.771916, + 2.336509, + 33.367564, + 35.205357, + 7.105782, + 3.789750, + 0.556398, + 0.696037, + 0.385255, + 0.770510, + -1.455568, + -2.149952, + 0.528491, + 1.222875, + -4.17, + 0.00, + 3.010561, + -2.420128, + 1.450000, + -4.145597, + 78, + 195.08, + -2.420128, + 3.789750, + 0.770510, + 0.25, + 1.15, +) +Database["Al"] = AtType( + "Al", + 2.863924, + 1.403115, + 20.418205, + 23.195740, + 6.613165, + 3.527021, + 0.314873, + 0.365551, + 0.379846, + 0.759692, + -2.807602, + -0.301435, + 1.258562, + -1.247604, + -2.83, + 0.00, + 0.622245, + -2.488244, + 0.785902, + -2.824528, + 13, + 26.981539, + -2.488244, + 3.527021, + 0.759692, + 0.85, + 1.15, +) +Database["Pb"] = AtType( + "Pb", + 3.499723, + 0.647872, + 8.450154, + 8.450063, + 9.121799, + 5.212457, + 0.161219, + 0.236884, + 0.250805, + 0.764955, + -1.422370, + -0.210107, + 0.682886, + -0.529378, + -1.44, + 0.00, + 0.702726, + -0.538766, + 0.935380, + -1.439436, + 82, + 207.2, + -0.538766, + 5.212457, + 0.764955, + 0.85, + 1.15, +) +Database["Fe"] = AtType( + "Fe", + 2.481987, + 1.885957, + 20.041463, + 20.041463, + 9.818270, + 5.236411, + 0.392811, + 0.646243, + 0.170306, + 0.340613, + -2.534992, + -0.059605, + 0.193065, + -2.282322, + -2.54, + 0.00, + 0.200269, + -0.148770, + 0.391750, + -2.539945, + 26, + 55.847, + -0.148770, + 5.236411, + 0.340613, + 0.85, + 1.15, +) +Database["Mo"] = AtType( + "Mo", + 2.728100, + 2.723710, + 29.354065, + 29.354065, + 8.393531, + 4.476550, + 0.708787, + 1.120373, + 0.137640, + 0.275280, + -3.692913, + -0.178812, + 0.380450, + -3.133650, + -3.71, + 0.00, + 0.875874, + 0.776222, + 0.790879, + -3.712093, + 42, + 95.94, + 0.776222, + 4.476550, + 0.275280, + 0.85, + 1.15, +) +Database["Ta"] = AtType( + "Ta", + 2.860082, + 3.086341, + 33.787168, + 33.787168, + 8.489528, + 4.527748, + 0.611679, + 1.032101, + 0.176977, + 0.353954, + -5.103845, + -0.405524, + 1.112997, + -3.585325, + -5.14, + 0.00, + 1.640098, + 0.221375, + 0.848843, + -5.141526, + 73, + 180.9479, + 0.221375, + 4.527748, + 0.353954, + 0.85, + 1.15, +) +Database["W"] = AtType( + "W", + 2.740840, + 3.487340, + 37.234847, + 37.234847, + 8.900114, + 4.746728, + 0.882435, + 1.394592, + 0.139209, + 0.278417, + -4.946281, + -0.148818, + 0.365057, + -4.432406, + -4.96, + 0.00, + 0.661935, + 0.348147, + 0.582714, + -4.961306, + 74, + 183.84, + 0.348147, + 4.746728, + 0.278417, + 0.85, + 1.15, +) +Database["Mg"] = AtType( + "Mg", + 3.196291, + 0.544323, + 7.132600, + 7.132600, + 10.228708, + 5.455311, + 0.137518, + 0.225930, + 0.5, + 1.0, + -0.896473, + -0.044291, + 0.162232, + -0.689950, + -0.90, + 0.00, + 0.122838, + -0.226010, + 0.431425, + -0.899702, + 12, + 24.305, + -0.226010, + 5.455311, + 1.0, + 0.85, + 1.15, +) +Database["Co"] = AtType( + "Co", + 2.505979, + 1.975299, + 27.206789, + 27.206789, + 8.679625, + 4.629134, + 0.421378, + 0.640107, + 0.5, + 1.0, + -2.541799, + -0.219415, + 0.733381, + -1.589003, + -2.56, + 0.00, + 0.705845, + -0.687140, + 0.694608, + -2.559307, + 27, + 58.9332, + -0.687140, + 4.629134, + 1.0, + 0.85, + 1.15, +) +Database["Ti"] = AtType( + "Ti", + 2.933872, + 1.863200, + 25.565138, + 25.565138, + 8.775431, + 4.680230, + 0.373601, + 0.570968, + 0.5, + 1.0, + -3.203773, + -0.198262, + 0.683779, + -2.321732, + -3.22, + 0.00, + 0.608587, + -0.750710, + 0.558572, + -3.219176, + 22, + 47.88, + -0.750710, + 4.680230, + 1.0, + 0.85, + 1.15, +) +Database["Zr"] = AtType( + "Zr", + 3.199978, + 2.230909, + 30.879991, + 30.879991, + 8.559190, + 4.564902, + 0.424667, + 0.640054, + 0.5, + 1.0, + -4.485793, + -0.293129, + 0.990148, + -3.202516, + -4.51, + 0.00, + 0.928602, + -0.981870, + 0.597133, + -4.509025, + 40, + 91.224, + -0.981870, + 4.564902, + 1.0, + 0.85, + 1.15, +) +Database["Cr"] = AtType( + "Cr", + 2.493879, +1.793835, +17.641302, +19.60545, +8.604593, +7.170494, +1.551848, +1.827556, +0.18533, +0.277995, +-2.022754, +0.039608, +-0.183611, +-2.245972, +-2.02, +0.00, +-0.056517, +0.439144, +0.456, +-2.020038, +24, +51.9961, +0.439144, +7.170494, +0.277995, +0.85, +1.15 +) diff --git a/tools/eam_database/test/EAM.input b/tools/eam_database/test/EAM.input new file mode 100644 index 0000000000..4e16d7df69 --- /dev/null +++ b/tools/eam_database/test/EAM.input @@ -0,0 +1,9 @@ + &funccard + atomtype='@ELEM1@' + &end + &funccard + atomtype='@ELEM2@' + &end + &funccard + &end + diff --git a/tools/eam_database/test/EAM_code b/tools/eam_database/test/EAM_code new file mode 120000 index 0000000000..8c67aeaca3 --- /dev/null +++ b/tools/eam_database/test/EAM_code @@ -0,0 +1 @@ +../EAM_code \ No newline at end of file diff --git a/tools/eam_database/test/README b/tools/eam_database/test/README new file mode 100644 index 0000000000..4812f7526f --- /dev/null +++ b/tools/eam_database/test/README @@ -0,0 +1,2 @@ +This directory contains a systematic regression test for eam parameters +comparing the old Zhou's FORTRAN version with the new Python script. diff --git a/tools/eam_database/test/create_eam.py b/tools/eam_database/test/create_eam.py new file mode 120000 index 0000000000..610cdcbb77 --- /dev/null +++ b/tools/eam_database/test/create_eam.py @@ -0,0 +1 @@ +../create_eam.py \ No newline at end of file diff --git a/tools/eam_database/test/create_lattice.lmp b/tools/eam_database/test/create_lattice.lmp new file mode 100644 index 0000000000..78591a9145 --- /dev/null +++ b/tools/eam_database/test/create_lattice.lmp @@ -0,0 +1,20 @@ +# Creates an "NaCl like" structure in data.lmp file +# Assigns a type 2 to the second atom of a bcc lattice +# replicate the box in every direction 5x5x5=250 atoms +units metal +boundary p p p +atom_style atomic + +lattice bcc 5.4 +region Myreg block 0 1 0 1 0 1 units lattice + +create_box 2 Myreg +create_atoms 1 box + +set atom 2 type 2 + +mass * 1. + +replicate 5 5 5 + +write_data data.lmp diff --git a/tools/eam_database/test/data.lmp b/tools/eam_database/test/data.lmp new file mode 100644 index 0000000000..ee8d7530c8 --- /dev/null +++ b/tools/eam_database/test/data.lmp @@ -0,0 +1,519 @@ +LAMMPS data file via write_data, version 7 Jan 2022, timestep = 0 + +250 atoms +2 atom types + +0 27 xlo xhi +0 27 ylo yhi +0 27 zlo zhi + +Masses + +1 1 +2 1 + +Atoms # atomic + +1 1 0 0 0 0 0 0 +2 2 2.7 2.7 2.7 0 0 0 +51 1 0 0 5.4 0 0 0 +52 2 2.7 2.7 8.100000000000001 0 0 0 +101 1 0 0 10.8 0 0 0 +102 2 2.7 2.7 13.5 0 0 0 +151 1 0 0 16.200000000000003 0 0 0 +152 2 2.7 2.7 18.900000000000002 0 0 0 +201 1 0 0 21.6 0 0 0 +202 2 2.7 2.7 24.3 0 0 0 +11 1 0 5.4 0 0 0 0 +12 2 2.7 8.100000000000001 2.7 0 0 0 +61 1 0 5.4 5.4 0 0 0 +62 2 2.7 8.100000000000001 8.100000000000001 0 0 0 +111 1 0 5.4 10.8 0 0 0 +112 2 2.7 8.100000000000001 13.5 0 0 0 +161 1 0 5.4 16.200000000000003 0 0 0 +162 2 2.7 8.100000000000001 18.900000000000002 0 0 0 +211 1 0 5.4 21.6 0 0 0 +212 2 2.7 8.100000000000001 24.3 0 0 0 +21 1 0 10.8 0 0 0 0 +22 2 2.7 13.5 2.7 0 0 0 +71 1 0 10.8 5.4 0 0 0 +72 2 2.7 13.5 8.100000000000001 0 0 0 +121 1 0 10.8 10.8 0 0 0 +122 2 2.7 13.5 13.5 0 0 0 +171 1 0 10.8 16.200000000000003 0 0 0 +172 2 2.7 13.5 18.900000000000002 0 0 0 +221 1 0 10.8 21.6 0 0 0 +222 2 2.7 13.5 24.3 0 0 0 +31 1 0 16.200000000000003 0 0 0 0 +32 2 2.7 18.900000000000002 2.7 0 0 0 +81 1 0 16.200000000000003 5.4 0 0 0 +82 2 2.7 18.900000000000002 8.100000000000001 0 0 0 +131 1 0 16.200000000000003 10.8 0 0 0 +132 2 2.7 18.900000000000002 13.5 0 0 0 +181 1 0 16.200000000000003 16.200000000000003 0 0 0 +182 2 2.7 18.900000000000002 18.900000000000002 0 0 0 +231 1 0 16.200000000000003 21.6 0 0 0 +232 2 2.7 18.900000000000002 24.3 0 0 0 +41 1 0 21.6 0 0 0 0 +42 2 2.7 24.3 2.7 0 0 0 +91 1 0 21.6 5.4 0 0 0 +92 2 2.7 24.3 8.100000000000001 0 0 0 +141 1 0 21.6 10.8 0 0 0 +142 2 2.7 24.3 13.5 0 0 0 +191 1 0 21.6 16.200000000000003 0 0 0 +192 2 2.7 24.3 18.900000000000002 0 0 0 +241 1 0 21.6 21.6 0 0 0 +242 2 2.7 24.3 24.3 0 0 0 +3 1 5.4 0 0 0 0 0 +4 2 8.100000000000001 2.7 2.7 0 0 0 +53 1 5.4 0 5.4 0 0 0 +54 2 8.100000000000001 2.7 8.100000000000001 0 0 0 +103 1 5.4 0 10.8 0 0 0 +104 2 8.100000000000001 2.7 13.5 0 0 0 +153 1 5.4 0 16.200000000000003 0 0 0 +154 2 8.100000000000001 2.7 18.900000000000002 0 0 0 +203 1 5.4 0 21.6 0 0 0 +204 2 8.100000000000001 2.7 24.3 0 0 0 +13 1 5.4 5.4 0 0 0 0 +14 2 8.100000000000001 8.100000000000001 2.7 0 0 0 +63 1 5.4 5.4 5.4 0 0 0 +64 2 8.100000000000001 8.100000000000001 8.100000000000001 0 0 0 +113 1 5.4 5.4 10.8 0 0 0 +114 2 8.100000000000001 8.100000000000001 13.5 0 0 0 +163 1 5.4 5.4 16.200000000000003 0 0 0 +164 2 8.100000000000001 8.100000000000001 18.900000000000002 0 0 0 +213 1 5.4 5.4 21.6 0 0 0 +214 2 8.100000000000001 8.100000000000001 24.3 0 0 0 +23 1 5.4 10.8 0 0 0 0 +24 2 8.100000000000001 13.5 2.7 0 0 0 +73 1 5.4 10.8 5.4 0 0 0 +74 2 8.100000000000001 13.5 8.100000000000001 0 0 0 +123 1 5.4 10.8 10.8 0 0 0 +124 2 8.100000000000001 13.5 13.5 0 0 0 +173 1 5.4 10.8 16.200000000000003 0 0 0 +174 2 8.100000000000001 13.5 18.900000000000002 0 0 0 +223 1 5.4 10.8 21.6 0 0 0 +224 2 8.100000000000001 13.5 24.3 0 0 0 +33 1 5.4 16.200000000000003 0 0 0 0 +34 2 8.100000000000001 18.900000000000002 2.7 0 0 0 +83 1 5.4 16.200000000000003 5.4 0 0 0 +84 2 8.100000000000001 18.900000000000002 8.100000000000001 0 0 0 +133 1 5.4 16.200000000000003 10.8 0 0 0 +134 2 8.100000000000001 18.900000000000002 13.5 0 0 0 +183 1 5.4 16.200000000000003 16.200000000000003 0 0 0 +184 2 8.100000000000001 18.900000000000002 18.900000000000002 0 0 0 +233 1 5.4 16.200000000000003 21.6 0 0 0 +234 2 8.100000000000001 18.900000000000002 24.3 0 0 0 +43 1 5.4 21.6 0 0 0 0 +44 2 8.100000000000001 24.3 2.7 0 0 0 +93 1 5.4 21.6 5.4 0 0 0 +94 2 8.100000000000001 24.3 8.100000000000001 0 0 0 +143 1 5.4 21.6 10.8 0 0 0 +144 2 8.100000000000001 24.3 13.5 0 0 0 +193 1 5.4 21.6 16.200000000000003 0 0 0 +194 2 8.100000000000001 24.3 18.900000000000002 0 0 0 +243 1 5.4 21.6 21.6 0 0 0 +244 2 8.100000000000001 24.3 24.3 0 0 0 +5 1 10.8 0 0 0 0 0 +6 2 13.5 2.7 2.7 0 0 0 +55 1 10.8 0 5.4 0 0 0 +56 2 13.5 2.7 8.100000000000001 0 0 0 +105 1 10.8 0 10.8 0 0 0 +106 2 13.5 2.7 13.5 0 0 0 +155 1 10.8 0 16.200000000000003 0 0 0 +156 2 13.5 2.7 18.900000000000002 0 0 0 +205 1 10.8 0 21.6 0 0 0 +206 2 13.5 2.7 24.3 0 0 0 +15 1 10.8 5.4 0 0 0 0 +16 2 13.5 8.100000000000001 2.7 0 0 0 +65 1 10.8 5.4 5.4 0 0 0 +66 2 13.5 8.100000000000001 8.100000000000001 0 0 0 +115 1 10.8 5.4 10.8 0 0 0 +116 2 13.5 8.100000000000001 13.5 0 0 0 +165 1 10.8 5.4 16.200000000000003 0 0 0 +166 2 13.5 8.100000000000001 18.900000000000002 0 0 0 +215 1 10.8 5.4 21.6 0 0 0 +216 2 13.5 8.100000000000001 24.3 0 0 0 +25 1 10.8 10.8 0 0 0 0 +26 2 13.5 13.5 2.7 0 0 0 +75 1 10.8 10.8 5.4 0 0 0 +76 2 13.5 13.5 8.100000000000001 0 0 0 +125 1 10.8 10.8 10.8 0 0 0 +126 2 13.5 13.5 13.5 0 0 0 +175 1 10.8 10.8 16.200000000000003 0 0 0 +176 2 13.5 13.5 18.900000000000002 0 0 0 +225 1 10.8 10.8 21.6 0 0 0 +226 2 13.5 13.5 24.3 0 0 0 +35 1 10.8 16.200000000000003 0 0 0 0 +36 2 13.5 18.900000000000002 2.7 0 0 0 +85 1 10.8 16.200000000000003 5.4 0 0 0 +86 2 13.5 18.900000000000002 8.100000000000001 0 0 0 +135 1 10.8 16.200000000000003 10.8 0 0 0 +136 2 13.5 18.900000000000002 13.5 0 0 0 +185 1 10.8 16.200000000000003 16.200000000000003 0 0 0 +186 2 13.5 18.900000000000002 18.900000000000002 0 0 0 +235 1 10.8 16.200000000000003 21.6 0 0 0 +236 2 13.5 18.900000000000002 24.3 0 0 0 +45 1 10.8 21.6 0 0 0 0 +46 2 13.5 24.3 2.7 0 0 0 +95 1 10.8 21.6 5.4 0 0 0 +96 2 13.5 24.3 8.100000000000001 0 0 0 +145 1 10.8 21.6 10.8 0 0 0 +146 2 13.5 24.3 13.5 0 0 0 +195 1 10.8 21.6 16.200000000000003 0 0 0 +196 2 13.5 24.3 18.900000000000002 0 0 0 +245 1 10.8 21.6 21.6 0 0 0 +246 2 13.5 24.3 24.3 0 0 0 +7 1 16.200000000000003 0 0 0 0 0 +8 2 18.900000000000002 2.7 2.7 0 0 0 +57 1 16.200000000000003 0 5.4 0 0 0 +58 2 18.900000000000002 2.7 8.100000000000001 0 0 0 +107 1 16.200000000000003 0 10.8 0 0 0 +108 2 18.900000000000002 2.7 13.5 0 0 0 +157 1 16.200000000000003 0 16.200000000000003 0 0 0 +158 2 18.900000000000002 2.7 18.900000000000002 0 0 0 +207 1 16.200000000000003 0 21.6 0 0 0 +208 2 18.900000000000002 2.7 24.3 0 0 0 +17 1 16.200000000000003 5.4 0 0 0 0 +18 2 18.900000000000002 8.100000000000001 2.7 0 0 0 +67 1 16.200000000000003 5.4 5.4 0 0 0 +68 2 18.900000000000002 8.100000000000001 8.100000000000001 0 0 0 +117 1 16.200000000000003 5.4 10.8 0 0 0 +118 2 18.900000000000002 8.100000000000001 13.5 0 0 0 +167 1 16.200000000000003 5.4 16.200000000000003 0 0 0 +168 2 18.900000000000002 8.100000000000001 18.900000000000002 0 0 0 +217 1 16.200000000000003 5.4 21.6 0 0 0 +218 2 18.900000000000002 8.100000000000001 24.3 0 0 0 +27 1 16.200000000000003 10.8 0 0 0 0 +28 2 18.900000000000002 13.5 2.7 0 0 0 +77 1 16.200000000000003 10.8 5.4 0 0 0 +78 2 18.900000000000002 13.5 8.100000000000001 0 0 0 +127 1 16.200000000000003 10.8 10.8 0 0 0 +128 2 18.900000000000002 13.5 13.5 0 0 0 +177 1 16.200000000000003 10.8 16.200000000000003 0 0 0 +178 2 18.900000000000002 13.5 18.900000000000002 0 0 0 +227 1 16.200000000000003 10.8 21.6 0 0 0 +228 2 18.900000000000002 13.5 24.3 0 0 0 +37 1 16.200000000000003 16.200000000000003 0 0 0 0 +38 2 18.900000000000002 18.900000000000002 2.7 0 0 0 +87 1 16.200000000000003 16.200000000000003 5.4 0 0 0 +88 2 18.900000000000002 18.900000000000002 8.100000000000001 0 0 0 +137 1 16.200000000000003 16.200000000000003 10.8 0 0 0 +138 2 18.900000000000002 18.900000000000002 13.5 0 0 0 +187 1 16.200000000000003 16.200000000000003 16.200000000000003 0 0 0 +188 2 18.900000000000002 18.900000000000002 18.900000000000002 0 0 0 +237 1 16.200000000000003 16.200000000000003 21.6 0 0 0 +238 2 18.900000000000002 18.900000000000002 24.3 0 0 0 +47 1 16.200000000000003 21.6 0 0 0 0 +48 2 18.900000000000002 24.3 2.7 0 0 0 +97 1 16.200000000000003 21.6 5.4 0 0 0 +98 2 18.900000000000002 24.3 8.100000000000001 0 0 0 +147 1 16.200000000000003 21.6 10.8 0 0 0 +148 2 18.900000000000002 24.3 13.5 0 0 0 +197 1 16.200000000000003 21.6 16.200000000000003 0 0 0 +198 2 18.900000000000002 24.3 18.900000000000002 0 0 0 +247 1 16.200000000000003 21.6 21.6 0 0 0 +248 2 18.900000000000002 24.3 24.3 0 0 0 +9 1 21.6 0 0 0 0 0 +10 2 24.3 2.7 2.7 0 0 0 +59 1 21.6 0 5.4 0 0 0 +60 2 24.3 2.7 8.100000000000001 0 0 0 +109 1 21.6 0 10.8 0 0 0 +110 2 24.3 2.7 13.5 0 0 0 +159 1 21.6 0 16.200000000000003 0 0 0 +160 2 24.3 2.7 18.900000000000002 0 0 0 +209 1 21.6 0 21.6 0 0 0 +210 2 24.3 2.7 24.3 0 0 0 +19 1 21.6 5.4 0 0 0 0 +20 2 24.3 8.100000000000001 2.7 0 0 0 +69 1 21.6 5.4 5.4 0 0 0 +70 2 24.3 8.100000000000001 8.100000000000001 0 0 0 +119 1 21.6 5.4 10.8 0 0 0 +120 2 24.3 8.100000000000001 13.5 0 0 0 +169 1 21.6 5.4 16.200000000000003 0 0 0 +170 2 24.3 8.100000000000001 18.900000000000002 0 0 0 +219 1 21.6 5.4 21.6 0 0 0 +220 2 24.3 8.100000000000001 24.3 0 0 0 +29 1 21.6 10.8 0 0 0 0 +30 2 24.3 13.5 2.7 0 0 0 +79 1 21.6 10.8 5.4 0 0 0 +80 2 24.3 13.5 8.100000000000001 0 0 0 +129 1 21.6 10.8 10.8 0 0 0 +130 2 24.3 13.5 13.5 0 0 0 +179 1 21.6 10.8 16.200000000000003 0 0 0 +180 2 24.3 13.5 18.900000000000002 0 0 0 +229 1 21.6 10.8 21.6 0 0 0 +230 2 24.3 13.5 24.3 0 0 0 +39 1 21.6 16.200000000000003 0 0 0 0 +40 2 24.3 18.900000000000002 2.7 0 0 0 +89 1 21.6 16.200000000000003 5.4 0 0 0 +90 2 24.3 18.900000000000002 8.100000000000001 0 0 0 +139 1 21.6 16.200000000000003 10.8 0 0 0 +140 2 24.3 18.900000000000002 13.5 0 0 0 +189 1 21.6 16.200000000000003 16.200000000000003 0 0 0 +190 2 24.3 18.900000000000002 18.900000000000002 0 0 0 +239 1 21.6 16.200000000000003 21.6 0 0 0 +240 2 24.3 18.900000000000002 24.3 0 0 0 +49 1 21.6 21.6 0 0 0 0 +50 2 24.3 24.3 2.7 0 0 0 +99 1 21.6 21.6 5.4 0 0 0 +100 2 24.3 24.3 8.100000000000001 0 0 0 +149 1 21.6 21.6 10.8 0 0 0 +150 2 24.3 24.3 13.5 0 0 0 +199 1 21.6 21.6 16.200000000000003 0 0 0 +200 2 24.3 24.3 18.900000000000002 0 0 0 +249 1 21.6 21.6 21.6 0 0 0 +250 2 24.3 24.3 24.3 0 0 0 + +Velocities + +1 0 0 0 +2 0 0 0 +51 0 0 0 +52 0 0 0 +101 0 0 0 +102 0 0 0 +151 0 0 0 +152 0 0 0 +201 0 0 0 +202 0 0 0 +11 0 0 0 +12 0 0 0 +61 0 0 0 +62 0 0 0 +111 0 0 0 +112 0 0 0 +161 0 0 0 +162 0 0 0 +211 0 0 0 +212 0 0 0 +21 0 0 0 +22 0 0 0 +71 0 0 0 +72 0 0 0 +121 0 0 0 +122 0 0 0 +171 0 0 0 +172 0 0 0 +221 0 0 0 +222 0 0 0 +31 0 0 0 +32 0 0 0 +81 0 0 0 +82 0 0 0 +131 0 0 0 +132 0 0 0 +181 0 0 0 +182 0 0 0 +231 0 0 0 +232 0 0 0 +41 0 0 0 +42 0 0 0 +91 0 0 0 +92 0 0 0 +141 0 0 0 +142 0 0 0 +191 0 0 0 +192 0 0 0 +241 0 0 0 +242 0 0 0 +3 0 0 0 +4 0 0 0 +53 0 0 0 +54 0 0 0 +103 0 0 0 +104 0 0 0 +153 0 0 0 +154 0 0 0 +203 0 0 0 +204 0 0 0 +13 0 0 0 +14 0 0 0 +63 0 0 0 +64 0 0 0 +113 0 0 0 +114 0 0 0 +163 0 0 0 +164 0 0 0 +213 0 0 0 +214 0 0 0 +23 0 0 0 +24 0 0 0 +73 0 0 0 +74 0 0 0 +123 0 0 0 +124 0 0 0 +173 0 0 0 +174 0 0 0 +223 0 0 0 +224 0 0 0 +33 0 0 0 +34 0 0 0 +83 0 0 0 +84 0 0 0 +133 0 0 0 +134 0 0 0 +183 0 0 0 +184 0 0 0 +233 0 0 0 +234 0 0 0 +43 0 0 0 +44 0 0 0 +93 0 0 0 +94 0 0 0 +143 0 0 0 +144 0 0 0 +193 0 0 0 +194 0 0 0 +243 0 0 0 +244 0 0 0 +5 0 0 0 +6 0 0 0 +55 0 0 0 +56 0 0 0 +105 0 0 0 +106 0 0 0 +155 0 0 0 +156 0 0 0 +205 0 0 0 +206 0 0 0 +15 0 0 0 +16 0 0 0 +65 0 0 0 +66 0 0 0 +115 0 0 0 +116 0 0 0 +165 0 0 0 +166 0 0 0 +215 0 0 0 +216 0 0 0 +25 0 0 0 +26 0 0 0 +75 0 0 0 +76 0 0 0 +125 0 0 0 +126 0 0 0 +175 0 0 0 +176 0 0 0 +225 0 0 0 +226 0 0 0 +35 0 0 0 +36 0 0 0 +85 0 0 0 +86 0 0 0 +135 0 0 0 +136 0 0 0 +185 0 0 0 +186 0 0 0 +235 0 0 0 +236 0 0 0 +45 0 0 0 +46 0 0 0 +95 0 0 0 +96 0 0 0 +145 0 0 0 +146 0 0 0 +195 0 0 0 +196 0 0 0 +245 0 0 0 +246 0 0 0 +7 0 0 0 +8 0 0 0 +57 0 0 0 +58 0 0 0 +107 0 0 0 +108 0 0 0 +157 0 0 0 +158 0 0 0 +207 0 0 0 +208 0 0 0 +17 0 0 0 +18 0 0 0 +67 0 0 0 +68 0 0 0 +117 0 0 0 +118 0 0 0 +167 0 0 0 +168 0 0 0 +217 0 0 0 +218 0 0 0 +27 0 0 0 +28 0 0 0 +77 0 0 0 +78 0 0 0 +127 0 0 0 +128 0 0 0 +177 0 0 0 +178 0 0 0 +227 0 0 0 +228 0 0 0 +37 0 0 0 +38 0 0 0 +87 0 0 0 +88 0 0 0 +137 0 0 0 +138 0 0 0 +187 0 0 0 +188 0 0 0 +237 0 0 0 +238 0 0 0 +47 0 0 0 +48 0 0 0 +97 0 0 0 +98 0 0 0 +147 0 0 0 +148 0 0 0 +197 0 0 0 +198 0 0 0 +247 0 0 0 +248 0 0 0 +9 0 0 0 +10 0 0 0 +59 0 0 0 +60 0 0 0 +109 0 0 0 +110 0 0 0 +159 0 0 0 +160 0 0 0 +209 0 0 0 +210 0 0 0 +19 0 0 0 +20 0 0 0 +69 0 0 0 +70 0 0 0 +119 0 0 0 +120 0 0 0 +169 0 0 0 +170 0 0 0 +219 0 0 0 +220 0 0 0 +29 0 0 0 +30 0 0 0 +79 0 0 0 +80 0 0 0 +129 0 0 0 +130 0 0 0 +179 0 0 0 +180 0 0 0 +229 0 0 0 +230 0 0 0 +39 0 0 0 +40 0 0 0 +89 0 0 0 +90 0 0 0 +139 0 0 0 +140 0 0 0 +189 0 0 0 +190 0 0 0 +239 0 0 0 +240 0 0 0 +49 0 0 0 +50 0 0 0 +99 0 0 0 +100 0 0 0 +149 0 0 0 +150 0 0 0 +199 0 0 0 +200 0 0 0 +249 0 0 0 +250 0 0 0 diff --git a/tools/eam_database/test/eamDatabase.py b/tools/eam_database/test/eamDatabase.py new file mode 120000 index 0000000000..600def02b9 --- /dev/null +++ b/tools/eam_database/test/eamDatabase.py @@ -0,0 +1 @@ +../eamDatabase.py \ No newline at end of file diff --git a/tools/eam_database/test/in.lmp b/tools/eam_database/test/in.lmp new file mode 100644 index 0000000000..d37bba5b09 --- /dev/null +++ b/tools/eam_database/test/in.lmp @@ -0,0 +1,37 @@ +units metal +boundary p p p +atom_style atomic + +read_data data.lmp + +pair_style eam/alloy +pair_coeff * * @FORTRANFILE@ @ELEM1@ @ELEM2@ + +variable etot equal etotal +variable press equal press +thermo_style custom pe etotal press + +run 0 post no + +variable efor equal ${etot} +variable pfor equal ${press} +thermo_style custom pe etotal v_efor press v_pfor + +run 0 post no + +pair_coeff * * @PYTHONFILE@ @ELEM1@ @ELEM2@ + +variable epyt equal ${etot} +variable ppyt equal ${press} +thermo_style custom pe etotal v_epyt press v_ppyt + +run 0 post no + +variable e equal "1 - v_epyt/v_efor" +variable p equal "1 - v_ppyt/v_pfor" +variable de equal v_epyt-v_efor +variable dp equal v_ppyt-v_pfor + +print "Relative energy and pressure error for pair @ELEM1@ @ELEM2@ de = $e; dp = $p" append ../errors.dat +print "Absolute energy and pressure error for pair @ELEM1@ @ELEM2@ de = ${de}; dp = ${dp}" append ../errors.dat + diff --git a/tools/eam_database/test/test.sh b/tools/eam_database/test/test.sh new file mode 100755 index 0000000000..3f098902aa --- /dev/null +++ b/tools/eam_database/test/test.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +elements=(Cu Ag Au Ni Pd Pt Al Pb Fe Mo Ta W Mg Co Ti Zr Cr) +LMP=${LMP-../../../src/lmp_serial} + +rm -r tmp +for ((i=0; i< ${#elements[@]}; i=$i+1)) +do + for (( j=$i; j<${#elements[@]}; j=$j+1)) + do + e1=${elements[${i}]} + e2=${elements[${j}]} + echo "e1 = ${e1} e2 = ${e2}" + pythonfile="${e1}${e2}.eam.alloy.python" + fortranfile="${e1}${e2}.eam.alloy.fortran" + mkdir tmp; + cp eamDatabase.py create_eam.py in.lmp data.lmp a.out EAM.input EAM_code tmp/ + cd tmp + sed -i "s/@ELEM1@/${e1}/g" EAM.input + sed -i "s/@ELEM2@/${e2}/g" EAM.input + ./a.out < EAM.input + mv "${e1}${e2}.eam.alloy" ${fortranfile} + python create_eam.py -n ${e1} ${e2} + mv "${e1}${e2}.eam.alloy" ${pythonfile} + sed -i "s/@ELEM1@/${e1}/g" in.lmp + sed -i "s/@ELEM2@/${e2}/g" in.lmp + sed -i "s/@PYTHONFILE@/${pythonfile}/g" in.lmp + sed -i "s/@FORTRANFILE@/${fortranfile}/g" in.lmp + ${LMP} -i in.lmp + cd ../ + rm -r tmp + done +done + diff --git a/tools/msi2lmp/src/GetParameters.c b/tools/msi2lmp/src/GetParameters.c index 192b4d296c..921e37491f 100644 --- a/tools/msi2lmp/src/GetParameters.c +++ b/tools/msi2lmp/src/GetParameters.c @@ -9,14 +9,14 @@ static int find_improper_body_data(char [][5],struct FrcFieldItem,int *); static void rearrange_improper(int,int); static int find_trigonal_body_data(char [][5],struct FrcFieldItem); -static int find_angleangle_data(char [][5],struct FrcFieldItem,int[]); +static int find_angleangle_data(char [][5],struct FrcFieldItem,int[3]); static int find_match(int, char [][5],struct FrcFieldItem,int *); static int match_types(int,int,char [][5],char [][5],int *); static double get_r0(int,int); static double get_t0(int,int,int); static int quo_cp(); static void get_equivs(int,char [][5],char[][5]); -static int find_equiv_type(char[]); +static int find_equiv_type(char[5]); /**********************************************************************/ /* */ diff --git a/tools/singularity/fedora34_mingw.def b/tools/singularity/fedora35_mingw.def similarity index 99% rename from tools/singularity/fedora34_mingw.def rename to tools/singularity/fedora35_mingw.def index 8a1f108aec..c2108a378c 100644 --- a/tools/singularity/fedora34_mingw.def +++ b/tools/singularity/fedora35_mingw.def @@ -1,5 +1,5 @@ BootStrap: docker -From: fedora:34 +From: fedora:35 %post dnf -y update @@ -94,7 +94,7 @@ EOF CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh cat >$CUSTOM_PROMPT_ENV < -log none -echo none -in in.empty - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + COMMAND $ -log none -echo none -in in.empty) set_tests_properties(RunLammps PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=1" PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?\\)") # check if the compiled executable will print the help message add_test(NAME HelpMessage - COMMAND $ -h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + COMMAND $ -h) set_tests_properties(HelpMessage PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=1" PASS_REGULAR_EXPRESSION ".*Large-scale Atomic/Molecular Massively Parallel Simulator -.*Usage example:.*") # check if the compiled executable will error out on an invalid command line flag add_test(NAME InvalidFlag - COMMAND $ -xxx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + COMMAND $ -xxx) set_tests_properties(InvalidFlag PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=1" PASS_REGULAR_EXPRESSION "ERROR: Invalid command-line argument.*") diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 3d57dbbc90..e9409be0cc 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -1,26 +1,26 @@ add_executable(test_library_open test_library_open.cpp test_main.cpp) target_link_libraries(test_library_open PRIVATE lammps GTest::GMock) -add_test(LibraryOpen test_library_open) +add_test(NAME LibraryOpen COMMAND test_library_open) add_executable(test_library_commands test_library_commands.cpp test_main.cpp) target_link_libraries(test_library_commands PRIVATE lammps GTest::GMock) -add_test(LibraryCommands test_library_commands) +add_test(NAME LibraryCommands COMMAND test_library_commands) add_executable(test_library_external test_library_external.cpp test_main.cpp) target_link_libraries(test_library_external PRIVATE lammps GTest::GMock) -add_test(LibraryExternal test_library_external) +add_test(NAME LibraryExternal COMMAND test_library_external) add_executable(test_library_properties test_library_properties.cpp test_main.cpp) target_link_libraries(test_library_properties PRIVATE lammps GTest::GMock) target_compile_definitions(test_library_properties PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) -add_test(LibraryProperties test_library_properties) +add_test(NAME LibraryProperties COMMAND test_library_properties) set_tests_properties(LibraryProperties PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") add_executable(test_library_scatter_gather test_library_scatter_gather.cpp test_main.cpp) target_link_libraries(test_library_scatter_gather PRIVATE lammps GTest::GMock) target_compile_definitions(test_library_scatter_gather PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) -add_test(LibraryScatterGather test_library_scatter_gather) +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}") @@ -65,7 +65,7 @@ endforeach() add_executable(test_library_config test_library_config.cpp test_main.cpp) target_link_libraries(test_library_config PRIVATE lammps GTest::GMock) target_compile_definitions(test_library_config PRIVATE ${TEST_CONFIG_DEFS}) -add_test(LibraryConfig test_library_config) +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) diff --git a/unittest/c-library/test_library_commands.cpp b/unittest/c-library/test_library_commands.cpp index 203862c696..f1cc51d8d9 100644 --- a/unittest/c-library/test_library_commands.cpp +++ b/unittest/c-library/test_library_commands.cpp @@ -20,7 +20,7 @@ const char *cont_input[] = {"create_atoms 1 single &", "0.2 0.1 0.1"}; class LibraryCommands : public ::testing::Test { protected: void *lmp; - LibraryCommands() = default; + LibraryCommands() = default; ~LibraryCommands() override = default; void SetUp() override @@ -55,13 +55,13 @@ TEST_F(LibraryCommands, from_file) const char cont_file[] = "in.cont"; fp = fopen(demo_file, "w"); - for (auto & inp : demo_input) { + for (auto &inp : demo_input) { fputs(inp, fp); fputc('\n', fp); } fclose(fp); fp = fopen(cont_file, "w"); - for (auto & inp : cont_input) { + for (auto &inp : cont_input) { fputs(inp, fp); fputc('\n', fp); } @@ -85,7 +85,7 @@ TEST_F(LibraryCommands, from_line) { EXPECT_EQ(lammps_get_natoms(lmp), 0); if (!verbose) ::testing::internal::CaptureStdout(); - for (auto & inp : demo_input) { + for (auto &inp : demo_input) { lammps_command(lmp, inp); } if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -106,11 +106,11 @@ TEST_F(LibraryCommands, from_string) { std::string cmds(""); - for (auto & inp : demo_input) { + for (auto &inp : demo_input) { cmds += inp; cmds += "\n"; } - for (auto & inp : cont_input) { + for (auto &inp : cont_input) { cmds += inp; cmds += "\n"; } @@ -126,11 +126,11 @@ TEST_F(LibraryCommands, from_string) if (!verbose) ::testing::internal::GetCapturedStdout(); cmds.clear(); - for (auto & inp : demo_input) { + for (auto &inp : demo_input) { cmds += inp; cmds += "\r\n"; } - for (auto & inp : cont_input) { + for (auto &inp : cont_input) { cmds += inp; cmds += "\r\n"; } diff --git a/unittest/c-library/test_library_config.cpp b/unittest/c-library/test_library_config.cpp index 456faff06f..f402ffc2e9 100644 --- a/unittest/c-library/test_library_config.cpp +++ b/unittest/c-library/test_library_config.cpp @@ -22,7 +22,7 @@ protected: void *lmp; std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER); - LibraryConfig() = default; + LibraryConfig() = default; ~LibraryConfig() override = default; void SetUp() override diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 754c6df77f..9bfea75d40 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -3,6 +3,7 @@ #include "lammps.h" #include "library.h" #include "lmptype.h" +#include "platform.h" #include #include "gmock/gmock.h" @@ -13,6 +14,7 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val +using ::LAMMPS_NS::platform::path_join; using ::LAMMPS_NS::tagint; using ::testing::HasSubstr; using ::testing::StartsWith; @@ -23,7 +25,7 @@ protected: void *lmp; std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER); - LibraryProperties() = default; + LibraryProperties() = default; ~LibraryProperties() override = default; void SetUp() override @@ -82,7 +84,7 @@ TEST_F(LibraryProperties, get_mpi_comm) TEST_F(LibraryProperties, natoms) { if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); if (!verbose) ::testing::internal::CaptureStdout(); lammps_file(lmp, input.c_str()); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -92,7 +94,7 @@ TEST_F(LibraryProperties, natoms) TEST_F(LibraryProperties, thermo) { if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); ::testing::internal::CaptureStdout(); lammps_file(lmp, input.c_str()); lammps_command(lmp, "run 2 post no"); @@ -108,7 +110,7 @@ TEST_F(LibraryProperties, thermo) TEST_F(LibraryProperties, box) { if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); ::testing::internal::CaptureStdout(); lammps_file(lmp, input.c_str()); lammps_command(lmp, "run 2 post no"); @@ -248,7 +250,7 @@ TEST_F(LibraryProperties, setting) EXPECT_EQ(lammps_extract_setting(lmp, "UNKNOWN"), -1); if (lammps_has_style(lmp, "atom", "full")) { - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); if (!verbose) ::testing::internal::CaptureStdout(); lammps_file(lmp, input.c_str()); lammps_command(lmp, "run 2 post no"); @@ -289,7 +291,7 @@ TEST_F(LibraryProperties, global) { if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); if (!verbose) ::testing::internal::CaptureStdout(); lammps_file(lmp, input.c_str()); lammps_command(lmp, "run 2 post no"); @@ -436,8 +438,10 @@ class AtomProperties : public ::testing::Test { protected: void *lmp; - AtomProperties()= default;; - ~AtomProperties() override= default;; + AtomProperties() = default; + ; + ~AtomProperties() override = default; + ; void SetUp() override { diff --git a/unittest/c-library/test_library_scatter_gather.cpp b/unittest/c-library/test_library_scatter_gather.cpp index 7ee1cfc9eb..25e3dde787 100644 --- a/unittest/c-library/test_library_scatter_gather.cpp +++ b/unittest/c-library/test_library_scatter_gather.cpp @@ -3,6 +3,7 @@ #include "lammps.h" #include "library.h" #include "lmptype.h" +#include "platform.h" #include #include "gmock/gmock.h" @@ -13,6 +14,7 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val +using ::LAMMPS_NS::platform::path_join; using ::LAMMPS_NS::bigint; using ::LAMMPS_NS::tagint; using ::testing::HasSubstr; @@ -23,7 +25,7 @@ protected: void *lmp; std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER); - GatherProperties() = default; + GatherProperties() = default; ~GatherProperties() override = default; void SetUp() override @@ -55,7 +57,7 @@ protected: TEST_F(GatherProperties, gather_bonds_newton_on) { if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); if (!verbose) ::testing::internal::CaptureStdout(); lammps_command(lmp, "newton on on"); lammps_file(lmp, input.c_str()); @@ -95,7 +97,7 @@ TEST_F(GatherProperties, gather_bonds_newton_on) TEST_F(GatherProperties, gather_bonds_newton_off) { if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); - std::string input = INPUT_DIR + PATH_SEP + "in.fourmol"; + std::string input = path_join(INPUT_DIR, "in.fourmol"); if (!verbose) ::testing::internal::CaptureStdout(); lammps_command(lmp, "newton off off"); lammps_file(lmp, input.c_str()); diff --git a/unittest/c-library/test_main.h b/unittest/c-library/test_main.h index 567b913d27..9a719e4b88 100644 --- a/unittest/c-library/test_main.h +++ b/unittest/c-library/test_main.h @@ -25,9 +25,3 @@ extern bool verbose; } while (0); #endif - -#if defined _WIN32 -static const char PATH_SEP = '\\'; -#else -static const char PATH_SEP = '/'; -#endif diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index 49603a8b22..d4f437dc4c 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -9,21 +9,21 @@ if((NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows")) AND PKG_PLUGIN) endif() target_link_libraries(test_simple_commands PRIVATE lammps GTest::GMock) -add_test(NAME SimpleCommands COMMAND test_simple_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME SimpleCommands COMMAND test_simple_commands) set_tests_properties(SimpleCommands PROPERTIES - ENVIRONMENT "LAMMPS_PLUGIN_BIN_DIR=${CMAKE_BINARY_DIR}/build-plugins") + ENVIRONMENT "LAMMPS_PLUGIN_BIN_DIR=${CMAKE_BINARY_DIR}") add_executable(test_lattice_region test_lattice_region.cpp) target_link_libraries(test_lattice_region PRIVATE lammps GTest::GMock) -add_test(NAME LatticeRegion COMMAND test_lattice_region WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME LatticeRegion COMMAND test_lattice_region) add_executable(test_groups test_groups.cpp) target_link_libraries(test_groups PRIVATE lammps GTest::GMock) -add_test(NAME Groups COMMAND test_groups WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME Groups COMMAND test_groups) add_executable(test_variables test_variables.cpp) target_link_libraries(test_variables PRIVATE lammps GTest::GMock) -add_test(NAME Variables COMMAND test_variables WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME Variables COMMAND test_variables) add_executable(test_kim_commands test_kim_commands.cpp) if(KIM_EXTRA_UNITTESTS) @@ -34,12 +34,12 @@ if(KIM_EXTRA_UNITTESTS) endif() endif() target_link_libraries(test_kim_commands PRIVATE lammps GTest::GMock) -add_test(NAME KimCommands COMMAND test_kim_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME KimCommands COMMAND test_kim_commands) add_executable(test_reset_ids test_reset_ids.cpp) target_compile_definitions(test_reset_ids PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(test_reset_ids PRIVATE lammps GTest::GMock) -add_test(NAME ResetIDs COMMAND test_reset_ids WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME ResetIDs COMMAND test_reset_ids) add_executable(test_mpi_load_balancing test_mpi_load_balancing.cpp) target_link_libraries(test_mpi_load_balancing PRIVATE lammps GTest::GMock) diff --git a/unittest/commands/data.fourmol b/unittest/commands/data.fourmol deleted file mode 120000 index ebbe325d24..0000000000 --- a/unittest/commands/data.fourmol +++ /dev/null @@ -1 +0,0 @@ -../force-styles/tests/data.fourmol \ No newline at end of file diff --git a/unittest/commands/data.fourmol b/unittest/commands/data.fourmol new file mode 100644 index 0000000000..70dc685895 --- /dev/null +++ b/unittest/commands/data.fourmol @@ -0,0 +1,223 @@ +LAMMPS data file via write_data, version 5 May 2020, timestep = 0 + +29 atoms +5 atom types +24 bonds +5 bond types +30 angles +4 angle types +31 dihedrals +5 dihedral types +2 impropers +2 improper types + + -6.024572 8.975428 xlo xhi + -7.692866 7.307134 ylo yhi + -8.086924 6.913076 zlo zhi + +Masses + +1 12.0107 +2 4.00794 +3 14.0067 +4 15.9994 +5 15.9994 + +Pair Coeffs # zero + +1 +2 +3 +4 +5 + +Bond Coeffs # zero + +1 1.5 +2 1.1 +3 1.3 +4 1.2 +5 1 + +Angle Coeffs # zero + +1 110.1 +2 111 +3 120 +4 108.5 + +Dihedral Coeffs # zero + +1 +2 +3 +4 +5 + +Improper Coeffs # zero + +1 +2 + +Atoms # full + +10 2 1 7.0000000000000007e-02 2.0185283555536988e+00 -1.4283966846517357e+00 -9.6733527271133024e-01 0 0 0 +11 2 2 8.9999999999999997e-02 1.7929780509347666e+00 -1.9871047540768743e+00 -1.8840626643185674e+00 0 0 0 +12 2 1 -2.7000000000000002e-01 3.0030247876861225e+00 -4.8923319967572748e-01 -1.6188658531537248e+00 0 0 0 +13 2 2 8.9999999999999997e-02 4.0447273787895934e+00 -9.0131998547446246e-01 -1.6384447268320836e+00 0 0 0 +14 2 2 8.9999999999999997e-02 2.6033152817257075e+00 -4.0789761505963579e-01 -2.6554413538823063e+00 0 0 0 + 2 1 2 3.1000000000000000e-01 3.0197083955402204e-01 2.9515239068888608e+00 -8.5689735572907566e-01 0 0 0 + 3 1 1 -2.0000000000000000e-02 -6.9435377880558602e-01 1.2440473127136711e+00 -6.2233801468892025e-01 0 0 0 + 4 1 2 8.9999999999999997e-02 -1.5771614164685133e+00 1.4915333140468066e+00 -1.2487126845040522e+00 0 0 0 + 6 1 1 5.1000000000000001e-01 2.9412607937706009e-01 2.2719282656652909e-01 -1.2843094067857870e+00 0 0 0 + 7 1 4 -5.1000000000000001e-01 3.4019871062879609e-01 -9.1277350075786561e-03 -2.4633113224304561e+00 0 0 0 +19 3 2 4.2359999999999998e-01 1.5349125211132961e+00 2.6315969880333707e+00 -4.2472859440220647e+00 0 0 0 +15 2 2 8.9999999999999997e-02 2.9756315249791303e+00 5.6334269722969288e-01 -1.2437650754599008e+00 0 0 0 +18 3 4 -8.4719999999999995e-01 2.1384791188033843e+00 3.0177261773770208e+00 -3.5160827596876225e+00 0 0 0 +20 3 2 4.2359999999999998e-01 2.7641167828863153e+00 3.6833419064000221e+00 -3.9380850623312638e+00 0 0 0 + 8 2 3 -4.6999999999999997e-01 1.1641187171852805e+00 -4.8375305955385234e-01 -6.7659823767368688e-01 0 0 0 + 9 2 2 3.1000000000000000e-01 1.3777459838125838e+00 -2.5366338669522998e-01 2.6877644730326306e-01 0 0 0 +16 2 1 5.1000000000000001e-01 2.6517554244980306e+00 -2.3957110424978438e+00 3.2908335999178327e-02 0 0 0 +17 2 4 -5.1000000000000001e-01 2.2309964792710639e+00 -2.1022918943319384e+00 1.1491948328949437e+00 0 0 0 + 1 1 3 -4.6999999999999997e-01 -2.7993683669226832e-01 2.4726588069312840e+00 -1.7200860244148433e-01 0 0 0 + 5 1 2 8.9999999999999997e-02 -8.9501761359359255e-01 9.3568128743071344e-01 4.0227731871484346e-01 0 0 0 +21 4 5 -8.4719999999999995e-01 4.9064454390208301e+00 -4.0751205255383196e+00 -3.6215576073601046e+00 0 0 0 +22 4 2 4.2359999999999998e-01 4.3687453488627543e+00 -4.2054270536772504e+00 -4.4651491269372565e+00 0 0 0 +23 4 2 4.2359999999999998e-01 5.7374928154769504e+00 -3.5763355905184966e+00 -3.8820297194230728e+00 0 0 0 +24 5 5 -8.4719999999999995e-01 2.0684115301174013e+00 3.1518221747664397e+00 3.1554242678474576e+00 0 0 0 +25 5 2 4.2359999999999998e-01 1.2998381073113014e+00 3.2755513587518097e+00 2.5092990173114837e+00 0 0 0 +26 5 2 4.2359999999999998e-01 2.5807438597688113e+00 4.0120175892854135e+00 3.2133398379059099e+00 0 0 0 +27 6 5 -8.4719999999999995e-01 -1.9613581876744359e+00 -4.3556300596085160e+00 2.1101467673534788e+00 0 0 0 +28 6 2 4.2359999999999998e-01 -2.7406520384725965e+00 -4.0207251278130975e+00 1.5828689861678511e+00 0 0 0 +29 6 2 4.2359999999999998e-01 -1.3108232656499081e+00 -3.5992986322410760e+00 2.2680459788743503e+00 0 0 0 + +Velocities + +1 7.7867804888392077e-04 5.8970331623292821e-04 -2.2179517633030531e-04 +2 2.7129529964126462e-03 4.6286427111164284e-03 3.5805549693846352e-03 +3 -1.2736791029204805e-03 1.6108674226414498e-03 -3.3618185901550799e-04 +4 -9.2828595122009308e-04 -1.2537885319521818e-03 -4.1204974953432108e-03 +5 -1.1800848061603740e-03 7.5424401975844038e-04 6.9023177964912290e-05 +6 -3.0914004879905335e-04 1.2755385764678133e-03 7.9574303350202582e-04 +7 -1.1037894966874103e-04 -7.6764845099077425e-04 -7.7217630460203659e-04 +8 3.9060281273221989e-04 -8.1444231918053418e-04 1.5134641148324972e-04 +9 1.2475530960659720e-03 -2.6608454451432528e-03 1.1117602907112732e-03 +10 4.5008983776042893e-04 4.9530197647538077e-04 -2.3336234361093645e-04 +11 -3.6977669078869707e-04 -1.5289071951960539e-03 -2.9176389881837113e-03 +12 1.0850834530183159e-03 -6.4965897903201833e-04 -1.2971152622619948e-03 +13 4.0754559196230639e-03 3.5043502394946119e-03 -7.8324487687854666e-04 +14 -1.3837220448746613e-04 -4.0656048637594394e-03 -3.9333461173944500e-03 +15 -4.3301707382721859e-03 -3.1802661664634938e-03 3.2037919043360571e-03 +16 -9.6715751018414326e-05 -5.0016572678960377e-04 1.4945658875149626e-03 +17 6.5692180538157174e-04 3.6635779995305095e-04 8.3495414466050911e-04 +18 -6.0936815808025862e-04 -9.3774557532468582e-04 -3.3558072507805731e-04 +19 -6.9919768291957119e-04 -3.6060777270430031e-03 4.2833405289822791e-03 +20 4.7777805013736515e-03 5.1003745845520452e-03 1.8002873923729241e-03 +21 -9.5568188553430398e-04 1.6594630943762931e-04 -1.8199788009966615e-04 +22 -3.3137518957653462e-03 -2.8683968287936054e-03 3.6384389958326871e-03 +23 2.4209481134686401e-04 -4.5457709985051130e-03 2.7663581642115042e-03 +24 2.5447450568861086e-04 4.8412447786110117e-04 -4.8021914527341357e-04 +25 4.3722771097312743e-03 -4.5184411669545515e-03 2.5200952006556795e-03 +26 -1.9250110555001179e-03 -3.0342169883610837e-03 3.5062814567984532e-03 +27 -2.6510179146429716e-04 3.6306203629019116e-04 -5.6235585400647747e-04 +28 -2.3068708109787484e-04 -8.5663070212203200e-04 2.1302563179109169e-03 +29 -2.5054744388303732e-03 -1.6773997805290820e-04 2.8436699761004796e-03 + +Bonds + +1 5 1 2 +2 3 1 3 +3 2 3 4 +4 2 3 5 +5 1 3 6 +6 3 6 8 +7 4 6 7 +8 5 8 9 +9 3 8 10 +10 2 10 11 +11 1 10 12 +12 1 10 16 +13 2 12 13 +14 2 12 14 +15 2 12 15 +16 4 16 17 +17 5 18 19 +18 5 18 20 +19 5 21 22 +20 5 21 23 +21 5 24 25 +22 5 24 26 +23 5 27 28 +24 5 27 29 + +Angles + +1 4 2 1 3 +2 4 1 3 5 +3 4 1 3 4 +4 4 1 3 6 +5 4 4 3 5 +6 2 5 3 6 +7 2 4 3 6 +8 3 3 6 7 +9 3 3 6 8 +10 3 7 6 8 +11 2 6 8 9 +12 2 9 8 10 +13 3 6 8 10 +14 2 8 10 11 +15 3 8 10 16 +16 2 11 10 12 +17 1 12 10 16 +18 1 8 10 12 +19 2 11 10 16 +20 2 10 12 15 +21 2 10 12 14 +22 2 10 12 13 +23 4 13 12 15 +24 4 13 12 14 +25 4 14 12 15 +26 4 10 16 17 +27 1 19 18 20 +28 1 22 21 23 +29 1 25 24 26 +30 1 28 27 29 + +Dihedrals + +1 2 2 1 3 6 +2 2 2 1 3 4 +3 3 2 1 3 5 +4 1 1 3 6 8 +5 1 1 3 6 7 +6 5 4 3 6 8 +7 5 4 3 6 7 +8 5 5 3 6 8 +9 5 5 3 6 7 +10 4 3 6 8 9 +11 3 3 6 8 10 +12 3 7 6 8 9 +13 4 7 6 8 10 +14 2 6 8 10 12 +15 2 6 8 10 16 +16 2 6 8 10 11 +17 2 9 8 10 12 +18 4 9 8 10 16 +19 5 9 8 10 11 +20 5 8 10 12 13 +21 1 8 10 12 14 +22 5 8 10 12 15 +23 4 8 10 16 17 +24 5 11 10 12 13 +25 5 11 10 12 14 +26 5 11 10 12 15 +27 2 11 10 16 17 +28 2 12 10 16 17 +29 5 16 10 12 13 +30 5 16 10 12 14 +31 5 16 10 12 15 + +Impropers + +1 1 6 3 8 7 +2 2 8 6 10 9 diff --git a/unittest/commands/in.fourmol b/unittest/commands/in.fourmol deleted file mode 120000 index cc47b5adb9..0000000000 --- a/unittest/commands/in.fourmol +++ /dev/null @@ -1 +0,0 @@ -../force-styles/tests/in.fourmol \ No newline at end of file diff --git a/unittest/commands/in.fourmol b/unittest/commands/in.fourmol new file mode 100644 index 0000000000..df936da78e --- /dev/null +++ b/unittest/commands/in.fourmol @@ -0,0 +1,30 @@ +variable newton_pair index on +variable newton_bond index on +variable bond_factor index 0.10 +variable angle_factor index 0.25 +variable dihedral_factor index 0.50 +variable units index real +variable input_dir index . +variable data_file index ${input_dir}/data.fourmol +variable pair_style index 'zero 8.0' +variable bond_style index zero +variable angle_style index zero +variable dihedral_style index zero +variable improper_style index zero +variable t_target index 100.0 + +atom_style full +atom_modify map array +neigh_modify delay 2 every 2 check no +units ${units} +timestep 0.1 +newton ${newton_pair} ${newton_bond} +special_bonds lj/coul ${bond_factor} ${angle_factor} ${dihedral_factor} + +pair_style ${pair_style} +bond_style ${bond_style} +angle_style ${angle_style} +dihedral_style ${dihedral_style} +improper_style ${improper_style} + +read_data ${data_file} diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index 9d69b5412e..a356a02cca 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -34,7 +34,6 @@ using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::ExitedWithCode; -using ::testing::MatchesRegex; using ::testing::StrEq; class GroupTest : public LAMMPSTest { diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 183d333ab4..953b4e5a00 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -33,7 +33,6 @@ bool verbose = false; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { -using ::testing::MatchesRegex; using ::testing::StrEq; class KimCommandsTest : public LAMMPSTest { diff --git a/unittest/commands/test_lattice_region.cpp b/unittest/commands/test_lattice_region.cpp index 1bbda21001..4f314b1669 100644 --- a/unittest/commands/test_lattice_region.cpp +++ b/unittest/commands/test_lattice_region.cpp @@ -35,8 +35,8 @@ bool verbose = false; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { +using ::testing::ContainsRegex; using ::testing::ExitedWithCode; -using ::testing::MatchesRegex; using ::testing::StrEq; class LatticeRegionTest : public LAMMPSTest { @@ -82,7 +82,7 @@ TEST_F(LatticeRegionTest, lattice_sc) BEGIN_CAPTURE_OUTPUT(); command("lattice sc 1.0 spacing 1.5 2.0 3.0"); auto output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*")); + ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*")); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->xlattice, 1.5); @@ -92,7 +92,7 @@ TEST_F(LatticeRegionTest, lattice_sc) BEGIN_CAPTURE_OUTPUT(); command("lattice sc 2.0"); output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 2.* 2.* 2.*")); + ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 2.* 2.* 2.*")); lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SC); diff --git a/unittest/commands/test_reset_ids.cpp b/unittest/commands/test_reset_ids.cpp index c67f90b341..1506f9a892 100644 --- a/unittest/commands/test_reset_ids.cpp +++ b/unittest/commands/test_reset_ids.cpp @@ -32,7 +32,6 @@ bool verbose = false; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { -using ::testing::MatchesRegex; #define GETIDX(i) lmp->atom->map(i) @@ -47,8 +46,8 @@ protected: LAMMPSTest::SetUp(); if (info->has_style("atom", "full")) { BEGIN_HIDE_OUTPUT(); - command("variable input_dir index " STRINGIFY(TEST_INPUT_FOLDER)); - command("include ${input_dir}/in.fourmol"); + command("variable input_dir index \"" STRINGIFY(TEST_INPUT_FOLDER) "\""); + command("include \"${input_dir}/in.fourmol\""); END_HIDE_OUTPUT(); } } diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 1844752d33..acbade5ad8 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -39,8 +39,8 @@ bool verbose = false; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { +using ::testing::ContainsRegex; using ::testing::ExitedWithCode; -using ::testing::MatchesRegex; using ::testing::StrEq; class SimpleCommandsTest : public LAMMPSTest { @@ -394,62 +394,62 @@ TEST_F(SimpleCommandsTest, Plugin) lmp->input->one(fmt::format(loadfmt, "hello")); auto text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Loading plugin: Hello world command.*")); + ASSERT_THAT(text, ContainsRegex(".*Loading plugin: Hello world command.*")); ::testing::internal::CaptureStdout(); lmp->input->one(fmt::format(loadfmt, "xxx")); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Open of file .*xxx.* failed.*")); + ASSERT_THAT(text, ContainsRegex(".*Open of file .*xxx.* failed.*")); ::testing::internal::CaptureStdout(); lmp->input->one(fmt::format(loadfmt, "nve2")); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Loading plugin: NVE2 variant fix style.*")); + ASSERT_THAT(text, ContainsRegex(".*Loading plugin: NVE2 variant fix style.*")); ::testing::internal::CaptureStdout(); lmp->input->one("plugin list"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*1: command style plugin hello" - ".*2: fix style plugin nve2.*")); + ASSERT_THAT(text, ContainsRegex(".*1: command style plugin hello" + ".*2: fix style plugin nve2.*")); ::testing::internal::CaptureStdout(); lmp->input->one(fmt::format(loadfmt, "hello")); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Ignoring load of command style hello: " - "must unload existing hello plugin.*")); + ASSERT_THAT(text, ContainsRegex(".*Ignoring load of command style hello: " + "must unload existing hello plugin.*")); ::testing::internal::CaptureStdout(); lmp->input->one("plugin unload command hello"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Unloading command style hello.*")); + ASSERT_THAT(text, ContainsRegex(".*Unloading command style hello.*")); ::testing::internal::CaptureStdout(); lmp->input->one("plugin unload pair nve2"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of pair style nve2: not from a plugin.*")); + ASSERT_THAT(text, ContainsRegex(".*Ignoring unload of pair style nve2: not from a plugin.*")); ::testing::internal::CaptureStdout(); lmp->input->one("plugin unload fix nve2"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Unloading fix style nve2.*")); + ASSERT_THAT(text, ContainsRegex(".*Unloading fix style nve2.*")); ::testing::internal::CaptureStdout(); lmp->input->one("plugin unload fix nve"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of fix style nve: not from a plugin.*")); + ASSERT_THAT(text, ContainsRegex(".*Ignoring unload of fix style nve: not from a plugin.*")); ::testing::internal::CaptureStdout(); lmp->input->one("plugin list"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Currently loaded plugins.*")); + ASSERT_THAT(text, ContainsRegex(".*Currently loaded plugins.*")); } #endif @@ -478,7 +478,13 @@ TEST_F(SimpleCommandsTest, Shell) test_var = getenv("TEST_VARIABLE"); ASSERT_NE(test_var, nullptr); +#if defined(_WIN32) + // we cannot create empty environment variables on Windows so platform::putenv() sets their + // value to "1" + ASSERT_THAT(test_var, StrEq("1")); +#else ASSERT_THAT(test_var, StrEq("")); +#endif } TEST_F(SimpleCommandsTest, CiteMe) @@ -495,8 +501,9 @@ TEST_F(SimpleCommandsTest, CiteMe) std::string text = END_CAPTURE_OUTPUT(); // find the two unique citations, but not the third - ASSERT_THAT(text, MatchesRegex(".*one.*two.*")); - ASSERT_THAT(text, Not(MatchesRegex(".*one.*two.*one.*"))); + ASSERT_THAT(text, ContainsRegex("test citation one.\n.*test citation two.*")); + ASSERT_THAT(text, Not(ContainsRegex( + "test citation one.\n.*test citation two.*\n.*test citation one.*"))); BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 0\n"); @@ -507,8 +514,8 @@ TEST_F(SimpleCommandsTest, CiteMe) text = END_CAPTURE_OUTPUT(); // find the forth (only differs in long citation) and sixth added citation - ASSERT_THAT(text, MatchesRegex(".*one.*three.*")); - ASSERT_THAT(text, Not(MatchesRegex(".*two.*"))); + ASSERT_THAT(text, ContainsRegex("test citation one.*\n.*test citation three.*")); + ASSERT_THAT(text, Not(ContainsRegex("test_citation two.*\n"))); BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 1\n"); @@ -521,7 +528,7 @@ TEST_F(SimpleCommandsTest, CiteMe) text = END_CAPTURE_OUTPUT(); // no new citation. no CITE-CITE-CITE- lines - ASSERT_THAT(text, Not(MatchesRegex(".*CITE-CITE-CITE-CITE.*"))); + ASSERT_THAT(text, Not(ContainsRegex(".*CITE-CITE-CITE-CITE.*"))); } } // namespace LAMMPS_NS diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index fb0aa58069..57a5d4f0ca 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -36,8 +36,8 @@ using LAMMPS_NS::MathConst::MY_PI; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { +using ::testing::ContainsRegex; using ::testing::ExitedWithCode; -using ::testing::MatchesRegex; using ::testing::StrEq; class VariableTest : public LAMMPSTest { @@ -317,7 +317,7 @@ TEST_F(VariableTest, Expressions) ASSERT_TRUE(variable->equalstyle(ivar)); ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.0); ASSERT_DOUBLE_EQ(variable->compute_equal("v_three"), 3.0); - ASSERT_NEAR(variable->compute_equal("v_four"), MY_PI,1.0e-14); + ASSERT_NEAR(variable->compute_equal("v_four"), MY_PI, 1.0e-14); ASSERT_GE(variable->compute_equal("v_five"), 20210310); ASSERT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1); ASSERT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5); @@ -394,58 +394,58 @@ TEST_F(VariableTest, IfCommand) BEGIN_CAPTURE_OUTPUT(); command("if 1>0 then 'print \"bingo!\"'"); auto text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if 1>2 then 'print \"bingo!\"' else 'print \"nope?\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*nope\?.*")); + ASSERT_THAT(text, ContainsRegex(".*nope\?.*")); BEGIN_CAPTURE_OUTPUT(); command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*nope\?.*")); + ASSERT_THAT(text, ContainsRegex(".*nope\?.*")); BEGIN_CAPTURE_OUTPUT(); command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if (${one}==1.0)&&(2>=1) then 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if !((${one}!=1.0)||(2|^1)) then 'print \"missed\"' else 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if (1>=2)&&(0&&1) then 'print \"missed\"' else 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if !1 then 'print \"missed\"' else 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if !(a==b) then 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if x==x|^1==0 then 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); BEGIN_CAPTURE_OUTPUT(); command("if x!=x|^a!=b then 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT(); - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", command("if () then 'print \"bingo!\"'");); diff --git a/unittest/cplusplus/CMakeLists.txt b/unittest/cplusplus/CMakeLists.txt index efd194b9d2..88f082a204 100644 --- a/unittest/cplusplus/CMakeLists.txt +++ b/unittest/cplusplus/CMakeLists.txt @@ -1,13 +1,13 @@ add_executable(test_lammps_class test_lammps_class.cpp) target_link_libraries(test_lammps_class PRIVATE lammps GTest::GMockMain) -add_test(LammpsClass test_lammps_class) +add_test(NAME LammpsClass COMMAND test_lammps_class) set_tests_properties(LammpsClass PROPERTIES ENVIRONMENT "OMP_NUM_THREADS=1") add_executable(test_input_class test_input_class.cpp) target_link_libraries(test_input_class PRIVATE lammps GTest::GTestMain) -add_test(InputClass test_input_class) +add_test(NAME InputClass COMMAND test_input_class) add_executable(test_error_class test_error_class.cpp) target_link_libraries(test_error_class PRIVATE lammps GTest::GMock) -add_test(ErrorClass test_error_class) +add_test(NAME ErrorClass COMMAND test_error_class) diff --git a/unittest/cplusplus/test_error_class.cpp b/unittest/cplusplus/test_error_class.cpp index f4f0d3b28b..27318646be 100644 --- a/unittest/cplusplus/test_error_class.cpp +++ b/unittest/cplusplus/test_error_class.cpp @@ -17,7 +17,7 @@ bool verbose = false; namespace LAMMPS_NS { -using ::testing::MatchesRegex; +using ::testing::ContainsRegex; using utils::split_words; class Error_class : public LAMMPSTest { @@ -39,7 +39,7 @@ TEST_F(Error_class, message) auto output = CAPTURE_OUTPUT([&] { error->message(FLERR, "one message"); }); - ASSERT_THAT(output, MatchesRegex("one message .*test_error_class.cpp:.*")); + ASSERT_THAT(output, ContainsRegex("one message .*test_error_class.cpp:.*")); }; TEST_F(Error_class, warning) @@ -48,7 +48,7 @@ TEST_F(Error_class, warning) auto output = CAPTURE_OUTPUT([&] { error->warning(FLERR, "one warning"); }); - ASSERT_THAT(output, MatchesRegex("WARNING: one warning .*test_error_class.cpp:.*")); + ASSERT_THAT(output, ContainsRegex("WARNING: one warning .*test_error_class.cpp:.*")); ASSERT_THAT(error->get_maxwarn(), 100); // warnings disabled @@ -72,7 +72,7 @@ TEST_F(Error_class, warning) output = CAPTURE_OUTPUT([&] { thermo->lost_check(); }); - ASSERT_THAT(output, MatchesRegex("WARNING: Too many warnings: 5 vs 2. All future.*")); + ASSERT_THAT(output, ContainsRegex("WARNING: Too many warnings: 5 vs 2. All future.*")); output = CAPTURE_OUTPUT([&] { error->warning(FLERR, "one warning"); @@ -91,7 +91,7 @@ TEST_F(Error_class, warning) output = CAPTURE_OUTPUT([&] { error->warning(FLERR, "one warning"); }); - ASSERT_THAT(output, MatchesRegex("WARNING: one warning.*")); + ASSERT_THAT(output, ContainsRegex("WARNING: one warning.*")); BEGIN_HIDE_OUTPUT(); command("thermo_modify warn default"); diff --git a/unittest/cplusplus/test_input_class.cpp b/unittest/cplusplus/test_input_class.cpp index b1d8af28c6..6595c24695 100644 --- a/unittest/cplusplus/test_input_class.cpp +++ b/unittest/cplusplus/test_input_class.cpp @@ -60,13 +60,13 @@ TEST_F(Input_commands, from_file) const char cont_file[] = "in.cont"; fp = fopen(demo_file, "w"); - for (auto & inp : demo_input) { + for (auto &inp : demo_input) { fputs(inp, fp); fputc('\n', fp); } fclose(fp); fp = fopen(cont_file, "w"); - for (auto & inp : cont_input) { + for (auto &inp : cont_input) { fputs(inp, fp); fputc('\n', fp); } @@ -84,7 +84,7 @@ TEST_F(Input_commands, from_file) TEST_F(Input_commands, from_line) { EXPECT_EQ(lmp->atom->natoms, 0); - for (auto & inp : demo_input) { + for (auto &inp : demo_input) { lmp->input->one(inp); } EXPECT_EQ(lmp->atom->natoms, 1); diff --git a/unittest/cplusplus/test_lammps_class.cpp b/unittest/cplusplus/test_lammps_class.cpp index 3a1bde51ff..d25bf43656 100644 --- a/unittest/cplusplus/test_lammps_class.cpp +++ b/unittest/cplusplus/test_lammps_class.cpp @@ -11,7 +11,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -using ::testing::MatchesRegex; +using ::testing::ContainsRegex; using ::testing::StartsWith; namespace LAMMPS_NS { @@ -90,14 +90,14 @@ TEST_F(LAMMPS_plain, InitMembers) EXPECT_EQ(lmp->memoryKK, nullptr); EXPECT_NE(lmp->python, nullptr); EXPECT_EQ(lmp->citeme, nullptr); - if (LAMMPS::has_git_info) { - EXPECT_STRNE(LAMMPS::git_commit, ""); - EXPECT_STRNE(LAMMPS::git_branch, ""); - EXPECT_STRNE(LAMMPS::git_descriptor, ""); + if (LAMMPS::has_git_info()) { + EXPECT_STRNE(LAMMPS::git_commit(), ""); + EXPECT_STRNE(LAMMPS::git_branch(), ""); + EXPECT_STRNE(LAMMPS::git_descriptor(), ""); } else { - EXPECT_STREQ(LAMMPS::git_commit, "(unknown)"); - EXPECT_STREQ(LAMMPS::git_branch, "(unknown)"); - EXPECT_STREQ(LAMMPS::git_descriptor, "(unknown)"); + EXPECT_STREQ(LAMMPS::git_commit(), "(unknown)"); + EXPECT_STREQ(LAMMPS::git_branch(), "(unknown)"); + EXPECT_STREQ(LAMMPS::git_descriptor(), "(unknown)"); } } @@ -225,18 +225,18 @@ TEST_F(LAMMPS_omp, InitMembers) EXPECT_EQ(lmp->memoryKK, nullptr); EXPECT_NE(lmp->python, nullptr); EXPECT_NE(lmp->citeme, nullptr); - if (LAMMPS::has_git_info) { - EXPECT_STRNE(LAMMPS::git_commit, ""); - EXPECT_STRNE(LAMMPS::git_branch, ""); - EXPECT_STRNE(LAMMPS::git_descriptor, ""); + if (LAMMPS::has_git_info()) { + EXPECT_STRNE(LAMMPS::git_commit(), ""); + EXPECT_STRNE(LAMMPS::git_branch(), ""); + EXPECT_STRNE(LAMMPS::git_descriptor(), ""); } else { - EXPECT_STREQ(LAMMPS::git_commit, "(unknown)"); - EXPECT_STREQ(LAMMPS::git_branch, "(unknown)"); - EXPECT_STREQ(LAMMPS::git_descriptor, "(unknown)"); + EXPECT_STREQ(LAMMPS::git_commit(), "(unknown)"); + EXPECT_STREQ(LAMMPS::git_branch(), "(unknown)"); + EXPECT_STREQ(LAMMPS::git_descriptor(), "(unknown)"); } } -// test fixture for Kokkos tests +// test fixture for Kokkos using 2 threads if threading is available class LAMMPS_kokkos : public ::testing::Test { protected: LAMMPS *lmp; @@ -256,18 +256,15 @@ protected: void SetUp() override { const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "none", "-screen", "none", - "-k", "on", "t", "2", "-sf", "kk"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - - // only run this test fixture with kk suffix if KOKKOS package is installed - // also need to figure out a way to find which parallelizations are enabled + "-k", "on", "t", "1", "-sf", "kk"}; + if (Info::has_accelerator_feature("KOKKOS", "api", "openmp")) args[10] = "2"; + char **argv = (char **)args; + int argc = sizeof(args) / sizeof(char *); if (LAMMPS::is_installed_pkg("KOKKOS")) { ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - std::string output = ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(output, StartsWith("Kokkos::OpenMP::")); + lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + ::testing::internal::GetCapturedStdout(); } else GTEST_SKIP(); } @@ -307,19 +304,23 @@ TEST_F(LAMMPS_kokkos, InitMembers) EXPECT_EQ(lmp->num_package, 0); EXPECT_EQ(lmp->clientserver, 0); + if (Info::has_accelerator_feature("KOKKOS", "api", "openmp")) + EXPECT_EQ(lmp->comm->nthreads, 2); + else + EXPECT_EQ(lmp->comm->nthreads, 1); EXPECT_NE(lmp->kokkos, nullptr); EXPECT_NE(lmp->atomKK, nullptr); EXPECT_NE(lmp->memoryKK, nullptr); EXPECT_NE(lmp->python, nullptr); EXPECT_NE(lmp->citeme, nullptr); - if (LAMMPS::has_git_info) { - EXPECT_STRNE(LAMMPS::git_commit, ""); - EXPECT_STRNE(LAMMPS::git_branch, ""); - EXPECT_STRNE(LAMMPS::git_descriptor, ""); + if (LAMMPS::has_git_info()) { + EXPECT_STRNE(LAMMPS::git_commit(), ""); + EXPECT_STRNE(LAMMPS::git_branch(), ""); + EXPECT_STRNE(LAMMPS::git_descriptor(), ""); } else { - EXPECT_STREQ(LAMMPS::git_commit, "(unknown)"); - EXPECT_STREQ(LAMMPS::git_branch, "(unknown)"); - EXPECT_STREQ(LAMMPS::git_descriptor, "(unknown)"); + EXPECT_STREQ(LAMMPS::git_commit(), "(unknown)"); + EXPECT_STREQ(LAMMPS::git_branch(), "(unknown)"); + EXPECT_STREQ(LAMMPS::git_descriptor(), "(unknown)"); } } @@ -339,7 +340,7 @@ TEST(LAMMPS_init, OpenMP) ::testing::internal::CaptureStdout(); LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); std::string output = ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(output, MatchesRegex(".*using 2 OpenMP thread.*per MPI task.*")); + EXPECT_THAT(output, ContainsRegex(".*using 2 OpenMP thread.*per MPI task.*")); if (LAMMPS_NS::Info::has_accelerator_feature("OPENMP", "api", "openmp")) EXPECT_EQ(lmp->comm->nthreads, 2); @@ -372,8 +373,8 @@ TEST(LAMMPS_init, NoOpenMP) ::testing::internal::CaptureStdout(); LAMMPS *lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); std::string output = ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(output, - MatchesRegex(".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*")); + EXPECT_THAT(output, ContainsRegex( + ".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*")); EXPECT_EQ(lmp->comm->nthreads, 1); ::testing::internal::CaptureStdout(); delete lmp; diff --git a/unittest/force-styles/CMakeLists.txt b/unittest/force-styles/CMakeLists.txt index 464cd9426a..934c110b1f 100644 --- a/unittest/force-styles/CMakeLists.txt +++ b/unittest/force-styles/CMakeLists.txt @@ -46,11 +46,7 @@ else() endif() target_include_directories(style_tests PRIVATE ${LAMMPS_SOURCE_DIR}) target_link_libraries(style_tests PUBLIC gmock Yaml::Yaml lammps) -if(BUILD_MPI) - target_link_libraries(style_tests PUBLIC MPI::MPI_CXX) -else() - target_link_libraries(style_tests PUBLIC mpi_stubs) -endif() + # propagate sanitizer options to test tools if(ENABLE_SANITIZER AND (NOT (ENABLE_SANITIZER STREQUAL "none"))) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) @@ -72,6 +68,28 @@ if(FFT_SINGLE) target_compile_definitions(test_pair_style PRIVATE -DFFT_SINGLE) endif() +# prepare environment for testers +if(WIN32) + set(FORCE_TEST_ENVIRONMENT PYTHONPATH=${TEST_INPUT_FOLDER}) +else() + set(FORCE_TEST_ENVIRONMENT PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}) +endif() +list(APPEND FORCE_TEST_ENVIRONMENT "PYTHONUNBUFFERED=1") +list(APPEND FORCE_TEST_ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") +get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(BUILD_IS_MULTI_CONFIG) + set(LAMMPS_LIB_PATH ${CMAKE_BINARY_DIR}/$) +else() + set(LAMMPS_LIB_PATH ${CMAKE_BINARY_DIR}) +endif() +if(APPLE) + list(APPEND FORCE_TEST_ENVIRONMENT "DYLD_LIBRARY_PATH=${LAMMPS_LIB_PATH}:$ENV{DYLD_LIBRARY_PATH}") +elseif(WIN32) + list(APPEND FORCE_TEST_ENVIRONMENT "LAMMPSDLLPATH=${LAMMPS_LIB_PATH}") +else() + list(APPEND FORCE_TEST_ENVIRONMENT "LD_LIBRARY_PATH=${LAMMPS_LIB_PATH}:$ENV{LD_LIBRARY_PATH}") +endif() + # tests for molecular systems and related pair styles file(GLOB MOL_PAIR_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/mol-pair-*.yaml) # cannot test MSM with single precision data @@ -81,8 +99,12 @@ endif() foreach(TEST ${MOL_PAIR_TESTS}) string(REGEX REPLACE "^.*mol-pair-(.*)\.yaml" "MolPairStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "${FORCE_TEST_ENVIRONMENT}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -91,8 +113,12 @@ file(GLOB ATOMIC_PAIR_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/atomic-p foreach(TEST ${ATOMIC_PAIR_TESTS}) string(REGEX REPLACE "^.*atomic-pair-(.*)\.yaml" "AtomicPairStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "${FORCE_TEST_ENVIRONMENT}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -101,8 +127,12 @@ file(GLOB MANYBODY_PAIR_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/manybo foreach(TEST ${MANYBODY_PAIR_TESTS}) string(REGEX REPLACE "^.*manybody-pair-(.*)\.yaml" "ManybodyPairStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "${FORCE_TEST_ENVIRONMENT}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -114,8 +144,12 @@ file(GLOB BOND_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/bond-*.yaml) foreach(TEST ${BOND_TESTS}) string(REGEX REPLACE "^.*bond-(.*)\.yaml" "BondStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_bond_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_bond_style ${TEST}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "${FORCE_TEST_ENVIRONMENT}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -127,8 +161,12 @@ file(GLOB ANGLE_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/angle-*.yaml) foreach(TEST ${ANGLE_TESTS}) string(REGEX REPLACE "^.*angle-(.*)\.yaml" "AngleStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_angle_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_angle_style ${TEST}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "${FORCE_TEST_ENVIRONMENT}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -141,8 +179,12 @@ endif() foreach(TEST ${KSPACE_TESTS}) string(REGEX REPLACE "^.*kspace-(.*)\.yaml" "KSpaceStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_pair_style ${TEST}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "${FORCE_TEST_ENVIRONMENT}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -158,8 +200,16 @@ file(GLOB FIX_TIMESTEP_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/fix-tim foreach(TEST ${FIX_TIMESTEP_TESTS}) string(REGEX REPLACE "^.*fix-timestep-(.*)\.yaml" "FixTimestep:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_fix_timestep ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_fix_timestep ${TEST}) +if(WIN32) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}\\\;${LAMMPS_PYTHON_DIR}") +else() set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}") +endif() set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -171,7 +221,11 @@ file(GLOB DIHEDRAL_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/dihedral-*. foreach(TEST ${DIHEDRAL_TESTS}) string(REGEX REPLACE "^.*dihedral-(.*)\.yaml" "DihedralStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_dihedral_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_dihedral_style ${TEST}) set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() @@ -184,7 +238,11 @@ file(GLOB IMPROPER_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/improper-*. foreach(TEST ${IMPROPER_TESTS}) string(REGEX REPLACE "^.*improper-(.*)\.yaml" "ImproperStyle:\\1" TNAME ${TEST}) extract_tags(TEST_TAGS ${TEST}) - add_test(NAME ${TNAME} COMMAND test_improper_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + list(FIND TEST_TAGS "no${CMAKE_SYSTEM_NAME}" _SKIPME) + if(_SKIPME GREATER_EQUAL 0) + continue() + endif() + add_test(NAME ${TNAME} COMMAND test_improper_style ${TEST}) set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") set_tests_properties(${TNAME} PROPERTIES LABELS "${TEST_TAGS}") endforeach() diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index b4300218b7..a617ec1783 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -33,6 +33,7 @@ #include "lammps.h" #include "modify.h" #include "universe.h" +#include "platform.h" #include #include @@ -50,16 +51,11 @@ using ::testing::StartsWith; using namespace LAMMPS_NS; -static void delete_file(const std::string &filename) -{ - remove(filename.c_str()); -}; - void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) { - delete_file(cfg.basename + ".restart"); - delete_file(cfg.basename + ".data"); - delete_file(cfg.basename + "-coeffs.in"); + platform::unlink(cfg.basename + ".restart"); + platform::unlink(cfg.basename + ".data"); + platform::unlink(cfg.basename + "-coeffs.in"); delete lmp; } @@ -112,7 +108,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new command(pre_command); } - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); command("angle_style " + cfg.angle_style); @@ -198,7 +194,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable angle_style index '" + cfg.angle_style + "'"); command("variable data_file index " + cfg.basename + ".data"); - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); for (auto &angle_coeff : cfg.angle_coeff) { @@ -289,7 +285,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress stress = lmp->force->angle->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], - stress[1], stress[2], stress[3], stress[4], stress[5]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); @@ -304,6 +300,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) return; } + TEST(AngleStyle, plain) { if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); @@ -337,29 +334,11 @@ TEST(AngleStyle, plain) double epsilon = test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; ErrorStats stats; - stats.reset(); - const std::vector &f_ref = test_config.init_forces; - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto angle = lmp->force->angle; - auto stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); @@ -369,29 +348,8 @@ TEST(AngleStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = angle->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -407,27 +365,10 @@ TEST(AngleStyle, plain) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - angle = lmp->force->angle; - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 2 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", angle->virial, test_config.init_stress, 2*epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); @@ -437,26 +378,8 @@ TEST(AngleStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = angle->virial; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", angle->virial, test_config.run_stress, epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -470,27 +393,9 @@ TEST(AngleStyle, plain) restart_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "restart_forces stats:" << stats << std::endl; - angle = lmp->force->angle; - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "restart_stress stats:" << stats << std::endl; + EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("restart_stress", angle->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); @@ -500,27 +405,9 @@ TEST(AngleStyle, plain) data_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "data_forces stats:" << stats << std::endl; - angle = lmp->force->angle; - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "data_stress stats:" << stats << std::endl; + EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("data_stress", angle->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); @@ -567,30 +454,11 @@ TEST(AngleStyle, omp) // relax error a bit for OPENMP package double epsilon = 5.0 * test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto angle = lmp->force->angle; - auto stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); @@ -600,29 +468,8 @@ TEST(AngleStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = angle->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -641,27 +488,10 @@ TEST(AngleStyle, omp) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - angle = lmp->force->angle; - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", angle->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); @@ -671,25 +501,8 @@ TEST(AngleStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = angle->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", angle->virial, test_config.run_stress, 10 * epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index f4c151a394..a851f4341f 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -33,6 +33,7 @@ #include "lammps.h" #include "modify.h" #include "universe.h" +#include "platform.h" #include #include @@ -50,16 +51,11 @@ using ::testing::StartsWith; using namespace LAMMPS_NS; -static void delete_file(const std::string &filename) -{ - remove(filename.c_str()); -}; - void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) { - delete_file(cfg.basename + ".restart"); - delete_file(cfg.basename + ".data"); - delete_file(cfg.basename + "-coeffs.in"); + platform::unlink(cfg.basename + ".restart"); + platform::unlink(cfg.basename + ".data"); + platform::unlink(cfg.basename + "-coeffs.in"); delete lmp; } @@ -112,7 +108,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new command(pre_command); } - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); command("bond_style " + cfg.bond_style); @@ -198,7 +194,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable bond_style index '" + cfg.bond_style + "'"); command("variable data_file index " + cfg.basename + ".data"); - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); for (auto &bond_coeff : cfg.bond_coeff) { @@ -289,7 +285,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress stress = lmp->force->bond->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], - stress[1], stress[2], stress[3], stress[4], stress[5]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); @@ -337,29 +333,11 @@ TEST(BondStyle, plain) double epsilon = test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; ErrorStats stats; - stats.reset(); - const std::vector &f_ref = test_config.init_forces; - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto bond = lmp->force->bond; - auto stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon); @@ -369,29 +347,8 @@ TEST(BondStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = bond->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -407,27 +364,10 @@ TEST(BondStyle, plain) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - bond = lmp->force->bond; - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 2 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", bond->virial, test_config.init_stress, 2 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon); @@ -437,26 +377,8 @@ TEST(BondStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = bond->virial; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", bond->virial, test_config.run_stress, epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -470,27 +392,10 @@ TEST(BondStyle, plain) restart_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "restart_forces stats:" << stats << std::endl; - bond = lmp->force->bond; - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "restart_stress stats:" << stats << std::endl; + + EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("restart_stress", bond->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon); @@ -500,27 +405,10 @@ TEST(BondStyle, plain) data_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "data_forces stats:" << stats << std::endl; - bond = lmp->force->bond; - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "data_stress stats:" << stats << std::endl; + + EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("data_stress", bond->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon); @@ -567,29 +455,11 @@ TEST(BondStyle, omp) // relax error a bit for OPENMP package double epsilon = 5.0 * test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto bond = lmp->force->bond; - auto stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon); @@ -599,29 +469,8 @@ TEST(BondStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = bond->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -640,27 +489,10 @@ TEST(BondStyle, omp) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - bond = lmp->force->bond; - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", bond->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon); @@ -670,25 +502,8 @@ TEST(BondStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = bond->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", bond->virial, test_config.run_stress, 10 * epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index e6cf73f10e..d152b4fcf4 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -374,7 +374,7 @@ void TestConfigReader::tags(const yaml_event_t &event) { std::stringstream data((char *)event.data.scalar.value); config.tags.clear(); - for (std::string tag; std::getline(data, tag, ','); ) { + for (std::string tag; std::getline(data, tag, ',');) { config.tags.push_back(trim(tag)); } } diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index 8cae5d5f7c..0156e8e021 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -33,6 +33,7 @@ #include "lammps.h" #include "modify.h" #include "universe.h" +#include "platform.h" #include #include @@ -50,16 +51,11 @@ using ::testing::StartsWith; using namespace LAMMPS_NS; -static void delete_file(const std::string &filename) -{ - remove(filename.c_str()); -}; - void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) { - delete_file(cfg.basename + ".restart"); - delete_file(cfg.basename + ".data"); - delete_file(cfg.basename + "-coeffs.in"); + platform::unlink(cfg.basename + ".restart"); + platform::unlink(cfg.basename + ".data"); + platform::unlink(cfg.basename + "-coeffs.in"); delete lmp; } @@ -112,7 +108,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new command(pre_command); } - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); command("dihedral_style " + cfg.dihedral_style); @@ -207,7 +203,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable pair_style index 'lj/charmmfsw/coul/charmmfsh 7.0 8.0'"); } - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); for (auto &dihedral_coeff : cfg.dihedral_coeff) { @@ -292,7 +288,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress stress = lmp->force->dihedral->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], - stress[1], stress[2], stress[3], stress[4], stress[5]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); @@ -340,29 +336,11 @@ TEST(DihedralStyle, plain) double epsilon = test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; ErrorStats stats; - stats.reset(); - const std::vector &f_ref = test_config.init_forces; - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto dihedral = lmp->force->dihedral; - auto stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon); @@ -372,29 +350,8 @@ TEST(DihedralStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = dihedral->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -410,27 +367,10 @@ TEST(DihedralStyle, plain) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - dihedral = lmp->force->dihedral; - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 2 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", dihedral->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon); @@ -440,26 +380,8 @@ TEST(DihedralStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = dihedral->virial; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", dihedral->virial, test_config.run_stress, epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -473,27 +395,10 @@ TEST(DihedralStyle, plain) restart_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "restart_forces stats:" << stats << std::endl; - dihedral = lmp->force->dihedral; - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "restart_stress stats:" << stats << std::endl; + + EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("restart_stress", dihedral->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon); @@ -503,27 +408,10 @@ TEST(DihedralStyle, plain) data_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "data_forces stats:" << stats << std::endl; - dihedral = lmp->force->dihedral; - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "data_stress stats:" << stats << std::endl; + + EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("data_stress", dihedral->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon); @@ -570,30 +458,11 @@ TEST(DihedralStyle, omp) // relax error a bit for OPENMP package double epsilon = 5.0 * test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto dihedral = lmp->force->dihedral; - auto stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon); @@ -603,29 +472,8 @@ TEST(DihedralStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = dihedral->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -644,27 +492,10 @@ TEST(DihedralStyle, omp) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - dihedral = lmp->force->dihedral; - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", dihedral->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon); @@ -674,25 +505,8 @@ TEST(DihedralStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = dihedral->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", dihedral->virial, test_config.run_stress, 10 * epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index ac83ff9573..fcf6be39d3 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -37,6 +37,7 @@ #include "universe.h" #include "utils.h" #include "variable.h" +#include "platform.h" #include #include @@ -54,16 +55,10 @@ using ::testing::StartsWith; using namespace LAMMPS_NS; -static void delete_file(const std::string &filename) -{ - remove(filename.c_str()); -}; - void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) { - delete_file(cfg.basename + ".restart"); + platform::unlink(cfg.basename + ".restart"); delete lmp; - lmp = nullptr; } LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool use_respa = false) @@ -104,7 +99,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool use for (auto &pre_command : cfg.pre_commands) command(pre_command); - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); lmp->input->file(input_file.c_str()); if (use_respa) command("run_style respa 2 1 bond 1 pair 2"); @@ -209,8 +204,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) if (fix->thermo_virial) { auto stress = fix->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} " - "{:23.16e} {:23.16e} {:23.16e}", - stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); + "{:23.16e} {:23.16e} {:23.16e}", + stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); } @@ -287,29 +282,10 @@ TEST(FixTimestep, plain) double epsilon = test_config.epsilon; - auto tag = lmp->atom->tag; - auto x = lmp->atom->x; - auto v = lmp->atom->v; ErrorStats stats; - stats.reset(); - const std::vector &x_ref = test_config.run_pos; - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, normal run, verlet: " << stats << std::endl; - const std::vector &v_ref = test_config.run_vel; - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, normal run, verlet: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon); int ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -317,15 +293,7 @@ TEST(FixTimestep, plain) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress normal run, verlet: " << stats << std::endl; + EXPECT_STRESS("run_stress (normal run, verlet)", fix->virial, test_config.run_stress, epsilon); } stats.reset(); @@ -365,26 +333,8 @@ TEST(FixTimestep, plain) restart_lammps(lmp, test_config, false, false); if (!verbose) ::testing::internal::GetCapturedStdout(); - tag = lmp->atom->tag; - x = lmp->atom->x; - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, restart, verlet: " << stats << std::endl; - - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, restart, verlet: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (restart, verlet)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (restart, verlet)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -392,15 +342,7 @@ TEST(FixTimestep, plain) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress restart, verlet: " << stats << std::endl; + EXPECT_STRESS("run_stress (restart, verlet)", fix->virial, test_config.run_stress, epsilon); } stats.reset(); @@ -429,26 +371,8 @@ TEST(FixTimestep, plain) restart_lammps(lmp, test_config, true, false); if (!verbose) ::testing::internal::GetCapturedStdout(); - x = lmp->atom->x; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, rmass, verlet: " << stats << std::endl; - - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, rmass, verlet: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (rmass, verlet)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (rmass, verlet)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -456,15 +380,7 @@ TEST(FixTimestep, plain) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress rmass, verlet: " << stats << std::endl; + EXPECT_STRESS("run_stress (rmass, verlet)", fix->virial, test_config.run_stress, epsilon); } stats.reset(); @@ -507,26 +423,8 @@ TEST(FixTimestep, plain) // lower required precision by two orders of magnitude to accommodate respa epsilon *= 100.0; - tag = lmp->atom->tag; - x = lmp->atom->x; - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, normal run, respa: " << stats << std::endl; - - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, normal run, respa: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (normal run, respa)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (normal run, respa)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -534,16 +432,7 @@ TEST(FixTimestep, plain) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 1000 * epsilon); - if (print_stats) - std::cerr << "run_stress normal run, respa: " << stats << std::endl; + EXPECT_STRESS("run_stress (normal run, respa)", fix->virial, test_config.run_stress, 1000 * epsilon); } stats.reset(); @@ -571,26 +460,8 @@ TEST(FixTimestep, plain) restart_lammps(lmp, test_config, false, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - tag = lmp->atom->tag; - x = lmp->atom->x; - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, restart, respa: " << stats << std::endl; - - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, restart, respa: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (restart, respa)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (restart, respa)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -598,15 +469,7 @@ TEST(FixTimestep, plain) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 1000 * epsilon); - if (print_stats) std::cerr << "run_stress restart, respa: " << stats << std::endl; + EXPECT_STRESS("run_stress (restart, respa)", fix->virial, test_config.run_stress, 1000 * epsilon); } stats.reset(); @@ -635,26 +498,8 @@ TEST(FixTimestep, plain) restart_lammps(lmp, test_config, true, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - x = lmp->atom->x; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, rmass, respa: " << stats << std::endl; - - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, rmass, respa: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (rmass, respa)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (rmass, respa)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -662,15 +507,7 @@ TEST(FixTimestep, plain) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 1000 * epsilon); - if (print_stats) std::cerr << "run_stress rmass, respa: " << stats << std::endl; + EXPECT_STRESS("run_stress (rmass, respa)", fix->virial, test_config.run_stress, 1000 * epsilon); } stats.reset(); @@ -739,29 +576,10 @@ TEST(FixTimestep, omp) double epsilon = test_config.epsilon; - auto tag = lmp->atom->tag; - auto x = lmp->atom->x; - auto v = lmp->atom->v; ErrorStats stats; - stats.reset(); - const std::vector &x_ref = test_config.run_pos; - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, normal run, verlet: " << stats << std::endl; - const std::vector &v_ref = test_config.run_vel; - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, normal run, verlet: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon); int ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -769,15 +587,7 @@ TEST(FixTimestep, omp) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress normal run, verlet: " << stats << std::endl; + EXPECT_STRESS("run_stress (normal run, verlet)", fix->virial, test_config.run_stress, epsilon); } stats.reset(); @@ -817,26 +627,8 @@ TEST(FixTimestep, omp) restart_lammps(lmp, test_config, false, false); if (!verbose) ::testing::internal::GetCapturedStdout(); - tag = lmp->atom->tag; - x = lmp->atom->x; - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, restart, verlet: " << stats << std::endl; - - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, restart, verlet: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (restart, verlet)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (restart, verlet)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -844,15 +636,7 @@ TEST(FixTimestep, omp) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress restart, verlet: " << stats << std::endl; + EXPECT_STRESS("run_stress (restart, verlet)", fix->virial, test_config.run_stress, epsilon); } stats.reset(); @@ -881,26 +665,8 @@ TEST(FixTimestep, omp) restart_lammps(lmp, test_config, true, false); if (!verbose) ::testing::internal::GetCapturedStdout(); - x = lmp->atom->x; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, rmass, verlet: " << stats << std::endl; - - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, rmass, verlet: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (rmass, verlet)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (rmass, verlet)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -908,15 +674,7 @@ TEST(FixTimestep, omp) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress rmass, verlet: " << stats << std::endl; + EXPECT_STRESS("run_stress (rmass, verlet)", fix->virial, test_config.run_stress, epsilon); } stats.reset(); @@ -958,27 +716,8 @@ TEST(FixTimestep, omp) // lower required precision by two orders of magnitude to accommodate respa epsilon *= 100.0; - tag = lmp->atom->tag; - x = lmp->atom->x; - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, normal run, respa: " << stats << std::endl; - printf("x1\n"); - - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, normal run, respa: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (normal run, respa)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (normal run, respa)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -986,16 +725,7 @@ TEST(FixTimestep, omp) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 1000 * epsilon); - if (print_stats) - std::cerr << "run_stress normal run, respa: " << stats << std::endl; + EXPECT_STRESS("run_stress (normal run, respa)", fix->virial, test_config.run_stress, 1000 * epsilon); } stats.reset(); @@ -1023,26 +753,8 @@ TEST(FixTimestep, omp) restart_lammps(lmp, test_config, false, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - tag = lmp->atom->tag; - x = lmp->atom->x; - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, restart, respa: " << stats << std::endl; - - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, restart, respa: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (restart, respa)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (restart, respa)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -1050,15 +762,7 @@ TEST(FixTimestep, omp) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 1000 * epsilon); - if (print_stats) std::cerr << "run_stress restart, respa: " << stats << std::endl; + EXPECT_STRESS("run_stress (restart, respa)", fix->virial, test_config.run_stress, 1000 * epsilon); } stats.reset(); @@ -1087,26 +791,8 @@ TEST(FixTimestep, omp) restart_lammps(lmp, test_config, true, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - x = lmp->atom->x; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, x_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_pos, rmass, respa: " << stats << std::endl; - - v = lmp->atom->v; - stats.reset(); - ASSERT_EQ(nlocal + 1, v_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "run_vel, rmass, respa: " << stats << std::endl; + EXPECT_POSITIONS("run_pos (rmass, respa)", lmp->atom, test_config.run_pos, epsilon); + EXPECT_VELOCITIES("run_vel (rmass, respa)", lmp->atom, test_config.run_vel, epsilon); ifix = lmp->modify->find_fix("test"); if (ifix < 0) { @@ -1114,15 +800,7 @@ TEST(FixTimestep, omp) } else { Fix *fix = lmp->modify->fix[ifix]; if (fix->thermo_virial) { - stats.reset(); - auto stress = fix->virial; - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 1000 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 1000 * epsilon); - if (print_stats) std::cerr << "run_stress rmass, respa: " << stats << std::endl; + EXPECT_STRESS("run_stress (rmass, respa)", fix->virial, test_config.run_stress, 1000 * epsilon); } stats.reset(); diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index b6d6b9a06b..49b7d22cad 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -33,6 +33,7 @@ #include "lammps.h" #include "modify.h" #include "universe.h" +#include "platform.h" #include #include @@ -50,16 +51,11 @@ using ::testing::StartsWith; using namespace LAMMPS_NS; -static void delete_file(const std::string &filename) -{ - remove(filename.c_str()); -}; - void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) { - delete_file(cfg.basename + ".restart"); - delete_file(cfg.basename + ".data"); - delete_file(cfg.basename + "-coeffs.in"); + platform::unlink(cfg.basename + ".restart"); + platform::unlink(cfg.basename + ".data"); + platform::unlink(cfg.basename + "-coeffs.in"); delete lmp; } @@ -112,7 +108,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new command(pre_command); } - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); command("improper_style " + cfg.improper_style); @@ -198,7 +194,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable improper_style index '" + cfg.improper_style + "'"); command("variable data_file index " + cfg.basename + ".data"); - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); for (auto &improper_coeff : cfg.improper_coeff) { @@ -283,7 +279,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress stress = lmp->force->improper->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], - stress[1], stress[2], stress[3], stress[4], stress[5]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); @@ -331,29 +327,11 @@ TEST(ImproperStyle, plain) double epsilon = test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; ErrorStats stats; - stats.reset(); - const std::vector &f_ref = test_config.init_forces; - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto improper = lmp->force->improper; - auto stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.init_energy, epsilon); @@ -363,29 +341,8 @@ TEST(ImproperStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = improper->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -401,27 +358,10 @@ TEST(ImproperStyle, plain) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - improper = lmp->force->improper; - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 2 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 2 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", improper->virial, test_config.init_stress, 2 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.init_energy, epsilon); @@ -431,26 +371,8 @@ TEST(ImproperStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = improper->virial; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", improper->virial, test_config.run_stress, epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -464,27 +386,10 @@ TEST(ImproperStyle, plain) restart_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "restart_forces stats:" << stats << std::endl; - improper = lmp->force->improper; - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "restart_stress stats:" << stats << std::endl; + + EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("restart_stress", improper->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.init_energy, epsilon); @@ -494,27 +399,10 @@ TEST(ImproperStyle, plain) data_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "data_forces stats:" << stats << std::endl; - improper = lmp->force->improper; - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "data_stress stats:" << stats << std::endl; + + EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("data_stress", improper->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.init_energy, epsilon); @@ -561,30 +449,11 @@ TEST(ImproperStyle, omp) // relax error a bit for OPENMP package double epsilon = 5.0 * test_config.epsilon; - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto improper = lmp->force->improper; - auto stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.init_energy, epsilon); @@ -594,29 +463,8 @@ TEST(ImproperStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = improper->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -635,27 +483,10 @@ TEST(ImproperStyle, omp) // skip over these tests if newton bond is forced to be on if (lmp->force->newton_bond == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - improper = lmp->force->improper; - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", improper->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.init_energy, epsilon); @@ -665,25 +496,8 @@ TEST(ImproperStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 10 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = improper->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); + EXPECT_STRESS("run_stress (newton off)", improper->virial, test_config.run_stress, 10 * epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index 2680804fdf..0fc2fef47d 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -15,10 +15,13 @@ #include "pointers.h" #include "test_config.h" #include "test_config_reader.h" +#include "error_stats.h" #include "utils.h" #include "yaml_writer.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "lammps.h" +#include "atom.h" #include #include @@ -27,8 +30,69 @@ #include #include +using LAMMPS_NS::LAMMPS; +using LAMMPS_NS::Atom; using LAMMPS_NS::utils::split_words; using LAMMPS_NS::utils::trim; +using LAMMPS_NS::tagint; + +void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & expected_stress, double epsilon) +{ + SCOPED_TRACE("EXPECT_STRESS: " + name); + ErrorStats stats; + EXPECT_FP_LE_WITH_EPS(stress[0], expected_stress.xx, epsilon); + EXPECT_FP_LE_WITH_EPS(stress[1], expected_stress.yy, epsilon); + EXPECT_FP_LE_WITH_EPS(stress[2], expected_stress.zz, epsilon); + EXPECT_FP_LE_WITH_EPS(stress[3], expected_stress.xy, epsilon); + EXPECT_FP_LE_WITH_EPS(stress[4], expected_stress.xz, epsilon); + EXPECT_FP_LE_WITH_EPS(stress[5], expected_stress.yz, epsilon); + if (print_stats) std::cerr << name << " stats" << stats << std::endl; +} + +void EXPECT_FORCES(const std::string & name, Atom * atom, const std::vector & f_ref, double epsilon) { + SCOPED_TRACE("EXPECT_FORCES: " + name); + double ** f = atom->f; + tagint * tag = atom->tag; + const int nlocal = atom->nlocal; + ASSERT_EQ(nlocal + 1, f_ref.size()); + ErrorStats stats; + for (int i = 0; i < nlocal; ++i) { + EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); + EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); + EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); + } + if (print_stats) std::cerr << name << " stats" << stats << std::endl; +} + +void EXPECT_POSITIONS(const std::string & name, Atom * atom, const std::vector & x_ref, double epsilon) { + SCOPED_TRACE("EXPECT_POSITIONS: " + name); + double ** x = atom->x; + tagint * tag = atom->tag; + const int nlocal = atom->nlocal; + ASSERT_EQ(nlocal + 1, x_ref.size()); + ErrorStats stats; + for (int i = 0; i < nlocal; ++i) { + EXPECT_FP_LE_WITH_EPS(x[i][0], x_ref[tag[i]].x, epsilon); + EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon); + EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon); + } + if (print_stats) std::cerr << name << " stats" << stats << std::endl; +} + +void EXPECT_VELOCITIES(const std::string & name, Atom * atom, const std::vector & v_ref, double epsilon) { + SCOPED_TRACE("EXPECT_VELOCITIES: " + name); + double ** v = atom->v; + tagint * tag = atom->tag; + const int nlocal = atom->nlocal; + ASSERT_EQ(nlocal + 1, v_ref.size()); + ErrorStats stats; + for (int i = 0; i < nlocal; ++i) { + EXPECT_FP_LE_WITH_EPS(v[i][0], v_ref[tag[i]].x, epsilon); + EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon); + EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon); + } + if (print_stats) std::cerr << name << " stats" << stats << std::endl; +} // common read_yaml_file function bool read_yaml_file(const char *infile, TestConfig &config) diff --git a/unittest/force-styles/test_main.h b/unittest/force-styles/test_main.h index 3a9651e621..ff373e5174 100644 --- a/unittest/force-styles/test_main.h +++ b/unittest/force-styles/test_main.h @@ -15,7 +15,10 @@ #define TEST_MAIN_H #include "test_config.h" +#include "lammps.h" +#include "atom.h" #include +#include extern TestConfig test_config; extern bool print_stats; @@ -34,10 +37,9 @@ void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *ve EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \ } while (0); -#if defined _WIN32 -static const char PATH_SEP = '\\'; -#else -static const char PATH_SEP = '/'; -#endif +void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & expected_stress, double epsilon); +void EXPECT_FORCES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector & f_ref, double epsilon); +void EXPECT_POSITIONS(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector & x_ref, double epsilon); +void EXPECT_VELOCITIES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector & v_ref, double epsilon); #endif diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 898fb8e412..4b1175455f 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -34,6 +34,7 @@ #include "pair.h" #include "universe.h" #include "utils.h" +#include "platform.h" #include #include @@ -51,18 +52,12 @@ using ::testing::StartsWith; using namespace LAMMPS_NS; -static void delete_file(const std::string &filename) -{ - remove(filename.c_str()); -}; - void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) { - delete_file(cfg.basename + ".restart"); - delete_file(cfg.basename + ".data"); - delete_file(cfg.basename + "-coeffs.in"); + platform::unlink(cfg.basename + ".restart"); + platform::unlink(cfg.basename + ".data"); + platform::unlink(cfg.basename + "-coeffs.in"); delete lmp; - lmp = nullptr; } LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool newton = true) @@ -114,7 +109,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new command(pre_command); } - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); command("pair_style " + cfg.pair_style); @@ -212,7 +207,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable pair_style index '" + cfg.pair_style + "'"); command("variable data_file index " + cfg.basename + ".data"); - std::string input_file = INPUT_FOLDER + PATH_SEP + cfg.input_file; + std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); for (auto &pair_coeff : cfg.pair_coeff) { @@ -361,30 +356,12 @@ TEST(PairStyle, plain) if (lmp->force->kspace && lmp->force->kspace->compute_flag) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - ErrorStats stats; - stats.reset(); - const std::vector &f_ref = test_config.init_forces; - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto pair = lmp->force->pair; - auto stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, epsilon); + + ErrorStats stats; stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, epsilon); @@ -394,29 +371,8 @@ TEST(PairStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = pair->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -435,27 +391,10 @@ TEST(PairStyle, plain) // skip over these tests if newton pair is forced to be on if (lmp->force->newton_pair == 0) { - - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 3 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 3 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 3 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 3 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 3 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 3 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 3 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -466,26 +405,8 @@ TEST(PairStyle, plain) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = pair->virial; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -502,27 +423,10 @@ TEST(PairStyle, plain) restart_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "restart_forces stats:" << stats << std::endl; - pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "restart_stress stats:" << stats << std::endl; + + EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("restart_stress", pair->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -535,27 +439,10 @@ TEST(PairStyle, plain) restart_lammps(lmp, test_config, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "nofdotr_forces stats:" << stats << std::endl; - pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "nofdotr_stress stats:" << stats << std::endl; + + EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -567,27 +454,9 @@ TEST(PairStyle, plain) data_lammps(lmp, test_config); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "data_forces stats:" << stats << std::endl; - pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon); - if (print_stats) std::cerr << "data_stress stats:" << stats << std::endl; + EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("data_stress", pair->virial, test_config.init_stress, epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -608,25 +477,8 @@ TEST(PairStyle, plain) pair = lmp->force->pair; if (pair->ncoultablebits) epsilon *= 5.0e6; - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, r-RESPA:" << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, epsilon); - if (print_stats) std::cerr << "run_stress stats, r-RESPA:" << stats << std::endl; + EXPECT_FORCES("run_forces (r-RESPA)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (r-RESPA)", pair->virial, test_config.run_stress, epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -684,29 +536,11 @@ TEST(PairStyle, omp) if (lmp->force->kspace && lmp->force->kspace->compute_flag) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; - ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton on: " << stats << std::endl; - auto pair = lmp->force->pair; - auto stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton on: " << stats << std::endl; + ErrorStats stats; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -717,29 +551,8 @@ TEST(PairStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - stress = pair->virial; - tag = lmp->atom->tag; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton on: " << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton on: " << stats << std::endl; + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 5* epsilon); + EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -757,26 +570,10 @@ TEST(PairStyle, omp) lmp = init_lammps(argc, argv, test_config, false); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -787,25 +584,8 @@ TEST(PairStyle, omp) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon); stats.reset(); id = lmp->modify->find_compute("sum"); @@ -820,27 +600,133 @@ TEST(PairStyle, omp) restart_lammps(lmp, test_config, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; + pair = lmp->force->pair; + + EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon); + EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon); + stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, 5 * epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, 5 * epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, 5 * epsilon); + if (print_stats) std::cerr << "nofdotr_energy stats:" << stats << std::endl; + + if (!verbose) ::testing::internal::CaptureStdout(); + cleanup_lammps(lmp, test_config); + if (!verbose) ::testing::internal::GetCapturedStdout(); +}; + +TEST(PairStyle, kokkos_omp) +{ + if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); + + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", + "-k", "on", "t", "4", "-sf", "kk"}; + + // cannot run dpd styles with more than 1 thread due to using multiple pRNGs + if (utils::strmatch(test_config.pair_style, "^dpd")) args[9] = "1"; + + char **argv = (char **)args; + int argc = sizeof(args) / sizeof(char *); + + ::testing::internal::CaptureStdout(); + LAMMPS *lmp = init_lammps(argc, argv, test_config, true); + + std::string output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + + if (!lmp) { + std::cerr << "One or more prerequisite styles with /kk suffix\n" + "are not available in this LAMMPS configuration:\n"; + for (auto &prerequisite : test_config.prerequisites) { + std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n"; + } + GTEST_SKIP(); } - if (print_stats) std::cerr << "nofdotr_forces stats:" << stats << std::endl; + + EXPECT_THAT(output, StartsWith("LAMMPS (")); + EXPECT_THAT(output, HasSubstr("Loop time")); + + // abort if running in parallel and not all atoms are local + const int nlocal = lmp->atom->nlocal; + ASSERT_EQ(lmp->atom->natoms, nlocal); + + // relax error a bit for KOKKOS package + double epsilon = 5.0 * test_config.epsilon; + // relax test precision when using pppm and single precision FFTs +#if defined(FFT_SINGLE) + if (lmp->force->kspace && lmp->force->kspace->compute_flag) + if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; +#endif + auto pair = lmp->force->pair; + ErrorStats stats; + + EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, 10 * epsilon); + + stats.reset(); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, epsilon); + if (print_stats) std::cerr << "init_energy stats, newton on: " << stats << std::endl; + + if (!verbose) ::testing::internal::CaptureStdout(); + run_lammps(lmp); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, 10 * epsilon); + + stats.reset(); + int id = lmp->modify->find_compute("sum"); + double energy = lmp->modify->compute[id]->compute_scalar(); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.run_vdwl, epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.run_coul, epsilon); + EXPECT_FP_LE_WITH_EPS((pair->eng_vdwl + pair->eng_coul), energy, epsilon); + if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl; + + // skip over these tests if newton pair is forced to be on + if (lmp->force->newton_pair == 0) { + + if (!verbose) ::testing::internal::CaptureStdout(); + cleanup_lammps(lmp, test_config); + lmp = init_lammps(argc, argv, test_config, false); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + pair = lmp->force->pair; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon); + + stats.reset(); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, epsilon); + if (print_stats) std::cerr << "init_energy stats, newton off:" << stats << std::endl; + + if (!verbose) ::testing::internal::CaptureStdout(); + run_lammps(lmp); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon); + + stats.reset(); + id = lmp->modify->find_compute("sum"); + energy = lmp->modify->compute[id]->compute_scalar(); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.run_vdwl, epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.run_coul, epsilon); + EXPECT_FP_LE_WITH_EPS((pair->eng_vdwl + pair->eng_coul), energy, epsilon); + if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl; + } + + if (!verbose) ::testing::internal::CaptureStdout(); + restart_lammps(lmp, test_config, true); + if (!verbose) ::testing::internal::GetCapturedStdout(); pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "nofdotr_stress stats:" << stats << std::endl; + + EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon); + EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, 5 * epsilon); @@ -916,30 +802,11 @@ TEST(PairStyle, gpu) Info::has_accelerator_feature("GPU", "precision", "double")) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - const std::vector &f_ref = test_config.init_forces; - const std::vector &f_run = test_config.run_forces; ErrorStats stats; - - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; - auto pair = lmp->force->pair; - auto stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -950,25 +817,8 @@ TEST(PairStyle, gpu) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon); stats.reset(); auto id = lmp->modify->find_compute("sum"); @@ -1036,29 +886,11 @@ TEST(PairStyle, intel) const int nlocal = lmp->atom->nlocal; ASSERT_EQ(lmp->atom->natoms, nlocal); - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats:" << stats << std::endl; + auto pair = lmp->force->pair; - Pair *pair = lmp->force->pair; - double *stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats:" << stats << std::endl; + EXPECT_FORCES("init_forces", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -1069,29 +901,8 @@ TEST(PairStyle, intel) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = pair->virial; - - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats:" << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats:" << stats << std::endl; + EXPECT_FORCES("run_forces", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress", pair->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -1149,29 +960,11 @@ TEST(PairStyle, opt) if (lmp->force->kspace && lmp->force->kspace->compute_flag) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - auto f = lmp->atom->f; - auto tag = lmp->atom->tag; - - const std::vector &f_ref = test_config.init_forces; ErrorStats stats; - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); - } - if (print_stats) std::cerr << "init_forces stats:" << stats << std::endl; + auto pair = lmp->force->pair; - Pair *pair = lmp->force->pair; - double *stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "init_stress stats:" << stats << std::endl; + EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); + EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); @@ -1182,28 +975,8 @@ TEST(PairStyle, opt) run_lammps(lmp); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stress = pair->virial; - const std::vector &f_run = test_config.run_forces; - ASSERT_EQ(nlocal + 1, f_run.size()); - stats.reset(); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "run_forces stats:" << stats << std::endl; - - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "run_stress stats:" << stats << std::endl; + EXPECT_FORCES("run_forces", lmp->atom, test_config.run_forces, 5 * epsilon); + EXPECT_STRESS("run_stress", pair->virial, test_config.run_stress, 10 * epsilon); stats.reset(); int id = lmp->modify->find_compute("sum"); @@ -1217,27 +990,10 @@ TEST(PairStyle, opt) restart_lammps(lmp, test_config, true); if (!verbose) ::testing::internal::GetCapturedStdout(); - f = lmp->atom->f; - tag = lmp->atom->tag; - stats.reset(); - ASSERT_EQ(nlocal + 1, f_ref.size()); - for (int i = 0; i < nlocal; ++i) { - EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, 5 * epsilon); - EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, 5 * epsilon); - } - if (print_stats) std::cerr << "nofdotr_forces stats:" << stats << std::endl; - pair = lmp->force->pair; - stress = pair->virial; - stats.reset(); - EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); - EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); - if (print_stats) std::cerr << "nofdotr_stress stats:" << stats << std::endl; + + EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon); + EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon); stats.reset(); EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, 5 * epsilon); diff --git a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml index 84bf844350..5663efccbf 100644 --- a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml +++ b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:03 2021 -epsilon: 5e-13 +epsilon: 1e-12 prerequisites: ! | pair kim pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-reaxff_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reaxff_tabulate.yaml index 5acd407191..b8d662829b 100644 --- a/unittest/force-styles/tests/atomic-pair-reaxff_tabulate.yaml +++ b/unittest/force-styles/tests/atomic-pair-reaxff_tabulate.yaml @@ -1,6 +1,6 @@ --- lammps_version: 30 Jul 2021 -tags: slow, unstable +tags: slow, unstable, noWindows date_generated: Mon Aug 23 20:32:05 2021 epsilon: 1e-12 skip_tests: diff --git a/unittest/force-styles/tests/kspace-pppm_ad.yaml b/unittest/force-styles/tests/kspace-pppm_ad.yaml index 5eb711c089..0f77e7b208 100644 --- a/unittest/force-styles/tests/kspace-pppm_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_ad.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 -skip_tests: gpu +skip_tests: gpu kokkos_omp prerequisites: ! | atom full pair coul/long diff --git a/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml b/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml index 84b44bcb0a..e5d77898ec 100644 --- a/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml +++ b/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Wed Aug 25 07:37:07 2021 -epsilon: 2e-12 +epsilon: 2e-9 skip_tests: single prerequisites: ! | pair lebedeva/z diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml index a9390a4fd3..34706e4b25 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 -skip_tests: gpu intel +skip_tests: gpu intel kokkos_omp prerequisites: ! | pair tersoff/mod pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml index 9808d348a7..3d98f221b0 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-13 -skip_tests: gpu intel +skip_tests: gpu intel kokkos_omp prerequisites: ! | pair tersoff pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml index 69b63cf259..1bf994e7b2 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:21 2021 epsilon: 5e-11 -skip_tests: gpu intel +skip_tests: gpu intel kokkos_omp prerequisites: ! | pair tersoff/zbl pre_commands: ! | diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml index 0c4d543e7a..009ceb6359 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:41 2021 -epsilon: 2e-08 +epsilon: 5e-08 prerequisites: ! | atom full pair buck/long/coul/long diff --git a/unittest/force-styles/tests/mol-pair-coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-coul_dsf.yaml index 9bc59e4431..5e47bd6c79 100644 --- a/unittest/force-styles/tests/mol-pair-coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_dsf.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:42 2021 epsilon: 1e-12 +skip_tests: kokkos_omp prerequisites: ! | atom full pair coul/dsf diff --git a/unittest/force-styles/tests/mol-pair-harmonic_cut.yaml b/unittest/force-styles/tests/mol-pair-harmonic_cut.yaml new file mode 100644 index 0000000000..fb2714626f --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-harmonic_cut.yaml @@ -0,0 +1,93 @@ +--- +lammps_version: 7 Jan 2022 +date_generated: Sat Jan 15 17:42:24 2022 +epsilon: 5e-14 +skip_tests: +prerequisites: ! | + atom full + pair harmonic/cut +pre_commands: ! "" +post_commands: ! | + pair_modify mix arithmetic +input_file: in.fourmol +pair_style: harmonic/cut +pair_coeff: ! | + 1 1 0.2 2.5 + 2 2 0.05 1.0 + 2 4 0.05 0.5 + 3 3 0.2 3.4 + 4 4 0.15 3.1 + 5 5 0.15 3.1 +extract: ! | + k 2 + cut 2 +natoms: 29 +init_vdwl: 0.6229303832094011 +init_coul: 0 +init_stress: ! |2- + 2.7086112336155066e-01 2.7116413086977192e-01 3.9219767031763964e-01 -1.0030847564854772e-01 4.4609473180383268e-02 -4.3637124113592815e-02 +init_forces: ! |2 + 1 8.0131849873788189e-03 4.9888010120265600e-02 2.8122360795900539e-02 + 2 7.9791227934915224e-03 6.5662021486410233e-03 -9.3912001601608869e-03 + 3 -3.0383030044476164e-02 -2.4462070024746502e-02 -6.7080526995988831e-03 + 4 -4.2871382862959282e-03 1.2944422156819623e-04 -3.1664690534881235e-03 + 5 -2.5653599407787658e-03 -5.6347847352330024e-03 5.7588483204582012e-03 + 6 -2.7432516621812987e-02 2.2443342050432843e-02 6.0842119146428050e-03 + 7 -2.3732010354850359e-02 4.8925005245008778e-03 -1.0554388509160603e-01 + 8 -1.9721449495438432e-02 8.7099489439665806e-03 7.7340656614040257e-02 + 9 3.1079843659201794e-03 3.3474898466584100e-03 1.3753907856580455e-02 + 10 1.5600383364335340e-02 -3.4154073795756010e-02 -2.4568763191891510e-02 + 11 -6.4786170866648325e-04 -2.7187839165446434e-03 -4.0027246972607657e-03 + 12 4.5446169193717613e-02 9.5334383719478614e-03 -2.3805265135058946e-02 + 13 3.6852167147282842e-03 -1.4578336695269954e-03 -6.9263908097426375e-05 + 14 -1.4516812720744084e-03 2.9539789066737132e-04 -3.7646771444256287e-03 + 15 -5.4837745225155548e-05 3.7892348244262858e-03 1.3279622443994443e-03 + 16 2.7804441490434852e-02 -2.9016569654227675e-02 -2.3977127174652516e-02 + 17 -1.3606174403879238e-03 -1.2150893147040220e-02 7.2609480510219010e-02 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 -2.8478436810585638e-03 -3.4997997565726423e-03 1.0311097670993996e-02 + 22 -5.0036838658335881e-03 -1.2125954307909393e-03 -7.8502223695393180e-03 + 23 7.8515275468921519e-03 4.7123951873635815e-03 -2.4608753014546784e-03 + 24 2.2422341594776187e-03 -9.2864513866737705e-03 5.4147040050256424e-03 + 25 -7.0931333559850684e-03 1.1418916865888746e-03 -5.9630640752421178e-03 + 26 4.8508991965074497e-03 8.1445597000848954e-03 5.4836007021647544e-04 + 27 1.4352981398486984e-03 -1.0223071626521522e-02 3.5886145449699289e-03 + 28 -7.4679157140535102e-03 3.2093693544577983e-03 -5.0528642356851916e-03 + 29 6.0326175742048118e-03 7.0137022720637250e-03 1.4642496907152625e-03 +run_vdwl: 0.6227892941470253 +run_coul: 0 +run_stress: ! |2- + 2.7079595899259656e-01 2.7106155255810421e-01 3.9199181631609364e-01 -1.0017597886837336e-01 4.4639512685950337e-02 -4.3538044335882868e-02 +run_forces: ! |2 + 1 8.0241133736762959e-03 4.9859217970288555e-02 2.8099645116503875e-02 + 2 7.9858506322803297e-03 6.5851530052680168e-03 -9.3657942914726639e-03 + 3 -3.0378796721416249e-02 -2.4495674709975927e-02 -6.7374520329115941e-03 + 4 -4.2659306402640165e-03 1.3406094892709258e-04 -3.1564081120146015e-03 + 5 -2.5644106889098472e-03 -5.6291258903991056e-03 5.7537772274397249e-03 + 6 -2.7398860728585855e-02 2.2446081967441193e-02 6.0769742046490674e-03 + 7 -2.3725250988273959e-02 4.8748360958146379e-03 -1.0543946577300001e-01 + 8 -1.9795760001146530e-02 8.7619549352892182e-03 7.7257651402956734e-02 + 9 3.1107511049119794e-03 3.3343639112369677e-03 1.3749677634153570e-02 + 10 1.5635110483272714e-02 -3.4177809303542570e-02 -2.4562568959156386e-02 + 11 -6.4680122415666373e-04 -2.7045376093154955e-03 -3.9833439702283155e-03 + 12 4.5410386808201031e-02 9.5232810722562407e-03 -2.3816427499003763e-02 + 13 3.6819606745360318e-03 -1.4490090012638590e-03 -6.8397423783681964e-05 + 14 -1.4472530230181654e-03 2.8919520744570527e-04 -3.7524156545238243e-03 + 15 -5.6155855006963267e-05 3.7938646788886268e-03 1.3339639717048200e-03 + 16 2.7787095304862428e-02 -2.9020839215424241e-02 -2.3998357673493245e-02 + 17 -1.3560485109625556e-03 -1.2125014062935051e-02 7.2608941832180307e-02 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 -2.8538862991433229e-03 -3.4800313716197438e-03 1.0305823645864499e-02 + 22 -5.0214625596301642e-03 -1.2260879074991976e-03 -7.8500736428379052e-03 + 23 7.8753488587734871e-03 4.7061192791189414e-03 -2.4557500030265946e-03 + 24 2.2600769444580133e-03 -9.2990099176050046e-03 5.4253104994500942e-03 + 25 -7.1247130587123505e-03 1.1308496354809658e-03 -5.9913273289481242e-03 + 26 4.8646361142543372e-03 8.1681602821240384e-03 5.6601682949803040e-04 + 27 1.4504263375229804e-03 -1.0234012017965840e-02 3.5742943025157811e-03 + 28 -7.4838995855112476e-03 3.2116101208619755e-03 -5.0534250649872060e-03 + 29 6.0334732479882672e-03 7.0224018971038644e-03 1.4791307624714251e-03 +... diff --git a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml index 68f23ae526..6559e2d53c 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml @@ -1,6 +1,7 @@ --- lammps_version: 8 Apr 2021 date_generated: Mon Apr 19 08:49:07 2021 +skip_tests: kokkos_omp epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml b/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml index e9a036b545..814f3780fe 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml @@ -2,7 +2,7 @@ lammps_version: 8 Apr 2021 date_generated: Mon Apr 19 08:49:07 2021 epsilon: 5e-14 -skip_tests: gpu intel omp +skip_tests: gpu intel omp kokkos_omp prerequisites: ! | atom full pair lj/cut diff --git a/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml b/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml index 59a5098238..c46ee40b93 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml @@ -2,7 +2,7 @@ lammps_version: 8 Apr 2021 date_generated: Mon Apr 19 08:49:08 2021 epsilon: 5e-14 -skip_tests: gpu +skip_tests: gpu kokkos_omp prerequisites: ! | atom full pair lj/cut diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml index 109e347449..1e3e4249a6 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml @@ -1,6 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:48 2021 +skip_tests: kokkos_omp epsilon: 8e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml index d1bed9430b..eaf9bf1a7c 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:49 2021 -epsilon: 1e-13 +epsilon: 5e-12 prerequisites: ! | atom full pair lj/cut/tip4p/long diff --git a/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml b/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml index 4f21995ed5..2d6626922f 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:53 2021 -epsilon: 2e-08 +epsilon: 5e-08 prerequisites: ! | atom full pair lj/long/coul/long diff --git a/unittest/force-styles/tests/mol-pair-soft.yaml b/unittest/force-styles/tests/mol-pair-soft.yaml index e5be18374a..d7cba08f72 100644 --- a/unittest/force-styles/tests/mol-pair-soft.yaml +++ b/unittest/force-styles/tests/mol-pair-soft.yaml @@ -1,6 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:56 2021 +tags: unstable epsilon: 1.5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-table.yaml b/unittest/force-styles/tests/mol-pair-table.yaml index fb9e647677..1b75119519 100644 --- a/unittest/force-styles/tests/mol-pair-table.yaml +++ b/unittest/force-styles/tests/mol-pair-table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 tags: slow date_generated: Fri Feb 26 23:08:56 2021 +skip_tests: kokkos_omp epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-zbl.yaml b/unittest/force-styles/tests/mol-pair-zbl.yaml index 113072816e..2f29826e67 100644 --- a/unittest/force-styles/tests/mol-pair-zbl.yaml +++ b/unittest/force-styles/tests/mol-pair-zbl.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:57 2021 epsilon: 1e-12 +skip_tests: kokkos_omp prerequisites: ! | atom full pair zbl diff --git a/unittest/formats/CMakeLists.txt b/unittest/formats/CMakeLists.txt index be8e055adb..8a198d4c64 100644 --- a/unittest/formats/CMakeLists.txt +++ b/unittest/formats/CMakeLists.txt @@ -1,49 +1,49 @@ add_executable(test_atom_styles test_atom_styles.cpp) target_link_libraries(test_atom_styles PRIVATE lammps GTest::GMock) -add_test(NAME AtomStyles COMMAND test_atom_styles WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME AtomStyles COMMAND test_atom_styles) add_executable(test_image_flags test_image_flags.cpp) target_link_libraries(test_image_flags PRIVATE lammps GTest::GMock) -add_test(NAME ImageFlags COMMAND test_image_flags WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME ImageFlags COMMAND test_image_flags) add_executable(test_input_convert test_input_convert.cpp) target_link_libraries(test_input_convert PRIVATE lammps GTest::GMockMain) -add_test(NAME InputConvert COMMAND test_input_convert WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME InputConvert COMMAND test_input_convert) add_executable(test_molecule_file test_molecule_file.cpp) target_link_libraries(test_molecule_file PRIVATE lammps GTest::GMock) -add_test(NAME MoleculeFile COMMAND test_molecule_file WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME MoleculeFile COMMAND test_molecule_file) add_executable(test_pair_unit_convert test_pair_unit_convert.cpp) target_link_libraries(test_pair_unit_convert PRIVATE lammps GTest::GMock) -add_test(NAME PairUnitConvert COMMAND test_pair_unit_convert WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME PairUnitConvert COMMAND test_pair_unit_convert) set_tests_properties(PairUnitConvert PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") add_executable(test_potential_file_reader test_potential_file_reader.cpp) target_link_libraries(test_potential_file_reader PRIVATE lammps GTest::GMock) -add_test(NAME PotentialFileReader COMMAND test_potential_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME PotentialFileReader COMMAND test_potential_file_reader) set_tests_properties(PotentialFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") if(PKG_MANYBODY) add_executable(test_eim_potential_file_reader test_eim_potential_file_reader.cpp) target_link_libraries(test_eim_potential_file_reader PRIVATE lammps GTest::GMock) - add_test(NAME EIMPotentialFileReader COMMAND test_eim_potential_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME EIMPotentialFileReader COMMAND test_eim_potential_file_reader) set_tests_properties(EIMPotentialFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") endif() add_executable(test_text_file_reader test_text_file_reader.cpp) target_link_libraries(test_text_file_reader PRIVATE lammps GTest::GMock) -add_test(NAME TextFileReader COMMAND test_text_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME TextFileReader COMMAND test_text_file_reader) set_tests_properties(TextFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") add_executable(test_file_operations test_file_operations.cpp) target_link_libraries(test_file_operations PRIVATE lammps GTest::GMock) -add_test(NAME FileOperations COMMAND test_file_operations WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME FileOperations COMMAND test_file_operations) add_executable(test_dump_atom test_dump_atom.cpp) target_link_libraries(test_dump_atom PRIVATE lammps GTest::GMock) -add_test(NAME DumpAtom COMMAND test_dump_atom WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME DumpAtom COMMAND test_dump_atom) set_tests_properties(DumpAtom PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") if(PKG_COMPRESS) @@ -64,19 +64,19 @@ if(PKG_COMPRESS) add_executable(test_dump_xyz_compressed test_dump_xyz_compressed.cpp compressed_dump_test_main.cpp) target_link_libraries(test_dump_xyz_compressed PRIVATE lammps GTest::GMock) - add_test(NAME DumpAtomGZ COMMAND test_dump_atom_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpAtomGZ COMMAND test_dump_atom_compressed gz) set_tests_properties(DumpAtomGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}") - add_test(NAME DumpCustomGZ COMMAND test_dump_custom_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpCustomGZ COMMAND test_dump_custom_compressed gz) set_tests_properties(DumpCustomGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}") - add_test(NAME DumpCfgGZ COMMAND test_dump_cfg_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpCfgGZ COMMAND test_dump_cfg_compressed gz) set_tests_properties(DumpCfgGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}") - add_test(NAME DumpLocalGZ COMMAND test_dump_local_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpLocalGZ COMMAND test_dump_local_compressed gz) set_tests_properties(DumpLocalGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}") - add_test(NAME DumpXYZGZ COMMAND test_dump_xyz_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpXYZGZ COMMAND test_dump_xyz_compressed gz) set_tests_properties(DumpXYZGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}") find_package(PkgConfig REQUIRED) @@ -84,43 +84,43 @@ if(PKG_COMPRESS) find_program(ZSTD_BINARY NAMES zstd) if(Zstd_FOUND AND ZSTD_BINARY) - add_test(NAME DumpAtomZstd COMMAND test_dump_atom_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpAtomZstd COMMAND test_dump_atom_compressed zstd) set_tests_properties(DumpAtomZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}") - add_test(NAME DumpCustomZstd COMMAND test_dump_custom_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpCustomZstd COMMAND test_dump_custom_compressed zstd) set_tests_properties(DumpCustomZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}") - add_test(NAME DumpCfgZstd COMMAND test_dump_cfg_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpCfgZstd COMMAND test_dump_cfg_compressed zstd) set_tests_properties(DumpCfgZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}") - add_test(NAME DumpLocalZstd COMMAND test_dump_local_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpLocalZstd COMMAND test_dump_local_compressed zstd) set_tests_properties(DumpLocalZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}") - add_test(NAME DumpXYZZstd COMMAND test_dump_xyz_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpXYZZstd COMMAND test_dump_xyz_compressed zstd) set_tests_properties(DumpXYZZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}") endif() endif() add_executable(test_dump_custom test_dump_custom.cpp) target_link_libraries(test_dump_custom PRIVATE lammps GTest::GMock) -add_test(NAME DumpCustom COMMAND test_dump_custom WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME DumpCustom COMMAND test_dump_custom) set_tests_properties(DumpCustom PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") add_executable(test_dump_cfg test_dump_cfg.cpp) target_link_libraries(test_dump_cfg PRIVATE lammps GTest::GMock) -add_test(NAME DumpCfg COMMAND test_dump_cfg WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME DumpCfg COMMAND test_dump_cfg) set_tests_properties(DumpCfg PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") add_executable(test_dump_local test_dump_local.cpp) target_link_libraries(test_dump_local PRIVATE lammps GTest::GMock) -add_test(NAME DumpLocal COMMAND test_dump_local WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME DumpLocal COMMAND test_dump_local) set_tests_properties(DumpLocal PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") if(PKG_NETCDF) find_program(NCDUMP NAMES ncdump ncdump.exe) add_executable(test_dump_netcdf test_dump_netcdf.cpp) target_link_libraries(test_dump_netcdf PRIVATE lammps GTest::GMock) - add_test(NAME DumpNetCDF COMMAND test_dump_netcdf WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME DumpNetCDF COMMAND test_dump_netcdf) if(NOT (NCDUMP STREQUAL "NCDUMP-NOTFOUND")) set_tests_properties(DumpNetCDF PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};NCDUMP_BINARY=${NCDUMP}") endif() diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 59c0e1350c..c4c79238aa 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -2123,7 +2123,7 @@ TEST_F(AtomStyleTest, body_nparticle) "12.0 0.0 12.0 0.0 0.0 0.0\n" "0.0 1.0 0.0\n" "0.0 -3.0 0.0\n"; - FILE *fp = fopen("input_atom_styles.data", "w"); + FILE *fp = fopen("input_atom_styles.data", "w"); fputs(data_file, fp); fclose(fp); BEGIN_HIDE_OUTPUT(); @@ -4809,6 +4809,446 @@ TEST_F(AtomStyleTest, property_atom) EXPECT_NEAR(three[GETIDX(2)], 0.5, EPSILON); } +TEST_F(AtomStyleTest, oxdna) +{ + if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); + if (!LAMMPS::is_installed_pkg("ASPHERE")) GTEST_SKIP(); + if (!LAMMPS::is_installed_pkg("CG-DNA")) GTEST_SKIP(); + + BEGIN_HIDE_OUTPUT(); + command("atom_style hybrid bond ellipsoid oxdna"); + END_HIDE_OUTPUT(); + + AtomState expected; + expected.atom_style = "hybrid"; + expected.molecular = Atom::MOLECULAR; + expected.tag_enable = 1; + expected.molecule_flag = 1; + expected.ellipsoid_flag = 1; + expected.rmass_flag = 1; + expected.torque_flag = 1; + expected.angmom_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.has_bonds = true; + expected.has_nspecial = true; + expected.has_special = true; + expected.map_style = 3; + + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); + + auto hybrid = (AtomVecHybrid *)lmp->atom->avec; + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); + ASSERT_EQ(hybrid->nstyles, 3); + ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("bond")); + ASSERT_THAT(std::string(hybrid->keywords[1]), Eq("ellipsoid")); + ASSERT_THAT(std::string(hybrid->keywords[2]), Eq("oxdna")); + ASSERT_NE(hybrid->styles[0], nullptr); + ASSERT_NE(hybrid->styles[1], nullptr); + ASSERT_NE(hybrid->styles[2], nullptr); + + BEGIN_HIDE_OUTPUT(); + command("units lj"); + command("dimension 3"); + command("newton on"); + command("boundary p p p"); + command("atom_modify sort 0 1.0"); + command("neighbor 2.0 bin"); + command("neigh_modify every 1 delay 0 check yes"); + command("region mybox block -20 20 -20 20 -20 20"); + command("create_box 4 mybox bond/types 1 extra/bond/per/atom 2 extra/special/per/atom 4"); + command("create_atoms 1 single -0.33741452300167507 -0.43708835412476305 0.6450685042019271"); + command("create_atoms 2 single -0.32142606102826937 -0.7137743037592722 1.1817366147004618"); + command("create_atoms 3 single -0.130363628207774 -0.9147144801536078 1.62581312195109"); + command("create_atoms 4 single 0.16795127962282844 -0.9808507459807022 2.0894908590909003"); + command("create_atoms 1 single 0.46370423490634166 -0.7803347954883079 2.4251986815515827"); + command("create_atoms 4 single -0.4462950185476711 0.09062163051035639 2.4668941268777607"); + command("create_atoms 1 single -0.03377054097560965 0.20979847489755046 2.078208732038921"); + command("create_atoms 2 single 0.3297325391466579 0.17657587120899895 1.7206328374934152"); + command("create_atoms 3 single 0.6063699309305985 0.04682595158675571 1.2335049647817748"); + command("create_atoms 4 single 0.8003979559814726 -0.364393011459011 0.9884025318908612"); + command("set type 1 mass 3.1575"); + command("set type 2 mass 3.1575"); + command("set type 3 mass 3.1575"); + command("set type 4 mass 3.1575"); + command("mass 1 3.1575"); + command("mass 2 3.1575"); + command("mass 3 3.1575"); + command("mass 4 3.1575"); + command("set atom 1 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 2 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 3 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 4 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 5 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 6 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 7 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 8 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 9 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 10 shape 1.173984503142341 1.173984503142341 1.173984503142341"); + command("set atom 1 quat 0.120438343611269 -0.970540441176996 0.208676441957758 16.990727782866998"); + command("set atom 2 quat 0.122039415796829 -0.068232256412985 0.990177125658213 40.001729435287870"); + command("set atom 3 quat 0.052760168698289 0.030943512185297 0.998127679033382 69.627682451632380"); + command("set atom 4 quat -0.037622918613871 0.030623545471522 0.998822664169035 97.038820280300570"); + command("set atom 5 quat 0.055056042946138 0.077631917807377 0.995460756369964 137.7813218321917"); + command("set atom 6 quat 0.931128471673637 -0.355724722922553 -0.080372201291206 166.2836226291888"); + command("set atom 7 quat 0.753526078198930 -0.648440397941919 0.108275111595674 200.6802564250672"); + command("set atom 8 quat 0.553942138074214 -0.829580511279186 0.070315595507185 192.0355407659524"); + command("set atom 9 quat -0.373540155765431 0.913070802138105 -0.163613759548524 171.0789308260751"); + command("set atom 10 quat 0.027515673832457 0.998248649922676 -0.052369080773879 161.2621224558284"); + command("bond_style oxdna2/fene"); + command("bond_coeff * 2.0 0.25 0.7564"); + command("special_bonds lj 0 1 1"); + command("create_bonds single/bond 1 1 2"); + command("create_bonds single/bond 1 2 3"); + command("create_bonds single/bond 1 3 4"); + command("create_bonds single/bond 1 4 5"); + command("create_bonds single/bond 1 6 7"); + command("create_bonds single/bond 1 7 8"); + command("create_bonds single/bond 1 8 9"); + command("create_bonds single/bond 1 9 10"); + command("pair_style hybrid/overlay oxdna2/excv oxdna2/stk oxdna2/hbond oxdna2/xstk oxdna2/coaxstk oxdna2/dh"); + command("pair_coeff * * oxdna2/excv 2.0 0.7 0.675 2.0 0.515 0.5 2.0 0.33 0.32"); + command("pair_coeff * * oxdna2/stk seqdep 0.1 1.3523 2.6717 6.0 0.4 0.9 0.32 0.75 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 2.0 0.65 2.0 0.65"); + command("pair_coeff * * oxdna2/hbond seqdep 0.0 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff 1 4 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff 2 3 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff * * oxdna2/xstk 47.5 0.575 0.675 0.495 0.655 2.25 0.791592653589793 0.58 1.7 1.0 0.68 1.7 1.0 0.68 1.5 0 0.65 1.7 0.875 0.68 1.7 0.875 0.68"); + command("pair_coeff * * oxdna2/coaxstk 58.5 0.4 0.6 0.22 0.58 2.0 2.891592653589793 0.65 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 40.0 3.116592653589793"); + command("pair_coeff * * oxdna2/dh 0.1 0.2 0.815"); + END_HIDE_OUTPUT(); + + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 10); + ASSERT_EQ(lmp->atom->nbonds, 8); + ASSERT_EQ(lmp->atom->nbondtypes, 1); + ASSERT_EQ(lmp->atom->nellipsoids, 10); + ASSERT_EQ(lmp->atom->nlocal, 10); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::MOLECULAR); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); + ASSERT_NE(lmp->atom->mass, nullptr); + ASSERT_NE(lmp->atom->rmass, nullptr); + ASSERT_EQ(lmp->atom->ellipsoid_flag, 1); + ASSERT_NE(lmp->atom->ellipsoid, nullptr); + ASSERT_NE(lmp->atom->mass_setflag, nullptr); + ASSERT_NE(lmp->atom->id5p, nullptr); + + BEGIN_HIDE_OUTPUT(); + command("write_data test_atom_styles.data nocoeff"); + command("clear"); + command("units lj"); + command("dimension 3"); + command("newton on"); + command("boundary p p p"); + command("atom_style hybrid bond ellipsoid oxdna"); + command("atom_modify sort 0 1.0"); + command("neighbor 2.0 bin"); + command("neigh_modify every 1 delay 0 check yes"); + command("read_data test_atom_styles.data"); + command("set type 1 mass 3.1575"); + command("set type 2 mass 3.1575"); + command("set type 3 mass 3.1575"); + command("set type 4 mass 3.1575"); + command("mass 1 3.1575"); + command("mass 2 3.1575"); + command("mass 3 3.1575"); + command("mass 4 3.1575"); + command("bond_style oxdna2/fene"); + command("bond_coeff * 2.0 0.25 0.7564"); + command("special_bonds lj 0 1 1"); + command("pair_style hybrid/overlay oxdna2/excv oxdna2/stk oxdna2/hbond oxdna2/xstk oxdna2/coaxstk oxdna2/dh"); + command("pair_coeff * * oxdna2/excv 2.0 0.7 0.675 2.0 0.515 0.5 2.0 0.33 0.32"); + command("pair_coeff * * oxdna2/stk seqdep 0.1 1.3523 2.6717 6.0 0.4 0.9 0.32 0.75 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 2.0 0.65 2.0 0.65"); + command("pair_coeff * * oxdna2/hbond seqdep 0.0 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff 1 4 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff 2 3 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff * * oxdna2/xstk 47.5 0.575 0.675 0.495 0.655 2.25 0.791592653589793 0.58 1.7 1.0 0.68 1.7 1.0 0.68 1.5 0 0.65 1.7 0.875 0.68 1.7 0.875 0.68"); + command("pair_coeff * * oxdna2/coaxstk 58.5 0.4 0.6 0.22 0.58 2.0 2.891592653589793 0.65 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 40.0 3.116592653589793"); + command("pair_coeff * * oxdna2/dh 0.1 0.2 0.815"); + + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); + ASSERT_NE(lmp->atom->avec, nullptr); + hybrid = (AtomVecHybrid *)lmp->atom->avec; + + ASSERT_EQ(hybrid->nstyles, 3); + ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("bond")); + ASSERT_THAT(std::string(hybrid->keywords[1]), Eq("ellipsoid")); + ASSERT_THAT(std::string(hybrid->keywords[2]), Eq("oxdna")); + ASSERT_NE(hybrid->styles[0], nullptr); + ASSERT_NE(hybrid->styles[1], nullptr); + ASSERT_NE(hybrid->styles[2], nullptr); + + ASSERT_EQ(lmp->atom->natoms, 10); + ASSERT_EQ(lmp->atom->nbonds, 8); + ASSERT_EQ(lmp->atom->nbondtypes, 1); + ASSERT_EQ(lmp->atom->nellipsoids, 10); + ASSERT_EQ(lmp->atom->nlocal, 10); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::MOLECULAR); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); + ASSERT_NE(lmp->atom->mass, nullptr); + ASSERT_NE(lmp->atom->rmass, nullptr); + ASSERT_EQ(lmp->atom->ellipsoid_flag, 1); + ASSERT_NE(lmp->atom->ellipsoid, nullptr); + ASSERT_NE(lmp->atom->mass_setflag, nullptr); + ASSERT_NE(lmp->atom->id5p, nullptr); + + auto x = lmp->atom->x; + auto v = lmp->atom->v; + auto type = lmp->atom->type; + auto ellipsoid = lmp->atom->ellipsoid; + auto rmass = lmp->atom->rmass; + + auto avec = (AtomVecEllipsoid *)hybrid->styles[1]; + auto bonus = avec->bonus; + + EXPECT_NEAR(x[GETIDX(1)][0], -0.33741452300167507, EPSILON); + EXPECT_NEAR(x[GETIDX(1)][1], -0.43708835412476305, EPSILON); + EXPECT_NEAR(x[GETIDX(1)][2], 0.6450685042019271, EPSILON); + EXPECT_NEAR(x[GETIDX(2)][0], -0.32142606102826937, EPSILON); + EXPECT_NEAR(x[GETIDX(2)][1], -0.7137743037592722, EPSILON); + EXPECT_NEAR(x[GETIDX(2)][2], 1.1817366147004618, EPSILON); + EXPECT_NEAR(x[GETIDX(3)][0], -0.130363628207774, EPSILON); + EXPECT_NEAR(x[GETIDX(3)][1], -0.9147144801536078, EPSILON); + EXPECT_NEAR(x[GETIDX(3)][2], 1.62581312195109, EPSILON); + EXPECT_NEAR(x[GETIDX(4)][0], 0.16795127962282844, EPSILON); + EXPECT_NEAR(x[GETIDX(4)][1], -0.9808507459807022, EPSILON); + EXPECT_NEAR(x[GETIDX(4)][2], 2.0894908590909003, EPSILON); + EXPECT_NEAR(x[GETIDX(5)][0], 0.46370423490634166, EPSILON); + EXPECT_NEAR(x[GETIDX(5)][1], -0.7803347954883079, EPSILON); + EXPECT_NEAR(x[GETIDX(5)][2], 2.4251986815515827, EPSILON); + EXPECT_NEAR(x[GETIDX(6)][0], -0.4462950185476711, EPSILON); + EXPECT_NEAR(x[GETIDX(6)][1], 0.09062163051035639, EPSILON); + EXPECT_NEAR(x[GETIDX(6)][2], 2.4668941268777607, EPSILON); + EXPECT_NEAR(x[GETIDX(7)][0], -0.03377054097560965, EPSILON); + EXPECT_NEAR(x[GETIDX(7)][1], 0.20979847489755046, EPSILON); + EXPECT_NEAR(x[GETIDX(7)][2], 2.078208732038921, EPSILON); + EXPECT_NEAR(x[GETIDX(8)][0], 0.3297325391466579, EPSILON); + EXPECT_NEAR(x[GETIDX(8)][1], 0.17657587120899895, EPSILON); + EXPECT_NEAR(x[GETIDX(8)][2], 1.7206328374934152, EPSILON); + EXPECT_NEAR(x[GETIDX(9)][0], 0.6063699309305985, EPSILON); + EXPECT_NEAR(x[GETIDX(9)][1], 0.04682595158675571, EPSILON); + EXPECT_NEAR(x[GETIDX(9)][2], 1.2335049647817748, EPSILON); + EXPECT_NEAR(x[GETIDX(10)][0], 0.8003979559814726, EPSILON); + EXPECT_NEAR(x[GETIDX(10)][1], -0.364393011459011, EPSILON); + EXPECT_NEAR(x[GETIDX(10)][2], 0.9884025318908612, EPSILON); + + EXPECT_NEAR(v[GETIDX(1)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(1)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(1)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(2)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(2)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(2)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(3)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(3)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(3)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(4)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(4)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(4)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(5)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(5)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(5)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(6)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(6)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(6)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(7)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(7)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(7)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(8)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(8)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(8)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(9)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(9)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(9)][2], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(10)][0], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(10)][1], 0.0, EPSILON); + EXPECT_NEAR(v[GETIDX(10)][2], 0.0, EPSILON); + + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 3); + ASSERT_EQ(type[GETIDX(4)], 4); + ASSERT_EQ(type[GETIDX(5)], 1); + ASSERT_EQ(type[GETIDX(6)], 4); + ASSERT_EQ(type[GETIDX(7)], 1); + ASSERT_EQ(type[GETIDX(8)], 2); + ASSERT_EQ(type[GETIDX(9)], 3); + ASSERT_EQ(type[GETIDX(10)], 4); + + ASSERT_EQ(ellipsoid[GETIDX(1)], 0); + ASSERT_EQ(ellipsoid[GETIDX(2)], 1); + ASSERT_EQ(ellipsoid[GETIDX(3)], 2); + ASSERT_EQ(ellipsoid[GETIDX(4)], 3); + ASSERT_EQ(ellipsoid[GETIDX(5)], 4); + ASSERT_EQ(ellipsoid[GETIDX(6)], 5); + ASSERT_EQ(ellipsoid[GETIDX(7)], 6); + ASSERT_EQ(ellipsoid[GETIDX(8)], 7); + ASSERT_EQ(ellipsoid[GETIDX(9)], 8); + ASSERT_EQ(ellipsoid[GETIDX(10)], 9); + + EXPECT_NEAR(rmass[GETIDX(1)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(2)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(3)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(4)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(5)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(6)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(7)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(8)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(9)], 3.1575, EPSILON); + EXPECT_NEAR(rmass[GETIDX(10)], 3.1575, EPSILON); + + EXPECT_NEAR(bonus[0].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[0].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[0].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[1].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[1].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[1].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[2].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[2].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[2].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[3].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[3].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[3].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[4].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[4].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[4].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[5].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[5].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[5].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[6].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[6].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[6].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[7].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[7].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[7].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[8].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[8].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[8].shape[2], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[9].shape[0], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[9].shape[1], 0.5869922515711705, EPSILON); + EXPECT_NEAR(bonus[9].shape[2], 0.5869922515711705, EPSILON); + + EXPECT_NEAR(bonus[0].quat[0], 0.9890278201757743, EPSILON); + EXPECT_NEAR(bonus[0].quat[1], 0.01779228232037064, EPSILON); + EXPECT_NEAR(bonus[0].quat[2], -0.14337734159225404, EPSILON); + EXPECT_NEAR(bonus[0].quat[3], 0.030827642240801516, EPSILON); + EXPECT_NEAR(bonus[1].quat[0], 0.939687458852748, EPSILON); + EXPECT_NEAR(bonus[1].quat[1], 0.04174166924055095, EPSILON); + EXPECT_NEAR(bonus[1].quat[2], -0.023337773785056866, EPSILON); + EXPECT_NEAR(bonus[1].quat[3], 0.338674565089608, EPSILON); + EXPECT_NEAR(bonus[2].quat[0], 0.8210113150655425, EPSILON); + EXPECT_NEAR(bonus[2].quat[1], 0.03012140921736572, EPSILON); + EXPECT_NEAR(bonus[2].quat[2], 0.017666019956944813, EPSILON); + EXPECT_NEAR(bonus[2].quat[3], 0.5698429897612057, EPSILON); + EXPECT_NEAR(bonus[3].quat[0], 0.6623662858285051, EPSILON); + EXPECT_NEAR(bonus[3].quat[1], -0.028186343967346823, EPSILON); + EXPECT_NEAR(bonus[3].quat[2], 0.022942552517501488, EPSILON); + EXPECT_NEAR(bonus[3].quat[3], 0.7482981175276918, EPSILON); + EXPECT_NEAR(bonus[4].quat[0], 0.3601488726765216, EPSILON); + EXPECT_NEAR(bonus[4].quat[1], 0.0513614985821682, EPSILON); + EXPECT_NEAR(bonus[4].quat[2], 0.0724224158335286, EPSILON); + EXPECT_NEAR(bonus[4].quat[3], 0.9286602067807472, EPSILON); + EXPECT_NEAR(bonus[5].quat[0], 0.11941234710084649, EPSILON); + EXPECT_NEAR(bonus[5].quat[1], 0.9244660117493703, EPSILON); + EXPECT_NEAR(bonus[5].quat[2], -0.35317942248051865, EPSILON); + EXPECT_NEAR(bonus[5].quat[3], -0.07979711784524246, EPSILON); + EXPECT_NEAR(bonus[6].quat[0], -0.17949125421205164, EPSILON); + EXPECT_NEAR(bonus[6].quat[1], 0.7412884899431119, EPSILON); + EXPECT_NEAR(bonus[6].quat[2], -0.6379094464220707, EPSILON); + EXPECT_NEAR(bonus[6].quat[3], 0.1065166771202199, EPSILON); + EXPECT_NEAR(bonus[7].quat[0], -0.10483691088405202, EPSILON); + EXPECT_NEAR(bonus[7].quat[1], 0.5508895999584645, EPSILON); + EXPECT_NEAR(bonus[7].quat[2], -0.8250090480220789, EPSILON); + EXPECT_NEAR(bonus[7].quat[3], 0.06992811634525403, EPSILON); + EXPECT_NEAR(bonus[8].quat[0], 0.07777239911646, EPSILON); + EXPECT_NEAR(bonus[8].quat[1], -0.3724087549185288, EPSILON); + EXPECT_NEAR(bonus[8].quat[2], 0.9103052384821374, EPSILON); + EXPECT_NEAR(bonus[8].quat[3], -0.1631181963720798, EPSILON); + EXPECT_NEAR(bonus[9].quat[0], 0.16279109707978262, EPSILON); + EXPECT_NEAR(bonus[9].quat[1], 0.027148630125149613, EPSILON); + EXPECT_NEAR(bonus[9].quat[2], 0.9849325709665359, EPSILON); + EXPECT_NEAR(bonus[9].quat[3], -0.0516705065113425, EPSILON); + + auto num_bond = lmp->atom->num_bond; + auto bond_type = lmp->atom->bond_type; + auto bond_atom = lmp->atom->bond_atom; + auto id5p = lmp->atom->id5p; + + ASSERT_EQ(num_bond[GETIDX(1)], 1); + ASSERT_EQ(num_bond[GETIDX(2)], 1); + ASSERT_EQ(num_bond[GETIDX(3)], 1); + ASSERT_EQ(num_bond[GETIDX(4)], 1); + ASSERT_EQ(num_bond[GETIDX(5)], 0); + ASSERT_EQ(num_bond[GETIDX(6)], 1); + ASSERT_EQ(num_bond[GETIDX(7)], 1); + ASSERT_EQ(num_bond[GETIDX(8)], 1); + ASSERT_EQ(num_bond[GETIDX(9)], 1); + ASSERT_EQ(num_bond[GETIDX(10)], 0); + + ASSERT_EQ(bond_type[GETIDX(1)][0], 1); + ASSERT_EQ(bond_type[GETIDX(2)][0], 1); + ASSERT_EQ(bond_type[GETIDX(3)][0], 1); + ASSERT_EQ(bond_type[GETIDX(4)][0], 1); + ASSERT_EQ(bond_type[GETIDX(6)][0], 1); + ASSERT_EQ(bond_type[GETIDX(7)][0], 1); + ASSERT_EQ(bond_type[GETIDX(8)][0], 1); + ASSERT_EQ(bond_type[GETIDX(9)][0], 1); + + ASSERT_EQ(bond_atom[GETIDX(1)][0], 2); + ASSERT_EQ(bond_atom[GETIDX(2)][0], 3); + ASSERT_EQ(bond_atom[GETIDX(3)][0], 4); + ASSERT_EQ(bond_atom[GETIDX(4)][0], 5); + ASSERT_EQ(bond_atom[GETIDX(6)][0], 7); + ASSERT_EQ(bond_atom[GETIDX(7)][0], 8); + ASSERT_EQ(bond_atom[GETIDX(8)][0], 9); + ASSERT_EQ(bond_atom[GETIDX(9)][0], 10); + + ASSERT_EQ(id5p[GETIDX(1)], 2); + ASSERT_EQ(id5p[GETIDX(2)], 3); + ASSERT_EQ(id5p[GETIDX(3)], 4); + ASSERT_EQ(id5p[GETIDX(4)], 5); + ASSERT_EQ(id5p[GETIDX(5)], -1); + ASSERT_EQ(id5p[GETIDX(6)], 7); + ASSERT_EQ(id5p[GETIDX(7)], 8); + ASSERT_EQ(id5p[GETIDX(8)], 9); + ASSERT_EQ(id5p[GETIDX(9)], 10); + ASSERT_EQ(id5p[GETIDX(10)], -1); + + END_HIDE_OUTPUT(); + +} + } // namespace LAMMPS_NS int main(int argc, char **argv) diff --git a/unittest/formats/test_dump_atom.cpp b/unittest/formats/test_dump_atom.cpp index a73204fb92..6303d2c019 100644 --- a/unittest/formats/test_dump_atom.cpp +++ b/unittest/formats/test_dump_atom.cpp @@ -547,12 +547,12 @@ TEST_F(DumpAtomTest, rerun_bin) command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file)); }); lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); - ASSERT_NEAR(pe_1, pe_rerun,1.0e-14); + ASSERT_NEAR(pe_1, pe_rerun, 1.0e-14); HIDE_OUTPUT([&] { command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file)); }); lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); - ASSERT_NEAR(pe_2, pe_rerun,1.0e-14); + ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14); delete_file(dump_file); } diff --git a/unittest/formats/test_dump_cfg.cpp b/unittest/formats/test_dump_cfg.cpp index a180c6b342..c2ab96c5ed 100644 --- a/unittest/formats/test_dump_cfg.cpp +++ b/unittest/formats/test_dump_cfg.cpp @@ -81,6 +81,7 @@ TEST_F(DumpCfgTest, write_dump) auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; BEGIN_HIDE_OUTPUT(); + command("run 0 post no"); command(std::string("write_dump all cfg dump_cfg.melt.cfg ") + fields); command(std::string("write_dump all cfg dump_cfg*.melt.cfg ") + fields); END_HIDE_OUTPUT(); diff --git a/unittest/formats/test_dump_custom.cpp b/unittest/formats/test_dump_custom.cpp index 434acf462c..40e22f5a11 100644 --- a/unittest/formats/test_dump_custom.cpp +++ b/unittest/formats/test_dump_custom.cpp @@ -346,7 +346,7 @@ TEST_F(DumpCustomTest, rerun) }); lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); ASSERT_DOUBLE_EQ(pe_1, pe_rerun); - + HIDE_OUTPUT([&] { command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file)); }); @@ -375,12 +375,12 @@ TEST_F(DumpCustomTest, rerun_bin) command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file)); }); lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); - ASSERT_NEAR(pe_1, pe_rerun,1.0e-14); + ASSERT_NEAR(pe_1, pe_rerun, 1.0e-14); HIDE_OUTPUT([&] { command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file)); }); lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); - ASSERT_NEAR(pe_2, pe_rerun,1.0e-14); + ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14); delete_file(dump_file); } diff --git a/unittest/formats/test_file_operations.cpp b/unittest/formats/test_file_operations.cpp index bb26dff391..fdb3e1a815 100644 --- a/unittest/formats/test_file_operations.cpp +++ b/unittest/formats/test_file_operations.cpp @@ -29,7 +29,6 @@ using namespace LAMMPS_NS; -using testing::MatchesRegex; using testing::StrEq; using utils::read_lines_from_file; @@ -335,7 +334,9 @@ TEST_F(FileOperationsTest, write_restart) ASSERT_FILE_EXISTS("multi2-0.restart"); ASSERT_FILE_EXISTS("multi3-base.restart"); ASSERT_FILE_EXISTS("multi3-0.restart"); - if (info->has_package("MPIIO")) ASSERT_FILE_EXISTS("test.restart.mpiio"); + if (info->has_package("MPIIO")) { + ASSERT_FILE_EXISTS("test.restart.mpiio"); + } if (!info->has_package("MPIIO")) { TEST_FAILURE(".*ERROR: Writing to MPI-IO filename when MPIIO package is not inst.*", diff --git a/unittest/formats/test_molecule_file.cpp b/unittest/formats/test_molecule_file.cpp index 2cca7a6832..17bd30a349 100644 --- a/unittest/formats/test_molecule_file.cpp +++ b/unittest/formats/test_molecule_file.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -using testing::MatchesRegex; +using testing::ContainsRegex; using testing::StrEq; using utils::split_words; @@ -173,7 +173,37 @@ TEST_F(MoleculeFileTest, minimal) BEGIN_CAPTURE_OUTPUT(); run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n"); auto output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*")); + ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n" + ".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*")); +} + +TEST_F(MoleculeFileTest, notype) +{ + BEGIN_CAPTURE_OUTPUT(); + command("atom_style atomic"); + command("region box block 0 1 0 1 0 1"); + command("create_box 1 box"); + run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n"); + auto output = END_CAPTURE_OUTPUT(); + ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n" + ".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*")); + TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*", + command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465");); +} + +TEST_F(MoleculeFileTest, extramass) +{ + BEGIN_CAPTURE_OUTPUT(); + command("atom_style atomic"); + command("region box block 0 1 0 1 0 1"); + command("create_box 1 box"); + run_mol_cmd(test_name, "", + "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n" + " Types\n\n 1 1\n Masses\n\n 1 1.0\n"); + command("create_atoms 0 single 0.0 0.0 0.0 mol extramass 73546"); + auto output = END_CAPTURE_OUTPUT(); + ASSERT_THAT(output, ContainsRegex(".*WARNING: Molecule attributes do not match " + "system attributes.*")); } TEST_F(MoleculeFileTest, twomols) @@ -184,8 +214,8 @@ TEST_F(MoleculeFileTest, twomols) " Coords\n\n 1 0.0 0.0 0.0\n 2 0.0 0.0 1.0\n" " Molecules\n\n 1 1\n 2 2\n\n Types\n\n 1 1\n 2 2\n\n"); auto output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*2 molecules.*2 atoms " - "with max type 2.*0 bonds.*")); + ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*2 molecules.*\n" + ".*0 fragments.*\n.*2 atoms with max type 2.*\n.*0 bonds.*")); } TEST_F(MoleculeFileTest, twofiles) @@ -193,12 +223,14 @@ TEST_F(MoleculeFileTest, twofiles) BEGIN_CAPTURE_OUTPUT(); command("molecule twomols moltest.h2o.mol moltest.co2.mol offset 2 1 1 0 0"); auto output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms " - "with max type 2.*2 bonds with max type 1.*" - "1 angles with max type 1.*0 dihedrals.*" - ".*Read molecule template twomols:.*1 molecules.*3 atoms " - "with max type 4.*2 bonds with max type 2.*" - "1 angles with max type 2.*0 dihedrals.*")); + ASSERT_THAT( + output, + ContainsRegex(".*Read molecule template twomols:.*\n.*1 molecules.*\n" + ".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n" + ".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n" + ".*Read molecule template twomols:.*\n.*1 molecules.*\n" + ".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n" + ".*1 angles with max type 2.*\n.*0 dihedrals.*")); } TEST_F(MoleculeFileTest, bonds) @@ -227,14 +259,15 @@ TEST_F(MoleculeFileTest, bonds) " 1 1 1 2\n" " 2 2 1 3\n\n"); auto output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*4 atoms.*type.*2.*" - "2 bonds.*type.*2.*0 angles.*")); + ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n" + ".*0 fragments.*\n.*4 atoms.*type.*2.*\n" + ".*2 bonds.*type.*2.*\n.*0 angles.*")); BEGIN_CAPTURE_OUTPUT(); command("mass * 2.0"); command("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235"); output = END_CAPTURE_OUTPUT(); - ASSERT_THAT(output, MatchesRegex(".*Created 4 atoms.*")); + ASSERT_THAT(output, ContainsRegex(".*Created 4 atoms.*")); BEGIN_HIDE_OUTPUT(); Molecule *mol = lmp->atom->molecules[0]; diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 7cd61d25a4..db235722a4 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -37,7 +37,6 @@ #include using namespace LAMMPS_NS; -using ::testing::MatchesRegex; using utils::split_words; // whether to print verbose output (i.e. not capturing LAMMPS screen output). @@ -283,7 +282,7 @@ TEST_F(OpenPotentialTest, Sw_conv) { int convert_flag = utils::get_supported_conversions(utils::ENERGY); ASSERT_EQ(convert_flag, utils::METAL2REAL | utils::REAL2METAL); - BEGIN_HIDE_OUTPUT(); + BEGIN_CAPTURE_OUTPUT(); command("units real"); FILE *fp = utils::open_potential("Si.sw", lmp, &convert_flag); auto text = END_CAPTURE_OUTPUT(); @@ -301,7 +300,7 @@ TEST_F(OpenPotentialTest, Sw_noconv) BEGIN_HIDE_OUTPUT(); command("units real"); END_HIDE_OUTPUT(); - TEST_FAILURE(".*potential.*requires metal units but real.*", + TEST_FAILURE(".*Potential.*requires metal units but real.*", utils::open_potential("Si.sw", lmp, nullptr);); BEGIN_HIDE_OUTPUT(); command("units lj"); diff --git a/unittest/formats/test_text_file_reader.cpp b/unittest/formats/test_text_file_reader.cpp index 6fcc21fb33..4965daab5d 100644 --- a/unittest/formats/test_text_file_reader.cpp +++ b/unittest/formats/test_text_file_reader.cpp @@ -72,7 +72,7 @@ TEST_F(TextFileReaderTest, permissions) { platform::unlink("text_reader_noperms.file"); FILE *fp = fopen("text_reader_noperms.file", "w"); - ASSERT_NE(fp,nullptr); + ASSERT_NE(fp, nullptr); fputs("word\n", fp); fclose(fp); chmod("text_reader_noperms.file", 0); diff --git a/unittest/fortran/CMakeLists.txt b/unittest/fortran/CMakeLists.txt index 6e7e165018..2e7703747b 100644 --- a/unittest/fortran/CMakeLists.txt +++ b/unittest/fortran/CMakeLists.txt @@ -26,11 +26,11 @@ if(CMAKE_Fortran_COMPILER) add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90) target_link_libraries(test_fortran_create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) - add_test(FortranOpen test_fortran_create) + add_test(NAME FortranOpen COMMAND test_fortran_create) add_executable(test_fortran_commands wrap_commands.cpp test_fortran_commands.f90) target_link_libraries(test_fortran_commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) - add_test(FortranCommands test_fortran_commands) + add_test(NAME FortranCommands COMMAND test_fortran_commands) else() message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran compiler") endif() diff --git a/unittest/fortran/mpi_stubs.f90 b/unittest/fortran/mpi_stubs.f90 index 3f87fc38f7..8601f436d2 100644 --- a/unittest/fortran/mpi_stubs.f90 +++ b/unittest/fortran/mpi_stubs.f90 @@ -9,7 +9,7 @@ MODULE MPI mpi_comm_split CONTAINS - + SUBROUTINE mpi_comm_split(comm,color,key,newcomm,ierr) INTEGER, INTENT(in) :: comm,color,key INTEGER, INTENT(out) :: newcomm,ierr diff --git a/unittest/python/CMakeLists.txt b/unittest/python/CMakeLists.txt index f61a9c61ab..a1fcce635c 100644 --- a/unittest/python/CMakeLists.txt +++ b/unittest/python/CMakeLists.txt @@ -12,41 +12,50 @@ if(NOT BUILD_SHARED_LIBS) endif() if(CMAKE_VERSION VERSION_LESS 3.12) - find_package(PythonInterp 3.5) # Deprecated since version 3.12 + find_package(PythonInterp 3.6) # Deprecated since version 3.12 if(PYTHONINTERP_FOUND) set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) endif() else() - find_package(Python3 COMPONENTS Interpreter Development) + find_package(Python COMPONENTS Interpreter Development) endif() add_executable(test_python_package test_python_package.cpp) target_link_libraries(test_python_package PRIVATE lammps GTest::GMock) target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER}) # this requires CMake 3.12. don't care to add backward compatibility for this. -if(Python3_Development_FOUND) +if(Python_Development_FOUND) target_compile_definitions(test_python_package PRIVATE -DTEST_HAVE_PYTHON_DEVELOPMENT=1) - target_link_libraries(test_python_package PRIVATE Python3::Python) + target_link_libraries(test_python_package PRIVATE Python::Python) endif() -add_test(NAME PythonPackage COMMAND test_python_package WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -set_tests_properties(PythonPackage PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH};PYTHONUNBUFFERED=1") +add_test(NAME PythonPackage COMMAND test_python_package) + +# build list of environment variables for testing python functionality +if(WIN32) + set(PYTHON_TEST_ENVIRONMENT PYTHONPATH=${LAMMPS_PYTHON_DIR}) +else() + set(PYTHON_TEST_ENVIRONMENT PYTHONPATH=${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}) +endif() +get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(BUILD_IS_MULTI_CONFIG) + set(LAMMPS_LIB_PATH ${CMAKE_BINARY_DIR}/$) +else() + set(LAMMPS_LIB_PATH ${CMAKE_BINARY_DIR}) +endif() +list(APPEND PYTHON_TEST_ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") +list(APPEND PYTHON_TEST_ENVIRONMENT "PYTHONUNBUFFERED=1") +if(APPLE) + list(APPEND PYTHON_TEST_ENVIRONMENT "DYLD_LIBRARY_PATH=${LAMMPS_LIB_PATH}:$ENV{DYLD_LIBRARY_PATH}") +elseif(WIN32) + list(APPEND PYTHON_TEST_ENVIRONMENT "LAMMPSDLLPATH=${LAMMPS_LIB_PATH}") +else() + list(APPEND PYTHON_TEST_ENVIRONMENT "LD_LIBRARY_PATH=${LAMMPS_LIB_PATH}:$ENV{LD_LIBRARY_PATH}") +endif() +set_tests_properties(PythonPackage PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") if(Python_EXECUTABLE) - # prepare to augment the environment so that the LAMMPS python module and the shared library is found. - set(PYTHON_TEST_ENVIRONMENT PYTHONPATH=${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}) - get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if(BUILD_IS_MULTI_CONFIG) - set(LAMMPS_LIB_PATH ${CMAKE_BINARY_DIR}/$) - else() - set(LAMMPS_LIB_PATH ${CMAKE_BINARY_DIR}) - endif() - list(APPEND PYTHON_TEST_ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") list(APPEND PYTHON_TEST_ENVIRONMENT "TEST_INPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR}") - if(APPLE) - list(APPEND PYTHON_TEST_ENVIRONMENT "DYLD_LIBRARY_PATH=${LAMMPS_LIB_PATH}:$ENV{DYLD_LIBRARY_PATH};LAMMPS_CMAKE_CACHE=${CMAKE_BINARY_DIR}/CMakeCache.txt") - else() - list(APPEND PYTHON_TEST_ENVIRONMENT "LD_LIBRARY_PATH=${LAMMPS_LIB_PATH}:$ENV{LD_LIBRARY_PATH};LAMMPS_CMAKE_CACHE=${CMAKE_BINARY_DIR}/CMakeCache.txt") - endif() + list(APPEND PYTHON_TEST_ENVIRONMENT "LAMMPS_CMAKE_CACHE=${CMAKE_BINARY_DIR}/CMakeCache.txt") if(LAMMPS_MACHINE) # convert from '_machine' to 'machine' string(SUBSTRING ${LAMMPS_MACHINE} 1 -1 LAMMPS_MACHINE_NAME) diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index bd8512894f..58a0772510 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -356,18 +356,16 @@ create_atoms 1 single & def test_extract_box_triclinic(self): self.lmp.command("boundary p p p") - self.lmp.command("region box block 0 2 0 2 0 2") + self.lmp.command("region box prism 0 2 0 2 0 2 0.1 0.2 0.3") self.lmp.command("create_box 1 box") - self.lmp.command("change_box all triclinic") - self.lmp.command("change_box all xy final 0.1 yz final 0.2 xz final 0.3") boxlo, boxhi, xy, yz, xz, periodicity, box_change = self.lmp.extract_box() self.assertEqual(boxlo, [0.0, 0.0, 0.0]) self.assertEqual(boxhi, [2.0, 2.0, 2.0]) self.assertEqual(xy, 0.1) - self.assertEqual(yz, 0.2) - self.assertEqual(xz, 0.3) + self.assertEqual(xz, 0.2) + self.assertEqual(yz, 0.3) self.assertEqual(periodicity, [1, 1, 1]) self.assertEqual(box_change, 0) diff --git a/unittest/python/python-pylammps.py b/unittest/python/python-pylammps.py index 6294972ab4..2b92f82248 100644 --- a/unittest/python/python-pylammps.py +++ b/unittest/python/python-pylammps.py @@ -1,6 +1,13 @@ -import sys,os,unittest +import os,unittest from lammps import PyLammps +try: + import numpy + NUMPY_INSTALLED = True +except ImportError: + NUMPY_INSTALLED = False + +@unittest.skipIf(not NUMPY_INSTALLED, "numpy is not available") class PythonPyLammps(unittest.TestCase): def setUp(self): machine = None @@ -49,8 +56,8 @@ class PythonPyLammps(unittest.TestCase): self.assertEqual(self.pylmp.lmp.create_atoms(2, id=None, type=types, x=x), 2) self.assertEqual(self.pylmp.system.natoms, 2) self.assertEqual(len(self.pylmp.atoms), 2) - self.assertEqual(self.pylmp.atoms[0].position, tuple(x[0:3])) - self.assertEqual(self.pylmp.atoms[1].position, tuple(x[3:6])) + numpy.testing.assert_array_equal(self.pylmp.atoms[0].position, tuple(x[0:3])) + numpy.testing.assert_array_equal(self.pylmp.atoms[1].position, tuple(x[3:6])) self.assertEqual(self.pylmp.last_run, None) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index e04be89df1..db7a7a41b6 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -43,9 +43,9 @@ bool verbose = false; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { +using ::testing::ContainsRegex; using ::testing::Eq; using ::testing::HasSubstr; -using ::testing::MatchesRegex; using ::testing::StrEq; class PythonPackageTest : public LAMMPSTest { @@ -89,7 +89,7 @@ TEST_F(PythonPackageTest, InvokeFunctionFromFile) auto output = CAPTURE_OUTPUT([&]() { command("python printnum invoke"); }); - ASSERT_THAT(output, HasSubstr("2.25\n")); + ASSERT_THAT(output, HasSubstr("2.25")); } #if defined(TEST_HAVE_PYTHON_DEVELOPMENT) @@ -210,7 +210,7 @@ TEST_F(PythonPackageTest, InvokeOtherFunctionFromFile) auto output = CAPTURE_OUTPUT([&] { command("python printtxt invoke"); }); - ASSERT_THAT(output, HasSubstr("sometext\n")); + ASSERT_THAT(output, HasSubstr("sometext")); } TEST_F(PythonPackageTest, InvokeFunctionThatUsesLAMMPSModule) @@ -224,7 +224,7 @@ TEST_F(PythonPackageTest, InvokeFunctionThatUsesLAMMPSModule) auto output = CAPTURE_OUTPUT([&] { command("python getidxvar invoke"); }); - ASSERT_THAT(output, HasSubstr("2.25\n")); + ASSERT_THAT(output, HasSubstr("2.25")); } TEST_F(PythonPackageTest, python_variable) @@ -238,7 +238,7 @@ TEST_F(PythonPackageTest, python_variable) std::string output = CAPTURE_OUTPUT([&] { command("print \"${sq}\""); }); - ASSERT_THAT(output, MatchesRegex("print.*2.25.*")); + ASSERT_THAT(output, ContainsRegex("print.*\n.*2.25.*")); } TEST_F(PythonPackageTest, InlineFunction) @@ -309,7 +309,7 @@ TEST_F(FixPythonInvokeTest, end_of_step) auto output = CAPTURE_OUTPUT([&] { command("run 50"); }); - + fprintf(stderr,"lines: %s\n",output.c_str()); auto lines = utils::split_lines(output); int count = 0; diff --git a/unittest/testing/core.h b/unittest/testing/core.h index c922e96cc0..81a7112934 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -28,20 +28,20 @@ using namespace LAMMPS_NS; -using ::testing::MatchesRegex; +using ::testing::ContainsRegex; #define TEST_FAILURE(errmsg, ...) \ if (Info::has_exceptions()) { \ ::testing::internal::CaptureStdout(); \ ASSERT_ANY_THROW({__VA_ARGS__}); \ auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ + ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ } else { \ if (platform::mpi_vendor() != "Open MPI") { \ ::testing::internal::CaptureStdout(); \ ASSERT_DEATH({__VA_ARGS__}, ""); \ auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ + ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ } else { \ std::cerr << "[ ] [ INFO ] Skipping death test (no exception support) \n"; \ } \ diff --git a/unittest/tools/CMakeLists.txt b/unittest/tools/CMakeLists.txt index 5ed9c55b57..bde006a3ab 100644 --- a/unittest/tools/CMakeLists.txt +++ b/unittest/tools/CMakeLists.txt @@ -6,7 +6,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12) set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) endif() else() - find_package(Python3 COMPONENTS Interpreter) + find_package(Python 3.5 COMPONENTS Interpreter) endif() if(Python_EXECUTABLE) diff --git a/unittest/utils/CMakeLists.txt b/unittest/utils/CMakeLists.txt index 28486048c4..c01313ad8d 100644 --- a/unittest/utils/CMakeLists.txt +++ b/unittest/utils/CMakeLists.txt @@ -1,22 +1,23 @@ + add_executable(test_tokenizer test_tokenizer.cpp) target_link_libraries(test_tokenizer PRIVATE lammps GTest::GMockMain) -add_test(Tokenizer test_tokenizer) +add_test(NAME Tokenizer COMMAND test_tokenizer) add_executable(test_mempool test_mempool.cpp) target_link_libraries(test_mempool PRIVATE lammps GTest::GMockMain) -add_test(MemPool test_mempool) +add_test(NAME MemPool COMMAND test_mempool) add_executable(test_argutils test_argutils.cpp) target_link_libraries(test_argutils PRIVATE lammps GTest::GMockMain) -add_test(ArgUtils test_argutils) +add_test(NAME ArgUtils COMMAND test_argutils) add_executable(test_utils test_utils.cpp) target_link_libraries(test_utils PRIVATE lammps GTest::GMockMain) -add_test(Utils test_utils) +add_test(NAME Utils COMMAND test_utils) add_executable(test_platform test_platform.cpp) target_link_libraries(test_platform PRIVATE lammps GTest::GMockMain) -add_test(Platform test_platform) +add_test(NAME Platform COMMAND test_platform) set_tests_properties(Utils Platform PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") @@ -35,8 +36,8 @@ endif() add_executable(test_fmtlib test_fmtlib.cpp) target_link_libraries(test_fmtlib PRIVATE lammps GTest::GMockMain) -add_test(FmtLib test_fmtlib) +add_test(NAME FmtLib COMMAND test_fmtlib) add_executable(test_math_eigen_impl test_math_eigen_impl.cpp) target_include_directories(test_math_eigen_impl PRIVATE ${LAMMPS_SOURCE_DIR}) -add_test(MathEigen test_math_eigen_impl 10 5) +add_test(NAME MathEigen COMMAND test_math_eigen_impl 10 5) diff --git a/unittest/utils/test_math_eigen_impl.cpp b/unittest/utils/test_math_eigen_impl.cpp index 47ca8d9cca..b38438d1f7 100644 --- a/unittest/utils/test_math_eigen_impl.cpp +++ b/unittest/utils/test_math_eigen_impl.cpp @@ -48,7 +48,7 @@ inline static bool SimilarVec(Vector a, Vector b, int n, Scalar eps = 1.0e-06, Scalar ratio = 1.0e-06, Scalar ratio_denom = 1.0) { for (int i = 0; i < n; i++) - if (! Similar(a[i], b[i], eps, ratio, ratio_denom)) return false; + if (!Similar(a[i], b[i], eps, ratio, ratio_denom)) return false; return true; } @@ -61,7 +61,7 @@ inline static bool SimilarVecUnsigned(Vector a, Vector b, int n, Scalar eps = 1. return true; else { for (int i = 0; i < n; i++) - if (! Similar(a[i], -b[i], eps, ratio, ratio_denom)) return false; + if (!Similar(a[i], -b[i], eps, ratio, ratio_denom)) return false; return true; } } @@ -464,7 +464,7 @@ void TestJacobi(int n, //::SORT_INCREASING_ABS_EVALS); #else ecalc.Diagonalize(M, evals, evecs, - Jacobi::SORT_INCREASING_ABS_EVALS); #endif @@ -488,7 +488,7 @@ void TestJacobi(int n, //::SORT_DECREASING_ABS_EVALS); #else ecalc.Diagonalize(M, evals, evecs, - Jacobi::SORT_DECREASING_ABS_EVALS); #endif @@ -511,7 +511,7 @@ void TestJacobi(int n, //::SORT_INCREASING_EVALS); #else ecalc.Diagonalize(M, evals, evecs, - Jacobi::SORT_INCREASING_EVALS); #endif for (int i = 1; i < n; i++) @@ -533,8 +533,8 @@ void TestJacobi(int n, //::DO_NOT_SORT); #else ecalc.Diagonalize( - M, evals, evecs, - Jacobi::DO_NOT_SORT); + M, evals, evecs, + Jacobi::DO_NOT_SORT); #endif } // if (test_code_coverage) diff --git a/unittest/utils/test_platform.cpp b/unittest/utils/test_platform.cpp index ace546ba90..37e749b9be 100644 --- a/unittest/utils/test_platform.cpp +++ b/unittest/utils/test_platform.cpp @@ -68,10 +68,10 @@ TEST(Platform, putenv_unsetenv) ASSERT_EQ(platform::unsetenv(""), -1); ASSERT_EQ(platform::unsetenv("UNITTEST_VAR3=two"), -1); - var = getenv("UNITTEST_VAR1"); + var = getenv("UNITTEST_VAR1"); ASSERT_NE(var, nullptr); ASSERT_EQ(platform::unsetenv("UNITTEST_VAR1"), 0); - var = getenv("UNITTEST_VAR1"); + var = getenv("UNITTEST_VAR1"); ASSERT_EQ(var, nullptr); } diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index 72a90a95a0..dccbdb4118 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -838,15 +838,15 @@ TEST(Utils, date2num) TEST(Utils, current_date) { - auto vals = ValueTokenizer(utils::current_date(),"-"); - int year = vals.next_int(); + auto vals = ValueTokenizer(utils::current_date(), "-"); + int year = vals.next_int(); int month = vals.next_int(); - int day = vals.next_int(); - ASSERT_GT(year,2020); - ASSERT_GE(month,1); - ASSERT_GE(day,1); - ASSERT_LE(month,12); - ASSERT_LE(day,31); + int day = vals.next_int(); + ASSERT_GT(year, 2020); + ASSERT_GE(month, 1); + ASSERT_GE(day, 1); + ASSERT_LE(month, 12); + ASSERT_LE(day, 31); } TEST(Utils, binary_search)