diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2686011281..f99a336dbb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -67,6 +67,7 @@ src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps src/MISC/*_tracker.* @jtclemm src/MC/fix_gcmc.* @athomps src/MC/fix_sgcmc.* @athomps +src/REPLICA/fix_pimd_langevin.* @Yi-FanLi # core LAMMPS classes src/lammps.* @sjplimp diff --git a/cmake/CMakeLists.jpeg b/cmake/CMakeLists.jpeg deleted file mode 100644 index f0bd85a90d..0000000000 --- a/cmake/CMakeLists.jpeg +++ /dev/null @@ -1,615 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -# When using CMake 3.4 and later, don't export symbols from executables unless -# the CMAKE_ENABLE_EXPORTS variable is set. -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() -if(CMAKE_EXECUTABLE_SUFFIX) - set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX}) -endif() - -project(libjpeg-turbo C) -set(VERSION 2.1.3) -set(COPYRIGHT_YEAR "1991-2022") -string(REPLACE "." ";" VERSION_TRIPLET ${VERSION}) -list(GET VERSION_TRIPLET 0 VERSION_MAJOR) -list(GET VERSION_TRIPLET 1 VERSION_MINOR) -list(GET VERSION_TRIPLET 2 VERSION_REVISION) -function(pad_number NUMBER OUTPUT_LEN) - string(LENGTH "${${NUMBER}}" INPUT_LEN) - if(INPUT_LEN LESS OUTPUT_LEN) - math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1") - set(NUM ${${NUMBER}}) - foreach(C RANGE ${ZEROES}) - set(NUM "0${NUM}") - endforeach() - set(${NUMBER} ${NUM} PARENT_SCOPE) - endif() -endfunction() -pad_number(VERSION_MINOR 3) -pad_number(VERSION_REVISION 3) -set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION}) - -# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when -# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo -# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for -# Apple platforms are built as application bundles, which causes CMake to -# complain that our install() directives for executables do not specify a -# BUNDLE DESTINATION. Even if CMake did not complain, building executables as -# application bundles would break our iOS packages.) -set(CMAKE_MACOSX_BUNDLE FALSE) - -string(TIMESTAMP DEFAULT_BUILD "%Y%m%d") -set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})") - -# NOTE: On Windows, this does nothing except when using MinGW or Cygwin. -# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to -# Debug when using NMake. -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() -message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") - -message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") - -include(cmakescripts/PackageInfo.cmake) - -# Detect CPU type and whether we're building 64-bit or 32-bit code -math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") -string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) -set(COUNT 1) -foreach(ARCH ${CMAKE_OSX_ARCHITECTURES}) - if(COUNT GREATER 1) - message(FATAL_ERROR "The libjpeg-turbo build system does not support multiple values in CMAKE_OSX_ARCHITECTURES.") - endif() - math(EXPR COUNT "${COUNT}+1") -endforeach() -if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32") - if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32") - set(CPU_TYPE x86_64) - else() - set(CPU_TYPE i386) - endif() - if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE}) - set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE}) - endif() -elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm") - if(BITS EQUAL 64) - set(CPU_TYPE arm64) - else() - set(CPU_TYPE arm) - endif() -elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc") - set(CPU_TYPE powerpc) -else() - set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC}) -endif() -if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR - CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR - CMAKE_OSX_ARCHITECTURES MATCHES "i386") - set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES}) -endif() -if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc") - set(CPU_TYPE powerpc) -endif() -if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64") - set(CPU_TYPE arm64) -endif() - -message(STATUS "${BITS}-bit build (${CPU_TYPE})") - -macro(report_directory var) - if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var}) - message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}") - else() - message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})") - endif() - mark_as_advanced(CLEAR CMAKE_INSTALL_${var}) -endmacro() - -set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR") -if(UNIX) - list(APPEND DIRLIST "MANDIR") -endif() -foreach(dir ${DIRLIST}) - report_directory(${dir}) -endforeach() - - -############################################################################### -# CONFIGURATION OPTIONS -############################################################################### - -macro(boolean_number var) - if(${var}) - set(${var} 1 ${ARGN}) - else() - set(${var} 0 ${ARGN}) - endif() -endmacro() - -option(ENABLE_SHARED "Build shared libraries" FALSE) -boolean_number(ENABLE_SHARED) -option(ENABLE_STATIC "Build static libraries" TRUE) -boolean_number(ENABLE_STATIC) -option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE) -boolean_number(REQUIRE_SIMD) -option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE) -boolean_number(WITH_12BIT) -option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE) -boolean_number(WITH_ARITH_DEC) -option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE) -boolean_number(WITH_ARITH_ENC) -if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32") - set(WITH_JAVA 0) -else() - option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE) - boolean_number(WITH_JAVA) -endif() -option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) -boolean_number(WITH_JPEG7) -option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) -boolean_number(WITH_JPEG8) -option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) -boolean_number(WITH_MEM_SRCDST) -option(WITH_SIMD "Include SIMD extensions, if available for this platform" FALSE) -boolean_number(WITH_SIMD) -option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" FALSE) -boolean_number(WITH_TURBOJPEG) -option(WITH_FUZZ "Build fuzz targets" FALSE) - -macro(report_option var desc) - if(${var}) - message(STATUS "${desc} enabled (${var} = ${${var}})") - else() - message(STATUS "${desc} disabled (${var} = ${${var}})") - endif() -endmacro() - -if(WITH_JAVA) - set(ENABLE_SHARED 1) -endif() - -# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all -# targets, which will cause the shared library builds to fail. Thus, if shared -# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set -# to FALSE, we need to unset it, thus restoring the default behavior -# (automatically using PIC for shared library targets.) -if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND - NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED) - unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE) -endif() - -report_option(ENABLE_SHARED "Shared libraries") -report_option(ENABLE_STATIC "Static libraries") - -if(ENABLE_SHARED) - set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) -endif() - -if(WITH_JPEG8 OR WITH_JPEG7) - set(WITH_ARITH_ENC 1) - set(WITH_ARITH_DEC 1) -endif() -if(WITH_JPEG8) - set(WITH_MEM_SRCDST 0) -endif() - -if(WITH_12BIT) - set(WITH_ARITH_DEC 0) - set(WITH_ARITH_ENC 0) - set(WITH_JAVA 0) - set(WITH_SIMD 0) - set(WITH_TURBOJPEG 0) - set(BITS_IN_JSAMPLE 12) -else() - set(BITS_IN_JSAMPLE 8) -endif() -report_option(WITH_12BIT "12-bit JPEG support") - -if(WITH_ARITH_DEC) - set(D_ARITH_CODING_SUPPORTED 1) -endif() -if(NOT WITH_12BIT) - report_option(WITH_ARITH_DEC "Arithmetic decoding support") -endif() - -if(WITH_ARITH_ENC) - set(C_ARITH_CODING_SUPPORTED 1) -endif() -if(NOT WITH_12BIT) - report_option(WITH_ARITH_ENC "Arithmetic encoding support") -endif() - -if(NOT WITH_12BIT) - report_option(WITH_TURBOJPEG "TurboJPEG API library") - report_option(WITH_JAVA "TurboJPEG Java wrapper") -endif() - -if(WITH_MEM_SRCDST) - set(MEM_SRCDST_SUPPORTED 1) - set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;") -endif() -if(NOT WITH_JPEG8) - report_option(WITH_MEM_SRCDST "In-memory source/destination managers") -endif() - -set(SO_AGE 2) -if(WITH_MEM_SRCDST) - set(SO_AGE 3) -endif() - -if(WITH_JPEG8) - set(JPEG_LIB_VERSION 80) -elseif(WITH_JPEG7) - set(JPEG_LIB_VERSION 70) -else() - set(JPEG_LIB_VERSION 62) -endif() - -math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10") -math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10") -if(JPEG_LIB_VERSION STREQUAL "62") - set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION}) -else() - set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10}) -endif() -if(JPEG_LIB_VERSION STREQUAL "80") - set(DEFAULT_SO_MINOR_VERSION 2) -else() - set(DEFAULT_SO_MINOR_VERSION 0) -endif() - -# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if -# WITH_JPEG7 or WITH_JPEG8 has changed. -if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR - (DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT)) - set(FORCE_SO_VERSION "FORCE") -endif() -set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "") -set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "") - -set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING - "Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})" - ${FORCE_SO_VERSION}) -set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING - "Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})" - ${FORCE_SO_VERSION}) - -set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}") -message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})") -message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}") - -# Because the TurboJPEG API library uses versioned symbols and changes the -# names of functions whenever they are modified in a backward-incompatible -# manner, it is always backward-ABI-compatible with itself, so the major and -# minor SO versions don't change. However, we increase the middle number (the -# SO "age") whenever functions are added to the API. -set(TURBOJPEG_SO_MAJOR_VERSION 0) -set(TURBOJPEG_SO_AGE 2) -set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0) - - -############################################################################### -# COMPILER SETTINGS -############################################################################### - -if(MSVC) - option(WITH_CRT_DLL - "Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it." - FALSE) - if(NOT WITH_CRT_DLL) - # Use the static C library for all build types - foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") - endif() - endforeach() - endif() - add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) -endif() - -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - # Use the maximum optimization level for release builds - foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${var} MATCHES "-O2") - string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}") - endif() - endforeach() -endif() - -if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - if(CMAKE_C_COMPILER_ID MATCHES "SunPro") - # Use the maximum optimization level for release builds - foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${var} MATCHES "-xO3") - string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}") - endif() - if(${var} MATCHES "-xO2") - string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}") - endif() - endforeach() - endif() -endif() - -string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) - -set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") -message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") - -set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") -message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") - -include(CheckCSourceCompiles) -include(CheckIncludeFiles) -include(CheckTypeSize) - -check_type_size("size_t" SIZE_T) -check_type_size("unsigned long" UNSIGNED_LONG) - -if(SIZE_T EQUAL UNSIGNED_LONG) - check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" - HAVE_BUILTIN_CTZL) -endif() -if(MSVC) - check_include_files("intrin.h" HAVE_INTRIN_H) -endif() - -if(UNIX) - if(CMAKE_CROSSCOMPILING) - set(RIGHT_SHIFT_IS_UNSIGNED 0) - else() - include(CheckCSourceRuns) - check_c_source_runs(" - #include - #include - int is_shifting_signed (long arg) { - long res = arg >> 4; - if (res == -0x7F7E80CL) - return 1; /* right shift is signed */ - /* see if unsigned-shift hack will fix it. */ - /* we can't just test exact value since it depends on width of long... */ - res |= (~0L) << (32-4); - if (res == -0x7F7E80CL) - return 0; /* right shift is unsigned */ - printf(\"Right shift isn't acting as I expect it to.\\\\n\"); - printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\"); - return 0; /* try it with unsigned anyway */ - } - int main (void) { - exit(is_shifting_signed(-0x7F7E80B1L)); - }" RIGHT_SHIFT_IS_UNSIGNED) - endif() -endif() - -if(MSVC) - set(INLINE_OPTIONS "__inline;inline") -else() - set(INLINE_OPTIONS "__inline__;inline") -endif() -option(FORCE_INLINE "Force function inlining" TRUE) -boolean_number(FORCE_INLINE) -if(FORCE_INLINE) - if(MSVC) - list(INSERT INLINE_OPTIONS 0 "__forceinline") - else() - list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))") - list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))") - endif() -endif() -foreach(inline ${INLINE_OPTIONS}) - check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" - INLINE_WORKS) - if(INLINE_WORKS) - set(INLINE ${inline}) - break() - endif() -endforeach() -if(NOT INLINE_WORKS) - message(FATAL_ERROR "Could not determine how to inline functions.") -endif() -message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") - -if(WITH_TURBOJPEG) - if(MSVC) - set(THREAD_LOCAL "__declspec(thread)") - else() - set(THREAD_LOCAL "__thread") - endif() - check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL) - if(HAVE_THREAD_LOCAL) - message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") - else() - message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.") - unset(THREAD_LOCAL) - endif() -endif() - -if(UNIX AND NOT APPLE) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };") - set(CMAKE_REQUIRED_FLAGS - "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") - check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT) - set(CMAKE_REQUIRED_FLAGS) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) - if(HAVE_VERSION_SCRIPT) - message(STATUS "Linker supports GNU-style version scripts") - set(MAPFLAG "-Wl,--version-script,") - set(TJMAPFLAG "-Wl,--version-script,") - else() - message(STATUS "Linker does not support GNU-style version scripts") - if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - # The Solaris linker doesn't like our version script for the libjpeg API - # library, but the version script for the TurboJPEG API library should - # still work. - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map - "VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;") - set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared") - check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }" - HAVE_MAPFILE) - set(CMAKE_REQUIRED_FLAGS) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) - if(HAVE_MAPFILE) - message(STATUS "Linker supports mapfiles") - set(TJMAPFLAG "-Wl,-M,") - else() - message(STATUS "Linker does not support mapfiles") - endif() - endif() - endif() -endif() - -# Generate files -if(WIN32) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win/jconfig.h.in jconfig.h) -else() - configure_file(jconfig.h.in jconfig.h) -endif() -configure_file(jconfigint.h.in jconfigint.h) -configure_file(jversion.h.in jversion.h) -if(UNIX) - configure_file(libjpeg.map.in libjpeg.map) -endif() - -# Include directories and compiler definitions -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - -############################################################################### -# TARGETS -############################################################################### - -if(CMAKE_EXECUTABLE_SUFFIX_TMP) - set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP}) -endif() -message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}") - -set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c - jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c - jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c - jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c - jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c - jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) - -if(WITH_ARITH_ENC OR WITH_ARITH_DEC) - set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) -endif() - -if(WITH_ARITH_ENC) - set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) -endif() - -if(WITH_ARITH_DEC) - set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) -endif() - -if(WITH_SIMD) - add_subdirectory(simd) - if(NEON_INTRINSICS) - add_definitions(-DNEON_INTRINSICS) - endif() -elseif(NOT WITH_12BIT) - message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})") -endif() -if(WITH_SIMD) - message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})") - if(MSVC_IDE OR XCODE) - set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) - endif() -else() - add_library(simd OBJECT jsimd_none.c) - if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)) - set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() -endif() - -if(WITH_JAVA) - add_subdirectory(java) -endif() - -if(ENABLE_SHARED) - add_subdirectory(sharedlib) -endif() - -if(ENABLE_STATIC) - add_library(jpeg-static STATIC ${JPEG_SOURCES} $ - ${SIMD_OBJS}) - if(NOT MSVC) - set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) - endif() -endif() - -if(WITH_TURBOJPEG) - if(ENABLE_SHARED) - set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $ ${SIMD_OBJS} - turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c rdppm.c - wrbmp.c wrppm.c) - set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile) - if(WITH_JAVA) - set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) - include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) - set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni) - endif() - if(MSVC) - configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in - ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) - set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} - ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) - endif() - add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) - set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DPPM_SUPPORTED") - if(WIN32) - set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) - endif() - if(MINGW) - set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) - endif() - if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR - CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4)) - if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") - endif() - set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1) - endif() - set_target_properties(turbojpeg PROPERTIES - SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION}) - if(TJMAPFLAG) - set_target_properties(turbojpeg PROPERTIES - LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}") - endif() - endif() - - if(ENABLE_STATIC) - add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $ - ${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c - rdppm.c wrbmp.c wrppm.c) - set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DPPM_SUPPORTED") - if(NOT MSVC) - set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) - endif() - endif() -endif() - -if(WIN32) - set(USE_SETMODE "-DUSE_SETMODE") -endif() -if(WITH_12BIT) - set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}") -else() - set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}") - set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) - set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) -endif() \ No newline at end of file diff --git a/cmake/CMakeLists.png b/cmake/CMakeLists.png deleted file mode 100644 index 2521ab41be..0000000000 --- a/cmake/CMakeLists.png +++ /dev/null @@ -1,741 +0,0 @@ -# CMakeLists.txt - -# Copyright (C) 2018 Cosmin Truta -# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson -# Written by Christian Ehrlicher, 2007 -# Revised by Roger Lowman, 2009-2010 -# Revised by Clifford Yapp, 2011-2012,2017 -# Revised by Roger Leigh, 2016 -# Revised by Andreas Franek, 2016 -# Revised by Sam Serrels, 2017 -# Revised by Vadim Barkov, 2017 -# Revised by Vicky Pfau, 2018 -# Revised by Cameron Cawley, 2018 -# Revised by Cosmin Truta, 2018 -# Revised by Kyle Bentley, 2018 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h - -cmake_minimum_required(VERSION 3.10) -cmake_policy(VERSION 3.1) -# When using CMake 3.4 and later, don't export symbols from executables unless -# the CMAKE_ENABLE_EXPORTS variable is set. -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -project(libpng C ASM) -enable_testing() - -set(PNGLIB_MAJOR 1) -set(PNGLIB_MINOR 6) -set(PNGLIB_RELEASE 37) -set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) -set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) - -include(GNUInstallDirs) - -# needed packages - -# Allow users to specify location of Zlib. -# Useful if zlib is being built alongside this as a sub-project. -option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" ON) - -if(NOT PNG_BUILD_ZLIB) - find_package(ZLIB REQUIRED) - include_directories(${ZLIB_INCLUDE_DIR}) -endif() - -if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) - find_library(M_LIBRARY m) -else() - # libm is not needed and/or not available - set(M_LIBRARY "") -endif() - -# COMMAND LINE OPTIONS -option(PNG_SHARED "Build shared lib" OFF) -option(PNG_STATIC "Build static lib" ON) -option(PNG_TESTS "Build libpng tests" OFF) - -# Many more configuration options could be added here -option(PNG_FRAMEWORK "Build OS X framework" OFF) -option(PNG_DEBUG "Build with debug output" OFF) -option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" OFF) - -set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names") -set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings") - -if(PNG_HARDWARE_OPTIMIZATIONS) - -# set definitions and sources for arm -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") - set(PNG_ARM_NEON_POSSIBLE_VALUES check on off) - set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations: - check: (default) use internal checking code; - off: disable the optimizations; - on: turn on unconditionally.") - set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS - ${PNG_ARM_NEON_POSSIBLE_VALUES}) - list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_ARM_NEON} STREQUAL "off") - set(libpng_arm_sources - arm/arm_init.c - arm/filter_neon.S - arm/filter_neon_intrinsics.c - arm/palette_neon_intrinsics.c) - - if(${PNG_ARM_NEON} STREQUAL "on") - add_definitions(-DPNG_ARM_NEON_OPT=2) - elseif(${PNG_ARM_NEON} STREQUAL "check") - add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED) - endif() - else() - add_definitions(-DPNG_ARM_NEON_OPT=0) - endif() -endif() - -# set definitions and sources for powerpc -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*") - set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off) - set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations: - off: disable the optimizations.") - set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS - ${PNG_POWERPC_VSX_POSSIBLE_VALUES}) - list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off") - set(libpng_powerpc_sources - powerpc/powerpc_init.c - powerpc/filter_vsx_intrinsics.c) - if(${PNG_POWERPC_VSX} STREQUAL "on") - add_definitions(-DPNG_POWERPC_VSX_OPT=2) - endif() - else() - add_definitions(-DPNG_POWERPC_VSX_OPT=0) - endif() -endif() - -# set definitions and sources for intel -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*") - set(PNG_INTEL_SSE_POSSIBLE_VALUES on off) - set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations: - off: disable the optimizations") - set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS - ${PNG_INTEL_SSE_POSSIBLE_VALUES}) - list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off") - set(libpng_intel_sources - intel/intel_init.c - intel/filter_sse2_intrinsics.c) - if(${PNG_INTEL_SSE} STREQUAL "on") - add_definitions(-DPNG_INTEL_SSE_OPT=1) - endif() - else() - add_definitions(-DPNG_INTEL_SSE_OPT=0) - endif() -endif() - -# set definitions and sources for MIPS -if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*") - set(PNG_MIPS_MSA_POSSIBLE_VALUES on off) - set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations: - off: disable the optimizations") - set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS - ${PNG_MIPS_MSA_POSSIBLE_VALUES}) - list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off") - set(libpng_mips_sources - mips/mips_init.c - mips/filter_msa_intrinsics.c) - if(${PNG_MIPS_MSA} STREQUAL "on") - add_definitions(-DPNG_MIPS_MSA_OPT=2) - endif() - else() - add_definitions(-DPNG_MIPS_MSA_OPT=0) - endif() -endif() - -else(PNG_HARDWARE_OPTIMIZATIONS) - -# set definitions and sources for arm -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") - add_definitions(-DPNG_ARM_NEON_OPT=0) -endif() - -# set definitions and sources for powerpc -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*") - add_definitions(-DPNG_POWERPC_VSX_OPT=0) -endif() - -# set definitions and sources for intel -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*") - add_definitions(-DPNG_INTEL_SSE_OPT=0) -endif() - -# set definitions and sources for MIPS -if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*") - add_definitions(-DPNG_MIPS_MSA_OPT=0) -endif() - -endif(PNG_HARDWARE_OPTIMIZATIONS) - -# SET LIBNAME -set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) - -# to distinguish between debug and release lib -set(CMAKE_DEBUG_POSTFIX "d") - -include(CheckCSourceCompiles) -option(ld-version-script "Enable linker version script" ON) -if(ld-version-script AND NOT APPLE) - # Check if LD supports linker scripts. - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 { - global: sym; - local: *; -}; - -VERS_2 { - global: sym2; - main; -} VERS_1; -") - set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'") - check_c_source_compiles("void sym(void) {} -void sym2(void) {} -int main(void) {return 0;} -" HAVE_LD_VERSION_SCRIPT) - if(NOT HAVE_LD_VERSION_SCRIPT) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") - check_c_source_compiles("void sym(void) {} -void sym2(void) {} -int main(void) {return 0;} -" HAVE_SOLARIS_LD_VERSION_SCRIPT) - endif() - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map") -endif() - -# Find symbol prefix. Likely obsolete and unnecessary with recent -# toolchains (it's not done in many other projects). -function(symbol_prefix) - set(SYMBOL_PREFIX) - - execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-" - INPUT_FILE /dev/null - OUTPUT_VARIABLE OUT - RESULT_VARIABLE STATUS) - - if(CPP_FAIL) - message(WARNING "Failed to run the C preprocessor") - endif() - - string(REPLACE "\n" ";" OUT "${OUT}") - foreach(line ${OUT}) - string(REGEX MATCH "^PREFIX=" found_match "${line}") - if(found_match) - string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}") - string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}") - if(found_match) - string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}") - endif() - set(SYMBOL_PREFIX "${prefix}") - endif() - endforeach() - - message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}") - set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE) -endfunction() - -if(UNIX) - symbol_prefix() -endif() - -find_program(AWK NAMES gawk awk) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -if(NOT AWK OR ANDROID) - # No awk available to generate sources; use pre-built pnglibconf.h - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt - ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h) - add_custom_target(genfiles) # Dummy -else() - include(CMakeParseArguments) - # Generate .chk from .out with awk - # generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]]) - function(generate_chk) - set(options) - set(oneValueArgs INPUT OUTPUT) - set(multiValueArgs DEPENDS) - cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _GC_INPUT) - message(FATAL_ERROR "generate_chk: Missing INPUT argument") - endif() - if(NOT _GC_OUTPUT) - message(FATAL_ERROR "generate_chk: Missing OUTPUT argument") - endif() - - add_custom_command(OUTPUT "${_GC_OUTPUT}" - COMMAND "${CMAKE_COMMAND}" - "-DINPUT=${_GC_INPUT}" - "-DOUTPUT=${_GC_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake" - DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endfunction() - - # Generate .out from .c with awk - # generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]]) - function(generate_out) - set(options) - set(oneValueArgs INPUT OUTPUT) - set(multiValueArgs DEPENDS) - cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _GO_INPUT) - message(FATAL_ERROR "generate_out: Missing INPUT argument") - endif() - if(NOT _GO_OUTPUT) - message(FATAL_ERROR "generate_out: Missing OUTPUT argument") - endif() - - add_custom_command(OUTPUT "${_GO_OUTPUT}" - COMMAND "${CMAKE_COMMAND}" - "-DINPUT=${_GO_INPUT}" - "-DOUTPUT=${_GO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake" - DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endfunction() - - # Generate specific source file with awk - # generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]]) - function(generate_source) - set(options) - set(oneValueArgs OUTPUT) - set(multiValueArgs DEPENDS) - cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _GSO_OUTPUT) - message(FATAL_ERROR "generate_source: Missing OUTPUT argument") - endif() - - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}" - COMMAND "${CMAKE_COMMAND}" - "-DOUTPUT=${_GSO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" - DEPENDS ${_GSO_DEPENDS} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endfunction() - - # Copy file - function(generate_copy source destination) - add_custom_command(OUTPUT "${destination}" - COMMAND "${CMAKE_COMMAND}" -E remove "${destination}" - COMMAND "${CMAKE_COMMAND}" -E copy "${source}" - "${destination}" - DEPENDS "${source}") - endfunction() - - # Generate scripts/pnglibconf.h - generate_source(OUTPUT "scripts/pnglibconf.c" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h") - - # Generate pnglibconf.c - generate_source(OUTPUT "pnglibconf.c" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h") - - if(PNG_PREFIX) - set(PNGLIBCONF_H_EXTRA_DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst") - set(PNGPREFIX_H_EXTRA_DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out") - endif() - - generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out") - - # Generate pnglibconf.h - generate_source(OUTPUT "pnglibconf.h" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" - ${PNGLIBCONF_H_EXTRA_DEPENDS}) - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out") - - # Generate pngprefix.h - generate_source(OUTPUT "pngprefix.h" - DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS}) - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt") - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") - - generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def") - - add_custom_target(symbol-check DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk") - - generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" - "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym") - generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" - "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers") - - add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers") - add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym") - - add_custom_target("genprebuilt" - COMMAND "${CMAKE_COMMAND}" - "-DOUTPUT=scripts/pnglibconf.h.prebuilt" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - - # A single target handles generation of all generated files. If - # they are depended upon separately by multiple targets, this - # confuses parallel make (it would require a separate top-level - # target for each file to track the dependencies properly). - add_custom_target(genfiles DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym" - "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" - "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out") -endif(NOT AWK OR ANDROID) - -# OUR SOURCES -set(libpng_public_hdrs - png.h - pngconf.h - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" -) -set(libpng_private_hdrs - pngpriv.h - pngdebug.h - pnginfo.h - pngstruct.h -) -if(AWK AND NOT ANDROID) - list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h") -endif() -set(libpng_sources - ${libpng_public_hdrs} - ${libpng_private_hdrs} - png.c - pngerror.c - pngget.c - pngmem.c - pngpread.c - pngread.c - pngrio.c - pngrtran.c - pngrutil.c - pngset.c - pngtrans.c - pngwio.c - pngwrite.c - pngwtran.c - pngwutil.c - ${libpng_arm_sources} - ${libpng_intel_sources} - ${libpng_mips_sources} - ${libpng_powerpc_sources} -) -set(pngtest_sources - pngtest.c -) -set(pngvalid_sources - contrib/libtests/pngvalid.c -) -set(pngstest_sources - contrib/libtests/pngstest.c -) -set(pngunknown_sources - contrib/libtests/pngunknown.c -) -set(pngimage_sources - contrib/libtests/pngimage.c -) -set(pngfix_sources - contrib/tools/pngfix.c -) -set(png_fix_itxt_sources - contrib/tools/png-fix-itxt.c -) - -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) -endif() - -if(PNG_DEBUG) - add_definitions(-DPNG_DEBUG) -endif() - -# NOW BUILD OUR TARGET -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) - -unset(PNG_LIB_TARGETS) - -if(PNG_STATIC) - # does not work without changing name - set(PNG_LIB_NAME_STATIC png_static) - add_library(png_static STATIC ${libpng_sources}) - add_dependencies(png_static genfiles) - # MSVC doesn't use a different file extension for shared vs. static - # libs. We are able to change OUTPUT_NAME to remove the _static - # for all other platforms. - if(NOT MSVC) - set_target_properties(png_static PROPERTIES - OUTPUT_NAME "${PNG_LIB_NAME}" - CLEAN_DIRECT_OUTPUT 1) - else() - set_target_properties(png_static PROPERTIES - OUTPUT_NAME "${PNG_LIB_NAME}_static" - CLEAN_DIRECT_OUTPUT 1) - endif() - list(APPEND PNG_LIB_TARGETS png_static) - if(MSVC) - # msvc does not append 'lib' - do it here to have consistent name - set_target_properties(png_static PROPERTIES PREFIX "lib") - endif() - target_link_libraries(png_static ${M_LIBRARY}) -endif() - -if(NOT PNG_LIB_TARGETS) - message(SEND_ERROR - "No library variant selected to build. " - "Please enable at least one of the following options: " - "PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK") -endif() - -# Set a variable with CMake code which: -# Creates a symlink from src to dest (if possible) or alternatively -# copies if different. -include(CMakeParseArguments) - -function(create_symlink DEST_FILE) - - cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN}) - - if(NOT S_TARGET AND NOT S_FILE) - message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument") - endif() - - if(S_TARGET AND S_FILE) - message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.") - endif() - - if(S_FILE) - # If we don't need to symlink something that's coming from a build target, - # we can go ahead and symlink/copy at configure time. - if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - execute_process( - COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - else() - execute_process( - COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endif() - endif() - - if(S_TARGET) - # We need to use generator expressions, which can be a bit tricky, so for - # simplicity make the symlink a POST_BUILD step and use the TARGET - # signature of add_custom_command. - if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - add_custom_command(TARGET ${S_TARGET} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE}) - else() - add_custom_command(TARGET ${S_TARGET} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E create_symlink $ $/${DEST_FILE}) - endif() - endif() - -endfunction() - -# Create source generation scripts. -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY) - -# libpng is a library so default to 'lib' -if(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR lib) -endif() - -# CREATE PKGCONFIG FILES -# We use the same files like ./configure, so we have to set its vars. -# Only do this on Windows for Cygwin - the files don't make much sense outside -# of a UNIX look-alike. -if(NOT WIN32 OR CYGWIN OR MINGW) - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix ${CMAKE_INSTALL_PREFIX}) - set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) - set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) - set(LIBS "-lz -lm") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) - create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc) - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) - create_symlink(libpng-config FILE ${PNGLIB_NAME}-config) -endif() - -# SET UP LINKS -if(PNG_SHARED) - set_target_properties(png PROPERTIES -# VERSION 16.${PNGLIB_RELEASE}.1.6.37 - VERSION 16.${PNGLIB_RELEASE}.0 - SOVERSION 16 - CLEAN_DIRECT_OUTPUT 1) -endif() - -# INSTALL -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS ${PNG_LIB_TARGETS} - EXPORT libpng - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - if(PNG_SHARED) - # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin - if(CYGWIN OR MINGW) - create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png) - install(FILES $/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(NOT WIN32) - create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png) - install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - endif() - - if(PNG_STATIC) - if(NOT WIN32 OR CYGWIN OR MINGW) - create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) - install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - endif() -endif() - -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(FILES ${libpng_public_hdrs} DESTINATION include) - install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME}) -endif() -if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL) - if(NOT WIN32 OR CYGWIN OR MINGW) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) - endif() -endif() - -if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL) - install(TARGETS ${PNG_BIN_TARGETS} - RUNTIME DESTINATION bin) -endif() - -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) - # Install man pages - if(NOT PNG_MAN_DIR) - set(PNG_MAN_DIR "share/man") - endif() - install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3) - install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5) - # Install pkg-config files - if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config - DESTINATION bin) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config - DESTINATION bin) - endif() -endif() - -# Create an export file that CMake users can include() to import our targets. -if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL) - install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake) -endif() - -# what's with libpng-manual.txt and all the extra files? - -# UNINSTALL -# do we need this? - -# DIST -# do we need this? - -# to create msvc import lib for mingw compiled shared lib -# pexports libpng.dll > libpng.def -# lib /def:libpng.def /machine:x86 diff --git a/cmake/CMakeLists.zlib b/cmake/CMakeLists.zlib deleted file mode 100644 index a33f14ce64..0000000000 --- a/cmake/CMakeLists.zlib +++ /dev/null @@ -1,195 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -# When using CMake 3.4 and later, don't export symbols from executables unless -# the CMAKE_ENABLE_EXPORTS variable is set. -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -project(zlib C) - -set(VERSION "1.2.11") - -option(ASM686 "Enable building i686 assembly implementation" OFF) -option(AMD64 "Enable building amd64 assembly implementation" OFF) - -set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") - -include(CheckTypeSize) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) - -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) - -# -# Check to see if we have large file support -# -set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -# We add these other definitions here because CheckTypeSize.cmake -# in CMake 2.4.x does not automatically do so and we want -# compatibility with CMake 2.4.x. -if(HAVE_SYS_TYPES_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -endif() -if(HAVE_STDINT_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -endif() -if(HAVE_STDDEF_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -endif() -check_type_size(off64_t OFF64_T) -check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable - -# -# Check for fseeko -# -check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() - -# -# Check for unistd.h -# -check_include_file(unistd.h Z_HAVE_UNISTD_H) - -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -endif() - -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) - endif() -endif() - -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) - - -#============================================================================ -# zlib -#============================================================================ - -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h - zlib.h -) -set(ZLIB_PRIVATE_HDRS - crc32.h - deflate.h - gzguts.h - inffast.h - inffixed.h - inflate.h - inftrees.h - trees.h - zutil.h -) -set(ZLIB_SRCS - adler32.c - compress.c - crc32.c - deflate.c - gzclose.c - gzlib.c - gzread.c - gzwrite.c - inflate.c - infback.c - inftrees.c - inffast.c - trees.c - uncompr.c - zutil.c -) - -if(NOT MINGW) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -endif() - -if(CMAKE_COMPILER_IS_GNUCC) - if(ASM686) - set(ZLIB_ASMS contrib/asm686/match.S) - elseif (AMD64) - set(ZLIB_ASMS contrib/amd64/amd64-match.S) - endif () - - if(ZLIB_ASMS) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() -endif() - -if(MSVC) - if(ASM686) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx86/inffas32.asm - contrib/masmx86/match686.asm - ) - elseif (AMD64) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx64/gvmat64.asm - contrib/masmx64/inffasx64.asm - ) - endif() - - if(ZLIB_ASMS) - add_definitions(-DASMV -DASMINF) - endif() -endif() - -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) - -if(MINGW) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) - endif() - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} - -D GCC_WINDRES - -I ${CMAKE_CURRENT_SOURCE_DIR} - -I ${CMAKE_CURRENT_BINARY_DIR} - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -endif(MINGW) - -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) - -if(UNIX) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z) -endif() \ No newline at end of file diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index aa93e0cd7c..795b087bcb 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -49,8 +49,8 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) - set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.01.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "f140e02b826223b1045207d9bc10d404" CACHE STRING "MD5 checksum of KOKKOS tarball") + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.02.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "34d7860d548c06a4040236d959c9f99a" CACHE STRING "MD5 checksum of KOKKOS tarball") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK) @@ -75,7 +75,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 3.7.01 REQUIRED CONFIG) + find_package(Kokkos 3.7.02 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) else() set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) @@ -88,7 +88,7 @@ else() if(CMAKE_REQUEST_PIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() - add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) + add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR} EXCLUDE_FROM_ALL) set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src diff --git a/doc/lammps.1 b/doc/lammps.1 index b1be867e60..9bc107624f 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,7 +1,7 @@ -.TH LAMMPS "1" "28 March 2023" "2023-03-28" +.TH LAMMPS "1" "15 June 2023" "2023-06-15" .SH NAME .B LAMMPS -\- Molecular Dynamics Simulator. Version 28 March 2023 +\- Molecular Dynamics Simulator. Version 15 June 2023 .SH SYNOPSIS .B lmp diff --git a/doc/src/Bibliography.rst b/doc/src/Bibliography.rst index 2d27d2e6f9..e9ea8b0925 100644 --- a/doc/src/Bibliography.rst +++ b/doc/src/Bibliography.rst @@ -203,7 +203,7 @@ Bibliography A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005) **(CasP)** - CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html + CasP webpage: http://www.casp-program.org/ **(Cawkwell2012)** A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012). diff --git a/doc/src/Build_manual.rst b/doc/src/Build_manual.rst index e9a55134da..4b4bfa5a45 100644 --- a/doc/src/Build_manual.rst +++ b/doc/src/Build_manual.rst @@ -52,7 +52,7 @@ can be translated to different output format using the `Sphinx incorporates programmer documentation extracted from the LAMMPS C++ sources through the `Doxygen `_ program. Currently the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers) -and MOBI (for Amazon Kindle(tm) readers) are supported. For that to work a +and MOBI (for Amazon Kindle readers) are supported. For that to work a Python interpreter version 3.8 or later, the ``doxygen`` tools and internet access to download additional files and tools are required. This download is usually only required once or after the documentation diff --git a/doc/src/Commands_compute.rst b/doc/src/Commands_compute.rst index a2d0fd3823..73f7373f8c 100644 --- a/doc/src/Commands_compute.rst +++ b/doc/src/Commands_compute.rst @@ -154,11 +154,11 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`sph/t/atom ` * :doc:`spin ` * :doc:`stress/atom ` - * :doc:`stress/cartesian ` - * :doc:`stress/cylinder ` + * :doc:`stress/cartesian ` + * :doc:`stress/cylinder ` * :doc:`stress/mop ` * :doc:`stress/mop/profile ` - * :doc:`stress/spherical ` + * :doc:`stress/spherical ` * :doc:`stress/tally ` * :doc:`tdpd/cc/atom ` * :doc:`temp (k) ` diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index c74b1fd037..6fe321e3c9 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -171,6 +171,7 @@ OPT. * :doc:`pafi ` * :doc:`pair ` * :doc:`phonon ` + * :doc:`pimd/langevin ` * :doc:`pimd/nvt ` * :doc:`planeforce ` * :doc:`plumed ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 5f79015aaf..c45a1d778c 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -37,6 +37,7 @@ OPT. * * :doc:`adp (ko) ` * :doc:`agni (o) ` + * :doc:`aip/water/2dm (t) ` * :doc:`airebo (io) ` * :doc:`airebo/morse (io) ` * :doc:`amoeba (g) ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index d50eab3a41..1848a28024 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -41,7 +41,7 @@ warning. LATTE package ------------- -.. deprecated:: TBD +.. deprecated:: 15Jun2023 The LATTE package with the fix latte command was removed from LAMMPS. This functionality has been superseded by :doc:`fix mdi/qm ` diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index 92a42997b8..3b9ad9d1ff 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -56,17 +56,6 @@ C++ in the ``examples/COUPLE/simple`` folder of the LAMMPS distribution. and Ubuntu 18.04 LTS and not compatible. Either newer compilers need to be installed or the Linux updated. -.. versionchanged:: 8Feb2023 - -.. note:: - - A contributed Fortran interface is available in the - ``examples/COUPLE/fortran2`` folder. However, since the completion - of the :f:mod:`LIBLAMMPS` module, this interface is now deprecated, - no longer actively maintained and will likely be removed in the - future. Please see the ``README`` file in that folder for more - information about it and how to contact its author and maintainer. - ---------- Creating or deleting a LAMMPS object @@ -203,40 +192,62 @@ Below is an example demonstrating some of the possible uses. .. code-block:: fortran - PROGRAM testprop - USE LIBLAMMPS - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t - USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT - TYPE(lammps) :: lmp - INTEGER(KIND=c_int64_t), POINTER :: natoms - REAL(KIND=c_double), POINTER :: dt - INTEGER(KIND=c_int64_t), POINTER :: ntimestep - REAL(KIND=c_double) :: pe, ke + PROGRAM testprop + USE LIBLAMMPS + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t, c_int + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT + TYPE(lammps) :: lmp + INTEGER(KIND=c_int64_t), POINTER :: natoms, ntimestep, bval + REAL(KIND=c_double), POINTER :: dt, dval + INTEGER(KIND=c_int), POINTER :: nfield, typ, ival + INTEGER(KIND=c_int) :: i + CHARACTER(LEN=11) :: key + REAL(KIND=c_double) :: pe, ke - lmp = lammps() - CALL lmp%file('in.sysinit') - natoms = lmp%extract_global('natoms') - WRITE(OUTPUT_UNIT,'(A,I0,A)') 'Running a simulation with ', natoms, ' atoms' - WRITE(OUTPUT_UNIT,'(I0,A,I0,A,I0,A)') lmp%extract_setting('nlocal'), & - ' local and ', lmp%extract_setting('nghost'), ' ghost atoms. ', & - lmp%extract_setting('ntypes'), ' atom types' + lmp = lammps() + CALL lmp%file('in.sysinit') + natoms = lmp%extract_global('natoms') + WRITE(OUTPUT_UNIT,'(A,I0,A)') 'Running a simulation with ', natoms, ' atoms' + WRITE(OUTPUT_UNIT,'(I0,A,I0,A,I0,A)') lmp%extract_setting('nlocal'), & + ' local and ', lmp%extract_setting('nghost'), ' ghost atoms. ', & + lmp%extract_setting('ntypes'), ' atom types' - CALL lmp%command('run 2 post no') - dt = lmp%extract_global('dt') - ntimestep = lmp%extract_global('ntimestep') - WRITE(OUTPUT_UNIT,'(A,I0,A,F4.1,A)') 'At step: ', ntimestep, & - ' Changing timestep from', dt, ' to 0.5' - dt = 0.5_c_double - CALL lmp%command('run 2 post no') + CALL lmp%command('run 2 post no') - WRITE(OUTPUT_UNIT,'(A,I0)') 'At step: ', ntimestep - pe = lmp%get_thermo('pe') - ke = lmp%get_thermo('ke') - PRINT*, 'PE = ', pe - PRINT*, 'KE = ', ke + ntimestep = lmp%last_thermo('step', 0) + nfield = lmp%last_thermo('num', 0) + WRITE(OUTPUT_UNIT,'(A,I0,A,I0)') 'Last thermo output on step: ', ntimestep, & + ', number of fields: ', nfield + DO i=1, nfield + key = lmp%last_thermo('keyword',i) + typ = lmp%last_thermo('type',i) + IF (typ == lmp%dtype%i32) THEN + ival = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', ival + ELSE IF (typ == lmp%dtype%i64) THEN + bval = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', bval + ELSE IF (typ == lmp%dtype%r64) THEN + dval = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', dval + END IF + END DO - CALL lmp%close(.TRUE.) - END PROGRAM testprop + dt = lmp%extract_global('dt') + ntimestep = lmp%extract_global('ntimestep') + WRITE(OUTPUT_UNIT,'(A,I0,A,F4.1,A)') 'At step: ', ntimestep, & + ' Changing timestep from', dt, ' to 0.5' + dt = 0.5_c_double + CALL lmp%command('run 2 post no') + + WRITE(OUTPUT_UNIT,'(A,I0)') 'At step: ', ntimestep + pe = lmp%get_thermo('pe') + ke = lmp%get_thermo('ke') + WRITE(OUTPUT_UNIT,*) 'PE = ', pe + WRITE(OUTPUT_UNIT,*) 'KE = ', ke + + CALL lmp%close(.TRUE.) + END PROGRAM testprop --------------- @@ -262,6 +273,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS. :ftype style: type(lammps_style) :f type: derived type to access lammps type constants :ftype type: type(lammps_type) + :f dtype: derived type to access lammps data type constants + :ftype dtype: type(lammps_dtype) :f close: :f:subr:`close` :ftype close: subroutine :f subroutine error: :f:subr:`error` @@ -278,6 +291,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS. :ftype get_natoms: function :f get_thermo: :f:func:`get_thermo` :ftype get_thermo: function + :f last_thermo: :f:func:`last_thermo` + :ftype last_thermo: function :f extract_box: :f:subr:`extract_box` :ftype extract_box: subroutine :f reset_box: :f:subr:`reset_box` @@ -587,6 +602,96 @@ Procedures Bound to the :f:type:`lammps` Derived Type -------- +.. f:function:: last_thermo(what, index) + + This function will call :cpp:func:`lammps_last_thermo` and returns + either a string or a pointer to a cached copy of LAMMPS last thermodynamic + output, depending on the data requested through *what*. Note that *index* + uses 1-based indexing to access thermo output columns. + + .. versionadded:: 15Jun2023 + + Note that this function actually does not return a value, but rather + associates the pointer on the left side of the assignment to point to + internal LAMMPS data (with the exception of string data, which are + copied and returned as ordinary Fortran strings). Pointers must be + of the correct data type to point to said data (typically + ``INTEGER(c_int)``, ``INTEGER(c_int64_t)``, or ``REAL(c_double)``). + The pointer being associated with LAMMPS data is type-checked at + run-time via an overloaded assignment operator. The pointers + returned by this function point to temporary, read-only data that may + be overwritten at any time, so their target values need to be copied + to local storage if they are supposed to persist. + + For example, + + .. code-block:: fortran + + PROGRAM thermo + USE LIBLAMMPS + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t, c_int + TYPE(lammps) :: lmp + INTEGER(KIND=c_int64_t), POINTER :: ntimestep, bval + REAL(KIND=c_double), POINTER :: dval + INTEGER(KIND=c_int), POINTER :: nfield, typ, ival + INTEGER(KIND=c_int) :: i + CHARACTER(LEN=11) :: key + + lmp = lammps() + CALL lmp%file('in.sysinit') + + ntimestep = lmp%last_thermo('step', 0) + nfield = lmp%last_thermo('num', 0) + PRINT*, 'Last thermo output on step: ', ntimestep, ' Number of fields: ', nfield + DO i=1, nfield + key = lmp%last_thermo('keyword',i) + typ = lmp%last_thermo('type',i) + IF (typ == lmp%dtype%i32) THEN + ival = lmp%last_thermo('data',i) + PRINT*, key, ':', ival + ELSE IF (typ == lmp%dtype%i64) THEN + bval = lmp%last_thermo('data',i) + PRINT*, key, ':', bval + ELSE IF (typ == lmp%dtype%r64) THEN + dval = lmp%last_thermo('data',i) + PRINT*, key, ':', dval + END IF + END DO + CALL lmp%close(.TRUE.) + END PROGRAM thermo + + would extract the last timestep where thermo output was done and the number + of columns it printed. Then it loops over the columns to print out column + header keywords and the corresponding data. + + .. note:: + + If :f:func:`last_thermo` returns a string, the string must have a length + greater than or equal to the length of the string (not including the + terminal ``NULL`` character) that LAMMPS returns. If the variable's + length is too short, the string will be truncated. As usual in Fortran, + strings are padded with spaces at the end. If you use an allocatable + string, the string **must be allocated** prior to calling this function. + + :p character(len=\*) what: string with the name of the thermo keyword + :p integer(c_int) index: 1-based column index + :to: :cpp:func:`lammps_last_thermo` + :r pointer [polymorphic]: pointer to LAMMPS data. The left-hand side of the + assignment should be either a string (if expecting string data) or a + C-compatible pointer (e.g., ``INTEGER(c_int), POINTER :: nlocal``) to the + extracted property. + + .. warning:: + + Modifying the data in the location pointed to by the returned pointer + may lead to inconsistent internal data and thus may cause failures, + crashes, or bogus simulations. In general, it is much better + to use a LAMMPS input command that sets or changes these parameters. + Using an input command will take care of all side effects and necessary + updates of settings derived from such settings. + +-------- + .. f:subroutine:: extract_box([boxlo][, boxhi][, xy][, yz][, xz][, pflags][, boxflag]) This subroutine will call :cpp:func:`lammps_extract_box`. All @@ -764,13 +869,14 @@ Procedures Bound to the :f:type:`lammps` Derived Type .. note:: - If :f:func:`extract_global` returns a string, the string must have length - greater than or equal to the length of the string (not including the - terminal ``NULL`` character) that LAMMPS returns. If the variable's - length is too short, the string will be truncated. As usual in Fortran, - strings are padded with spaces at the end. If you use an allocatable - string, the string **must be allocated** prior to calling this function, - but you can automatically reallocate it to the correct length after the + If :f:func:`extract_global` returns a string, the string must have + a length greater than or equal to the length of the string (not + including the terminal ``NULL`` character) that LAMMPS returns. If + the variable's length is too short, the string will be + truncated. As usual in Fortran, strings are padded with spaces at + the end. If you use an allocatable string, the string **must be + allocated** prior to calling this function, but you can + automatically reallocate it to the correct length after the function returns, viz., .. code-block :: fortran diff --git a/doc/src/Howto_2d.rst b/doc/src/Howto_2d.rst index be223c076a..ae58711063 100644 --- a/doc/src/Howto_2d.rst +++ b/doc/src/Howto_2d.rst @@ -13,9 +13,9 @@ box with a single z plane of atoms - e.g. .. code-block:: LAMMPS - create box 1 -10 10 -10 10 -0.25 0.25 + create_box 1 -10 10 -10 10 -0.25 0.25 -If using the :doc:`read data ` command to read in a file of +If using the :doc:`read_data ` command to read in a file of atom coordinates, set the "zlo zhi" values to be finite but narrow, similar to the create_box command settings just described. For each atom in the file, assign a z coordinate so it falls inside the diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst index 8b84e96b99..0ca4e85fbb 100644 --- a/doc/src/Howto_bpm.rst +++ b/doc/src/Howto_bpm.rst @@ -79,9 +79,9 @@ As bonds can be broken between neighbor list builds, the bond styles. There are two possible settings which determine how pair interactions work between bonded particles. First, one can overlay pair forces with bond forces such that all bonded particles also -feel pair interactions. This can be accomplished by using the *overlay/pair* -keyword present in all bpm bond styles and by using the following special -bond settings +feel pair interactions. This can be accomplished by setting the *overlay/pair* +keyword present in all bpm bond styles to *yes* and requires using the +following special bond settings .. code-block:: LAMMPS @@ -107,7 +107,17 @@ bond lists is expensive. By setting the lj weight for 1-2 bonds to zero, this turns off pairwise interactions. Even though there are no charges in BPM models, setting a nonzero coul weight for 1-2 bonds ensures all bonded neighbors are still included in the neighbor list -in case bonds break between neighbor list builds. +in case bonds break between neighbor list builds. If bond breakage is +disabled during a simulation run by setting the *break* keyword to *no*, +a zero coul weight for 1-2 bonds can be used to exclude bonded atoms +from the neighbor list builds + + .. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 0 1 1 + +This can be useful for post-processing, or to determine pair interaction +properties between distinct bonded particles. To monitor the fracture of bonds in the system, all BPM bond styles have the ability to record instances of bond breakage to output using diff --git a/doc/src/Howto_spc.rst b/doc/src/Howto_spc.rst index 6414d3b846..6dedfe40c4 100644 --- a/doc/src/Howto_spc.rst +++ b/doc/src/Howto_spc.rst @@ -69,15 +69,13 @@ SPC/E with rigid bonds. timestep 1.0 fix rigid all shake 0.0001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no - reset_timestep 0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300.0 300.0 1.0 + fix integrate all nvt temp 300.0 300.0 100.0 thermo_style custom step temp press etotal density pe ke thermo 1000 run 20000 upto - write_data tip4p.data nocoeff + write_data spce.data nocoeff .. _spce_molecule: .. code-block:: diff --git a/doc/src/Howto_tip3p.rst b/doc/src/Howto_tip3p.rst index 682c7f2640..5419b9ba1b 100644 --- a/doc/src/Howto_tip3p.rst +++ b/doc/src/Howto_tip3p.rst @@ -128,11 +128,11 @@ TIP3P with rigid bonds. fix rigid all shake 0.001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no reset_timestep 0 + timestep 1.0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300 300 1.0 + fix integrate all nvt temp 300 300 100.0 thermo_style custom step temp press etotal pe diff --git a/doc/src/Howto_tip4p.rst b/doc/src/Howto_tip4p.rst index 7775d43e76..4d9b514e0d 100644 --- a/doc/src/Howto_tip4p.rst +++ b/doc/src/Howto_tip4p.rst @@ -180,17 +180,17 @@ file changed): fix rigid all shake 0.001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no reset_timestep 0 + timestep 1.0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300 300 1.0 + fix integrate all nvt temp 300 300 100.0 thermo_style custom step temp press etotal pe thermo 1000 run 20000 - write_data tip3p.data nocoeff + write_data tip4p-implicit.data nocoeff Below is the code for a LAMMPS input file using the explicit method and a TIP4P molecule file. Because of using :doc:`fix rigid/nvt/small @@ -203,6 +203,7 @@ rigid/nvt/small can identify rigid bodies by their molecule ID: units real atom_style charge + atom_modify map array region box block -5 5 -5 5 -5 5 create_box 3 box @@ -219,14 +220,14 @@ rigid/nvt/small can identify rigid bodies by their molecule ID: molecule water tip4p.mol create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33 - timestep 0.1 - fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0 + timestep 0.5 + fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0 velocity all create 300.0 5463576 thermo_style custom step temp press etotal density pe ke thermo 1000 run 20000 - write_data tip4p.data nocoeff + write_data tip4p-explicit.data nocoeff .. _tip4p_molecule: .. code-block:: diff --git a/doc/src/Howto_tip5p.rst b/doc/src/Howto_tip5p.rst index 21cc78a684..10674a04b6 100644 --- a/doc/src/Howto_tip5p.rst +++ b/doc/src/Howto_tip5p.rst @@ -91,6 +91,7 @@ ID: units real atom_style charge + atom_modify map array region box block -5 5 -5 5 -5 5 create_box 3 box @@ -107,8 +108,8 @@ ID: molecule water tip5p.mol create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33 - timestep 0.20 - fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0 + timestep 0.5 + fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0 reset_timestep 0 velocity all create 300.0 5463576 diff --git a/doc/src/Library_properties.rst b/doc/src/Library_properties.rst index 21e5609fc0..005bfaeea5 100644 --- a/doc/src/Library_properties.rst +++ b/doc/src/Library_properties.rst @@ -5,6 +5,7 @@ This section documents the following functions: - :cpp:func:`lammps_get_natoms` - :cpp:func:`lammps_get_thermo` +- :cpp:func:`lammps_last_thermo` - :cpp:func:`lammps_extract_box` - :cpp:func:`lammps_reset_box` - :cpp:func:`lammps_memory_usage` @@ -81,6 +82,11 @@ subdomains and processors. ----------------------- +.. doxygenfunction:: lammps_last_thermo + :project: progguide + +----------------------- + .. doxygenfunction:: lammps_extract_box :project: progguide diff --git a/doc/src/Python_properties.rst b/doc/src/Python_properties.rst index d8e772379c..031461660a 100644 --- a/doc/src/Python_properties.rst +++ b/doc/src/Python_properties.rst @@ -53,6 +53,7 @@ against invalid accesses. * :py:meth:`version() `: return the numerical version id, e.g. LAMMPS 2 Sep 2015 -> 20150902 * :py:meth:`get_thermo() `: return current value of a thermo keyword + * :py:meth:`last_thermo() `: return a dictionary of the last thermodynamic output * :py:meth:`get_natoms() `: total # of atoms as int * :py:meth:`reset_box() `: reset the simulation box size * :py:meth:`extract_setting() `: return a global setting @@ -60,6 +61,10 @@ against invalid accesses. * :py:meth:`extract_box() `: extract box info * :py:meth:`create_atoms() `: create N atoms with IDs, types, x, v, and image flags + **Properties**: + + * :py:attr:`last_thermo_step `: the last timestep thermodynamic output was computed + .. tab:: PyLammps/IPyLammps API In addition to the functions provided by :py:class:`lammps `, :py:class:`PyLammps ` objects diff --git a/doc/src/atc_add_molecule.rst b/doc/src/atc_add_molecule.rst index dc0f0318ac..68330da256 100644 --- a/doc/src/atc_add_molecule.rst +++ b/doc/src/atc_add_molecule.rst @@ -6,7 +6,7 @@ fix_modify AtC add_molecule command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify add_molecule diff --git a/doc/src/atc_add_species.rst b/doc/src/atc_add_species.rst index 0b39379e62..3fc2bcb2d3 100644 --- a/doc/src/atc_add_species.rst +++ b/doc/src/atc_add_species.rst @@ -6,7 +6,7 @@ fix_modify AtC add_species command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify add_species diff --git a/doc/src/atc_atom_element_map.rst b/doc/src/atc_atom_element_map.rst index 96895acc8e..f614e8f350 100644 --- a/doc/src/atc_atom_element_map.rst +++ b/doc/src/atc_atom_element_map.rst @@ -6,7 +6,7 @@ fix_modify AtC atom_element_map command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify atom_element_map [] diff --git a/doc/src/atc_atom_weight.rst b/doc/src/atc_atom_weight.rst index 50e7ea146d..1e1d771ef1 100644 --- a/doc/src/atc_atom_weight.rst +++ b/doc/src/atc_atom_weight.rst @@ -6,7 +6,7 @@ fix_modify AtC atom_weight command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify atom_weight diff --git a/doc/src/atc_atomic_charge.rst b/doc/src/atc_atomic_charge.rst index 4b3d34b815..1207043324 100644 --- a/doc/src/atc_atomic_charge.rst +++ b/doc/src/atc_atomic_charge.rst @@ -6,7 +6,7 @@ fix_modify AtC atomic_charge command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify atomic_charge diff --git a/doc/src/atc_boundary_dynamics.rst b/doc/src/atc_boundary_dynamics.rst index 696d091094..6b571f53d0 100644 --- a/doc/src/atc_boundary_dynamics.rst +++ b/doc/src/atc_boundary_dynamics.rst @@ -6,7 +6,7 @@ fix_modify AtC boundary_dynamics command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify boundary_dynamics diff --git a/doc/src/atc_boundary_faceset.rst b/doc/src/atc_boundary_faceset.rst index c33239b833..7c0654cc00 100644 --- a/doc/src/atc_boundary_faceset.rst +++ b/doc/src/atc_boundary_faceset.rst @@ -6,7 +6,7 @@ fix_modify AtC boundary_faceset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify boundary_faceset diff --git a/doc/src/atc_boundary_type.rst b/doc/src/atc_boundary_type.rst index 26b40e5a12..a43c17a658 100644 --- a/doc/src/atc_boundary_type.rst +++ b/doc/src/atc_boundary_type.rst @@ -6,7 +6,7 @@ fix_modify AtC boundary type command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify boundary type diff --git a/doc/src/atc_consistent_fe_initialization.rst b/doc/src/atc_consistent_fe_initialization.rst index 3241752262..78f7699906 100644 --- a/doc/src/atc_consistent_fe_initialization.rst +++ b/doc/src/atc_consistent_fe_initialization.rst @@ -6,7 +6,7 @@ fix_modify AtC consistent_fe_initialization command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify consistent_fe_initialization diff --git a/doc/src/atc_control_localized_lambda.rst b/doc/src/atc_control_localized_lambda.rst index eb286756b7..ca0bba30d5 100644 --- a/doc/src/atc_control_localized_lambda.rst +++ b/doc/src/atc_control_localized_lambda.rst @@ -6,7 +6,7 @@ fix_modify AtC control localized_lambda command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control localized_lambda diff --git a/doc/src/atc_control_momentum.rst b/doc/src/atc_control_momentum.rst index e87bd789b9..fcc3570e06 100644 --- a/doc/src/atc_control_momentum.rst +++ b/doc/src/atc_control_momentum.rst @@ -6,7 +6,7 @@ fix_modify AtC control momentum command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control fix_modify AtC control momentum none diff --git a/doc/src/atc_control_thermal.rst b/doc/src/atc_control_thermal.rst index 7a17701c5c..c14e52ac8f 100644 --- a/doc/src/atc_control_thermal.rst +++ b/doc/src/atc_control_thermal.rst @@ -6,7 +6,7 @@ fix_modify AtC control thermal command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control fix_modify control thermal diff --git a/doc/src/atc_decomposition.rst b/doc/src/atc_decomposition.rst index 50d11bf52f..182a27d915 100644 --- a/doc/src/atc_decomposition.rst +++ b/doc/src/atc_decomposition.rst @@ -6,7 +6,7 @@ fix_modify AtC decomposition command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify decomposition diff --git a/doc/src/atc_electron_integration.rst b/doc/src/atc_electron_integration.rst index 2f3fd9eee2..b3cd858e3d 100644 --- a/doc/src/atc_electron_integration.rst +++ b/doc/src/atc_electron_integration.rst @@ -6,7 +6,7 @@ fix_modify AtC extrinsic electron_integration command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify extrinsic electron_integration [] diff --git a/doc/src/atc_equilibrium_start.rst b/doc/src/atc_equilibrium_start.rst index 0068dc02c3..b1ef99dc11 100644 --- a/doc/src/atc_equilibrium_start.rst +++ b/doc/src/atc_equilibrium_start.rst @@ -6,7 +6,7 @@ fix_modify AtC equilibrium_start command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify equilibrium_start diff --git a/doc/src/atc_extrinsic_exchange.rst b/doc/src/atc_extrinsic_exchange.rst index 03d794115b..55aa4115b5 100644 --- a/doc/src/atc_extrinsic_exchange.rst +++ b/doc/src/atc_extrinsic_exchange.rst @@ -6,7 +6,7 @@ fix_modify AtC extrinsic exchange command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify extrinsic exchange diff --git a/doc/src/atc_fe_md_boundary.rst b/doc/src/atc_fe_md_boundary.rst index ad66bf6d49..ebc783c333 100644 --- a/doc/src/atc_fe_md_boundary.rst +++ b/doc/src/atc_fe_md_boundary.rst @@ -6,7 +6,7 @@ fix_modify AtC fe_md_boundary command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fe_md_boundary diff --git a/doc/src/atc_filter_scale.rst b/doc/src/atc_filter_scale.rst index ce62a589eb..100906d9f7 100644 --- a/doc/src/atc_filter_scale.rst +++ b/doc/src/atc_filter_scale.rst @@ -6,7 +6,7 @@ fix_modify AtC filter scale command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify filter scale diff --git a/doc/src/atc_filter_type.rst b/doc/src/atc_filter_type.rst index 5e2da80755..605c84c192 100644 --- a/doc/src/atc_filter_type.rst +++ b/doc/src/atc_filter_type.rst @@ -6,7 +6,7 @@ fix_modify AtC filter type command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify filter type diff --git a/doc/src/atc_fix.rst b/doc/src/atc_fix.rst index d3ba972508..77bc37ccef 100644 --- a/doc/src/atc_fix.rst +++ b/doc/src/atc_fix.rst @@ -6,7 +6,7 @@ fix_modify AtC fix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fix diff --git a/doc/src/atc_fix_flux.rst b/doc/src/atc_fix_flux.rst index 12699e9163..71513eb1f9 100644 --- a/doc/src/atc_fix_flux.rst +++ b/doc/src/atc_fix_flux.rst @@ -6,7 +6,7 @@ fix_modify AtC fix_flux command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fix_flux diff --git a/doc/src/atc_hardy_computes.rst b/doc/src/atc_hardy_computes.rst index 609740fe99..fe42a6265f 100644 --- a/doc/src/atc_hardy_computes.rst +++ b/doc/src/atc_hardy_computes.rst @@ -6,7 +6,7 @@ fix_modify AtC computes command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify computes diff --git a/doc/src/atc_hardy_fields.rst b/doc/src/atc_hardy_fields.rst index bef051bbe8..0159bb55ab 100644 --- a/doc/src/atc_hardy_fields.rst +++ b/doc/src/atc_hardy_fields.rst @@ -6,7 +6,7 @@ fix_modify AtC fields command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fields fix_modify fields diff --git a/doc/src/atc_hardy_gradients.rst b/doc/src/atc_hardy_gradients.rst index 2e7649d73c..52d05eac7c 100644 --- a/doc/src/atc_hardy_gradients.rst +++ b/doc/src/atc_hardy_gradients.rst @@ -6,7 +6,7 @@ fix_modify AtC gradients command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify gradients diff --git a/doc/src/atc_hardy_kernel.rst b/doc/src/atc_hardy_kernel.rst index 74316ec8b2..b3a10e8e99 100644 --- a/doc/src/atc_hardy_kernel.rst +++ b/doc/src/atc_hardy_kernel.rst @@ -6,7 +6,7 @@ fix_modify AtC kernel command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify kernel diff --git a/doc/src/atc_hardy_on_the_fly.rst b/doc/src/atc_hardy_on_the_fly.rst index fe7c688387..4635d72d13 100644 --- a/doc/src/atc_hardy_on_the_fly.rst +++ b/doc/src/atc_hardy_on_the_fly.rst @@ -6,7 +6,7 @@ fix_modify AtC on_the_fly command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify on_the_fly diff --git a/doc/src/atc_hardy_rates.rst b/doc/src/atc_hardy_rates.rst index 56166087d7..0c23e211ba 100644 --- a/doc/src/atc_hardy_rates.rst +++ b/doc/src/atc_hardy_rates.rst @@ -6,7 +6,7 @@ fix_modify AtC rates command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify rates diff --git a/doc/src/atc_initial.rst b/doc/src/atc_initial.rst index 7d62251c6c..721f0f3538 100644 --- a/doc/src/atc_initial.rst +++ b/doc/src/atc_initial.rst @@ -6,7 +6,7 @@ fix_modify AtC initial command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify initial diff --git a/doc/src/atc_internal_element_set.rst b/doc/src/atc_internal_element_set.rst index 4a376f55a3..e50463feed 100644 --- a/doc/src/atc_internal_element_set.rst +++ b/doc/src/atc_internal_element_set.rst @@ -6,7 +6,7 @@ fix_modify AtC internal_element_set command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify internal_element_set diff --git a/doc/src/atc_internal_quadrature.rst b/doc/src/atc_internal_quadrature.rst index b171914021..d8e241572c 100644 --- a/doc/src/atc_internal_quadrature.rst +++ b/doc/src/atc_internal_quadrature.rst @@ -6,7 +6,7 @@ fix_modify AtC internal_quadrature command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify internal_quadrature [region] diff --git a/doc/src/atc_kernel_bandwidth.rst b/doc/src/atc_kernel_bandwidth.rst index 02707cfd30..f166a063e3 100644 --- a/doc/src/atc_kernel_bandwidth.rst +++ b/doc/src/atc_kernel_bandwidth.rst @@ -6,7 +6,7 @@ fix_modify AtC kernel_bandwidth command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify kernel_bandwidth diff --git a/doc/src/atc_lumped_lambda_solve.rst b/doc/src/atc_lumped_lambda_solve.rst index e777116da5..b64ffb2d01 100644 --- a/doc/src/atc_lumped_lambda_solve.rst +++ b/doc/src/atc_lumped_lambda_solve.rst @@ -6,7 +6,7 @@ fix_modify AtC control lumped_lambda_solve command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control lumped_lambda_solve diff --git a/doc/src/atc_mask_direction.rst b/doc/src/atc_mask_direction.rst index ed5c605834..0e55cc7190 100644 --- a/doc/src/atc_mask_direction.rst +++ b/doc/src/atc_mask_direction.rst @@ -6,7 +6,7 @@ fix_modify AtC control mask_direction command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control mask_direction diff --git a/doc/src/atc_mass_matrix.rst b/doc/src/atc_mass_matrix.rst index eb586b933b..7763044ec8 100644 --- a/doc/src/atc_mass_matrix.rst +++ b/doc/src/atc_mass_matrix.rst @@ -6,7 +6,7 @@ fix_modify AtC mass_matrix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mass_matrix diff --git a/doc/src/atc_material.rst b/doc/src/atc_material.rst index 471bffffb2..eef5dbdd0e 100644 --- a/doc/src/atc_material.rst +++ b/doc/src/atc_material.rst @@ -6,7 +6,7 @@ fix_modify AtC material command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify material diff --git a/doc/src/atc_mesh_add_to_nodeset.rst b/doc/src/atc_mesh_add_to_nodeset.rst index f9f6f575fe..0944a51099 100644 --- a/doc/src/atc_mesh_add_to_nodeset.rst +++ b/doc/src/atc_mesh_add_to_nodeset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh add_to_nodeset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh add_to_nodeset diff --git a/doc/src/atc_mesh_create.rst b/doc/src/atc_mesh_create.rst index b17bb8ac0d..289c0e5c56 100644 --- a/doc/src/atc_mesh_create.rst +++ b/doc/src/atc_mesh_create.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create diff --git a/doc/src/atc_mesh_create_elementset.rst b/doc/src/atc_mesh_create_elementset.rst index 3cb406e7bc..35086b0fc9 100644 --- a/doc/src/atc_mesh_create_elementset.rst +++ b/doc/src/atc_mesh_create_elementset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_elementset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_elementset diff --git a/doc/src/atc_mesh_create_faceset_box.rst b/doc/src/atc_mesh_create_faceset_box.rst index 09b099d179..29dcfa69ad 100644 --- a/doc/src/atc_mesh_create_faceset_box.rst +++ b/doc/src/atc_mesh_create_faceset_box.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_faceset box command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_faceset box [units] diff --git a/doc/src/atc_mesh_create_faceset_plane.rst b/doc/src/atc_mesh_create_faceset_plane.rst index 035e584044..e36990de40 100644 --- a/doc/src/atc_mesh_create_faceset_plane.rst +++ b/doc/src/atc_mesh_create_faceset_plane.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_faceset plane command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_faceset plane [units] diff --git a/doc/src/atc_mesh_create_nodeset.rst b/doc/src/atc_mesh_create_nodeset.rst index a2f9d74d07..943d1c7d19 100644 --- a/doc/src/atc_mesh_create_nodeset.rst +++ b/doc/src/atc_mesh_create_nodeset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_nodeset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_nodeset diff --git a/doc/src/atc_mesh_delete_elements.rst b/doc/src/atc_mesh_delete_elements.rst index 9785f0adf6..2c9d83d506 100644 --- a/doc/src/atc_mesh_delete_elements.rst +++ b/doc/src/atc_mesh_delete_elements.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh delete_elements command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh delete_elements diff --git a/doc/src/atc_mesh_nodeset_to_elementset.rst b/doc/src/atc_mesh_nodeset_to_elementset.rst index d8721cc295..1838aa120f 100644 --- a/doc/src/atc_mesh_nodeset_to_elementset.rst +++ b/doc/src/atc_mesh_nodeset_to_elementset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh nodeset_to_elementset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh nodeset_to_elementset diff --git a/doc/src/atc_mesh_output.rst b/doc/src/atc_mesh_output.rst index 63756df98e..237b88eff6 100644 --- a/doc/src/atc_mesh_output.rst +++ b/doc/src/atc_mesh_output.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh output command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh output diff --git a/doc/src/atc_mesh_quadrature.rst b/doc/src/atc_mesh_quadrature.rst index 0c9bd4b30f..4cc94d77e2 100644 --- a/doc/src/atc_mesh_quadrature.rst +++ b/doc/src/atc_mesh_quadrature.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh quadrature command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh quatrature diff --git a/doc/src/atc_mesh_read.rst b/doc/src/atc_mesh_read.rst index 9848e12b07..dcc999166f 100644 --- a/doc/src/atc_mesh_read.rst +++ b/doc/src/atc_mesh_read.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh read command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh read diff --git a/doc/src/atc_mesh_write.rst b/doc/src/atc_mesh_write.rst index dbb8f9c219..2636f51fc5 100644 --- a/doc/src/atc_mesh_write.rst +++ b/doc/src/atc_mesh_write.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh write command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh write diff --git a/doc/src/atc_output.rst b/doc/src/atc_output.rst index 5003817daa..13df4c7d58 100644 --- a/doc/src/atc_output.rst +++ b/doc/src/atc_output.rst @@ -6,7 +6,7 @@ fix_modify AtC output command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output [text|full_text|binary|vector_components|tensor_components] fix_modify output index [step|time] diff --git a/doc/src/atc_output_boundary_integral.rst b/doc/src/atc_output_boundary_integral.rst index 71a3e03ac2..65ad6e835e 100644 --- a/doc/src/atc_output_boundary_integral.rst +++ b/doc/src/atc_output_boundary_integral.rst @@ -6,7 +6,7 @@ fix_modify AtC output boundary_integral command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output boundary_integral faceset [name] diff --git a/doc/src/atc_output_contour_integral.rst b/doc/src/atc_output_contour_integral.rst index 24678ef6cc..fa6ab8c9d1 100644 --- a/doc/src/atc_output_contour_integral.rst +++ b/doc/src/atc_output_contour_integral.rst @@ -6,7 +6,7 @@ fix_modify AtC output contour_integral command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output contour_integral faceset [axis [x|y|z]] diff --git a/doc/src/atc_output_nodeset.rst b/doc/src/atc_output_nodeset.rst index eb12a2344e..e5d1580274 100644 --- a/doc/src/atc_output_nodeset.rst +++ b/doc/src/atc_output_nodeset.rst @@ -6,7 +6,7 @@ fix_modify AtC output nodeset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output nodeset diff --git a/doc/src/atc_output_volume_integral.rst b/doc/src/atc_output_volume_integral.rst index 464d43cbce..a740c56e8b 100644 --- a/doc/src/atc_output_volume_integral.rst +++ b/doc/src/atc_output_volume_integral.rst @@ -6,7 +6,7 @@ fix_modify AtC output volume_integral command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output volume_integral diff --git a/doc/src/atc_pair_interactions.rst b/doc/src/atc_pair_interactions.rst index 73ada09001..d8de219d89 100644 --- a/doc/src/atc_pair_interactions.rst +++ b/doc/src/atc_pair_interactions.rst @@ -9,7 +9,7 @@ fix_modify AtC bond_interactions command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify pair_interactions fix_modify bond_interactions diff --git a/doc/src/atc_poisson_solver.rst b/doc/src/atc_poisson_solver.rst index d37f214b97..e203c3dc51 100644 --- a/doc/src/atc_poisson_solver.rst +++ b/doc/src/atc_poisson_solver.rst @@ -6,7 +6,7 @@ fix_modify AtC poisson_solver command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify poisson_solver mesh create diff --git a/doc/src/atc_read_restart.rst b/doc/src/atc_read_restart.rst index 11ba4519a4..32badbd3a8 100644 --- a/doc/src/atc_read_restart.rst +++ b/doc/src/atc_read_restart.rst @@ -6,7 +6,7 @@ fix_modify AtC read_restart command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify read_restart diff --git a/doc/src/atc_remove_molecule.rst b/doc/src/atc_remove_molecule.rst index a654cd5c1d..13c0856307 100644 --- a/doc/src/atc_remove_molecule.rst +++ b/doc/src/atc_remove_molecule.rst @@ -6,7 +6,7 @@ fix_modify AtC remove_molecule command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify remove_molecule diff --git a/doc/src/atc_remove_source.rst b/doc/src/atc_remove_source.rst index d98b7933da..253166cd3c 100644 --- a/doc/src/atc_remove_source.rst +++ b/doc/src/atc_remove_source.rst @@ -6,7 +6,7 @@ fix_modify AtC remove_source command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify remove_source diff --git a/doc/src/atc_remove_species.rst b/doc/src/atc_remove_species.rst index 5c4fd771ba..b7718a6874 100644 --- a/doc/src/atc_remove_species.rst +++ b/doc/src/atc_remove_species.rst @@ -6,7 +6,7 @@ fix_modify AtC remove_species command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify remove_species diff --git a/doc/src/atc_reset_atomic_reference.rst b/doc/src/atc_reset_atomic_reference.rst index 8f53cbfbe9..43acc9b4b2 100644 --- a/doc/src/atc_reset_atomic_reference.rst +++ b/doc/src/atc_reset_atomic_reference.rst @@ -6,7 +6,7 @@ fix_modify AtC reset_atomic_reference_positions command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify reset_atomic_reference_positions diff --git a/doc/src/atc_reset_time.rst b/doc/src/atc_reset_time.rst index 147a6ab910..f02c723011 100644 --- a/doc/src/atc_reset_time.rst +++ b/doc/src/atc_reset_time.rst @@ -6,7 +6,7 @@ fix_modify AtC reset_time command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify reset_time diff --git a/doc/src/atc_sample_frequency.rst b/doc/src/atc_sample_frequency.rst index 5b0da6d9dd..e61e9fd6ed 100644 --- a/doc/src/atc_sample_frequency.rst +++ b/doc/src/atc_sample_frequency.rst @@ -6,7 +6,7 @@ fix_modify AtC sample_frequency command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify sample_frequency diff --git a/doc/src/atc_set_reference_pe.rst b/doc/src/atc_set_reference_pe.rst index 8053a1df98..f85e3f7ebc 100644 --- a/doc/src/atc_set_reference_pe.rst +++ b/doc/src/atc_set_reference_pe.rst @@ -6,7 +6,7 @@ fix_modify AtC set reference_potential_energy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify set reference_potential_energy [] diff --git a/doc/src/atc_source.rst b/doc/src/atc_source.rst index 6df4b67d1c..ce712c8186 100644 --- a/doc/src/atc_source.rst +++ b/doc/src/atc_source.rst @@ -6,7 +6,7 @@ fix_modify AtC source command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify source diff --git a/doc/src/atc_source_integration.rst b/doc/src/atc_source_integration.rst index b10e6c7e2a..a145a7c9f1 100644 --- a/doc/src/atc_source_integration.rst +++ b/doc/src/atc_source_integration.rst @@ -6,7 +6,7 @@ fix_modify AtC source_integration command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify source_integration diff --git a/doc/src/atc_temperature_definition.rst b/doc/src/atc_temperature_definition.rst index b5a27467ca..0194e38314 100644 --- a/doc/src/atc_temperature_definition.rst +++ b/doc/src/atc_temperature_definition.rst @@ -6,7 +6,7 @@ fix_modify AtC temperature_definition command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify temperature_definition diff --git a/doc/src/atc_time_filter.rst b/doc/src/atc_time_filter.rst index 0a97c83259..76163a77b5 100644 --- a/doc/src/atc_time_filter.rst +++ b/doc/src/atc_time_filter.rst @@ -6,7 +6,7 @@ fix_modify AtC filter command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify filter diff --git a/doc/src/atc_time_integration.rst b/doc/src/atc_time_integration.rst index cf746dde0d..3eae147a6e 100644 --- a/doc/src/atc_time_integration.rst +++ b/doc/src/atc_time_integration.rst @@ -6,7 +6,7 @@ fix_modify AtC time_integration command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify time_integration diff --git a/doc/src/atc_track_displacement.rst b/doc/src/atc_track_displacement.rst index 043f42ea9c..f5a2d1742c 100644 --- a/doc/src/atc_track_displacement.rst +++ b/doc/src/atc_track_displacement.rst @@ -6,7 +6,7 @@ fix_modify AtC track_displacement command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify track_displacement diff --git a/doc/src/atc_unfix.rst b/doc/src/atc_unfix.rst index 12ee37bbde..c6ada6dcca 100644 --- a/doc/src/atc_unfix.rst +++ b/doc/src/atc_unfix.rst @@ -6,7 +6,7 @@ fix_modify AtC unfix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify unfix diff --git a/doc/src/atc_unfix_flux.rst b/doc/src/atc_unfix_flux.rst index da9d1b4aba..73ef5b17af 100644 --- a/doc/src/atc_unfix_flux.rst +++ b/doc/src/atc_unfix_flux.rst @@ -6,7 +6,7 @@ fix_modify AtC unfix_flux command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify unfix_flux diff --git a/doc/src/atc_write_atom_weights.rst b/doc/src/atc_write_atom_weights.rst index ecb69b5deb..40af619356 100644 --- a/doc/src/atc_write_atom_weights.rst +++ b/doc/src/atc_write_atom_weights.rst @@ -6,7 +6,7 @@ fix_modify AtC write_atom_weights command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify write_atom_weights diff --git a/doc/src/atc_write_restart.rst b/doc/src/atc_write_restart.rst index e4f19dea10..75945e1715 100644 --- a/doc/src/atc_write_restart.rst +++ b/doc/src/atc_write_restart.rst @@ -6,7 +6,7 @@ fix_modify AtC write_restart command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify write_restart diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index ba93d679ba..7459d491d6 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -10,7 +10,7 @@ Syntax bond_style bpm/rotational keyword value attribute1 attribute2 ... -* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break/no* +* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break* .. parsed-literal:: @@ -24,14 +24,17 @@ Syntax *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) - *overlay/pair* value = none + *overlay/pair* value = *yes* or *no* bonded particles will still interact with pair forces *smooth* value = *yes* or *no* smooths bond forces near the breaking point - *break/no* - indicates that bonds should not break during a run + *normalize* value = *yes* or *no* + normalizes normal and shear forces by the reference length + + *break* value = *yes* or *no* + indicates whether bonds break during a run Examples """""""" @@ -77,32 +80,32 @@ respectively. Details on the calculations of shear displacements and angular displacements can be found in :ref:`(Wang) ` and :ref:`(Wang and Mora) `. -Bonds will break under sufficient stress. A breaking criteria is calculated +Bonds will break under sufficient stress. A breaking criterion is calculated .. math:: - B = \mathrm{max}\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} + - \frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \} + B = \mathrm{max}\left\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} + + \frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \right\} where :math:`|f_s|` is the magnitude of the shear force and :math:`|\tau_b|` and :math:`|\tau_t|` are the magnitudes of the -bending and twisting forces, respectively. The corresponding variables +bending and twisting torques, respectively. The corresponding variables :math:`f_{r,c}` :math:`f_{s,c}`, :math:`\tau_{b,c}`, and :math:`\tau_{t,c}` are critical limits to each force or torque. If :math:`B` is ever equal to or exceeds one, the bond will break. This -is done by setting by setting its type to 0 such that forces and +is done by setting the bond type to 0 such that forces and torques are no longer computed. After computing the base magnitudes of the forces and torques, they can be optionally multiplied by an extra factor :math:`w` to smoothly interpolate forces and torques to zero as the bond breaks. This term -is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be -added or removed using the *smooth* keyword. +is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be added +or removed by setting the *smooth* keyword to *yes* or *no*, respectively. Finally, additional damping forces and torques are applied to the two particles. A force is applied proportional to the difference in the normal velocity of particles using a similar construction as -dissipative particle dynamics (:ref:`(Groot) `): +dissipative particle dynamics :ref:`(Groot) `: .. math:: @@ -112,8 +115,8 @@ where :math:`\gamma_n` is the damping strength, :math:`\hat{r}` is the radial normal vector, and :math:`\vec{v}` is the velocity difference between the two particles. Similarly, tangential forces are applied to each atom proportional to the relative differences in sliding -velocities with a constant prefactor :math:`\gamma_s` (:ref:`(Wang et -al.) `) along with their associated torques. The rolling and +velocities with a constant prefactor :math:`\gamma_s` :ref:`(Wang et +al.) ` along with their associated torques. The rolling and twisting components of the relative angular velocities of the two atoms are also damped by applying torques with prefactors of :math:`\gamma_r` and :math:`\gamma_t`, respectively. @@ -136,18 +139,23 @@ or :doc:`read_restart ` commands: * :math:`\gamma_r` (force*distance/velocity units) * :math:`\gamma_t` (force*distance/velocity units) +If the *normalize* keyword is set to *yes*, the radial and shear forces +will be normalized by :math:`r_0` such that :math:`k_r` and :math:`k_s` +must be given in force units. + By default, pair forces are not calculated between bonded particles. -Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* keyword. These settings require specific +Pair forces can alternatively be overlaid on top of bond forces by setting +the *overlay/pair* keyword to *yes*. These settings require specific :doc:`special_bonds ` settings described in the -restrictions. Further details can be found in the `:doc: how to -` page on BPMs. +restrictions. Further details can be found in the :doc:`how to +` page on BPMs. .. versionadded:: 28Mar2023 -If the *break/no* keyword is used, then LAMMPS assumes bonds should not break +If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. -However, if a bond does break, it will trigger an error. +However, if a bond reaches a damage criterion greater than one, +it will trigger an error. If the *store/local* keyword is used, an internal fix will track bonds that break during the simulation. Whenever a bond breaks, data is processed @@ -226,16 +234,15 @@ This bond style is part of the BPM package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -By default if pair interactions are to be disabled, this bond style -requires setting +By default if pair interactions between bonded atoms are to be disabled, +this bond style requires setting .. code-block:: LAMMPS special_bonds lj 0 1 1 coul 1 1 1 -and :doc:`newton ` must be set to bond off. If the -*overlay/pair* option is used, this bond style alternatively requires -setting +and :doc:`newton ` must be set to bond off. If the *overlay/pair* +keyword is set to *yes*, this bond style alternatively requires setting .. code-block:: LAMMPS @@ -251,7 +258,7 @@ Related commands Default """"""" -The option defaults are *smooth* = *yes* +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* ---------- diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index 5762dbe208..04ff4d5991 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -10,7 +10,7 @@ Syntax bond_style bpm/spring keyword value attribute1 attribute2 ... -* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break/no* +* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break* .. parsed-literal:: @@ -24,14 +24,17 @@ Syntax *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) - *overlay/pair* value = none + *overlay/pair* value = *yes* or *no* bonded particles will still interact with pair forces *smooth* value = *yes* or *no* smooths bond forces near the breaking point - *break/no* - indicates that bonds should not break during a run + *normalize* value = *yes* or *no* + normalizes bond forces by the reference length + + *break* value = *yes* or *no* + indicates whether bonds break during a run Examples """""""" @@ -66,16 +69,16 @@ particles based on a model described by Clemmer and Robbins F = k (r - r_0) w -where :math:`k_r` is a stiffness, :math:`r` is the current distance +where :math:`k` is a stiffness, :math:`r` is the current distance and :math:`r_0` is the initial distance between the two particles, and :math:`w` is an optional smoothing factor discussed below. Bonds will -break at a strain of :math:`\epsilon_c`. This is done by setting by -setting its type to 0 such that forces are no longer computed. +break at a strain of :math:`\epsilon_c`. This is done by setting +the bond type to 0 such that forces are no longer computed. An additional damping force is applied to the bonded particles. This forces is proportional to the difference in the normal velocity of particles using a similar construction as -dissipative particle dynamics (:ref:`(Groot) `): +dissipative particle dynamics :ref:`(Groot) `: .. math:: @@ -85,9 +88,10 @@ where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the radial normal vector, and :math:`\vec{v}` is the velocity difference between the two particles. -The smoothing factor :math:`w` can be added or removed using the -*smooth* keyword. It is constructed such that forces smoothly go -to zero, avoiding discontinuities, as bonds approach the critical strain +The smoothing factor :math:`w` can be added or removed by setting the +*smooth* keyword to *yes* or *no*, respectively. It is constructed such +that forces smoothly go to zero, avoiding discontinuities, as bonds +approach the critical strain .. math:: @@ -102,18 +106,22 @@ the data file or restart files read by the :doc:`read_data * :math:`\epsilon_c` (unit less) * :math:`\gamma` (force/velocity units) +If the *normalize* keyword is set to *yes*, the elastic bond force will be +normalized by :math:`r_0` such that :math:`k` must be given in force units. + By default, pair forces are not calculated between bonded particles. -Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* keyword. These settings require specific +Pair forces can alternatively be overlaid on top of bond forces by setting +the *overlay/pair* keyword to *yes*. These settings require specific :doc:`special_bonds ` settings described in the -restrictions. Further details can be found in the `:doc: how to -` page on BPMs. +restrictions. Further details can be found in the :doc:`how to +` page on BPMs. .. versionadded:: 28Mar2023 -If the *break/no* keyword is used, then LAMMPS assumes bonds should not break +If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. -However, if a bond does break, it will trigger an error. +However, if a bond reaches a strain greater than :math:`\epsilon_c`, +it will trigger an error. If the *store/local* keyword is used, an internal fix will track bonds that break during the simulation. Whenever a bond breaks, data is processed @@ -183,16 +191,15 @@ This bond style is part of the BPM package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -By default if pair interactions are to be disabled, this bond style -requires setting +By default if pair interactions between bonded atoms are to be disabled, +this bond style requires setting .. code-block:: LAMMPS special_bonds lj 0 1 1 coul 1 1 1 -and :doc:`newton ` must be set to bond off. If the -*overlay/pair* option is used, this bond style alternatively requires -setting +and :doc:`newton ` must be set to bond off. If the *overlay/pair* +keyword is set to *yes*, this bond style alternatively requires setting .. code-block:: LAMMPS @@ -206,7 +213,7 @@ Related commands Default """"""" -The option defaults are *smooth* = *yes* +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* ---------- diff --git a/doc/src/compute.rst b/doc/src/compute.rst index 2862e94b02..317efa4f41 100644 --- a/doc/src/compute.rst +++ b/doc/src/compute.rst @@ -308,11 +308,11 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`sph/t/atom ` - per-atom internal temperature of Smooth-Particle Hydrodynamics atoms * :doc:`spin ` - magnetic quantities for a system of atoms having spins * :doc:`stress/atom ` - stress tensor for each atom -* :doc:`stress/cartesian ` - stress tensor in cartesian coordinates -* :doc:`stress/cylinder ` - stress tensor in cylindrical coordinates +* :doc:`stress/cartesian ` - stress tensor in cartesian coordinates +* :doc:`stress/cylinder ` - stress tensor in cylindrical coordinates * :doc:`stress/mop ` - normal components of the local stress tensor using the method of planes * :doc:`stress/mop/profile ` - profile of the normal components of the local stress tensor using the method of planes -* :doc:`stress/spherical ` - stress tensor in spherical coordinates +* :doc:`stress/spherical ` - stress tensor in spherical coordinates * :doc:`stress/tally ` - stress between two groups of atoms via the tally callback mechanism * :doc:`tdpd/cc/atom ` - per-atom chemical concentration of a specified species for each tDPD particle * :doc:`temp ` - temperature of group of atoms diff --git a/doc/src/compute_bond_local.rst b/doc/src/compute_bond_local.rst index f3fb752ebe..10e86bbe44 100644 --- a/doc/src/compute_bond_local.rst +++ b/doc/src/compute_bond_local.rst @@ -76,7 +76,10 @@ The value *force* is the magnitude of the force acting between the pair of atoms in the bond. The values *fx*, *fy*, and *fz* are the xyz components of -*force* between the pair of atoms in the bond. +*force* between the pair of atoms in the bond. For bond styles that apply +non-central forces, such as :doc:`bond_style bpm/rotational +`, these values only include the :math:`(x,y,z)` +components of the normal force component. The remaining properties are all computed for motion of the two atoms relative to the center of mass (COM) velocity of the 2 atoms in the diff --git a/doc/src/compute_count_type.rst b/doc/src/compute_count_type.rst index 81fffb4f28..ca3b02ecdb 100644 --- a/doc/src/compute_count_type.rst +++ b/doc/src/compute_count_type.rst @@ -25,7 +25,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 Define a computation that counts the current number of atoms for each atom type. Or the number of bonds (angles, dihedrals, impropers) for diff --git a/doc/src/compute_fabric.rst b/doc/src/compute_fabric.rst index f1a5d3d7f9..b38ffafa48 100644 --- a/doc/src/compute_fabric.rst +++ b/doc/src/compute_fabric.rst @@ -146,13 +146,13 @@ m to :math:`M` (inclusive). A middle asterisk means all types from m to n Output info """"""""""" -This compute calculates a local vector of doubles and a scalar. The vector -stores the unique components of the first requested tensor in the order -:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz` -followed by the same components for all subsequent tensors. +This compute calculates a global vector of doubles and a global scalar. The +vector stores the unique components of the first requested tensor in the +order :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, +:math:`yz` followed by the same components for all subsequent tensors. The length of the vector is therefore six times the number of requested -tensors. The scalar output is the number of pairwise interactions included in -the calculation of the fabric tensor. +tensors. The scalar output is the number of pairwise interactions included +in the calculation of the fabric tensor. Restrictions """""""""""" diff --git a/doc/src/compute_modify.rst b/doc/src/compute_modify.rst index 2c5f7d0e8e..028eb8b66d 100644 --- a/doc/src/compute_modify.rst +++ b/doc/src/compute_modify.rst @@ -12,16 +12,14 @@ Syntax * compute-ID = ID of the compute to modify * one or more keyword/value pairs may be listed -* keyword = *extra/dof* or *extra* or *dynamic/dof* or *dynamic* +* keyword = *extra/dof* or *dynamic/dof* .. parsed-literal:: *extra/dof* value = N N = # of extra degrees of freedom to subtract - *extra* syntax is identical to *extra/dof*, will be disabled at some point *dynamic/dof* value = *yes* or *no* yes/no = do or do not re-compute the number of degrees of freedom (DOF) contributing to the temperature - *dynamic* syntax is identical to *dynamic/dof*, will be disabled at some point Examples """""""" @@ -37,19 +35,18 @@ Description Modify one or more parameters of a previously defined compute. Not all compute styles support all parameters. -The *extra/dof* or *extra* keyword refers to how many degrees of -freedom are subtracted (typically from :math:`3N`) as a normalizing -factor in a temperature computation. Only computes that compute a -temperature use this option. The default is 2 or 3 for :doc:`2d or 3d -systems ` which is a correction factor for an ensemble of -velocities with zero total linear momentum. For compute temp/partial, -if one or more velocity components are excluded, the value used for -*extra* is scaled accordingly. You can use a negative number for the -*extra* parameter if you need to add degrees-of-freedom. See the -:doc:`compute temp/asphere ` command for an -example. +The *extra/dof* keyword refers to how many degrees of freedom are +subtracted (typically from :math:`3N`) as a normalizing factor in a +temperature computation. Only computes that compute a temperature use +this option. The default is 2 or 3 for :doc:`2d or 3d systems +` which is a correction factor for an ensemble of velocities +with zero total linear momentum. For compute temp/partial, if one or +more velocity components are excluded, the value used for *extra/dof* is +scaled accordingly. You can use a negative number for the *extra/dof* +parameter if you need to add degrees-of-freedom. See the :doc:`compute +temp/asphere ` command for an example. -The *dynamic/dof* or *dynamic* keyword determines whether the number +The *dynamic/dof* keyword determines whether the number of atoms :math:`N` in the compute group and their associated degrees of freedom (DOF) are re-computed each time a temperature is computed. Only compute styles that calculate a temperature use this option. By @@ -61,12 +58,6 @@ are adding atoms or molecules to the system (see the :doc:`fix pour `), then this option should be used to ensure the temperature is correctly normalized. -.. note:: - - The *extra* and *dynamic* keywords should not be used as they - are deprecated (March 2017) and will eventually be disabled. Instead, - use the equivalent *extra/dof* and *dynamic/dof* keywords. - Restrictions """""""""""" none @@ -79,5 +70,5 @@ Related commands Default """"""" -The option defaults are extra/dof = 2 or 3 for 2d or 3d systems and -dynamic/dof = *no*. +The option defaults are extra/dof = 2 or 3 for 2d or 3d systems, +respectively, and dynamic/dof = *no*. diff --git a/doc/src/compute_pair_local.rst b/doc/src/compute_pair_local.rst index dace280dee..31209f63f4 100644 --- a/doc/src/compute_pair_local.rst +++ b/doc/src/compute_pair_local.rst @@ -66,7 +66,9 @@ The value *eng* is the interaction energy for the pair of atoms. The value *force* is the force acting between the pair of atoms, which is positive for a repulsive force and negative for an attractive force. The values *fx*, *fy*, and *fz* are the :math:`(x,y,z)` components of -*force* on atom I. +*force* on atom I. For pair styles that apply non-central forces, +such as :doc:`granular pair styles `, these values only include +the :math:`(x,y,z)` components of the normal force component. A pair style may define additional pairwise quantities which can be accessed as *p1* to *pN*, where :math:`N` is defined by the pair style. diff --git a/doc/src/compute_property_grid.rst b/doc/src/compute_property_grid.rst index e65e822516..44389320d6 100644 --- a/doc/src/compute_property_grid.rst +++ b/doc/src/compute_property_grid.rst @@ -6,7 +6,7 @@ compute property/grid command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID property/grid Nx Ny Nz input1 input2 ... diff --git a/doc/src/compute_rdf.rst b/doc/src/compute_rdf.rst index 88bd7ec74c..ed73800f82 100644 --- a/doc/src/compute_rdf.rst +++ b/doc/src/compute_rdf.rst @@ -202,7 +202,7 @@ change from zero to one at the location of the spike in :math:`g(r)`. parallel efficiency and scaling. For systems, where only the type of atoms changes (e.g., when using :doc:`fix atom/swap `), you need to explicitly request the dynamic normalization updates - via :doc:`compute_modify dynamic yes ` + via :doc:`compute_modify dynamic/dof yes ` Related commands """""""""""""""" diff --git a/doc/src/compute_reduce_chunk.rst b/doc/src/compute_reduce_chunk.rst index 43fee39cf2..8ec19ade66 100644 --- a/doc/src/compute_reduce_chunk.rst +++ b/doc/src/compute_reduce_chunk.rst @@ -6,7 +6,7 @@ compute reduce/chunk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID reduce/chunk chunkID mode input1 input2 ... diff --git a/doc/src/compute_saed.rst b/doc/src/compute_saed.rst index deb6a61f7c..9ec455d03b 100644 --- a/doc/src/compute_saed.rst +++ b/doc/src/compute_saed.rst @@ -6,7 +6,7 @@ compute saed command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID saed lambda type1 type2 ... typeN keyword value ... diff --git a/doc/src/compute_slice.rst b/doc/src/compute_slice.rst index 9b4e7df626..0da7c99573 100644 --- a/doc/src/compute_slice.rst +++ b/doc/src/compute_slice.rst @@ -6,7 +6,7 @@ compute slice command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID slice Nstart Nstop Nskip input1 input2 ... diff --git a/doc/src/compute_smd_contact_radius.rst b/doc/src/compute_smd_contact_radius.rst index 4911ac4e27..2ac039a3b5 100644 --- a/doc/src/compute_smd_contact_radius.rst +++ b/doc/src/compute_smd_contact_radius.rst @@ -6,7 +6,7 @@ compute smd/contact/radius command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/contact/radius diff --git a/doc/src/compute_smd_damage.rst b/doc/src/compute_smd_damage.rst index fe5d94fa83..72307bc184 100644 --- a/doc/src/compute_smd_damage.rst +++ b/doc/src/compute_smd_damage.rst @@ -6,7 +6,7 @@ compute smd/damage command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/damage diff --git a/doc/src/compute_smd_hourglass_error.rst b/doc/src/compute_smd_hourglass_error.rst index 7e0aadd6d2..533c0f03c0 100644 --- a/doc/src/compute_smd_hourglass_error.rst +++ b/doc/src/compute_smd_hourglass_error.rst @@ -6,7 +6,7 @@ compute smd/hourglass/error command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/hourglass/error diff --git a/doc/src/compute_smd_internal_energy.rst b/doc/src/compute_smd_internal_energy.rst index 36bd816e8f..91c671c6a1 100644 --- a/doc/src/compute_smd_internal_energy.rst +++ b/doc/src/compute_smd_internal_energy.rst @@ -6,7 +6,7 @@ compute smd/internal/energy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/internal/energy diff --git a/doc/src/compute_smd_plastic_strain.rst b/doc/src/compute_smd_plastic_strain.rst index 00c6cb9a4a..b1e5719249 100644 --- a/doc/src/compute_smd_plastic_strain.rst +++ b/doc/src/compute_smd_plastic_strain.rst @@ -6,7 +6,7 @@ compute smd/plastic/strain command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/plastic/strain diff --git a/doc/src/compute_smd_plastic_strain_rate.rst b/doc/src/compute_smd_plastic_strain_rate.rst index 681573be9b..bf9b3b23f4 100644 --- a/doc/src/compute_smd_plastic_strain_rate.rst +++ b/doc/src/compute_smd_plastic_strain_rate.rst @@ -6,7 +6,7 @@ compute smd/plastic/strain/rate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/plastic/strain/rate diff --git a/doc/src/compute_smd_rho.rst b/doc/src/compute_smd_rho.rst index 605dd5b79c..8ecb09f318 100644 --- a/doc/src/compute_smd_rho.rst +++ b/doc/src/compute_smd_rho.rst @@ -6,7 +6,7 @@ compute smd/rho command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/rho diff --git a/doc/src/compute_smd_tlsph_defgrad.rst b/doc/src/compute_smd_tlsph_defgrad.rst index 399e54d055..aceecc1722 100644 --- a/doc/src/compute_smd_tlsph_defgrad.rst +++ b/doc/src/compute_smd_tlsph_defgrad.rst @@ -6,7 +6,7 @@ compute smd/tlsph/defgrad command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/defgrad diff --git a/doc/src/compute_smd_tlsph_dt.rst b/doc/src/compute_smd_tlsph_dt.rst index 9490f7da14..1cafecdb7c 100644 --- a/doc/src/compute_smd_tlsph_dt.rst +++ b/doc/src/compute_smd_tlsph_dt.rst @@ -6,7 +6,7 @@ compute smd/tlsph/dt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/dt diff --git a/doc/src/compute_smd_tlsph_num_neighs.rst b/doc/src/compute_smd_tlsph_num_neighs.rst index ef8c19d49c..8bf244a8db 100644 --- a/doc/src/compute_smd_tlsph_num_neighs.rst +++ b/doc/src/compute_smd_tlsph_num_neighs.rst @@ -6,7 +6,7 @@ compute smd/tlsph/num/neighs command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/num/neighs diff --git a/doc/src/compute_smd_tlsph_shape.rst b/doc/src/compute_smd_tlsph_shape.rst index 4a5abd868b..b682e72fdd 100644 --- a/doc/src/compute_smd_tlsph_shape.rst +++ b/doc/src/compute_smd_tlsph_shape.rst @@ -6,7 +6,7 @@ compute smd/tlsph/shape command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/shape diff --git a/doc/src/compute_smd_tlsph_strain.rst b/doc/src/compute_smd_tlsph_strain.rst index 053488886b..89b9bee132 100644 --- a/doc/src/compute_smd_tlsph_strain.rst +++ b/doc/src/compute_smd_tlsph_strain.rst @@ -6,7 +6,7 @@ compute smd/tlsph/strain command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/strain diff --git a/doc/src/compute_smd_tlsph_strain_rate.rst b/doc/src/compute_smd_tlsph_strain_rate.rst index 2f3d561cee..83797edd49 100644 --- a/doc/src/compute_smd_tlsph_strain_rate.rst +++ b/doc/src/compute_smd_tlsph_strain_rate.rst @@ -6,7 +6,7 @@ compute smd/tlsph/strain/rate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/strain/rate diff --git a/doc/src/compute_smd_tlsph_stress.rst b/doc/src/compute_smd_tlsph_stress.rst index 4f0473f30a..12539ffda7 100644 --- a/doc/src/compute_smd_tlsph_stress.rst +++ b/doc/src/compute_smd_tlsph_stress.rst @@ -6,7 +6,7 @@ compute smd/tlsph/stress command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/stress diff --git a/doc/src/compute_smd_triangle_vertices.rst b/doc/src/compute_smd_triangle_vertices.rst index 309c4260e9..2e7dd0cfd0 100644 --- a/doc/src/compute_smd_triangle_vertices.rst +++ b/doc/src/compute_smd_triangle_vertices.rst @@ -6,7 +6,7 @@ compute smd/triangle/vertices command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/triangle/vertices diff --git a/doc/src/compute_smd_vol.rst b/doc/src/compute_smd_vol.rst index d31eb53785..94372c23ce 100644 --- a/doc/src/compute_smd_vol.rst +++ b/doc/src/compute_smd_vol.rst @@ -6,7 +6,7 @@ compute smd/vol command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/vol diff --git a/doc/src/compute_sna_atom.rst b/doc/src/compute_sna_atom.rst index d604ca9d29..8d06868f3d 100644 --- a/doc/src/compute_sna_atom.rst +++ b/doc/src/compute_sna_atom.rst @@ -26,7 +26,7 @@ compute sna/grid/local command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sna/atom rcutfac rfac0 twojmax R_1 R_2 ... w_1 w_2 ... keyword values ... compute ID group-ID snad/atom rcutfac rfac0 twojmax R_1 R_2 ... w_1 w_2 ... keyword values ... diff --git a/doc/src/compute_sph_e_atom.rst b/doc/src/compute_sph_e_atom.rst index 5e6706fa27..d557eb7920 100644 --- a/doc/src/compute_sph_e_atom.rst +++ b/doc/src/compute_sph_e_atom.rst @@ -6,7 +6,7 @@ compute sph/e/atom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sph/e/atom diff --git a/doc/src/compute_sph_rho_atom.rst b/doc/src/compute_sph_rho_atom.rst index 7fcec0c9da..6e8579476a 100644 --- a/doc/src/compute_sph_rho_atom.rst +++ b/doc/src/compute_sph_rho_atom.rst @@ -6,7 +6,7 @@ compute sph/rho/atom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sph/rho/atom diff --git a/doc/src/compute_sph_t_atom.rst b/doc/src/compute_sph_t_atom.rst index 702d81027d..3383c26145 100644 --- a/doc/src/compute_sph_t_atom.rst +++ b/doc/src/compute_sph_t_atom.rst @@ -6,7 +6,7 @@ compute sph/t/atom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sph/t/atom diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst new file mode 100644 index 0000000000..bf019a9d6b --- /dev/null +++ b/doc/src/compute_stress_cartesian.rst @@ -0,0 +1,123 @@ +.. index:: compute stress/cartesian + +compute stress/cartesian command +================================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + compute ID group-ID stress/cartesian args + +* ID, group-ID are documented in :doc:`compute ` command +* args = argument specific to the compute style + +.. parsed-literal:: + + *stress/cartesian* args = dim1 bin_width1 dim2 bin_width2 keyword + dim1 = *x* or *y* or *z* + bin_width1 = width of the bin + dim2 = *x* or *y* or *z* or *NULL* + bin_width2 = width of the bin + keyword = *ke* or *pair* or *bond* + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute 1 all stress/cartesian x 0.1 NULL 0 + compute 1 all stress/cartesian y 0.1 z 0.1 + compute 1 all stress/cartesian x 0.1 NULL 0 ke pair + +Description +""""""""""" + +Compute *stress/cartesian* defines computations that calculate profiles of the +diagonal components of the local stress tensor over one or two Cartesian +dimensions, as described in :ref:`(Ikeshoji)`. The stress tensor is +split into a kinetic contribution :math:`P^k` and a virial contribution +:math:`P^v`. The sum gives the total stress tensor :math:`P = P^k+P^v`. +This compute obeys momentum balance through fluid interfaces. They use the +Irving--Kirkwood contour, which is the straight line between particle pairs. + +.. versionadded:: 15Jun2023 + + Added support for bond styles + +This compute only supports pair and bond (no angle, dihedral, improper, +or kspace) forces. By default, if no extra keywords are specified, all +supported contributions to the stress are included (ke, pair, bond). If any +keywords are specified, then only those components are summed. + +Output info +""""""""""" + +The output columns for *stress/cartesian* are the position of the +center of the local volume in the first and second dimensions, number +density, :math:`P^k_{xx}`, :math:`P^k_{yy}`, :math:`P^k_{zz}`, +:math:`P^v_{xx}`, :math:`P^v_{yy}`, and :math:`P^v_{zz}`. There are 8 +columns when one dimension is specified and 9 columns when two +dimensions are specified. The number of bins (rows) is +:math:`(L_1/b_1)(L_2/b_2)`, where :math:`L_1` and :math:`L_2` are the lengths +of the simulation box in the specified dimensions and :math:`b_1` and +:math:`b_2` are the specified bin widths. When only one dimension is +specified, the number of bins (rows) is :math:`L_1/b_1`. + +This array can be output with :doc:`fix ave/time `, + +.. code-block:: LAMMPS + + compute p all stress/cartesian x 0.1 + fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector + +The values calculated by this compute are "intensive". The stress +values will be in pressure :doc:`units `. The number density +values are in inverse volume :doc:`units `. + +NOTE 1: The local stress does not include any Lennard-Jones tail +corrections to the stress added by the +:doc:`pair_modify tail yes ` +command, since those are contributions to the global system pressure. + +NOTE 2: The local stress profiles generated by these computes are +similar to those obtained by the +:doc:`method-of-planes (MOP) `. +A key difference is that compute +:doc:`stress/mop/profile ` +considers particles crossing a set of planes, while +*stress/cartesian* computes averages for a set of small volumes. +Moreover, this compute computes the diagonal components of the stress +tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while +*stress/mop/profile* computes the components +:math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the +direction normal to the plane. + +More information on the similarities and differences can be found in +:ref:`(Ikeshoji)`. + +Restrictions +"""""""""""" + +These computes calculate the stress tensor contributions for pair and bond +forces only (no angle, dihedral, improper, or kspace force). +It requires pairwise force calculations not available for most +many-body pair styles. + +These computes are part of the EXTRA-COMPUTE package. They are only +enabled if LAMMPS was built with that package. See the :doc:`Build +package ` doc page for more info. + +Related commands +"""""""""""""""" + +:doc:`compute stress/atom `, :doc:`compute pressure `, +:doc:`compute stress/mop/profile `, :doc:`compute stress/spherical `, +:doc:`compute stress/cylinder ` + +---------- + +.. _Ikeshoji2: + +**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/src/compute_stress_profile.rst b/doc/src/compute_stress_curvilinear.rst similarity index 68% rename from doc/src/compute_stress_profile.rst rename to doc/src/compute_stress_curvilinear.rst index 7a4b6a38e6..022a87058f 100644 --- a/doc/src/compute_stress_profile.rst +++ b/doc/src/compute_stress_curvilinear.rst @@ -1,11 +1,6 @@ -.. index:: compute stress/cartesian .. index:: compute stress/cylinder .. index:: compute stress/spherical - -compute stress/cartesian command -================================== - compute stress/cylinder command ================================= @@ -20,15 +15,11 @@ Syntax compute ID group-ID style args * ID, group-ID are documented in :doc:`compute ` command -* style = stress/cartesian or stress/spherical or stress/cylinder +* style = stress/spherical or stress/cylinder * args = argument specific to the compute style .. parsed-literal:: - *stress/cartesian* args = dim bin_width - dim = *x* or *y* or *z* - bin_width = width of the bin - one or two dim/bin_width pairs may be appended *stress/cylinder* args = zlo zh Rmax bin_width keyword zlo = minimum z-boundary for cylinder zhi = maximum z-boundary for cylinder @@ -46,8 +37,6 @@ Examples .. code-block:: LAMMPS - compute 1 all stress/cartesian x 0.1 - compute 1 all stress/cartesian y 0.25 z 0.1 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 ke no compute 1 all stress/spherical 0 0 0 0.1 10 @@ -55,41 +44,28 @@ Examples Description """"""""""" -Compute *stress/cartesian*, compute *stress/cylinder*, and compute +Compute *stress/cylinder*, and compute *stress/spherical* define computations that calculate profiles of the diagonal components of the local stress tensor in the specified coordinate system. The stress tensor is split into a kinetic contribution :math:`P^k` and a virial contribution :math:`P^v`. The sum gives the total stress tensor :math:`P = P^k+P^v`. These computes can for example be used to calculate the diagonal components of the local -stress tensor of interfaces with flat, cylindrical, or spherical +stress tensor of surfaces with cylindrical or spherical symmetry. These computes obeys momentum balance through fluid interfaces. They use the Irving--Kirkwood contour, which is the straight line between particle pairs. -The *stress/cartesian* computes the stress profile along one or two -Cartesian coordinates, as described in :ref:`(Ikeshoji)`. The -compute *stress/cylinder* computes the stress profile along the +The compute *stress/cylinder* computes the stress profile along the radial direction in cylindrical coordinates, as described in :ref:`(Addington)`. The compute *stress/spherical* computes the stress profile along the radial direction in spherical -coordinates, as described in :ref:`(Ikeshoji)`. +coordinates, as described in :ref:`(Ikeshoji)`. Output info """"""""""" -The output columns for *stress/cartesian* are the position of the -center of the local volume in the first and second dimensions, number -density, :math:`P^k_{xx}`, :math:`P^k_{yy}`, :math:`P^k_{zz}`, -:math:`P^v_{xx}`, :math:`P^v_{yy}`, and :math:`P^v_{zz}`. There are 8 -columns when one dimension is specified and 9 columns when two -dimensions are specified. The number of bins (rows) is -:math:`(L_1/b_1)(L_2/b_2)`, where :math:`L_1` and :math:`L_2` are the lengths -of the simulation box in the specified dimensions and :math:`b_1` and -:math:`b_2` are the specified bin widths. When only one dimension is -specified, the number of bins (rows) is :math:`L_1/b_1`. - The default output columns for *stress/cylinder* are the radius to the center of the cylindrical shell, number density, :math:`P^k_{rr}`, :math:`P^k_{\phi\phi}`, :math:`P^k_{zz}`, :math:`P^v_{rr}`, @@ -111,7 +87,7 @@ This array can be output with :doc:`fix ave/time `, .. code-block:: LAMMPS - compute p all stress/cartesian x 0.1 + compute 1 all stress/spherical 0 0 0 0.1 10 fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector The values calculated by this compute are "intensive". The stress @@ -123,16 +99,6 @@ corrections to the stress added by the :doc:`pair_modify tail yes ` command, since those are contributions to the global system pressure. -NOTE 2: The local stress profiles generated by these computes are -similar to those obtained by the -:doc:`method-of-planes (MOP) `. -A key difference -is that compute `stress/mop/profile ` -considers particles crossing a set of planes, while -*stress/cartesian* computes averages for a set of small volumes. -More information on the similarities and differences can be found in -:ref:`(Ikeshoji)`. - Restrictions """""""""""" @@ -150,7 +116,8 @@ package ` doc page for more info. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/mop/profile ` +:doc:`compute stress/atom `, :doc:`compute pressure `, +:doc:`compute stress/mop/profile `, :doc:`compute stress/cartesian ` Default """"""" @@ -159,7 +126,7 @@ The keyword default for ke in style *stress/cylinder* is yes. ---------- -.. _Ikeshoji2: +.. _Ikeshoji4: **(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index 4ad2261bb0..21c2963545 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -18,7 +18,7 @@ Syntax * style = *stress/mop* or *stress/mop/profile* * dir = *x* or *y* or *z* is the direction normal to the plane * args = argument specific to the compute style -* keywords = *kin* or *conf* or *total* (one of more can be specified) +* keywords = *kin* or *conf* or *total* or *pair* or *bond* or *angle* (one or more can be specified) .. parsed-literal:: @@ -45,85 +45,112 @@ Examples Description """"""""""" -Compute *stress/mop* and compute *stress/mop/profile* define computations that -calculate components of the local stress tensor using the method of -planes :ref:`(Todd) `. Specifically in compute *stress/mop* calculates 3 -components are computed in directions *dir*,\ *x*\ ; *dir*,\ *y*\ ; and -*dir*,\ *z*\ ; where *dir* is the direction normal to the plane, while -in compute *stress/mop/profile* the profile of the stress is computed. +Compute *stress/mop* and compute *stress/mop/profile* define +computations that calculate components of the local stress tensor using +the method of planes :ref:`(Todd) `. Specifically in compute +*stress/mop* calculates 3 components are computed in directions *dir*,\ +*x*\ ; *dir*,\ *y*\ ; and *dir*,\ *z*\ ; where *dir* is the direction +normal to the plane, while in compute *stress/mop/profile* the profile +of the stress is computed. Contrary to methods based on histograms of atomic stress (i.e., using -:doc:`compute stress/atom `), the method of planes is -compatible with mechanical balance in heterogeneous systems and at +:doc:`compute stress/atom `), the method of planes +is compatible with mechanical balance in heterogeneous systems and at interfaces :ref:`(Todd) `. The stress tensor is the sum of a kinetic term and a configurational term, which are given respectively by Eq. (21) and Eq. (16) in -:ref:`(Todd) `. For the kinetic part, the algorithm considers that -atoms have crossed the plane if their positions at times :math:`t-\Delta t` -and :math:`t` are one on either side of the plane, and uses the velocity at -time :math:`t-\Delta t/2` given by the velocity Verlet algorithm. +:ref:`(Todd) `. For the kinetic part, the algorithm considers +that atoms have crossed the plane if their positions at times +:math:`t-\Delta t` and :math:`t` are one on either side of the plane, +and uses the velocity at time :math:`t-\Delta t/2` given by the velocity +Verlet algorithm. -Between one and three keywords can be used to indicate which -contributions to the stress must be computed: kinetic stress (kin), -configurational stress (conf), and/or total stress (total). +.. versionadded:: 15Jun2023 -NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID. + contributions from bond and angle potentials + +Between one and six keywords can be used to indicate which contributions +to the stress must be computed: total stress (total), kinetic stress +(kin), configurational stress (conf), stress due to bond stretching +(bond), stress due to angle bending (angle) and/or due to pairwise +non-bonded interactions (pair). The angle keyword is currently +available only for the *stress/mop* command and **not** the +*stress/mop/profile* command. + +NOTE 1: The configurational stress is computed considering all pairs of +atoms where at least one atom belongs to group group-ID. NOTE 2: The local stress does not include any Lennard-Jones tail -corrections to the stress added by the :doc:`pair_modify tail yes ` -command, since those are contributions to the global system pressure. +corrections to the stress added by the :doc:`pair_modify tail yes +` command, since those are contributions to the global +system pressure. -NOTE 3: The local stress profile generated by compute *stress/mop/profile* -is similar to that obtained by compute -:doc:`stress/cartesian `. -A key difference is that compute *stress/mop/profile* considers particles -crossing a set of planes, while compute *stress/cartesian* computes averages -for a set of small volumes. More information -on the similarities and differences can be found in -:ref:`(Ikeshoji)`. +NOTE 3: The local stress profile generated by compute +*stress/mop/profile* is similar to that obtained by compute +:doc:`stress/cartesian `. +A key difference is that compute *stress/mop/profile* +considers particles crossing a set of planes, while +*stress/cartesian* computes averages for a set +of small volumes. +Moreover, *stress/cartesian* compute computes the diagonal components of the stress +tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while +*stress/mop/profile* computes the components +:math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the +direction normal to the plane. Output info """"""""""" -Compute *stress/mop* calculates a global vector (indices starting at 1), with 3 -values for each declared keyword (in the order the keywords have been -declared). For each keyword, the stress tensor components are ordered as -follows: stress_dir,x, stress_dir,y, and stress_dir,z. +Compute *stress/mop* calculates a global vector (indices starting at 1), +with 3 values for each declared keyword (in the order the keywords have +been declared). For each keyword, the stress tensor components are +ordered as follows: stress_dir,x, stress_dir,y, and stress_dir,z. -Compute *stress/mop/profile* instead calculates a global array, with 1 column -giving the position of the planes where the stress tensor was computed, -and with 3 columns of values for each declared keyword (in the order the -keywords have been declared). For each keyword, the profiles of stress -tensor components are ordered as follows: stress_dir,x; stress_dir,y; -and stress_dir,z. +Compute *stress/mop/profile* instead calculates a global array, with 1 +column giving the position of the planes where the stress tensor was +computed, and with 3 columns of values for each declared keyword (in the +order the keywords have been declared). For each keyword, the profiles +of stress tensor components are ordered as follows: stress_dir,x; +stress_dir,y; and stress_dir,z. The values are in pressure :doc:`units `. -The values produced by this compute can be accessed by various :doc:`output commands `. -For instance, the results can be written to a file using the -:doc:`fix ave/time ` command. Please see the example -in the examples/PACKAGES/mop folder. +The values produced by this compute can be accessed by various +:doc:`output commands `. For instance, the results can be +written to a file using the :doc:`fix ave/time ` +command. Please see the example in the examples/PACKAGES/mop folder. Restrictions """""""""""" -These styles are part of the EXTRA-COMPUTE package. They are only enabled if -LAMMPS is built with that package. See the :doc:`Build package ` -doc page on for more info. +These styles are part of the EXTRA-COMPUTE package. They are only +enabled if LAMMPS is built with that package. See the :doc:`Build +package ` doc page on for more info. The method is only implemented for 3d orthogonal simulation boxes whose size does not change in time, and axis-aligned planes. The method only works with two-body pair interactions, because it -requires the class method pair->single() to be implemented. In -particular, it does not work with more than two-body pair interactions, -intra-molecular interactions, and long range (kspace) interactions. +requires the class method ``Pair::single()`` to be implemented, which is +not possible for manybody potentials. In particular, compute +*stress/mop/profile* does not work with more than two-body pair +interactions, long range (kspace) interactions and +angle/dihedral/improper intramolecular interactions. Similarly, compute +*stress/mop* does not work with more than two-body pair interactions, +long range (kspace) interactions and dihedral/improper intramolecular +interactions but works with all bond interactions with the class method +single() implemented and all angle interactions with the class method +born_matrix() implemented. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/cartesian `, :doc:`compute stress/cylinder `, :doc:`compute stress/spherical ` +:doc:`compute stress/atom `, +:doc:`compute pressure `, +:doc:`compute stress/cartesian `, +:doc:`compute stress/cylinder `, +:doc:`compute stress/spherical ` Default """"""" diff --git a/doc/src/compute_temp.rst b/doc/src/compute_temp.rst index 8f6f9f225f..e081280496 100644 --- a/doc/src/compute_temp.rst +++ b/doc/src/compute_temp.rst @@ -37,20 +37,24 @@ The temperature is calculated by the formula .. math:: - \text{KE} = \frac{\text{dim}}{2} N k_B T, + T = \frac{2 E_\mathrm{kin}}{N_\mathrm{DOF} k_B} \quad \mathrm{with} \quad + E_\mathrm{kin} = \sum^{N_\mathrm{atoms}}_{i=1} \frac{1}{2} m_i v^2_i \quad \mathrm{and} \quad + N_\mathrm{DOF} = n_\mathrm{dim} N_\mathrm{atoms} - n_\mathrm{dim} - N_\mathrm{fix DOFs} -where KE = total kinetic energy of the group of atoms (sum of -:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the -simulation, :math:`N` is the number of atoms in the group, :math:`k_B` -is the Boltzmann constant, and :math:`T` is the absolute temperature. +where :math:`E_\mathrm{kin}` is the total kinetic energy of the group of +atoms, :math:`n_\mathrm{dim}` is the dimensionality of the simulation +(i.e. either 2 or 3), :math:`N_\mathrm{atoms}` is the number of atoms in +the group, :math:`N_\mathrm{fix DOFs}` is the number of degrees of +freedom removed by fix commands (see below), :math:`k_B` is the +Boltzmann constant, and :math:`T` is the resulting computed temperature. A kinetic energy tensor, stored as a six-element vector, is also calculated by this compute for use in the computation of a pressure -tensor. The formula for the components of the tensor is the same as -the above formula, except that :math:`v^2` is replaced by :math:`v_x -v_y` for the :math:`xy` component, and so on. The six components of -the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, -:math:`xz`, :math:`yz`. +tensor. The formula for the components of the tensor is the same as the +above expression for :math:`E_\mathrm{kin}`, except that :math:`v_i^2` is +replaced by :math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. +The six components of the vector are ordered :math:`xx`, :math:`yy`, +:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be constant for the duration of the run; use the *dynamic* option of the @@ -62,6 +66,10 @@ constrain molecular motion, such as :doc:`fix shake ` and atoms that include these constraints will be computed correctly. If needed, the subtracted degrees-of-freedom can be altered using the *extra* option of the :doc:`compute_modify ` command. +By default this *extra* component is initialized to +:math:`n_\mathrm{dim}` (as shown in the formula above) to represent the +degrees of freedom removed from a system due to its translation +invariance due to periodic boundary conditions. A compute of this style with the ID of "thermo_temp" is created when LAMMPS starts up, as if this command were in the input script: diff --git a/doc/src/compute_temp_asphere.rst b/doc/src/compute_temp_asphere.rst index cba52a68b4..5741db76aa 100644 --- a/doc/src/compute_temp_asphere.rst +++ b/doc/src/compute_temp_asphere.rst @@ -49,25 +49,26 @@ rotational). .. note:: - This choice for degrees of freedom (DOF) assumes that all - finite-size aspherical or spherical particles in your model will - freely rotate, sampling all their rotational DOF. It is possible to - use a combination of interaction potentials and fixes that induce no - torque or otherwise constrain some of all of your particles so that - this is not the case. Then there are fewer DOF and you should use the - :doc:`compute_modify extra ` command to adjust the DOF - accordingly. + This choice for degrees of freedom (DOF) assumes that all finite-size + aspherical or spherical particles in your model will freely rotate, + sampling all their rotational DOF. It is possible to use a + combination of interaction potentials and fixes that induce no torque + or otherwise constrain some of all of your particles so that this is + not the case. Then there are fewer DOF and you should use the + :doc:`compute_modify extra/dof ` command to adjust + the DOF accordingly. For example, an aspherical particle with all three of its shape -parameters the same is a sphere. If it does not rotate, then it -should have 3 DOF instead of 6 in 3d (or two instead of three in 2d). -A uniaxial aspherical particle has two of its three shape parameters the +parameters the same is a sphere. If it does not rotate, then it should +have 3 DOF instead of 6 in 3d (or two instead of three in 2d). A +uniaxial aspherical particle has two of its three shape parameters the same. If it does not rotate around the axis perpendicular to its circular cross section, then it should have 5 DOF instead of 6 in 3d. -The latter is the case for uniaxial ellipsoids in a :doc:`GayBerne model ` since there is no induced torque around the -optical axis. It will also be the case for biaxial ellipsoids when -exactly two of the semiaxes have the same length and the corresponding -relative well depths are equal. +The latter is the case for uniaxial ellipsoids in a :doc:`GayBerne model +` since there is no induced torque around the optical +axis. It will also be the case for biaxial ellipsoids when exactly two +of the semiaxes have the same length and the corresponding relative well +depths are equal. The translational kinetic energy is computed the same as is described by the :doc:`compute temp ` command. The rotational @@ -90,15 +91,17 @@ inertia tensor are used. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be -constant for the duration of the run; use the *dynamic* option of the -:doc:`compute_modify ` command if this is not the case. +constant for the duration of the run; use the *dynamic/dof* option of +the :doc:`compute_modify ` command if this is not the +case. -This compute subtracts out translational degrees-of-freedom due to -fixes that constrain molecular motion, such as :doc:`fix shake ` and :doc:`fix rigid `. This means the -temperature of groups of atoms that include these constraints will be -computed correctly. If needed, the subtracted degrees-of-freedom can -be altered using the *extra* option of the -:doc:`compute_modify ` command. +This compute subtracts out translational degrees-of-freedom due to fixes +that constrain molecular motion, such as :doc:`fix shake ` +and :doc:`fix rigid `. This means the temperature of groups +of atoms that include these constraints will be computed correctly. If +needed, the subtracted degrees-of-freedom can be altered using the +*extra/dof* option of the :doc:`compute_modify ` +command. See the :doc:`Howto thermostat ` page for a discussion of different ways to compute temperature and perform diff --git a/doc/src/compute_temp_body.rst b/doc/src/compute_temp_body.rst index 64f5ce9a0f..f29ca5c39b 100644 --- a/doc/src/compute_temp_body.rst +++ b/doc/src/compute_temp_body.rst @@ -51,11 +51,10 @@ rotational). This choice for degrees of freedom (DOF) assumes that all body particles in your model will freely rotate, sampling all their rotational DOF. It is possible to use a combination of interaction - potentials and fixes that induce no torque or otherwise constrain some - of all of your particles so that this is not the case. Then there are - less DOF and you should use the - :doc:`compute_modify extra ` command to adjust the DOF - accordingly. + potentials and fixes that induce no torque or otherwise constrain + some of all of your particles so that this is not the case. Then + there are less DOF and you should use the :doc:`compute_modify + extra/dof ` command to adjust the DOF accordingly. The translational kinetic energy is computed the same as is described by the :doc:`compute temp ` command. The rotational @@ -72,15 +71,16 @@ used. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be -constant for the duration of the run; use the *dynamic* option of the -:doc:`compute_modify ` command if this is not the case. +constant for the duration of the run; use the *dynamic/dof* option of +the :doc:`compute_modify ` command if this is not the +case. This compute subtracts out translational degrees-of-freedom due to fixes that constrain molecular motion, such as :doc:`fix shake ` and :doc:`fix rigid `. This means the temperature of groups of atoms that include these constraints will be computed correctly. If needed, the subtracted degrees-of-freedom can -be altered using the *extra* option of the +be altered using the *extra/dof* option of the :doc:`compute_modify ` command. See the :doc:`Howto thermostat ` page for a diff --git a/doc/src/compute_temp_drude.rst b/doc/src/compute_temp_drude.rst index 8602bc3589..be09afc6a4 100644 --- a/doc/src/compute_temp_drude.rst +++ b/doc/src/compute_temp_drude.rst @@ -75,7 +75,8 @@ Restrictions The number of degrees of freedom contributing to the temperature is assumed to be constant for the duration of the run unless the -*fix_modify* command sets the option *dynamic yes*\ . +:doc:`fix_modify command ` sets the option *dynamic/dof +yes*\ . Related commands """""""""""""""" diff --git a/doc/src/compute_temp_sphere.rst b/doc/src/compute_temp_sphere.rst index 5c7c73a8d2..d1891f64bf 100644 --- a/doc/src/compute_temp_sphere.rst +++ b/doc/src/compute_temp_sphere.rst @@ -49,14 +49,13 @@ each has three degrees of freedom (two translational, one rotational). .. note:: - This choice for degrees of freedom (DOF) assumes that all - finite-size spherical particles in your model will freely rotate, - sampling all their rotational DOF. It is possible to use a - combination of interaction potentials and fixes that induce no torque - or otherwise constrain some of all of your particles so that this is - not the case. Then there are less DOF and you should use the - :doc:`compute_modify extra ` command to adjust the DOF - accordingly. + This choice for degrees of freedom (DOF) assumes that all finite-size + spherical particles in your model will freely rotate, sampling all + their rotational DOF. It is possible to use a combination of + interaction potentials and fixes that induce no torque or otherwise + constrain some of all of your particles so that this is not the case. + Then there are less DOF and you should use the :doc:`compute_modify + extra/dof ` command to adjust the DOF accordingly. The translational kinetic energy is computed the same as is described by the :doc:`compute temp ` command. The rotational @@ -73,20 +72,22 @@ velocity. A kinetic energy tensor, stored as a six-element vector, is also calculated by this compute. The formula for the components of the tensor is the same as the above formulas, except that :math:`v^2` and -:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x \omega_y` -for the :math:`xy` component. The six components of the vector are ordered -:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. +:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x +\omega_y` for the :math:`xy` component. The six components of the +vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, +:math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be constant for the duration of the run; use the *dynamic* option of the :doc:`compute_modify ` command if this is not the case. -This compute subtracts out translational degrees-of-freedom due to -fixes that constrain molecular motion, such as :doc:`fix shake ` and :doc:`fix rigid `. This means the -temperature of groups of atoms that include these constraints will be -computed correctly. If needed, the subtracted degrees of freedom can -be altered using the *extra* option of the -:doc:`compute_modify ` command. +This compute subtracts out translational degrees-of-freedom due to fixes +that constrain molecular motion, such as :doc:`fix shake ` +and :doc:`fix rigid `. This means the temperature of groups +of atoms that include these constraints will be computed correctly. If +needed, the subtracted degrees of freedom can be altered using the +*extra/dof* option of the :doc:`compute_modify ` +command. See the :doc:`Howto thermostat ` page for a discussion of different ways to compute temperature and perform diff --git a/doc/src/create_bonds.rst b/doc/src/create_bonds.rst index d520f1a88e..53a9a1ca50 100644 --- a/doc/src/create_bonds.rst +++ b/doc/src/create_bonds.rst @@ -86,19 +86,20 @@ data file for a complex system of molecules. .. note:: - If the system has no bonds (angles, dihedrals, impropers) to begin with, - or if more bonds per atom are being added than currently exist, then you - must ensure that the number of bond types and the maximum number of - bonds per atom are set to large enough values, and similarly for - angles, dihedrals, and impropers, otherwise an error may occur when too many - bonds (angles, dihedrals, impropers) are added to an atom. If the - :doc:`read_data ` command is used to define the system, these - parameters can be set via the "bond types" and "extra bond per atom" - fields in the header section of the data file. If the - :doc:`create_box ` command is used to define the system, - these two parameters can be set via its optional *bond/types* and - *extra/bond/per/atom* arguments, and similarly for angles, dihedrals, and - impropers. See the doc pages for these two commands for details. + If the system has no bonds (angles, dihedrals, impropers) to begin + with, or if more bonds per atom are being added than currently exist, + then you must ensure that the number of bond types and the maximum + number of bonds per atom are set to large enough values, and + similarly for angles, dihedrals, impropers, and special neighbors, + otherwise an error may occur when too many bonds (angles, dihedrals, + impropers) are added to an atom. If the :doc:`read_data ` + command is used to define the system, these parameters can be set via + its optional *extra/bond/types*, *extra/bond/per/atom*, and similar + keywords to the command. If the :doc:`create_box ` + command is used to define the system, these two parameters can be set + via its optional *bond/types* and *extra/bond/per/atom* arguments, + and similarly for angles, dihedrals, and impropers. See the + corresponding documentation pages for these two commands for details. ---------- @@ -112,7 +113,7 @@ For a bond to be created, an :math:`I,J` pair of atoms must be a distance :math:`D` apart such that :math:`r_\text{min} \le D \le r_\text{max}`. The following settings must have been made in an input script before -this style is used: +the *many* style is used: * special_bonds weight for 1--2 interactions must be 0.0 * a :doc:`pair_style ` must be defined @@ -121,10 +122,13 @@ this style is used: skin :math:`\ge r_\text{max}` These settings are required so that a neighbor list can be created to -search for nearby atoms. Pairs of atoms that are already bonded -cannot appear in the neighbor list, to avoid creation of duplicate -bonds. The neighbor list for all atom type pairs must also extend to -a distance that encompasses the *rmax* for new bonds to create. +search for nearby atoms. Pairs of atoms that are already bonded cannot +appear in the neighbor list, to avoid creation of duplicate bonds. The +neighbor list for all atom type pairs must also extend to a distance +that encompasses the *rmax* for new bonds to create. When using +periodic boundary conditions, the box length in each periodic dimension +must be larger than *rmax*, so that no bonds are created between the +system and its own periodic image. .. note:: @@ -219,6 +223,11 @@ This command cannot be used with molecular systems defined using molecule template files via the :doc:`molecule ` and :doc:`atom_style template ` commands. +For style *many*, no :doc:`kspace style ` must be +defined. Also, the *rmax* value must be smaller than any periodic box +length and the neighbor list cutoff (largest pair cutoff plus neighbor +skin). + Related commands """""""""""""""" diff --git a/doc/src/dump_image.rst b/doc/src/dump_image.rst index dd3354faaa..25d1efff7d 100644 --- a/doc/src/dump_image.rst +++ b/doc/src/dump_image.rst @@ -98,7 +98,7 @@ dump_modify options for dump image/movie Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump_modify dump-ID keyword values ... diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index f00cc339cc..0ac2afbeee 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -753,9 +753,13 @@ run, this option is ignored since the output is already balanced. ---------- The *thermo* keyword only applies the dump styles *netcdf* and *yaml*. -It triggers writing of :doc:`thermo ` information to the dump file -alongside per-atom data. The values included in the dump file are -identical to the values specified by :doc:`thermo_style `. +It triggers writing of :doc:`thermo ` information to the dump +file alongside per-atom data. The values included in the dump file are +cached values from the last thermo output and include the exact same the +values as specified by the :doc:`thermo_style ` command. +Because these are cached values, they are only up-to-date when dump +output is on a timestep that also has thermo output. Dump style *yaml* +will skip thermo output on incompatible steps. ---------- diff --git a/doc/src/dump_molfile.rst b/doc/src/dump_molfile.rst index ffc0b443e0..2878bc7b73 100644 --- a/doc/src/dump_molfile.rst +++ b/doc/src/dump_molfile.rst @@ -6,7 +6,7 @@ dump molfile command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump ID group-ID molfile N file format path diff --git a/doc/src/dump_netcdf.rst b/doc/src/dump_netcdf.rst index 296b725e20..f7495e29a8 100644 --- a/doc/src/dump_netcdf.rst +++ b/doc/src/dump_netcdf.rst @@ -10,7 +10,7 @@ dump netcdf/mpiio command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump ID group-ID netcdf N file args dump ID group-ID netcdf/mpiio N file args diff --git a/doc/src/dynamical_matrix.rst b/doc/src/dynamical_matrix.rst index 93e4c2a1aa..0243fb49db 100644 --- a/doc/src/dynamical_matrix.rst +++ b/doc/src/dynamical_matrix.rst @@ -4,7 +4,7 @@ dynamical_matrix command ======================== -Accelerator Variants: dynamical_matrix/kk +Accelerator Variant: dynamical_matrix/kk Syntax """""" diff --git a/doc/src/fitpod_command.rst b/doc/src/fitpod_command.rst index fc21caec70..28afb990ff 100644 --- a/doc/src/fitpod_command.rst +++ b/doc/src/fitpod_command.rst @@ -6,7 +6,7 @@ fitpod command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fitpod Ta_param.pod Ta_data.pod diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 8cee9dd687..cdf6be866b 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -323,7 +323,8 @@ accelerated styles exist. * :doc:`pafi ` - constrained force averages on hyper-planes to compute free energies (PAFI) * :doc:`pair ` - access per-atom info from pair styles * :doc:`phonon ` - calculate dynamical matrix from MD simulations -* :doc:`pimd/nvt ` - Feynman path integral molecular dynamics with Nose-Hoover thermostat +* :doc:`pimd/langevin ` - Feynman path-integral molecular dynamics with stochastic thermostat +* :doc:`pimd/nvt ` - Feynman path-integral molecular dynamics with Nose-Hoover thermostat * :doc:`planeforce ` - constrain atoms to move in a plane * :doc:`plumed ` - wrapper on PLUMED free energy library * :doc:`poems ` - constrain clusters of atoms to move as coupled rigid bodies diff --git a/doc/src/fix_alchemy.rst b/doc/src/fix_alchemy.rst index 4f0ad06fd4..14273d65c4 100644 --- a/doc/src/fix_alchemy.rst +++ b/doc/src/fix_alchemy.rst @@ -6,7 +6,7 @@ fix alchemy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID alchemy v_name diff --git a/doc/src/fix_ave_grid.rst b/doc/src/fix_ave_grid.rst index 5760bb4508..a79a6cf486 100644 --- a/doc/src/fix_ave_grid.rst +++ b/doc/src/fix_ave_grid.rst @@ -6,7 +6,7 @@ fix ave/grid command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ave/grid Nevery Nrepeat Nfreq Nx Ny Nz value1 value2 ... keyword args ... @@ -129,12 +129,12 @@ overlays the simulation box. For 2d simulations, *Nz* must be 1. The very coarse compared to the particle count, or very fine. If one or more of the values = 1, then bins are 2d planes or 1d slices of the simulation domain. Note that if the total number of grid cells is -small, it may be more efficient to use the doc:`fix ave/chunk +small, it may be more efficient to use the :doc:`fix ave/chunk ` command which can treat a grid defined by the :doc:`compute chunk/atom ` command as a global grid where each processor owns a copy of all the grid cells. If *Nx* = *Ny* = *Nz* = 1 is used, the same calculation would be more -efficiently performed by the doc:`fix ave/atom ` +efficiently performed by the :doc:`fix ave/atom ` command. If the simulation box size or shape changes during a simulation, the diff --git a/doc/src/fix_bond_swap.rst b/doc/src/fix_bond_swap.rst index c7535c21b1..6448dd6e1c 100644 --- a/doc/src/fix_bond_swap.rst +++ b/doc/src/fix_bond_swap.rst @@ -6,7 +6,7 @@ fix bond/swap command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID bond/swap Nevery fraction cutoff seed diff --git a/doc/src/fix_box_relax.rst b/doc/src/fix_box_relax.rst index 5efbfcab1b..9f1dade765 100644 --- a/doc/src/fix_box_relax.rst +++ b/doc/src/fix_box_relax.rst @@ -6,7 +6,7 @@ fix box/relax command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID box/relax keyword value ... diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index c1e790c691..bc2651a55b 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -7,7 +7,7 @@ fix charge/regulation command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID charge/regulation cation_type anion_type keyword value(s) @@ -45,10 +45,10 @@ Syntax Examples """""""" + .. code-block:: LAMMPS 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 Description @@ -171,7 +171,7 @@ Langevin thermostat: .. code-block:: LAMMPS compute dtemp all temp - compute_modify dtemp dynamic yes + compute_modify dtemp dynamic/dof yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp diff --git a/doc/src/fix_cmap.rst b/doc/src/fix_cmap.rst index 19d8cd2d52..316ad5d038 100644 --- a/doc/src/fix_cmap.rst +++ b/doc/src/fix_cmap.rst @@ -6,7 +6,7 @@ fix cmap command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID cmap filename diff --git a/doc/src/fix_colvars.rst b/doc/src/fix_colvars.rst index 77a90cc54f..5acd79ba34 100644 --- a/doc/src/fix_colvars.rst +++ b/doc/src/fix_colvars.rst @@ -6,7 +6,7 @@ fix colvars command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID colvars configfile keyword values ... diff --git a/doc/src/fix_controller.rst b/doc/src/fix_controller.rst index d03d9a123c..fc8186ef29 100644 --- a/doc/src/fix_controller.rst +++ b/doc/src/fix_controller.rst @@ -6,7 +6,7 @@ fix controller command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID controller Nevery alpha Kp Ki Kd pvar setpoint cvar diff --git a/doc/src/fix_damping_cundall.rst b/doc/src/fix_damping_cundall.rst index 262291c0b8..5c532f08d0 100644 --- a/doc/src/fix_damping_cundall.rst +++ b/doc/src/fix_damping_cundall.rst @@ -6,7 +6,7 @@ fix damping/cundall command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID damping/cundall gamma_l gamma_a keyword values ... diff --git a/doc/src/fix_deform.rst b/doc/src/fix_deform.rst index 9adf5b4aa2..ee010f5645 100644 --- a/doc/src/fix_deform.rst +++ b/doc/src/fix_deform.rst @@ -9,7 +9,7 @@ Accelerator Variants: *deform/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID deform N parameter args ... keyword value ... diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index 7d19e93148..7d2d28bfa9 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -6,7 +6,7 @@ fix deposit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID deposit N type M seed keyword values ... @@ -95,10 +95,9 @@ default group "all" and the group specified in the fix deposit command (which can also be "all"). If you are computing temperature values which include inserted -particles, you will want to use the -:doc:`compute_modify ` dynamic option, which ensures the -current number of atoms is used as a normalizing factor each time the -temperature is computed. +particles, you will want to use the :doc:`compute_modify dynamic/dof yes +` option, which ensures the current number of atoms is +used as a normalizing factor each time the temperature is computed. Care must be taken that inserted particles are not too near existing atoms, using the options described below. When inserting particles @@ -160,15 +159,17 @@ command which also appears in your input script. .. note:: - If you wish the new rigid molecules (and other rigid molecules) - to be thermostatted correctly via :doc:`fix rigid/small/nvt ` - or :doc:`fix rigid/small/npt `, then you need to use the - "fix_modify dynamic/dof yes" command for the rigid fix. This is to - inform that fix that the molecule count will vary dynamically. + If you wish the new rigid molecules (and other rigid molecules) to be + thermostatted correctly via :doc:`fix rigid/small/nvt ` or + :doc:`fix rigid/small/npt `, then you need to use the + :doc:`fix_modify dynamic/dof yes ` command for the rigid + fix. This is to inform that fix that the molecule count will vary + dynamically. If you wish to insert molecules via the *mol* keyword, that will have their bonds or angles constrained via SHAKE, use the *shake* keyword, -specifying as its value the ID of a separate :doc:`fix shake ` command which also appears in your input script. +specifying as its value the ID of a separate :doc:`fix shake +` command which also appears in your input script. Each timestep a particle is inserted, the coordinates for its atoms are chosen as follows. For insertion of individual atoms, the @@ -268,8 +269,8 @@ units of distance or velocity. If you are monitoring the temperature of a system where the atom count is changing due to adding particles, you typically should use - the :doc:`compute_modify dynamic yes ` command for the - temperature compute you are using. + the :doc:`compute_modify dynamic/dof yes ` command + for the temperature compute you are using. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_dpd_energy.rst b/doc/src/fix_dpd_energy.rst index d6e8dd7230..ef5a5ed073 100644 --- a/doc/src/fix_dpd_energy.rst +++ b/doc/src/fix_dpd_energy.rst @@ -9,7 +9,7 @@ Accelerator Variants: *dpd/energy/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID dpd/energy diff --git a/doc/src/fix_dpd_source.rst b/doc/src/fix_dpd_source.rst index ade9659d00..8ec5163854 100644 --- a/doc/src/fix_dpd_source.rst +++ b/doc/src/fix_dpd_source.rst @@ -10,7 +10,7 @@ fix tdpd/source command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID edpd/source keyword values ... fix ID group-ID tdpd/source cc_index keyword values ... @@ -61,7 +61,7 @@ heat conduction with a source term (see Fig.12 in :ref:`(Li2014) `) or diffusion with a source term (see Fig.1 in :ref:`(Li2015) `), as an analog of a periodic Poiseuille flow problem. -.. deprecated:: TBD +.. deprecated:: 15Jun2023 The *sphere* and *cuboid* keywords will be removed in a future version of LAMMPS. The same functionality and more can be achieved with a region. diff --git a/doc/src/fix_drag.rst b/doc/src/fix_drag.rst index 3bfc5420de..9e29762cf5 100644 --- a/doc/src/fix_drag.rst +++ b/doc/src/fix_drag.rst @@ -6,7 +6,7 @@ fix drag command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID drag x y z fmag delta diff --git a/doc/src/fix_drude.rst b/doc/src/fix_drude.rst index 5300d1f490..679d6eb4bf 100644 --- a/doc/src/fix_drude.rst +++ b/doc/src/fix_drude.rst @@ -6,7 +6,7 @@ fix drude command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID drude flag1 flag2 ... flagN diff --git a/doc/src/fix_drude_transform.rst b/doc/src/fix_drude_transform.rst index bd63a411be..399bf2dd45 100644 --- a/doc/src/fix_drude_transform.rst +++ b/doc/src/fix_drude_transform.rst @@ -10,7 +10,7 @@ fix drude/transform/inverse command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style keyword value ... diff --git a/doc/src/fix_dt_reset.rst b/doc/src/fix_dt_reset.rst index 5757f0ec99..03b07776e6 100644 --- a/doc/src/fix_dt_reset.rst +++ b/doc/src/fix_dt_reset.rst @@ -9,7 +9,7 @@ Accelerator Variants: *dt/reset/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID dt/reset N Tmin Tmax Xmax keyword values ... diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index e72510e4da..2958d89794 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -10,7 +10,7 @@ fix efield/tip4p command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style ex ey ez keyword value ... @@ -19,7 +19,7 @@ Syntax * ex,ey,ez = E-field component values (electric field units) * any of ex,ey,ez can be a variable (see below) * zero or more keyword/value pairs may be appended to args -* keyword = *region* or *energy* +* keyword = *region* or *energy* or *potential* .. parsed-literal:: @@ -27,6 +27,8 @@ Syntax region-ID = ID of region atoms must be in to have added force *energy* value = v_name v_name = variable with name that calculates the potential energy of each atom in the added E-field + *potential* value = v_name + v_name = variable with name that calculates the electric potential of each atom in the added E-field Examples """""""" @@ -112,7 +114,8 @@ one or more variables, and if you are performing dynamics via the :doc:`run ` command. If the keyword is not used, LAMMPS will set the energy to 0.0, which is typically fine for dynamics. -The *energy* keyword is required if the added force is defined with +The *energy* keyword (or *potential* keyword, described below) +is required if the added force is defined with one or more variables, and you are performing energy minimization via the "minimize" command for charged particles. It is not required for point-dipoles, but a warning is issued since the minimizer in LAMMPS @@ -122,7 +125,7 @@ minimize the orientation of dipoles in an applied electric field. The *energy* keyword specifies the name of an atom-style :doc:`variable ` which is used to compute the energy of each atom as function of its position. Like variables used for *ex*, -*ey*, *ez*, the energy variable is specified as v_name, where name +*ey*, *ez*, the energy variable is specified as "v_name", where "name" is the variable name. Note that when the *energy* keyword is used during an energy @@ -133,6 +136,27 @@ due to the electric field were a spring-like F = kx, then the energy formula should be E = -0.5kx\^2. If you don't do this correctly, the minimization will not converge properly. +.. versionadded:: 15Jun2023 + +The *potential* keyword can be used as an alternative to the *energy* keyword +to specify the name of an atom-style variable, which is used to compute the +added electric potential to each atom as a function of its position. The +variable should have units of electric field multiplied by distance (that is, +in `units real`, the potential should be in volts). As with the *energy* +keyword, the variable name is specified as "v_name". The energy added by this +fix is then calculated as the electric potential multiplied by charge. + +The *potential* keyword is mainly intended for correct charge +equilibration in simulations with :doc:`fix qeq/reaxff`, +since with variable charges the electric potential can be known +beforehand but the energy cannot. A small additional benefit is that +the *energy* keyword requires an additional conversion to energy units +which the *potential* keyword avoids. Thus, when the *potential* +keyword is specified, the *energy* keyword must not be used. As with +*energy*, the *potential* keyword is not allowed if the added field is a +constant vector. The *potential* keyword is not supported by *fix +efield/tip4p*. + ---------- Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/fix_ehex.rst b/doc/src/fix_ehex.rst index 186ed7065e..d7c09ce36c 100644 --- a/doc/src/fix_ehex.rst +++ b/doc/src/fix_ehex.rst @@ -6,7 +6,7 @@ fix ehex command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ehex nevery F keyword value diff --git a/doc/src/fix_electron_stopping.rst b/doc/src/fix_electron_stopping.rst index fa0fc763f5..990e4203f4 100644 --- a/doc/src/fix_electron_stopping.rst +++ b/doc/src/fix_electron_stopping.rst @@ -10,7 +10,7 @@ fix electron/stopping/fit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style args @@ -204,7 +204,7 @@ The default is no limitation by region, and minneigh = 1. .. _CasP: -**(CasP)** CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html +**(CasP)** CasP webpage: http://www.casp-program.org/ .. _PASS: diff --git a/doc/src/fix_enforce2d.rst b/doc/src/fix_enforce2d.rst index a8061e5eaa..5dd0b79057 100644 --- a/doc/src/fix_enforce2d.rst +++ b/doc/src/fix_enforce2d.rst @@ -9,7 +9,7 @@ Accelerator Variants: *enforce2d/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID enforce2d diff --git a/doc/src/fix_eos_cv.rst b/doc/src/fix_eos_cv.rst index c43b5461b1..3f5c87cd38 100644 --- a/doc/src/fix_eos_cv.rst +++ b/doc/src/fix_eos_cv.rst @@ -6,7 +6,7 @@ fix eos/cv command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID eos/cv cv diff --git a/doc/src/fix_eos_table.rst b/doc/src/fix_eos_table.rst index bfb8ec2c3c..533904b0e7 100644 --- a/doc/src/fix_eos_table.rst +++ b/doc/src/fix_eos_table.rst @@ -6,7 +6,7 @@ fix eos/table command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID eos/table style file N keyword diff --git a/doc/src/fix_eos_table_rx.rst b/doc/src/fix_eos_table_rx.rst index c9f134f985..104fa79c20 100644 --- a/doc/src/fix_eos_table_rx.rst +++ b/doc/src/fix_eos_table_rx.rst @@ -9,7 +9,7 @@ Accelerator Variants: *eos/table/rx/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID eos/table/rx style file1 N keyword ... diff --git a/doc/src/fix_evaporate.rst b/doc/src/fix_evaporate.rst index 4c5ea01e13..1df58aa5d5 100644 --- a/doc/src/fix_evaporate.rst +++ b/doc/src/fix_evaporate.rst @@ -6,7 +6,7 @@ fix evaporate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID evaporate N M region-ID seed @@ -69,14 +69,15 @@ incur overhead due to the cost of building neighbor lists. If you are monitoring the temperature of a system where the atom count is changing due to evaporation, you typically should use the - :doc:`compute_modify dynamic yes ` command for the + :doc:`compute_modify dynamic/dof yes ` command for the temperature compute you are using. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options -are relevant to this fix. +No 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 computes a global scalar, which can be accessed by various :doc:`output commands `. The scalar is the cumulative @@ -84,7 +85,8 @@ number of deleted atoms. The scalar value calculated by this fix is "intensive". No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +the :doc:`run ` command. This fix is not invoked during +:doc:`energy minimization `. Restrictions """""""""""" diff --git a/doc/src/fix_external.rst b/doc/src/fix_external.rst index a3677a350c..44dd0929ee 100644 --- a/doc/src/fix_external.rst +++ b/doc/src/fix_external.rst @@ -6,7 +6,7 @@ fix external command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID external mode args diff --git a/doc/src/fix_ffl.rst b/doc/src/fix_ffl.rst index 6058b0ed3e..04e4d9be90 100644 --- a/doc/src/fix_ffl.rst +++ b/doc/src/fix_ffl.rst @@ -6,7 +6,7 @@ fix ffl command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID id-group ffl tau Tstart Tstop seed [flip-type] diff --git a/doc/src/fix_filter_corotate.rst b/doc/src/fix_filter_corotate.rst index c0a2216be3..7c091140df 100644 --- a/doc/src/fix_filter_corotate.rst +++ b/doc/src/fix_filter_corotate.rst @@ -6,7 +6,7 @@ fix filter/corotate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID filter/corotate keyword value ... diff --git a/doc/src/fix_flow_gauss.rst b/doc/src/fix_flow_gauss.rst index 87ab283923..6100c5d635 100644 --- a/doc/src/fix_flow_gauss.rst +++ b/doc/src/fix_flow_gauss.rst @@ -6,7 +6,7 @@ fix flow/gauss command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID flow/gauss xflag yflag zflag keyword diff --git a/doc/src/fix_freeze.rst b/doc/src/fix_freeze.rst index ce79ce3caf..9b579633b1 100644 --- a/doc/src/fix_freeze.rst +++ b/doc/src/fix_freeze.rst @@ -9,7 +9,7 @@ Accelerator Variants: *freeze/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID freeze diff --git a/doc/src/fix_gcmc.rst b/doc/src/fix_gcmc.rst index c348e2a44f..13ae509684 100644 --- a/doc/src/fix_gcmc.rst +++ b/doc/src/fix_gcmc.rst @@ -6,7 +6,7 @@ fix gcmc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID gcmc N X M type seed T mu displace keyword values ... @@ -146,8 +146,8 @@ center-of-mass is inside the specified region. If used with :doc:`fix nvt `, the temperature of the imaginary reservoir, T, should be set to be equivalent to the target temperature used in fix nvt. Otherwise, the imaginary reservoir will not be in -thermal equilibrium with the simulation cell. Also, it is important -that the temperature used by fix nvt be dynamic/dof, which can be +thermal equilibrium with the simulation cell. Also, it is important that +the temperature used by *fix nvt* is dynamically updated, which can be achieved as follows: .. code-block:: LAMMPS @@ -197,15 +197,17 @@ which also appears in your input script. .. note:: - If you wish the new rigid molecules (and other rigid molecules) - to be thermostatted correctly via :doc:`fix rigid/small/nvt ` - or :doc:`fix rigid/small/npt `, then you need to use the - "fix_modify dynamic/dof yes" command for the rigid fix. This is to - inform that fix that the molecule count will vary dynamically. + If you wish the new rigid molecules (and other rigid molecules) to be + thermostatted correctly via :doc:`fix rigid/small/nvt ` or + :doc:`fix rigid/small/npt `, then you need to use the + :doc:`fix_modify dynamic/dof yes ` command for the rigid + fix. This is to inform that fix that the molecule count will vary + dynamically. If you wish to insert molecules via the *mol* keyword, that will have their bonds or angles constrained via SHAKE, use the *shake* keyword, -specifying as its value the ID of a separate :doc:`fix shake ` command which also appears in your input script. +specifying as its value the ID of a separate :doc:`fix shake +` command which also appears in your input script. Optionally, users may specify the relative amounts of different MC moves using the *mcmoves* keyword. The values *Patomtrans*, @@ -335,31 +337,30 @@ temperature. Some fixes have an associated potential energy. Examples of such fixes include: :doc:`efield `, :doc:`gravity `, :doc:`addforce `, :doc:`langevin `, -:doc:`restrain `, -:doc:`temp/berendsen `, -:doc:`temp/rescale `, and :doc:`wall fixes `. -For that energy to be included in the total potential energy of the -system (the quantity used when performing GCMC exchange and MC moves), -you MUST enable -the :doc:`fix_modify ` *energy* option for that fix. The -doc pages for individual :doc:`fix ` commands specify if this -should be done. +:doc:`restrain `, :doc:`temp/berendsen +`, :doc:`temp/rescale `, and +:doc:`wall fixes `. For that energy to be included in the +total potential energy of the system (the quantity used when performing +GCMC exchange and MC moves), you MUST enable the :doc:`fix_modify +` *energy* option for that fix. The doc pages for +individual :doc:`fix ` commands specify if this should be done. Use the *charge* option to insert atoms with a user-specified point -charge. Note that doing so will cause the system to become -non-neutral. LAMMPS issues a warning when using long-range -electrostatics (kspace) with non-neutral systems. See the :doc:`compute group/group ` documentation for more details -about simulating non-neutral systems with kspace on. +charge. Note that doing so will cause the system to become non-neutral. +LAMMPS issues a warning when using long-range electrostatics (kspace) +with non-neutral systems. See the :doc:`compute group/group +` documentation for more details about simulating +non-neutral systems with kspace on. Use of this fix typically will cause the number of atoms to fluctuate, -therefore, you will want to use the -:doc:`compute_modify dynamic/dof ` command to ensure that the -current number of atoms is used as a normalizing factor each time -temperature is computed. A simple example of this is: +therefore, you will want to use the :doc:`compute_modify dynamic/dof +` command to ensure that the current number of atoms is +used as a normalizing factor each time temperature is computed. A simple +example of this is: .. code-block:: LAMMPS - compute_modify thermo_temp dynamic yes + compute_modify thermo_temp dynamic/dof yes A more complicated example is listed earlier on this page in the context of NVT dynamics. @@ -369,31 +370,29 @@ in the context of NVT dynamics. If the density of the cell is initially very small or zero, and increases to a much larger density after a period of equilibration, then certain quantities that are only calculated once at the start - (kspace parameters) may no longer be accurate. The - solution is to start a new simulation after the equilibrium density - has been reached. + (kspace parameters) may no longer be accurate. The solution is to + start a new simulation after the equilibrium density has been + reached. With some pair_styles, such as :doc:`Buckingham `, -:doc:`Born-Mayer-Huggins ` and :doc:`ReaxFF `, two -atoms placed close to each other may have an arbitrary large, negative -potential energy due to the functional form of the potential. While -these unphysical configurations are inaccessible to typical dynamical -trajectories, they can be generated by Monte Carlo moves. The -*overlap_cutoff* keyword suppresses these moves by effectively -assigning an infinite positive energy to all new configurations that -place any pair of atoms closer than the specified overlap cutoff -distance. +:doc:`Born-Mayer-Huggins ` and :doc:`ReaxFF `, +two atoms placed close to each other may have an arbitrary large, +negative potential energy due to the functional form of the potential. +While these unphysical configurations are inaccessible to typical +dynamical trajectories, they can be generated by Monte Carlo moves. The +*overlap_cutoff* keyword suppresses these moves by effectively assigning +an infinite positive energy to all new configurations that place any +pair of atoms closer than the specified overlap cutoff distance. -The *max* and *min* keywords allow for the restriction of the number -of atoms in the simulation. They automatically reject all insertion -or deletion moves that would take the system beyond the set boundaries. +The *max* and *min* keywords allow for the restriction of the number of +atoms in the simulation. They automatically reject all insertion or +deletion moves that would take the system beyond the set boundaries. Should the system already be beyond the boundary, only moves that bring the system closer to the bounds may be accepted. -The *group* keyword adds all inserted atoms to the -:doc:`group ` of the group-ID value. The *grouptype* keyword -adds all inserted atoms of the specified type to the -:doc:`group ` of the group-ID value. +The *group* keyword adds all inserted atoms to the :doc:`group ` +of the group-ID value. The *grouptype* keyword adds all inserted atoms +of the specified type to the :doc:`group ` of the group-ID value. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -446,22 +445,21 @@ called. Reneighboring is required. Only usable for 3D simulations. -Can be run in parallel, but aspects of the GCMC part will not scale -well in parallel. Currently, molecule translations and rotations -are not supported with more than one MPI process. -It is still possible to do parallel molecule exchange without -translation and rotation moves by setting MC moves to zero -and/or by using the *mcmoves* keyword with *Pmoltrans* = *Pmolrotate* = 0 . +This fix can be run in parallel, but aspects of the GCMC part will not +scale well in parallel. Currently, molecule translations and rotations +are not supported with more than one MPI process. It is still possible +to do parallel molecule exchange without translation and rotation moves +by setting MC moves to zero and/or by using the *mcmoves* keyword with +*Pmoltrans* = *Pmolrotate* = 0 . -When using fix gcmc in combination with fix shake or fix rigid, -only GCMC exchange moves are supported, so the argument -*M* must be zero. +When using fix gcmc in combination with fix shake or fix rigid, only +GCMC exchange moves are supported, so the argument *M* must be zero. -When using fix gcmc in combination with fix rigid, deletion -of the last remaining molecule is not allowed for technical reasons, -and so the molecule count will never drop below 1, regardless of the -specified chemical potential. +When using fix gcmc in combination with fix rigid, deletion of the last +remaining molecule is not allowed for technical reasons, and so the +molecule count will never drop below 1, regardless of the specified +chemical potential. Note that very lengthy simulations involving insertions/deletions of billions of gas molecules may run out of atom or molecule IDs and diff --git a/doc/src/fix_gld.rst b/doc/src/fix_gld.rst index d0fd6a4c9e..ba26f7a51b 100644 --- a/doc/src/fix_gld.rst +++ b/doc/src/fix_gld.rst @@ -6,7 +6,7 @@ fix gld command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID gld Tstart Tstop N_k seed series c_1 tau_1 ... c_N_k tau_N_k keyword values ... diff --git a/doc/src/fix_gle.rst b/doc/src/fix_gle.rst index 03add9d354..d28a9bbf0d 100644 --- a/doc/src/fix_gle.rst +++ b/doc/src/fix_gle.rst @@ -6,7 +6,7 @@ fix gle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID id-group gle Ns Tstart Tstop seed Amatrix [noneq Cmatrix] [every stride] diff --git a/doc/src/fix_gravity.rst b/doc/src/fix_gravity.rst index 6d34cc1bf3..cd7cfcc3df 100644 --- a/doc/src/fix_gravity.rst +++ b/doc/src/fix_gravity.rst @@ -10,7 +10,7 @@ Accelerator Variants: *gravity/omp*, *gravity/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group gravity magnitude style args diff --git a/doc/src/fix_grem.rst b/doc/src/fix_grem.rst index 3e3ec02994..9cc6e3f43e 100644 --- a/doc/src/fix_grem.rst +++ b/doc/src/fix_grem.rst @@ -6,7 +6,7 @@ fix grem command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID grem lambda eta H0 thermostat-ID diff --git a/doc/src/fix_halt.rst b/doc/src/fix_halt.rst index 56e86208cd..4231c77cc5 100644 --- a/doc/src/fix_halt.rst +++ b/doc/src/fix_halt.rst @@ -6,7 +6,7 @@ fix halt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID halt N attribute operator avalue keyword value ... diff --git a/doc/src/fix_heat.rst b/doc/src/fix_heat.rst index 19bc3d84ca..1badf08bff 100644 --- a/doc/src/fix_heat.rst +++ b/doc/src/fix_heat.rst @@ -6,7 +6,7 @@ fix heat command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID heat N eflux diff --git a/doc/src/fix_heat_flow.rst b/doc/src/fix_heat_flow.rst index ee73d7d4f2..1ca99a1686 100644 --- a/doc/src/fix_heat_flow.rst +++ b/doc/src/fix_heat_flow.rst @@ -6,7 +6,7 @@ fix heat/flow command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID heat/flow style values ... diff --git a/doc/src/fix_hyper_global.rst b/doc/src/fix_hyper_global.rst index c8643b3b86..2ac1e5e4f3 100644 --- a/doc/src/fix_hyper_global.rst +++ b/doc/src/fix_hyper_global.rst @@ -6,7 +6,7 @@ fix hyper/global command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID hyper/global cutbond qfactor Vmax Tequil diff --git a/doc/src/fix_hyper_local.rst b/doc/src/fix_hyper_local.rst index b5350e9765..76b17cddc4 100644 --- a/doc/src/fix_hyper_local.rst +++ b/doc/src/fix_hyper_local.rst @@ -6,7 +6,7 @@ fix hyper/local command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID hyper/local cutbond qfactor Vmax Tequil Dcut alpha Btarget diff --git a/doc/src/fix_imd.rst b/doc/src/fix_imd.rst index cb1831d174..520af505a1 100644 --- a/doc/src/fix_imd.rst +++ b/doc/src/fix_imd.rst @@ -6,7 +6,7 @@ fix imd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID imd trate port keyword values ... diff --git a/doc/src/fix_indent.rst b/doc/src/fix_indent.rst index c8349e9381..15790e15d0 100644 --- a/doc/src/fix_indent.rst +++ b/doc/src/fix_indent.rst @@ -6,7 +6,7 @@ fix indent command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID indent K keyword values ... diff --git a/doc/src/fix_ipi.rst b/doc/src/fix_ipi.rst index 5e13d25971..7705f211e8 100644 --- a/doc/src/fix_ipi.rst +++ b/doc/src/fix_ipi.rst @@ -6,7 +6,7 @@ fix ipi command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ipi address port [unix] [reset] diff --git a/doc/src/fix_langevin.rst b/doc/src/fix_langevin.rst index c09fc7b928..e04805427e 100644 --- a/doc/src/fix_langevin.rst +++ b/doc/src/fix_langevin.rst @@ -9,7 +9,7 @@ Accelerator Variants: *langevin/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin Tstart Tstop damp seed keyword values ... diff --git a/doc/src/fix_langevin_drude.rst b/doc/src/fix_langevin_drude.rst index 5e62e4f416..c53c29b3ac 100644 --- a/doc/src/fix_langevin_drude.rst +++ b/doc/src/fix_langevin_drude.rst @@ -6,7 +6,7 @@ fix langevin/drude command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin/drude Tcom damp_com seed_com Tdrude damp_drude seed_drude keyword values ... diff --git a/doc/src/fix_langevin_eff.rst b/doc/src/fix_langevin_eff.rst index 506b5052d5..21cdc4a789 100644 --- a/doc/src/fix_langevin_eff.rst +++ b/doc/src/fix_langevin_eff.rst @@ -6,7 +6,7 @@ fix langevin/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin/eff Tstart Tstop damp seed keyword values ... diff --git a/doc/src/fix_langevin_spin.rst b/doc/src/fix_langevin_spin.rst index 0ca291a732..c82751a755 100644 --- a/doc/src/fix_langevin_spin.rst +++ b/doc/src/fix_langevin_spin.rst @@ -6,7 +6,7 @@ fix langevin/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin/spin T Tdamp seed diff --git a/doc/src/fix_lb_fluid.rst b/doc/src/fix_lb_fluid.rst index 04f306156a..a461175f71 100644 --- a/doc/src/fix_lb_fluid.rst +++ b/doc/src/fix_lb_fluid.rst @@ -6,7 +6,7 @@ fix lb/fluid command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lb/fluid nevery viscosity density keyword values ... diff --git a/doc/src/fix_lb_momentum.rst b/doc/src/fix_lb_momentum.rst index 8b2c5e6ae2..67a8d86d5f 100644 --- a/doc/src/fix_lb_momentum.rst +++ b/doc/src/fix_lb_momentum.rst @@ -6,7 +6,7 @@ fix lb/momentum command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lb/momentum nevery keyword values ... diff --git a/doc/src/fix_lb_viscous.rst b/doc/src/fix_lb_viscous.rst index 6e0ec21b7e..5557cba57f 100644 --- a/doc/src/fix_lb_viscous.rst +++ b/doc/src/fix_lb_viscous.rst @@ -6,7 +6,7 @@ fix lb/viscous command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lb/viscous diff --git a/doc/src/fix_lineforce.rst b/doc/src/fix_lineforce.rst index e82f6ed556..9b1d30e832 100644 --- a/doc/src/fix_lineforce.rst +++ b/doc/src/fix_lineforce.rst @@ -6,7 +6,7 @@ fix lineforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lineforce x y z diff --git a/doc/src/fix_manifoldforce.rst b/doc/src/fix_manifoldforce.rst index 2d72743707..cd5fffc881 100644 --- a/doc/src/fix_manifoldforce.rst +++ b/doc/src/fix_manifoldforce.rst @@ -6,7 +6,7 @@ fix manifoldforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID manifoldforce manifold manifold-args ... diff --git a/doc/src/fix_mdi_qm.rst b/doc/src/fix_mdi_qm.rst index 3d0b350407..0868cbbac8 100644 --- a/doc/src/fix_mdi_qm.rst +++ b/doc/src/fix_mdi_qm.rst @@ -6,7 +6,7 @@ fix mdi/qm command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mdi/qm keyword value(s) keyword value(s) ... diff --git a/doc/src/fix_mdi_qmmm.rst b/doc/src/fix_mdi_qmmm.rst index 1afce0f7e4..a39f8ba71d 100644 --- a/doc/src/fix_mdi_qmmm.rst +++ b/doc/src/fix_mdi_qmmm.rst @@ -6,7 +6,7 @@ fix mdi/qmmm command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mdi/qmmm mode keyword value(s) keyword value(s) ... diff --git a/doc/src/fix_meso_move.rst b/doc/src/fix_meso_move.rst index 7b3609a8c7..55d54b2107 100644 --- a/doc/src/fix_meso_move.rst +++ b/doc/src/fix_meso_move.rst @@ -6,7 +6,7 @@ fix meso/move command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID meso/move style args keyword values ... diff --git a/doc/src/fix_modify.rst b/doc/src/fix_modify.rst index 175d02dd8f..265803c213 100644 --- a/doc/src/fix_modify.rst +++ b/doc/src/fix_modify.rst @@ -131,24 +131,24 @@ with their specified level at the beginning of a r-RESPA run. The *dynamic/dof* keyword determines whether the number of atoms N in the fix group and their associated degrees of freedom are re-computed each time a temperature is computed. Only fix styles that calculate -their own internal temperature use this option. Currently this is -only the :doc:`fix rigid/nvt/small ` and :doc:`fix -rigid/npt/small ` commands for the purpose of -thermostatting rigid body translation and rotation. By default, N and -their DOF are assumed to be constant. If you are adding atoms or -molecules to the system (see the :doc:`fix pour `, :doc:`fix -deposit `, and :doc:`fix gcmc ` commands) or -expect atoms or molecules to be lost (e.g. due to exiting the -simulation box or via :doc:`fix evaporate `), then this -option should be used to ensure the temperature is correctly -normalized. +their own internal temperature use this option. Currently this is only +the :doc:`fix rigid/nvt/small ` and :doc:`fix rigid/npt/small +` commands for the purpose of thermostatting rigid body +translation and rotation. By default, N and their DOF are assumed to be +constant. If you are adding atoms or molecules to the system (see the +:doc:`fix pour `, :doc:`fix deposit `, and +:doc:`fix gcmc ` commands) or expect atoms or molecules to be +lost (e.g. due to exiting the simulation box or via :doc:`fix evaporate +`), then this option should be used to ensure the +temperature is correctly normalized. .. note:: - Other thermostatting fixes, such as :doc:`fix nvt `, do - not use the *dynamic/dof* keyword because they use a temperature - compute to calculate temperature. See the :doc:`compute_modify dynamic/dof ` command for a similar way to ensure - correct temperature normalization for those thermostats. + Other thermostatting fixes, such as :doc:`fix nvt `, do not + use the *dynamic/dof* keyword because they use a temperature compute + to calculate temperature. See the :doc:`compute_modify dynamic/dof + ` command for a similar way to ensure correct + temperature normalization for those thermostats. The *bodyforces* keyword determines whether the forces and torques acting on rigid bodies are computed *early* at the post-force stage of @@ -156,7 +156,8 @@ each timestep (right after per-atom forces have been computed and communicated among processors), or *late* at the final-integrate stage of each timestep (after any other fixes have finished their post-force tasks). Only the rigid-body integration fixes use this option, which -includes :doc:`fix rigid ` and :doc:`fix rigid/small `, and their variants, and also :doc:`fix poems `. +includes :doc:`fix rigid ` and :doc:`fix rigid/small +`, and their variants, and also :doc:`fix poems `. The default is *late*\ . If there are other fixes that add forces to individual atoms, then the rigid-body constraints will include these diff --git a/doc/src/fix_mol_swap.rst b/doc/src/fix_mol_swap.rst index 737536fa0d..b344b9c0e6 100644 --- a/doc/src/fix_mol_swap.rst +++ b/doc/src/fix_mol_swap.rst @@ -6,7 +6,7 @@ fix mol/swap command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mol/swap N X itype jtype seed T keyword value ... diff --git a/doc/src/fix_momentum.rst b/doc/src/fix_momentum.rst index dff30fffc4..727cb176a1 100644 --- a/doc/src/fix_momentum.rst +++ b/doc/src/fix_momentum.rst @@ -13,7 +13,7 @@ fix momentum/chunk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID momentum N keyword values ... diff --git a/doc/src/fix_move.rst b/doc/src/fix_move.rst index ff1f8403df..3fde5f0861 100644 --- a/doc/src/fix_move.rst +++ b/doc/src/fix_move.rst @@ -6,7 +6,7 @@ fix move command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID move style args keyword values ... diff --git a/doc/src/fix_mscg.rst b/doc/src/fix_mscg.rst index 3255f3fbe9..91eb0fe772 100644 --- a/doc/src/fix_mscg.rst +++ b/doc/src/fix_mscg.rst @@ -6,7 +6,7 @@ fix mscg command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mscg N keyword args ... diff --git a/doc/src/fix_msst.rst b/doc/src/fix_msst.rst index 9502fe21b8..6750934f61 100644 --- a/doc/src/fix_msst.rst +++ b/doc/src/fix_msst.rst @@ -6,7 +6,7 @@ fix msst command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID msst dir shockvel keyword value ... diff --git a/doc/src/fix_mvv_dpd.rst b/doc/src/fix_mvv_dpd.rst index c2f8a50391..ff5b169f97 100644 --- a/doc/src/fix_mvv_dpd.rst +++ b/doc/src/fix_mvv_dpd.rst @@ -14,7 +14,7 @@ fix mvv/tdpd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mvv/dpd lambda diff --git a/doc/src/fix_neb.rst b/doc/src/fix_neb.rst index 5f22acfb2b..ccd0f9b83d 100644 --- a/doc/src/fix_neb.rst +++ b/doc/src/fix_neb.rst @@ -6,7 +6,7 @@ fix neb command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID neb Kspring keyword value diff --git a/doc/src/fix_neb_spin.rst b/doc/src/fix_neb_spin.rst index 16baba44c0..d04ba367c4 100644 --- a/doc/src/fix_neb_spin.rst +++ b/doc/src/fix_neb_spin.rst @@ -6,7 +6,7 @@ fix neb/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID neb/spin Kspring diff --git a/doc/src/fix_nh.rst b/doc/src/fix_nh.rst index 7f2ec69f9b..0cfbc8f921 100644 --- a/doc/src/fix_nh.rst +++ b/doc/src/fix_nh.rst @@ -30,7 +30,7 @@ Accelerator Variants: *nph/kk*, *nph/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword value ... diff --git a/doc/src/fix_nh_eff.rst b/doc/src/fix_nh_eff.rst index 11990d365b..7f0f8ee8f1 100644 --- a/doc/src/fix_nh_eff.rst +++ b/doc/src/fix_nh_eff.rst @@ -14,7 +14,7 @@ fix nph/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword value ... diff --git a/doc/src/fix_nh_uef.rst b/doc/src/fix_nh_uef.rst index 922c2d515a..a515375746 100644 --- a/doc/src/fix_nh_uef.rst +++ b/doc/src/fix_nh_uef.rst @@ -10,7 +10,7 @@ fix npt/uef command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name erate edot_x edot_y temp Tstart Tstop Tdamp keyword value ... diff --git a/doc/src/fix_nph_asphere.rst b/doc/src/fix_nph_asphere.rst index a1028efacc..93938fdd58 100644 --- a/doc/src/fix_nph_asphere.rst +++ b/doc/src/fix_nph_asphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nph/asphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nph/asphere args keyword value ... diff --git a/doc/src/fix_nph_body.rst b/doc/src/fix_nph_body.rst index 1b740a5ae2..9ee0bd7669 100644 --- a/doc/src/fix_nph_body.rst +++ b/doc/src/fix_nph_body.rst @@ -6,7 +6,7 @@ fix nph/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nph/body args keyword value ... diff --git a/doc/src/fix_nph_sphere.rst b/doc/src/fix_nph_sphere.rst index 2ef85953e5..9d47cedc28 100644 --- a/doc/src/fix_nph_sphere.rst +++ b/doc/src/fix_nph_sphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nph/sphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nph/sphere args keyword value ... diff --git a/doc/src/fix_nphug.rst b/doc/src/fix_nphug.rst index 1cedfa909a..ce63f5eddd 100644 --- a/doc/src/fix_nphug.rst +++ b/doc/src/fix_nphug.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nphug/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nphug keyword value ... diff --git a/doc/src/fix_npt_asphere.rst b/doc/src/fix_npt_asphere.rst index 64e1c45be7..0d195821ad 100644 --- a/doc/src/fix_npt_asphere.rst +++ b/doc/src/fix_npt_asphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *npt/asphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID npt/asphere keyword value ... diff --git a/doc/src/fix_npt_body.rst b/doc/src/fix_npt_body.rst index ff98638b63..31ef1653b8 100644 --- a/doc/src/fix_npt_body.rst +++ b/doc/src/fix_npt_body.rst @@ -6,7 +6,7 @@ fix npt/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID npt/body keyword value ... diff --git a/doc/src/fix_npt_cauchy.rst b/doc/src/fix_npt_cauchy.rst index 36b22037bf..6764f88eee 100644 --- a/doc/src/fix_npt_cauchy.rst +++ b/doc/src/fix_npt_cauchy.rst @@ -6,7 +6,7 @@ fix npt/cauchy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword value ... diff --git a/doc/src/fix_npt_sphere.rst b/doc/src/fix_npt_sphere.rst index afaa2c9d67..f881bc2dfe 100644 --- a/doc/src/fix_npt_sphere.rst +++ b/doc/src/fix_npt_sphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *npt/sphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID npt/sphere keyword value ... diff --git a/doc/src/fix_numdiff.rst b/doc/src/fix_numdiff.rst index b5fdfb12e6..9b3d3bf7da 100644 --- a/doc/src/fix_numdiff.rst +++ b/doc/src/fix_numdiff.rst @@ -6,7 +6,7 @@ fix numdiff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID numdiff Nevery delta diff --git a/doc/src/fix_numdiff_virial.rst b/doc/src/fix_numdiff_virial.rst index f909d41111..2075d1d05f 100644 --- a/doc/src/fix_numdiff_virial.rst +++ b/doc/src/fix_numdiff_virial.rst @@ -6,7 +6,7 @@ fix numdiff/virial command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID numdiff/virial Nevery delta diff --git a/doc/src/fix_nve.rst b/doc/src/fix_nve.rst index c50bc4d62f..3757233bcc 100644 --- a/doc/src/fix_nve.rst +++ b/doc/src/fix_nve.rst @@ -12,7 +12,7 @@ Accelerator Variants: *nve/gpu*, *nve/intel*, *nve/kk*, *nve/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve diff --git a/doc/src/fix_nve_asphere.rst b/doc/src/fix_nve_asphere.rst index fbba2bc8dd..cf956bd0c4 100644 --- a/doc/src/fix_nve_asphere.rst +++ b/doc/src/fix_nve_asphere.rst @@ -10,7 +10,7 @@ Accelerator Variants: *nve/asphere/gpu*, *nve/asphere/intel* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/asphere diff --git a/doc/src/fix_nve_asphere_noforce.rst b/doc/src/fix_nve_asphere_noforce.rst index 7d904bef1c..9e6f35b56b 100644 --- a/doc/src/fix_nve_asphere_noforce.rst +++ b/doc/src/fix_nve_asphere_noforce.rst @@ -6,7 +6,7 @@ fix nve/asphere/noforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/asphere/noforce diff --git a/doc/src/fix_nve_awpmd.rst b/doc/src/fix_nve_awpmd.rst index c716a94a84..f835758e00 100644 --- a/doc/src/fix_nve_awpmd.rst +++ b/doc/src/fix_nve_awpmd.rst @@ -6,7 +6,7 @@ fix nve/awpmd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/awpmd diff --git a/doc/src/fix_nve_body.rst b/doc/src/fix_nve_body.rst index 45beee0659..9f562ef59e 100644 --- a/doc/src/fix_nve_body.rst +++ b/doc/src/fix_nve_body.rst @@ -6,7 +6,7 @@ fix nve/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/body diff --git a/doc/src/fix_nve_bpm_sphere.rst b/doc/src/fix_nve_bpm_sphere.rst index ef170605a4..fb3bd9e466 100644 --- a/doc/src/fix_nve_bpm_sphere.rst +++ b/doc/src/fix_nve_bpm_sphere.rst @@ -6,7 +6,7 @@ fix nve/bpm/sphere command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/bpm/sphere diff --git a/doc/src/fix_nve_dot.rst b/doc/src/fix_nve_dot.rst index 0a99e11452..0d6e0ab5c3 100644 --- a/doc/src/fix_nve_dot.rst +++ b/doc/src/fix_nve_dot.rst @@ -6,7 +6,7 @@ fix nve/dot command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/dot diff --git a/doc/src/fix_nve_dotc_langevin.rst b/doc/src/fix_nve_dotc_langevin.rst index e47e8f4a2a..51efa06a02 100644 --- a/doc/src/fix_nve_dotc_langevin.rst +++ b/doc/src/fix_nve_dotc_langevin.rst @@ -6,7 +6,7 @@ fix nve/dotc/langevin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/dotc/langevin Tstart Tstop damp seed keyword value diff --git a/doc/src/fix_nve_eff.rst b/doc/src/fix_nve_eff.rst index 60bece43d0..1cf954a88d 100644 --- a/doc/src/fix_nve_eff.rst +++ b/doc/src/fix_nve_eff.rst @@ -6,7 +6,7 @@ fix nve/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/eff diff --git a/doc/src/fix_nve_limit.rst b/doc/src/fix_nve_limit.rst index 0c572c6c6a..b00a5d64ca 100644 --- a/doc/src/fix_nve_limit.rst +++ b/doc/src/fix_nve_limit.rst @@ -6,7 +6,7 @@ fix nve/limit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/limit xmax diff --git a/doc/src/fix_nve_line.rst b/doc/src/fix_nve_line.rst index 5bb6fd4213..7574110041 100644 --- a/doc/src/fix_nve_line.rst +++ b/doc/src/fix_nve_line.rst @@ -6,7 +6,7 @@ fix nve/line command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/line diff --git a/doc/src/fix_nve_manifold_rattle.rst b/doc/src/fix_nve_manifold_rattle.rst index 63632ebac0..6adf72ac55 100644 --- a/doc/src/fix_nve_manifold_rattle.rst +++ b/doc/src/fix_nve_manifold_rattle.rst @@ -6,7 +6,7 @@ fix nve/manifold/rattle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/manifold/rattle tol maxit manifold manifold-args keyword value ... diff --git a/doc/src/fix_nve_noforce.rst b/doc/src/fix_nve_noforce.rst index ed13123403..9b9c30d325 100644 --- a/doc/src/fix_nve_noforce.rst +++ b/doc/src/fix_nve_noforce.rst @@ -6,7 +6,7 @@ fix nve/noforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve diff --git a/doc/src/fix_nve_sphere.rst b/doc/src/fix_nve_sphere.rst index df177a2eca..9340e4af22 100644 --- a/doc/src/fix_nve_sphere.rst +++ b/doc/src/fix_nve_sphere.rst @@ -10,7 +10,7 @@ Accelerator Variants: *nve/sphere/omp*, *nve/sphere/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/sphere diff --git a/doc/src/fix_nve_spin.rst b/doc/src/fix_nve_spin.rst index e35647aef4..6edc9da09a 100644 --- a/doc/src/fix_nve_spin.rst +++ b/doc/src/fix_nve_spin.rst @@ -6,7 +6,7 @@ fix nve/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/spin keyword values diff --git a/doc/src/fix_nve_tri.rst b/doc/src/fix_nve_tri.rst index b511d9b318..1bcecb71db 100644 --- a/doc/src/fix_nve_tri.rst +++ b/doc/src/fix_nve_tri.rst @@ -6,7 +6,7 @@ fix nve/tri command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/tri diff --git a/doc/src/fix_nvk.rst b/doc/src/fix_nvk.rst index 0d83a4b1be..d74ec1639c 100644 --- a/doc/src/fix_nvk.rst +++ b/doc/src/fix_nvk.rst @@ -6,7 +6,7 @@ fix nvk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvk diff --git a/doc/src/fix_nvt_asphere.rst b/doc/src/fix_nvt_asphere.rst index 7ce3aec125..b456516e3c 100644 --- a/doc/src/fix_nvt_asphere.rst +++ b/doc/src/fix_nvt_asphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nvt/asphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/asphere keyword value ... diff --git a/doc/src/fix_nvt_body.rst b/doc/src/fix_nvt_body.rst index 7b9e996a5b..4397159515 100644 --- a/doc/src/fix_nvt_body.rst +++ b/doc/src/fix_nvt_body.rst @@ -6,7 +6,7 @@ fix nvt/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/body keyword value ... diff --git a/doc/src/fix_nvt_manifold_rattle.rst b/doc/src/fix_nvt_manifold_rattle.rst index 91a5f28649..921022d743 100644 --- a/doc/src/fix_nvt_manifold_rattle.rst +++ b/doc/src/fix_nvt_manifold_rattle.rst @@ -6,7 +6,7 @@ fix nvt/manifold/rattle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/manifold/rattle tol maxit manifold manifold-args keyword value ... diff --git a/doc/src/fix_nvt_sllod.rst b/doc/src/fix_nvt_sllod.rst index 48d0bb5946..430ed31c14 100644 --- a/doc/src/fix_nvt_sllod.rst +++ b/doc/src/fix_nvt_sllod.rst @@ -11,7 +11,7 @@ Accelerator Variants: *nvt/sllod/intel*, *nvt/sllod/omp*, *nvt/sllod/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/sllod keyword value ... diff --git a/doc/src/fix_nvt_sllod_eff.rst b/doc/src/fix_nvt_sllod_eff.rst index dd4dd469ef..71a7e75b80 100644 --- a/doc/src/fix_nvt_sllod_eff.rst +++ b/doc/src/fix_nvt_sllod_eff.rst @@ -6,7 +6,7 @@ fix nvt/sllod/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/sllod/eff keyword value ... diff --git a/doc/src/fix_nvt_sphere.rst b/doc/src/fix_nvt_sphere.rst index f107940af9..6baa79532c 100644 --- a/doc/src/fix_nvt_sphere.rst +++ b/doc/src/fix_nvt_sphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nvt/sphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/sphere keyword value ... diff --git a/doc/src/fix_oneway.rst b/doc/src/fix_oneway.rst index 272797fa17..b4a55e9968 100644 --- a/doc/src/fix_oneway.rst +++ b/doc/src/fix_oneway.rst @@ -6,7 +6,7 @@ fix oneway command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID oneway N region-ID direction diff --git a/doc/src/fix_orient.rst b/doc/src/fix_orient.rst index 68522209b7..7e30b7bb01 100644 --- a/doc/src/fix_orient.rst +++ b/doc/src/fix_orient.rst @@ -10,7 +10,7 @@ fix orient/bcc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID orient/fcc nstats dir alat dE cutlo cuthi file0 file1 fix ID group-ID orient/bcc nstats dir alat dE cutlo cuthi file0 file1 diff --git a/doc/src/fix_pafi.rst b/doc/src/fix_pafi.rst index c8830316a2..a57fc658fc 100644 --- a/doc/src/fix_pafi.rst +++ b/doc/src/fix_pafi.rst @@ -6,7 +6,7 @@ fix pafi command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID pafi compute-ID Temp Tdamp seed keyword values... diff --git a/doc/src/fix_pair.rst b/doc/src/fix_pair.rst index 44c91f18ee..ec4a5bcb3f 100644 --- a/doc/src/fix_pair.rst +++ b/doc/src/fix_pair.rst @@ -6,7 +6,7 @@ fix pair command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID pair N pstyle name flag ... @@ -85,7 +85,7 @@ columns 4-6 will store the "uinp" values. .. code-block:: LAMMPS pair_style amoeba - fix ex all pair amoeba 10 uind 0 uinp 0 + fix ex all pair 10 amoeba uind 0 uinp 0 Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_phonon.rst b/doc/src/fix_phonon.rst index 527498bb21..e99d2b6891 100644 --- a/doc/src/fix_phonon.rst +++ b/doc/src/fix_phonon.rst @@ -6,7 +6,7 @@ fix phonon command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID phonon N Noutput Nwait map_file prefix keyword values ... diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index eae14e9e86..5b51b97c52 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -1,79 +1,118 @@ +.. index:: fix pimd/langevin .. index:: fix pimd/nvt +fix pimd/langevin command +========================= + fix pimd/nvt command ==================== Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS - fix ID group-ID pimd/nvt keyword value ... + fix ID group-ID style keyword value ... * ID, group-ID are documented in :doc:`fix ` command -* pimd/nvt = style name of this fix command +* style = *pimd/langevin* or *pimd/nvt* = style name of this fix command * zero or more keyword/value pairs may be appended -* keyword = *method* or *fmass* or *sp* or *temp* or *nhc* +* keywords for style *pimd/nvt* .. parsed-literal:: - + *keywords* = *method* or *fmass* or *sp* or *temp* or *nhc* *method* value = *pimd* or *nmpimd* or *cmd* *fmass* value = scaling factor on mass *sp* value = scaling factor on Planck constant - *temp* value = temperature (temperarate units) + *temp* value = temperature (temperature units) *nhc* value = Nc = number of chains in Nose-Hoover thermostat +* keywords for style *pimd/langevin* + + .. parsed-literal:: + *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or *tau* or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* + *method* value = *nmpimd* + *integrator* value = *obabo* or *baoab* + *fmmode* value = *physical* or *normal* + *fmass* value = scaling factor on mass + *temp* value = temperature (temperature unit) + temperature = target temperature of the thermostat + *thermostat* values = style seed + style value = *PILE_L* + seed = random number generator seed + *tau* value = thermostat damping parameter (time unit) + *scale* value = scaling factor of the damping times of non-centroid modes of PILE_L thermostat + *iso* or *aniso* values = pressure (pressure unit) + pressure = scalar external pressure of the barostat + *barostat* value = *BZP* or *MTTK* + *taup* value = barostat damping parameter (time unit) + *fixcom* value = *yes* or *no* + *lj* values = epsilon sigma mass planck mvv2e + epsilon = energy scale for reduced units (energy units) + sigma = length scale for reduced units (length units) + mass = mass scale for reduced units (mass units) + planck = Planck's constant for other unit style + mvv2e = mass * velocity^2 to energy conversion factor for other unit style + Examples """""""" .. code-block:: LAMMPS fix 1 all pimd/nvt method nmpimd fmass 1.0 sp 2.0 temp 300.0 nhc 4 + fix 1 all pimd/langevin ensemble npt integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0 iso 1.0 barostat BZP taup 1.0 Description """"""""""" .. versionchanged:: 28Mar2023 -Fix pimd was renamed to fix pimd/nvt. +Fix pimd was renamed to fix *pimd/nvt* and fix *pimd/langevin* was added. -This command performs quantum molecular dynamics simulations based on -the Feynman path integral to include effects of tunneling and +These fix commands perform quantum molecular dynamics simulations based +on the Feynman path-integral to include effects of tunneling and zero-point motion. In this formalism, the isomorphism of a quantum partition function for the original system to a classical partition function for a ring-polymer system is exploited, to efficiently sample configurations from the canonical ensemble :ref:`(Feynman) `. + The classical partition function and its components are given by the following equations: .. math:: Z = & \int d{\bf q} d{\bf p} \cdot \textrm{exp} [ -\beta H_{eff} ] \\ - H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2m_i}\bigg) + V_{eff} \\ + H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2M_i}\bigg) + V_{eff} \\ V_{eff} = & \sum_{i=1}^P \bigg[ \frac{mP}{2\beta^2 \hbar^2} (q_i - q_{i+1})^2 + \frac{1}{P} V(q_i)\bigg] +:math:`M_i` is the fictitious mass of the :math:`i`-th mode, and m is the actual mass of the atoms. + The interested user is referred to any of the numerous references on -this methodology, but briefly, each quantum particle in a path -integral simulation is represented by a ring-polymer of P quasi-beads, -labeled from 1 to P. During the simulation, each quasi-bead interacts -with beads on the other ring-polymers with the same imaginary time -index (the second term in the effective potential above). The -quasi-beads also interact with the two neighboring quasi-beads through -the spring potential in imaginary-time space (first term in effective -potential). To sample the canonical ensemble, a Nose-Hoover massive -chain thermostat is applied :ref:`(Tuckerman) `. With the -massive chain algorithm, a chain of NH thermostats is coupled to each -degree of freedom for each quasi-bead. The keyword *temp* sets the -target temperature for the system and the keyword *nhc* sets the -number *Nc* of thermostats in each chain. For example, for a -simulation of N particles with P beads in each ring-polymer, the total -number of NH thermostats would be 3 x N x P x Nc. +this methodology, but briefly, each quantum particle in a path integral +simulation is represented by a ring-polymer of P quasi-beads, labeled +from 1 to P. During the simulation, each quasi-bead interacts with +beads on the other ring-polymers with the same imaginary time index (the +second term in the effective potential above). The quasi-beads also +interact with the two neighboring quasi-beads through the spring +potential in imaginary-time space (first term in effective potential). +To sample the canonical ensemble, any thermostat can be applied. + +Fix *pimd/nvt* applies a Nose-Hoover massive chain thermostat +:ref:`(Tuckerman) `. With the massive chain +algorithm, a chain of NH thermostats is coupled to each degree of +freedom for each quasi-bead. The keyword *temp* sets the target +temperature for the system and the keyword *nhc* sets the number *Nc* of +thermostats in each chain. For example, for a simulation of N particles +with P beads in each ring-polymer, the total number of NH thermostats +would be 3 x N x P x Nc. + +Fix *pimd/langevin* implements a Langevin thermostat in the normal mode +representation, and also provides a barostat to sample the NPH/NPT ensembles. .. note:: - Fix pimd/nvt implements a complete velocity-verlet integrator - combined with NH massive chain thermostat, so no other time - integration fix should be used. + Both these *fix* styles implement a complete velocity-verlet integrator + combined with a thermostat, so no other time integration fix should be used. The *method* keyword determines what style of PIMD is performed. A value of *pimd* is standard PIMD. A value of *nmpimd* is for @@ -81,7 +120,7 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics (CMD). The difference between the styles is as follows. In standard PIMD, the value used for a bead's fictitious mass is - arbitrary. A common choice is to use Mi = m/P, which results in the + arbitrary. A common choice is to use :math:`M_i = m/P`, which results in the mass of the entire ring-polymer being equal to the real quantum particle. But it can be difficult to efficiently integrate the equations of motion for the stiff harmonic interactions in the ring @@ -97,6 +136,10 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics overall translation of the ring-polymer and is assigned the mass of the real particle. +.. note:: + Fix pimd/langevin only supports *method* value *nmpimd*. This should be enough + for most PIMD applications for quantum thermodynamics purpose. + Motion of the centroid can be effectively uncoupled from the other normal modes by scaling the fictitious masses to achieve a partial adiabatic separation. This is called a Centroid Molecular Dynamics @@ -108,17 +151,86 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics only the k > 0 modes are thermostatted, not the centroid degrees of freedom. +The keyword *integrator* specifies the Trotter splitting method used by *fix pimd/langevin*. +See :ref:`(Liu) ` for a discussion on the OBABO and BAOAB splitting schemes. Typically +either of the two should work fine. + The keyword *fmass* sets a further scaling factor for the fictitious masses of beads, which can be used for the Partial Adiabatic CMD :ref:`(Hone) `, or to be set as P, which results in the fictitious masses to be equal to the real particle masses. +The keyword *fmmode* of *fix pimd/langevin* determines the mode of fictitious +mass preconditioning. There are two options: *physical* and *normal*. If *fmmode* is +*physical*, then the physical mass of the particles are used (and then multiplied by +*fmass*). If *fmmode* is *normal*, then the physical mass is first multiplied by the +eigenvalue of each normal mode, and then multiplied by *fmass*. More precisely, the +fictitious mass of *fix pimd/langevin* is determined by two factors: *fmmode* and *fmass*. +If *fmmode* is *physical*, then the fictitious mass is + +.. math:: + + M_i = \mathrm{fmass} \times m + +If *fmmode* is *normal*, then the fictitious mass is + +.. math:: + + M_i = \mathrm{fmass} \times \lambda_i \times m + +where :math:`\lambda_i` is the eigenvalue of the :math:`i`-th normal mode. + +.. note:: + + Fictitious mass is only used in the momentum of the equation of motion + (:math:`\mathbf{p}_i=M_i\mathbf{v}_i`), and not used in the spring elastic energy + (:math:`\sum_{i=1}^P \frac{1}{2}m\omega_P^2(q_i - q_{i+1})^2`, :math:`m` is always the + actual mass of the particles). + The keyword *sp* is a scaling factor on Planck's constant, which can be useful for debugging or other purposes. The default value of 1.0 is appropriate for most situations. +The keyword *ensemble* for fix style *pimd/langevin* determines which ensemble is it +going to sample. The value can be *nve* (microcanonical), *nvt* (canonical), *nph* (isoenthalpic), +and *npt* (isothermal-isobaric). + +The keyword *temp* specifies temperature parameter for fix styles *pimd/nvt* and *pimd/langevin*. It should read +a positive floating-point number. + +.. note:: + + For pimd simulations, a temperature values should be specified even for nve ensemble. Temperature will make a difference + for nve pimd, since the spring elastic frequency between the beads will be affected by the temperature. + +The keyword *thermostat* reads *style* and *seed* of thermostat for fix style *pimd/langevin*. *style* can only +be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`Ceriotti `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. + +.. note:: + The fix style *pimd/langevin* uses the stochastic PILE_L thermostat to control temperature. This thermostat works on the normal modes + of the ring polymer. The *tau* parameter controls the centroid mode, and the *scale* parameter controls the non-centroid modes. + +The keyword *tau* specifies the thermostat damping time parameter for fix style *pimd/langevin*. It is in time unit. It only works on the centroid mode. + +The keyword *scale* specifies a scaling parameter for the damping times of the non-centroid modes for fix style *pimd/langevin*. The default +damping time of the non-centroid mode :math:`i` is :math:`\frac{P}{\beta\hbar}\sqrt{\lambda_i\times\mathrm{fmass}}` (*fmmode* is *physical*) or :math:`\frac{P}{\beta\hbar}\sqrt{\mathrm{fmass}}` (*fmmode* is *normal*). The damping times of all non-centroid modes are the default values divided by *scale*. + +The barostat parameters for fix style *pimd/langevin* with *npt* or *nph* ensemble is specified using one of *iso* and *aniso* +keywords. A *pressure* value should be given with pressure unit. The keyword *iso* means couple all 3 diagonal components together when pressure is computed (hydrostatic pressure), and dilate/contract the dimensions together. The keyword *aniso* means x, y, and z dimensions are controlled independently using the Pxx, Pyy, and Pzz components of the stress tensor as the driving forces, and the specified scalar external pressure. + +The keyword *barostat* reads *style* of barostat for fix style *pimd/langevin*. *style* can +be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`Bussi `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`Martyna1 ` and :ref:`Martyna2 `). + +The keyword *taup* specifies the barostat damping time parameter for fix style *pimd/langevin*. It is in time unit. + +The keyword *fixcom* specifies whether the center-of-mass of the extended ring-polymer system is fixed during the pimd simulation. +Once *fixcom* is set to be *yes*, the center-of-mass velocity will be distracted from the centroid-mode velocities in each step. + +The keyword *lj* should be used if :doc:`lj units ` is used for *fix pimd/langevin*. Typically one may want to use +reduced units to run the simulation, and then convert the results into some physical units (for example, :doc:`metal units `). In this case, the 5 quantities in the physical mass units are needed: epsilon (energy scale), sigma (length scale), mass, Planck's constant, mvv2e (mass * velocity^2 to energy conversion factor). Planck's constant and mvv2e can be found in src/update.cpp. If there is no need to convert reduced units to physical units, set all these five value to 1. + The PIMD algorithm in LAMMPS is implemented as a hyper-parallel scheme -as described in :ref:`(Calhoun) `. In LAMMPS this is done by using +as described in :ref:`Calhoun `. In LAMMPS this is done by using :doc:`multi-replica feature ` in LAMMPS, where each quasi-particle system is stored and simulated on a separate partition of processors. The following diagram illustrates this approach. The @@ -152,22 +264,49 @@ related tasks for each of the partitions, e.g. .. code-block:: LAMMPS dump dcd all dcd 10 system_${ibead}.dcd + dump 1 all custom 100 ${ibead}.xyz id type x y z vx vy vz ix iy iz fx fy fz restart 1000 system_${ibead}.restart1 system_${ibead}.restart2 read_restart system_${ibead}.restart2 +.. note:: + Fix *pimd/langevin* dumps the Cartesian coordinates, but dumps the velocities and + forces in the normal mode representation. If the Cartesian velocities and forces are + needed, it is easy to perform the transformation when doing post-processing. + + It is recommended to dump the image flags (*ix iy iz*) for fix *pimd/langevin*. It + will be useful if you want to calculate some estimators during post-processing. + +Major differences of *fix pimd/nvt* and *fix pimd/langevin* are: + + #. *Fix pimd/nvt* includes Cartesian pimd, normal mode pimd, and centroid md. *Fix pimd/langevin* only intends to support normal mode pimd, as it is commonly enough for thermodynamic sampling. + #. *Fix pimd/nvt* uses Nose-Hoover chain thermostat. *Fix pimd/langevin* uses Langevin thermostat. + #. *Fix pimd/langevin* provides barostat, so the npt ensemble can be sampled. *Fix pimd/nvt* only support nvt ensemble. + #. *Fix pimd/langevin* provides several quantum estimators in output. + #. *Fix pimd/langevin* allows multiple processes for each bead. For *fix pimd/nvt*, there is a large chance that multi-process tasks for each bead may fail. + #. The dump of *fix pimd/nvt* are all Cartesian. *Fix pimd/langevin* dumps normal-mode velocities and forces, and Cartesian coordinates. + +Initially, the inter-replica communication and normal mode transformation parts of *fix pimd/langevin* are written based on +those of *fix pimd/nvt*, but are significantly revised. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -Fix pimd/nvt writes the state of the Nose/Hoover thermostat over all +Fix *pimd/nvt* writes the state of the Nose/Hoover thermostat over all quasi-beads to :doc:`binary restart files `. See the :doc:`read_restart ` command for info on how to re-specify a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. +Fix *pimd/langevin* writes the state of the barostat overall beads to +:doc:`binary restart files `. Since it uses a stochastic thermostat, +the state of the thermostat is not written. However, the state of the system +can be restored by reading the restart file, except that it will re-initialize +the random number generator. + None of the :doc:`fix_modify ` options are relevant to fix pimd/nvt. -Fix pimd/nvt computes a global 3-vector, which can be accessed by +Fix *pimd/nvt* computes a global 3-vector, which can be accessed by various :doc:`output commands `. The three quantities in the global vector are: @@ -176,21 +315,80 @@ the global vector are: #. the current value of the scalar virial estimator for the kinetic energy of the quantum system :ref:`(Herman) `. -The vector values calculated by fix pimd/nvt are "extensive", except for the +The vector values calculated by fix *pimd/nvt* are "extensive", except for the temperature, which is "intensive". -No parameter of fix pimd/nvt can be used with the *start/stop* keywords -of the :doc:`run ` command. Fix pimd/nvt is not invoked during +Fix *pimd/langevin* computes a global vector of quantities, which +can be accessed by various :doc:`output commands `. Note that +it outputs multiple log files, and different log files contain information +about different beads or modes (see detailed explanations below). If *ensemble* +is *nve* or *nvt*, the vector has 10 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + +The first 3 are different for different log files, and the others are the same for different log files. + +If *ensemble* is *nph* or *npt*, the vector stores internal variables of the barostat. If *iso* is used, +the vector has 15 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + #. barostat velocity + #. barostat kinetic energy + #. barostat potential energy + #. barostat cell Jacobian + #. enthalpy of the extended system (sum of 4, 12, 13, and 14; conserved if *ensemble* is *nph*) + +If *aniso* or *x* or *y* or *z* is used for the barostat, the vector has 17 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + #. x component of barostat velocity + #. y component of barostat velocity + #. z component of barostat velocity + #. barostat kinetic energy + #. barostat potential energy + #. barostat cell Jacobian + #. enthalpy of the extended system (sum of 4, 14, 15, and 16; conserved if *ensemble* is *nph*) + +No parameter of fix *pimd/nvt* or *pimd/langevin* can be used with the *start/stop* keywords +of the :doc:`run ` command. Fix *pimd/nvt* or *pimd/langevin* is not invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix is part of the REPLICA package. It is only enabled if LAMMPS -was built with that package. See the :doc:`Build package +These fixes are part of the REPLICA package. They are only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -Fix pimd/nvt cannot be used with :doc:`lj units `. +Fix *pimd/nvt* cannot be used with :doc:`lj units `. +Fix *pimd/langevin* can be used with :doc:`lj units `. See the above part for how to use it. A PIMD simulation can be initialized with a single data file read via the :doc:`read_data ` command. However, this means all @@ -207,7 +405,7 @@ variable, e.g. Default """"""" -The keyword defaults for fix pimd/nvt are method = pimd, fmass = 1.0, sp +The keyword defaults for fix *pimd/nvt* are method = pimd, fmass = 1.0, sp = 1.0, temp = 300.0, and nhc = 2. ---------- @@ -243,3 +441,22 @@ Path Integrals, McGraw-Hill, New York (1965). **(Herman)** M. F. Herman, E. J. Bruskin, B. J. Berne, J Chem Phys, 76, 5150 (1982). +.. _Bussi: + +**(Bussi)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). + +.. _Ceriotti3: + +**(Ceriotti)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). + +.. _Martyna3: + +**(Martyna1)** G. Martyna, D. Tobias, M. Klein, J. Chem. Phys. 101, 4177 (1994). + +.. _Martyna4: + +**(Martyna2)** G. Martyna, A. Hughes, M. Tuckerman, J. Chem. Phys. 110, 3275 (1999). + +.. _Liujian: + +**(Liu)** J. Liu, D. Li, X. Liu, J. Chem. Phys. 145, 024103 (2016). diff --git a/doc/src/fix_planeforce.rst b/doc/src/fix_planeforce.rst index d0f1b8102e..f4032cf829 100644 --- a/doc/src/fix_planeforce.rst +++ b/doc/src/fix_planeforce.rst @@ -6,7 +6,7 @@ fix planeforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID planeforce x y z diff --git a/doc/src/fix_plumed.rst b/doc/src/fix_plumed.rst index c562ecc81d..ca56f83958 100644 --- a/doc/src/fix_plumed.rst +++ b/doc/src/fix_plumed.rst @@ -6,7 +6,7 @@ fix plumed command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID plumed keyword value ... diff --git a/doc/src/fix_poems.rst b/doc/src/fix_poems.rst index 7ecb4eef7d..a43e552fbb 100644 --- a/doc/src/fix_poems.rst +++ b/doc/src/fix_poems.rst @@ -6,7 +6,7 @@ fix poems command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID poems keyword values diff --git a/doc/src/fix_polarize.rst b/doc/src/fix_polarize.rst index dd8a0c7d75..93ef1e4276 100644 --- a/doc/src/fix_polarize.rst +++ b/doc/src/fix_polarize.rst @@ -14,7 +14,7 @@ fix polarize/functional command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style nevery tolerance @@ -130,10 +130,23 @@ Fix *polarize/functional* employs the energy functional variation approach as described in :ref:`(Jadhao) ` to solve :math:`\sigma_b`. +The induced charges computed by these fixes are stored in the *q_scaled* field, +and can be accessed as in the following example: + +.. code-block:: LAMMPS + + compute qs all property/atom q_scaled + dump 1 all custom 1000 all.txt id type q x y z c_qs + +Note that the *q* field is the regular atom charges, which do not change +during the simulation. For interface particles, *q_scaled* is the sum +of the real charge, divided by the local dielectric constant *epsilon*, +and their induced charges. For non-interface particles, *q_scaled* is +the real charge, divided by the local dielectric constant *epsilon*. + More details on the implementation of these fixes and their recommended use are described in :ref:`(NguyenTD) `. - Restart, fix_modify, output, run start/stop, minimize info """""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_pour.rst b/doc/src/fix_pour.rst index 6ef18ea800..eca1f70c41 100644 --- a/doc/src/fix_pour.rst +++ b/doc/src/fix_pour.rst @@ -6,7 +6,7 @@ fix pour command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID pour N type seed keyword values ... @@ -123,15 +123,17 @@ command which also appears in your input script. .. note:: - If you wish the new rigid molecules (and other rigid molecules) - to be thermostatted correctly via :doc:`fix rigid/small/nvt ` - or :doc:`fix rigid/small/npt `, then you need to use the - "fix_modify dynamic/dof yes" command for the rigid fix. This is to - inform that fix that the molecule count will vary dynamically. + If you wish the new rigid molecules (and other rigid molecules) to be + thermostatted correctly via :doc:`fix rigid/small/nvt ` or + :doc:`fix rigid/small/npt `, then you need to use the + :doc:`fix_modify dynamic/dof yes ` command for the rigid + fix. This is to inform that fix that the molecule count will vary + dynamically. If you wish to insert molecules via the *mol* keyword, that will have their bonds or angles constrained via SHAKE, use the *shake* keyword, -specifying as its value the ID of a separate :doc:`fix shake ` command which also appears in your input script. +specifying as its value the ID of a separate :doc:`fix shake +` command which also appears in your input script. Each timestep particles are inserted, they are placed randomly inside the insertion volume so as to mimic a stream of poured particles. If @@ -148,10 +150,10 @@ many timesteps until the desired # of particles has been inserted. .. note:: - If you are monitoring the temperature of a system where the - particle count is changing due to adding particles, you typically - should use the :doc:`compute_modify dynamic yes ` - command for the temperature compute you are using. + If you are monitoring the temperature of a system where the particle + count is changing due to adding particles, you typically should use + the :doc:`compute_modify dynamic/dof yes ` command + for the temperature compute you are using. ---------- diff --git a/doc/src/fix_press_berendsen.rst b/doc/src/fix_press_berendsen.rst index dee93c5b8b..09ec44e673 100644 --- a/doc/src/fix_press_berendsen.rst +++ b/doc/src/fix_press_berendsen.rst @@ -6,7 +6,7 @@ fix press/berendsen command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID press/berendsen keyword value ... diff --git a/doc/src/fix_print.rst b/doc/src/fix_print.rst index 938b40d1f9..1ec643a635 100644 --- a/doc/src/fix_print.rst +++ b/doc/src/fix_print.rst @@ -6,7 +6,7 @@ fix print command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID print N string keyword value ... @@ -44,7 +44,7 @@ one word. If it contains variables it must be enclosed in double quotes to ensure they are not evaluated when the input script line is read, but will instead be evaluated each time the string is printed. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 support for vector style variables diff --git a/doc/src/fix_propel_self.rst b/doc/src/fix_propel_self.rst index 863d43b6f2..0b932c7316 100644 --- a/doc/src/fix_propel_self.rst +++ b/doc/src/fix_propel_self.rst @@ -6,7 +6,7 @@ fix propel/self command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID propel/self mode magnitude keyword values diff --git a/doc/src/fix_property_atom.rst b/doc/src/fix_property_atom.rst index d09c15d192..b177fe9a96 100644 --- a/doc/src/fix_property_atom.rst +++ b/doc/src/fix_property_atom.rst @@ -9,7 +9,7 @@ Accelerator Variants: *property/atom/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID property/atom name1 name2 ... keyword value ... diff --git a/doc/src/fix_python_invoke.rst b/doc/src/fix_python_invoke.rst index c82fb91a27..ad55882270 100644 --- a/doc/src/fix_python_invoke.rst +++ b/doc/src/fix_python_invoke.rst @@ -6,7 +6,7 @@ fix python/invoke command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID python/invoke N callback function_name diff --git a/doc/src/fix_python_move.rst b/doc/src/fix_python_move.rst index b338dcbfac..63898f3aa1 100644 --- a/doc/src/fix_python_move.rst +++ b/doc/src/fix_python_move.rst @@ -6,7 +6,7 @@ fix python/move command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix python/move pymodule.CLASS diff --git a/doc/src/fix_qbmsst.rst b/doc/src/fix_qbmsst.rst index 5428eeb637..3234335b6b 100644 --- a/doc/src/fix_qbmsst.rst +++ b/doc/src/fix_qbmsst.rst @@ -6,7 +6,7 @@ fix qbmsst command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qbmsst dir shockvel keyword value ... diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index 73cf013fb9..bace7af0ca 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -22,7 +22,7 @@ fix qeq/fire command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style Nevery cutoff tolerance maxiter qfile keyword ... diff --git a/doc/src/fix_qeq_comb.rst b/doc/src/fix_qeq_comb.rst index 0c04a8c4a7..f93a650c17 100644 --- a/doc/src/fix_qeq_comb.rst +++ b/doc/src/fix_qeq_comb.rst @@ -9,7 +9,7 @@ Accelerator Variants: *qeq/comb/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qeq/comb Nevery precision keyword value ... diff --git a/doc/src/fix_qeq_reaxff.rst b/doc/src/fix_qeq_reaxff.rst index db9015f187..e90842ea6a 100644 --- a/doc/src/fix_qeq_reaxff.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -10,7 +10,7 @@ Accelerator Variants: *qeq/reaxff/kk*, *qeq/reaxff/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qeq/reaxff Nevery cutlo cuthi tolerance params args @@ -128,9 +128,12 @@ periodic cell dimensions less than 10 Angstroms. This fix may be used in combination with :doc:`fix efield ` and will apply the external electric field during charge equilibration, -but there may be only one fix efield instance used, it may only use a -constant electric field, and the electric field vector may only have -components in non-periodic directions. +but there may be only one fix efield instance used and the electric field +vector may only have components in non-periodic directions. Equal-style +variables can be used for electric field vector components without any further +settings. Atom-style variables can be used for spatially-varying electric field +vector components, but the resulting electric potential must be specified +as an atom-style variable using the *potential* keyword for `fix efield`. Related commands """""""""""""""" diff --git a/doc/src/fix_qmmm.rst b/doc/src/fix_qmmm.rst index 546635520c..eabbdbba03 100644 --- a/doc/src/fix_qmmm.rst +++ b/doc/src/fix_qmmm.rst @@ -6,7 +6,7 @@ fix qmmm command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qmmm diff --git a/doc/src/fix_qtb.rst b/doc/src/fix_qtb.rst index c41a58a8f4..2112a0f14b 100644 --- a/doc/src/fix_qtb.rst +++ b/doc/src/fix_qtb.rst @@ -6,7 +6,7 @@ fix qtb command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qtb keyword value ... diff --git a/doc/src/fix_reaxff_bonds.rst b/doc/src/fix_reaxff_bonds.rst index 15b2eb6da9..15fd9abafa 100644 --- a/doc/src/fix_reaxff_bonds.rst +++ b/doc/src/fix_reaxff_bonds.rst @@ -9,7 +9,7 @@ Accelerator Variants: *reaxff/bonds/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID reaxff/bonds Nevery filename diff --git a/doc/src/fix_reaxff_species.rst b/doc/src/fix_reaxff_species.rst index f57132f08b..9bf1a82933 100644 --- a/doc/src/fix_reaxff_species.rst +++ b/doc/src/fix_reaxff_species.rst @@ -9,7 +9,7 @@ Accelerator Variants: *reaxff/species/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID reaxff/species Nevery Nrepeat Nfreq filename keyword value ... @@ -25,7 +25,7 @@ Syntax .. parsed-literal:: *cutoff* value = I J Cutoff - I, J = atom types + I, J = atom types (see asterisk form below) Cutoff = Bond-order cutoff value for this pair of atom types *element* value = Element1, Element2, ... *position* value = posfreq filepos @@ -49,7 +49,7 @@ Examples .. code-block:: LAMMPS fix 1 all reaxff/species 10 10 100 species.out - fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2 0.55 + fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2*3 0.55 fix 1 all reaxff/species 1 100 100 species.out element Au O H position 1000 AuOH.pos fix 1 all reaxff/species 1 100 100 species.out delete species.del masslimit 0 50 @@ -88,13 +88,24 @@ If the filename ends with ".gz", the output file is written in gzipped format. A gzipped dump file will be about 3x smaller than the text version, but will also take longer to write. +.. versionadded:: 15Jun2023 + + Support for wildcards added + Optional keyword *cutoff* can be assigned to change the minimum bond-order values used in identifying chemical bonds between pairs of atoms. Bond-order cutoffs should be carefully chosen, as bond-order -cutoffs that are too small may include too many bonds (which will -result in an error), while cutoffs that are too large will result in -fragmented molecules. The default cutoff of 0.3 usually gives good -results. +cutoffs that are too small may include too many bonds (which will result +in an error), while cutoffs that are too large will result in fragmented +molecules. The default cutoff of 0.3 usually gives good results. A +wildcard asterisk can be used in place of or in conjunction with the I,J +arguments to set the bond-order cutoff for multiple pairs of atom types. +This takes the form "\*" or "\*n" or "n\*" or "m\*n". If :math:`N` is +the number of atom types, then an asterisk with no numeric values means +all types from 1 to :math:`N`. A leading asterisk means all types from +1 to n (inclusive). A trailing asterisk means all types from n to +:math:`N` (inclusive). A middle asterisk means all types from m to n +(inclusive). The optional keyword *element* can be used to specify the chemical symbol printed for each LAMMPS atom type. The number of symbols must diff --git a/doc/src/fix_recenter.rst b/doc/src/fix_recenter.rst index 520564677a..9991904b37 100644 --- a/doc/src/fix_recenter.rst +++ b/doc/src/fix_recenter.rst @@ -6,7 +6,7 @@ fix recenter command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID recenter x y z keyword value ... diff --git a/doc/src/fix_rhok.rst b/doc/src/fix_rhok.rst index 9d6114328f..7ac40e1bed 100644 --- a/doc/src/fix_rhok.rst +++ b/doc/src/fix_rhok.rst @@ -6,7 +6,7 @@ fix rhok command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID rhok nx ny nz K a diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index 884d883f5a..89759da817 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -60,7 +60,7 @@ fix rigid/nph/small command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style bodystyle args keyword values ... @@ -610,10 +610,12 @@ such attributes: the total mass of the rigid body, its center-of-mass position, its 6 moments of inertia, its center-of-mass velocity, and the 3 image flags of the center-of-mass position. For rigid bodies consisting of point particles or non-overlapping finite-size -particles, LAMMPS can compute these values accurately. However, for -rigid bodies consisting of finite-size particles which overlap each -other, LAMMPS will ignore the overlaps when computing these 4 -attributes. The amount of error this induces depends on the amount of +particles, LAMMPS can compute these values accurately. + +However, for rigid bodies consisting of finite-size particles which +overlap each other, LAMMPS will ignore the overlaps when computing +these 4 attributes, which means the dynamics of the bodies will be +incorrect. The amount of error this induces depends on the amount of overlap. To avoid this issue, the values can be pre-computed (e.g. using Monte Carlo integration). @@ -677,6 +679,28 @@ cross periodic boundaries during the simulation. auxiliary file will contain one line for every rigid body, even if the original file only listed a subset of the rigid bodies. +If the system has rigid bodies with finite-size overlapping particles +and the model uses the :doc:`fix gravity ` command to +apply a gravitational force to the rigid bodies, then the *gravity* +keyword should be used in the following manner. + +First, the group specified for the :doc:`fix gravity ` +command should not include any atoms in rigid bodies which have +overlapping particles. It can be empty (see the :doc:`group empty +` command) or only contain single particles not in rigid +bodies, e.g. background particles. + +Second, the *infile* keyword should be used to specify the total mass +and other properties of the rigid bodies with overlaps, so that their +dynamics will be modeled correctly, as explained above. + +Third, the *gravity* keyword should be used the with the ID of the +:doc:`fix gravity ` command as its argument. The rigid +fixes will access the gravity fix to extract the current direction of +the gravity vector at each timestep (which can be static or dynamic). +A gravity force will then be applied to each rigid body at its +center-of-mass position using its total mass. + ---------- If you use a :doc:`temperature compute ` with a group that diff --git a/doc/src/fix_rigid_meso.rst b/doc/src/fix_rigid_meso.rst index 1c70092092..c8c994fd26 100644 --- a/doc/src/fix_rigid_meso.rst +++ b/doc/src/fix_rigid_meso.rst @@ -6,7 +6,7 @@ fix rigid/meso command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID rigid/meso bodystyle args keyword values ... diff --git a/doc/src/fix_rx.rst b/doc/src/fix_rx.rst index 4028a4e7e1..631b227449 100644 --- a/doc/src/fix_rx.rst +++ b/doc/src/fix_rx.rst @@ -9,7 +9,7 @@ Accelerator Variants: *rx/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID rx file localTemp matrix solver minSteps ... diff --git a/doc/src/fix_saed_vtk.rst b/doc/src/fix_saed_vtk.rst index cd3cad7c72..e0cf251780 100644 --- a/doc/src/fix_saed_vtk.rst +++ b/doc/src/fix_saed_vtk.rst @@ -6,7 +6,7 @@ fix saed/vtk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID saed/vtk Nevery Nrepeat Nfreak c_ID attribute args ... keyword args ... diff --git a/doc/src/fix_setforce.rst b/doc/src/fix_setforce.rst index e115c52991..e194ad4c11 100644 --- a/doc/src/fix_setforce.rst +++ b/doc/src/fix_setforce.rst @@ -13,7 +13,7 @@ fix setforce/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID setforce fx fy fz keyword value ... diff --git a/doc/src/fix_sgcmc.rst b/doc/src/fix_sgcmc.rst index fd6f8beab4..63cfaf22da 100644 --- a/doc/src/fix_sgcmc.rst +++ b/doc/src/fix_sgcmc.rst @@ -6,7 +6,7 @@ fix sgcmc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID sgcmc every_nsteps swap_fraction temperature deltamu ... diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index 2483b9431a..73caa9c668 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -13,7 +13,7 @@ fix rattle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style tol iter N constraint values ... keyword value ... diff --git a/doc/src/fix_shardlow.rst b/doc/src/fix_shardlow.rst index 468985be1b..bc2684af53 100644 --- a/doc/src/fix_shardlow.rst +++ b/doc/src/fix_shardlow.rst @@ -9,7 +9,7 @@ Accelerator Variants: *shardlow/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID shardlow diff --git a/doc/src/fix_smd.rst b/doc/src/fix_smd.rst index 4c682e66c0..14892227fd 100644 --- a/doc/src/fix_smd.rst +++ b/doc/src/fix_smd.rst @@ -6,7 +6,7 @@ fix smd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID smd type values keyword values diff --git a/doc/src/fix_smd_setvel.rst b/doc/src/fix_smd_setvel.rst index 9dcc3c636c..31b92491ab 100644 --- a/doc/src/fix_smd_setvel.rst +++ b/doc/src/fix_smd_setvel.rst @@ -6,7 +6,7 @@ fix smd/setvel command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID smd/setvel vx vy vz keyword value ... diff --git a/doc/src/fix_sph.rst b/doc/src/fix_sph.rst index 1133142f05..4932485b03 100644 --- a/doc/src/fix_sph.rst +++ b/doc/src/fix_sph.rst @@ -6,7 +6,7 @@ fix sph command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID sph diff --git a/doc/src/fix_sph_stationary.rst b/doc/src/fix_sph_stationary.rst index 4496a10eca..07bedad4c3 100644 --- a/doc/src/fix_sph_stationary.rst +++ b/doc/src/fix_sph_stationary.rst @@ -6,7 +6,7 @@ fix sph/stationary command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID sph/stationary diff --git a/doc/src/fix_spring.rst b/doc/src/fix_spring.rst index 007f2cd278..b85fe26813 100644 --- a/doc/src/fix_spring.rst +++ b/doc/src/fix_spring.rst @@ -6,7 +6,7 @@ fix spring command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring keyword values diff --git a/doc/src/fix_spring_chunk.rst b/doc/src/fix_spring_chunk.rst index 3d3069c53e..63a225e878 100644 --- a/doc/src/fix_spring_chunk.rst +++ b/doc/src/fix_spring_chunk.rst @@ -6,7 +6,7 @@ fix spring/chunk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring/chunk K chunkID comID diff --git a/doc/src/fix_spring_rg.rst b/doc/src/fix_spring_rg.rst index aba35c8134..e615771d2a 100644 --- a/doc/src/fix_spring_rg.rst +++ b/doc/src/fix_spring_rg.rst @@ -6,7 +6,7 @@ fix spring/rg command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring/rg K RG0 diff --git a/doc/src/fix_spring_self.rst b/doc/src/fix_spring_self.rst index 6cf0a9e0e7..3383f27ebb 100644 --- a/doc/src/fix_spring_self.rst +++ b/doc/src/fix_spring_self.rst @@ -6,7 +6,7 @@ fix spring/self command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring/self K dir diff --git a/doc/src/fix_srd.rst b/doc/src/fix_srd.rst index 04eaeed251..1fc574a7ad 100644 --- a/doc/src/fix_srd.rst +++ b/doc/src/fix_srd.rst @@ -6,7 +6,7 @@ fix srd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID srd N groupbig-ID Tsrd hgrid seed keyword value ... diff --git a/doc/src/fix_store_force.rst b/doc/src/fix_store_force.rst index f6bed4d4af..487d4f0352 100644 --- a/doc/src/fix_store_force.rst +++ b/doc/src/fix_store_force.rst @@ -6,7 +6,7 @@ fix store/force command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID store/force diff --git a/doc/src/fix_store_state.rst b/doc/src/fix_store_state.rst index b47b6900aa..4a0bef2f74 100644 --- a/doc/src/fix_store_state.rst +++ b/doc/src/fix_store_state.rst @@ -6,7 +6,7 @@ fix store/state command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID store/state N input1 input2 ... keyword value ... diff --git a/doc/src/fix_temp_berendsen.rst b/doc/src/fix_temp_berendsen.rst index 473c30aced..67e496e6c5 100644 --- a/doc/src/fix_temp_berendsen.rst +++ b/doc/src/fix_temp_berendsen.rst @@ -6,7 +6,7 @@ fix temp/berendsen command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/berendsen Tstart Tstop Tdamp diff --git a/doc/src/fix_temp_csvr.rst b/doc/src/fix_temp_csvr.rst index 5fc6e8eae7..781ce97d96 100644 --- a/doc/src/fix_temp_csvr.rst +++ b/doc/src/fix_temp_csvr.rst @@ -10,7 +10,7 @@ fix temp/csld command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/csvr Tstart Tstop Tdamp seed fix ID group-ID temp/csld Tstart Tstop Tdamp seed diff --git a/doc/src/fix_temp_rescale.rst b/doc/src/fix_temp_rescale.rst index 41ad8709cc..bfdcaa90f8 100644 --- a/doc/src/fix_temp_rescale.rst +++ b/doc/src/fix_temp_rescale.rst @@ -6,7 +6,7 @@ fix temp/rescale command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/rescale N Tstart Tstop window fraction diff --git a/doc/src/fix_temp_rescale_eff.rst b/doc/src/fix_temp_rescale_eff.rst index ea3996e9b6..b92feccfed 100644 --- a/doc/src/fix_temp_rescale_eff.rst +++ b/doc/src/fix_temp_rescale_eff.rst @@ -6,7 +6,7 @@ fix temp/rescale/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/rescale/eff N Tstart Tstop window fraction diff --git a/doc/src/fix_tfmc.rst b/doc/src/fix_tfmc.rst index 7eb4d24935..f3379c1e2f 100644 --- a/doc/src/fix_tfmc.rst +++ b/doc/src/fix_tfmc.rst @@ -6,7 +6,7 @@ fix tfmc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID tfmc Delta Temp seed keyword value diff --git a/doc/src/fix_tgnh_drude.rst b/doc/src/fix_tgnh_drude.rst index d1f5cf19a4..0a67af291f 100644 --- a/doc/src/fix_tgnh_drude.rst +++ b/doc/src/fix_tgnh_drude.rst @@ -11,7 +11,7 @@ fix tgnpt/drude command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword values ... diff --git a/doc/src/fix_thermal_conductivity.rst b/doc/src/fix_thermal_conductivity.rst index 0652810267..041fde8be5 100644 --- a/doc/src/fix_thermal_conductivity.rst +++ b/doc/src/fix_thermal_conductivity.rst @@ -6,7 +6,7 @@ fix thermal/conductivity command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID thermal/conductivity N edim Nbin keyword value ... diff --git a/doc/src/fix_ti_spring.rst b/doc/src/fix_ti_spring.rst index d519f36157..6273164d52 100644 --- a/doc/src/fix_ti_spring.rst +++ b/doc/src/fix_ti_spring.rst @@ -6,7 +6,7 @@ fix ti/spring command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ti/spring k t_s t_eq keyword value ... diff --git a/doc/src/fix_tmd.rst b/doc/src/fix_tmd.rst index ccebb35823..3ee7f2a5c8 100644 --- a/doc/src/fix_tmd.rst +++ b/doc/src/fix_tmd.rst @@ -6,7 +6,7 @@ fix tmd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID tmd rho_final file1 N file2 diff --git a/doc/src/fix_ttm.rst b/doc/src/fix_ttm.rst index 413c5f5c3c..ccf7f16554 100644 --- a/doc/src/fix_ttm.rst +++ b/doc/src/fix_ttm.rst @@ -14,7 +14,7 @@ fix ttm/mod command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ttm seed C_e rho_e kappa_e gamma_p gamma_s v_0 Nx Ny Nz keyword value ... fix ID group-ID ttm/mod seed init_file Nx Ny Nz keyword value ... diff --git a/doc/src/fix_tune_kspace.rst b/doc/src/fix_tune_kspace.rst index 6a3cba16e4..17e0710be8 100644 --- a/doc/src/fix_tune_kspace.rst +++ b/doc/src/fix_tune_kspace.rst @@ -6,7 +6,7 @@ fix tune/kspace command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID tune/kspace N diff --git a/doc/src/fix_vector.rst b/doc/src/fix_vector.rst index f4eee41269..95ec350e12 100644 --- a/doc/src/fix_vector.rst +++ b/doc/src/fix_vector.rst @@ -6,7 +6,7 @@ fix vector command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID vector Nevery value1 value2 ... diff --git a/doc/src/fix_viscosity.rst b/doc/src/fix_viscosity.rst index c99196e09b..187d723d68 100644 --- a/doc/src/fix_viscosity.rst +++ b/doc/src/fix_viscosity.rst @@ -6,7 +6,7 @@ fix viscosity command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID viscosity N vdim pdim Nbin keyword value ... diff --git a/doc/src/fix_viscous.rst b/doc/src/fix_viscous.rst index d5fd794020..68d2568529 100644 --- a/doc/src/fix_viscous.rst +++ b/doc/src/fix_viscous.rst @@ -9,7 +9,7 @@ Accelerator Variants: *viscous/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID viscous gamma keyword values ... diff --git a/doc/src/fix_viscous_sphere.rst b/doc/src/fix_viscous_sphere.rst index 13463c8c11..678cb9904f 100644 --- a/doc/src/fix_viscous_sphere.rst +++ b/doc/src/fix_viscous_sphere.rst @@ -6,7 +6,7 @@ fix viscous/sphere command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID viscous/sphere gamma keyword values ... diff --git a/doc/src/fix_wall.rst b/doc/src/fix_wall.rst index 42cd94978d..eb8219e157 100644 --- a/doc/src/fix_wall.rst +++ b/doc/src/fix_wall.rst @@ -37,7 +37,7 @@ fix wall/table command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style [tabstyle] [N] face args ... keyword value ... diff --git a/doc/src/fix_wall_body_polygon.rst b/doc/src/fix_wall_body_polygon.rst index ac0a58f55c..504ded6aaf 100644 --- a/doc/src/fix_wall_body_polygon.rst +++ b/doc/src/fix_wall_body_polygon.rst @@ -6,7 +6,7 @@ fix wall/body/polygon command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/body/polygon k_n c_n c_t wallstyle args keyword values ... diff --git a/doc/src/fix_wall_body_polyhedron.rst b/doc/src/fix_wall_body_polyhedron.rst index 9930c10f74..86bd35ae02 100644 --- a/doc/src/fix_wall_body_polyhedron.rst +++ b/doc/src/fix_wall_body_polyhedron.rst @@ -6,7 +6,7 @@ fix wall/body/polyhedron command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/body/polyhedron k_n c_n c_t wallstyle args keyword values ... diff --git a/doc/src/fix_wall_ees.rst b/doc/src/fix_wall_ees.rst index 9c7f82e015..7bcfc830e2 100644 --- a/doc/src/fix_wall_ees.rst +++ b/doc/src/fix_wall_ees.rst @@ -10,7 +10,7 @@ fix wall/region/ees command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style args diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 27d19d60b5..f6465d1159 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -9,7 +9,7 @@ Accelerator Variants: *wall/gran/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/gran fstyle fstyle_params wallstyle args keyword values ... diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 94edebbcf1..0a4343493b 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -6,7 +6,7 @@ fix wall/gran/region command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/gran/region fstyle fstyle_params wallstyle regionID keyword values ... diff --git a/doc/src/fix_wall_piston.rst b/doc/src/fix_wall_piston.rst index 1237d1ac7c..d60d8cb731 100644 --- a/doc/src/fix_wall_piston.rst +++ b/doc/src/fix_wall_piston.rst @@ -6,7 +6,7 @@ fix wall/piston command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/piston face ... keyword value ... diff --git a/doc/src/fix_wall_reflect.rst b/doc/src/fix_wall_reflect.rst index 8bb895280c..c2f4c3a6ab 100644 --- a/doc/src/fix_wall_reflect.rst +++ b/doc/src/fix_wall_reflect.rst @@ -9,7 +9,7 @@ Accelerator Variants: *wall/reflect/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/reflect face arg ... keyword value ... diff --git a/doc/src/fix_wall_reflect_stochastic.rst b/doc/src/fix_wall_reflect_stochastic.rst index 64e3d759c1..5a93950a5d 100644 --- a/doc/src/fix_wall_reflect_stochastic.rst +++ b/doc/src/fix_wall_reflect_stochastic.rst @@ -6,7 +6,7 @@ fix wall/reflect/stochastic command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/reflect/stochastic rstyle seed face args ... keyword value ... diff --git a/doc/src/fix_wall_region.rst b/doc/src/fix_wall_region.rst index adfd8402c6..466319c12e 100644 --- a/doc/src/fix_wall_region.rst +++ b/doc/src/fix_wall_region.rst @@ -6,7 +6,7 @@ fix wall/region command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/region region-ID style args ... cutoff diff --git a/doc/src/fix_wall_srd.rst b/doc/src/fix_wall_srd.rst index a8cbdd1619..dfb6560ffd 100644 --- a/doc/src/fix_wall_srd.rst +++ b/doc/src/fix_wall_srd.rst @@ -6,7 +6,7 @@ fix wall/srd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/srd face arg ... keyword value ... diff --git a/doc/src/fix_widom.rst b/doc/src/fix_widom.rst index 5be93100b3..ff66095db5 100644 --- a/doc/src/fix_widom.rst +++ b/doc/src/fix_widom.rst @@ -6,7 +6,7 @@ fix widom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID widom N M type seed T keyword values ... diff --git a/doc/src/group2ndx.rst b/doc/src/group2ndx.rst index e465c4629f..077f88e3e8 100644 --- a/doc/src/group2ndx.rst +++ b/doc/src/group2ndx.rst @@ -10,13 +10,13 @@ ndx2group command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS - group2ndx file group-ID ... - ndx2group file group-ID ... + group2ndx file args + ndx2group file args * file = name of index file to write out or read in -* zero or more group IDs may be appended +* args = zero or more group IDs may be appended Examples """""""" diff --git a/doc/src/hyper.rst b/doc/src/hyper.rst index 9266a95523..c707c6b3fc 100644 --- a/doc/src/hyper.rst +++ b/doc/src/hyper.rst @@ -6,7 +6,7 @@ hyper command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS hyper N Nevent fix-ID compute-ID keyword values ... diff --git a/doc/src/include.rst b/doc/src/include.rst index 6d146061db..5e19f4a377 100644 --- a/doc/src/include.rst +++ b/doc/src/include.rst @@ -6,7 +6,7 @@ include command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS include file diff --git a/doc/src/info.rst b/doc/src/info.rst index 853e5020fc..958542e3c8 100644 --- a/doc/src/info.rst +++ b/doc/src/info.rst @@ -6,7 +6,7 @@ info command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS info args diff --git a/doc/src/jump.rst b/doc/src/jump.rst index e8047222ef..bf56934d8f 100644 --- a/doc/src/jump.rst +++ b/doc/src/jump.rst @@ -6,7 +6,7 @@ jump command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS jump file label diff --git a/doc/src/label.rst b/doc/src/label.rst index 430587135f..bf232431d7 100644 --- a/doc/src/label.rst +++ b/doc/src/label.rst @@ -6,7 +6,7 @@ label command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS label ID diff --git a/doc/src/lattice.rst b/doc/src/lattice.rst index d4d69c7af0..7dc9c579e5 100644 --- a/doc/src/lattice.rst +++ b/doc/src/lattice.rst @@ -6,7 +6,7 @@ lattice command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS lattice style scale keyword values ... diff --git a/doc/src/log.rst b/doc/src/log.rst index 5d4036dc06..46784f6ea6 100644 --- a/doc/src/log.rst +++ b/doc/src/log.rst @@ -6,7 +6,7 @@ log command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS log file keyword diff --git a/doc/src/mass.rst b/doc/src/mass.rst index f359ccf3a5..88bd14950c 100644 --- a/doc/src/mass.rst +++ b/doc/src/mass.rst @@ -6,7 +6,7 @@ mass command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS mass I value diff --git a/doc/src/min_style.rst b/doc/src/min_style.rst index 2f43308610..b89ae6d398 100644 --- a/doc/src/min_style.rst +++ b/doc/src/min_style.rst @@ -27,7 +27,7 @@ min_style fire command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS min_style style diff --git a/doc/src/minimize.rst b/doc/src/minimize.rst index 6221d33aad..56efa12f44 100644 --- a/doc/src/minimize.rst +++ b/doc/src/minimize.rst @@ -1,15 +1,15 @@ .. index:: minimize +.. index:: minimize/kk minimize command ================ -minimize/kk command -=================== +Accelerator Variant: minimize/kk Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS minimize etol ftol maxiter maxeval diff --git a/doc/src/molecule.rst b/doc/src/molecule.rst index b42bece327..480e175e7b 100644 --- a/doc/src/molecule.rst +++ b/doc/src/molecule.rst @@ -6,7 +6,7 @@ molecule command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS molecule ID file1 keyword values ... file2 keyword values ... fileN ... diff --git a/doc/src/neb.rst b/doc/src/neb.rst index a959eee01b..0bc5de010b 100644 --- a/doc/src/neb.rst +++ b/doc/src/neb.rst @@ -6,7 +6,7 @@ neb command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS neb etol ftol N1 N2 Nevery file-style arg keyword values diff --git a/doc/src/neb_spin.rst b/doc/src/neb_spin.rst index 9f714096dc..1d42ff884c 100644 --- a/doc/src/neb_spin.rst +++ b/doc/src/neb_spin.rst @@ -6,7 +6,7 @@ neb/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS neb/spin etol ttol N1 N2 Nevery file-style arg keyword diff --git a/doc/src/neighbor.rst b/doc/src/neighbor.rst index 9dcdd1daf2..12d6d91fde 100644 --- a/doc/src/neighbor.rst +++ b/doc/src/neighbor.rst @@ -6,7 +6,7 @@ neighbor command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS neighbor skin style diff --git a/doc/src/newton.rst b/doc/src/newton.rst index c1a015c3e6..f77c8c54c4 100644 --- a/doc/src/newton.rst +++ b/doc/src/newton.rst @@ -6,7 +6,7 @@ newton command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS newton flag newton flag1 flag2 diff --git a/doc/src/next.rst b/doc/src/next.rst index 46d39660eb..d86c15c5fb 100644 --- a/doc/src/next.rst +++ b/doc/src/next.rst @@ -6,7 +6,7 @@ next command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS next variables diff --git a/doc/src/package.rst b/doc/src/package.rst index 6d425b63dd..63a7f095ad 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -6,7 +6,7 @@ package command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS package style args @@ -49,7 +49,7 @@ Syntax *intel* args = NPhi keyword value ... Nphi = # of co-processors per node zero or more keyword/value pairs may be appended - keywords = *mode* or *omp* or *lrt* or *balance* or *ghost* or *tpc* or *tptask* or *no_affinity* + keywords = *mode* or *omp* or *lrt* or *balance* or *ghost* or *tpc* or *tptask* or *pppm_table* or *no_affinity* *mode* value = *single* or *mixed* or *double* single = perform force calculations in single precision mixed = perform force calculations in mixed precision @@ -68,6 +68,9 @@ Syntax Ntpc = max number of co-processor threads per co-processor core (default = 4) *tptask* value = Ntptask Ntptask = max number of co-processor threads per MPI task (default = 240) + *pppm_table* value = *yes* or *no* + *yes* = Precompute pppm values in table (doesn't change accuracy) + *no* = Compute pppm values on the fly *no_affinity* values = none *kokkos* args = keyword value ... zero or more keyword/value pairs may be appended @@ -392,13 +395,13 @@ is identical to the default *verlet* style aside from supporting the LRT feature. This feature requires setting the pre-processor flag -DLMP_INTEL_USELRT in the makefile when compiling LAMMPS. -The *balance* keyword sets the fraction of :doc:`pair style ` work offloaded to the co-processor for split -values between 0.0 and 1.0 inclusive. While this fraction of work is -running on the co-processor, other calculations will run on the host, -including neighbor and pair calculations that are not offloaded, as -well as angle, bond, dihedral, kspace, and some MPI communications. -If *split* is set to -1, the fraction of work is dynamically adjusted -automatically throughout the run. This typically give performance +The *balance* keyword sets the fraction of :doc:`pair style ` work +offloaded to the co-processor for split values between 0.0 and 1.0 inclusive. +While this fraction of work is running on the co-processor, other calculations +will run on the host, including neighbor and pair calculations that are not +offloaded, as well as angle, bond, dihedral, kspace, and some MPI +communications. If *split* is set to -1, the fraction of work is dynamically +adjusted automatically throughout the run. This typically give performance within 5 to 10 percent of the optimal fixed fraction. The *ghost* keyword determines whether or not ghost atoms, i.e. atoms @@ -430,6 +433,13 @@ with 16 threads, for a total of 128. Note that the default settings for *tpc* and *tptask* are fine for most problems, regardless of how many MPI tasks you assign to a Phi. +.. versionadded:: 15Jun2023 + +The *pppm_table* keyword with the argument yes allows to use a +pre-computed table to efficiently spread the charge to the PPPM grid. +This feature is enabled by default but can be turned off using the +keyword with the argument *no*. + The *no_affinity* keyword will turn off automatic setting of core affinity for MPI tasks and OpenMP threads on the host when using offload to a co-processor. Affinity settings are used when possible @@ -699,39 +709,37 @@ Related commands Default """"""" -For the GPU package, the default is Ngpu = 0 and the option defaults -are neigh = yes, newton = off, binsize = 0.0, split = 1.0, gpuID = 0 -to Ngpu-1, tpa = 1, omp = 0, and platform=-1. These settings are made -automatically if the "-sf gpu" :doc:`command-line switch ` -is used. If it is not used, you must invoke the package gpu command -in your input script or via the "-pk gpu" :doc:`command-line switch `. +For the GPU package, the default is Ngpu = 0 and the option defaults are neigh += yes, newton = off, binsize = 0.0, split = 1.0, gpuID = 0 to Ngpu-1, tpa = 1, +omp = 0, and platform=-1. These settings are made automatically if the "-sf +gpu" :doc:`command-line switch ` is used. If it is not used, you +must invoke the package gpu command in your input script or via the "-pk gpu" +:doc:`command-line switch `. -For the INTEL package, the default is Nphi = 1 and the option -defaults are omp = 0, mode = mixed, lrt = no, balance = -1, tpc = 4, -tptask = 240. The default ghost option is determined by the pair -style being used. This value is output to the screen in the offload -report at the end of each run. Note that all of these settings, -except "omp" and "mode", are ignored if LAMMPS was not built with Xeon -Phi co-processor support. These settings are made automatically if the -"-sf intel" :doc:`command-line switch ` is used. If it is -not used, you must invoke the package intel command in your input -script or via the "-pk intel" :doc:`command-line switch `. +For the INTEL package, the default is Nphi = 1 and the option defaults are omp += 0, mode = mixed, lrt = no, balance = -1, tpc = 4, tptask = 240, pppm_table = +yes. The default ghost option is determined by the pair style being used. +This value is output to the screen in the offload report at the end of each +run. Note that all of these settings, except "omp" and "mode", are ignored if +LAMMPS was not built with Xeon Phi co-processor support. These settings are +made automatically if the "-sf intel" :doc:`command-line switch ` +is used. If it is not used, you must invoke the package intel command in your +input script or via the "-pk intel" :doc:`command-line switch `. For the KOKKOS package, the option defaults for GPUs are neigh = full, -neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default -value, comm = device, sort = device, neigh/transpose = off, gpu/aware = -on. When LAMMPS can safely detect that GPU-aware MPI is not available, -the default value of gpu/aware becomes "off". For CPUs or Xeon Phis, the -option defaults are neigh = half, neigh/qeq = half, newton = on, binsize -= 0.0, comm = no, and sort = no. The option neigh/thread = on when -there are 16K atoms or less on an MPI rank, otherwise it is "off". These -settings are made automatically by the required "-k on" -:doc:`command-line switch `. You can change them by using -the package kokkos command in your input script or via the :doc:`-pk +neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default value, +comm = device, sort = device, neigh/transpose = off, gpu/aware = on. When +LAMMPS can safely detect that GPU-aware MPI is not available, the default value +of gpu/aware becomes "off". For CPUs or Xeon Phis, the option defaults are +neigh = half, neigh/qeq = half, newton = on, binsize = 0.0, comm = no, and sort += no. The option neigh/thread = on when there are 16K atoms or less on an MPI +rank, otherwise it is "off". These settings are made automatically by the +required "-k on" :doc:`command-line switch `. You can change them +by using the package kokkos command in your input script or via the :doc:`-pk kokkos command-line switch `. -For the OMP package, the default is Nthreads = 0 and the option -defaults are neigh = yes. These settings are made automatically if -the "-sf omp" :doc:`command-line switch ` is used. If it -is not used, you must invoke the package omp command in your input -script or via the "-pk omp" :doc:`command-line switch `. +For the OMP package, the default is Nthreads = 0 and the option defaults are +neigh = yes. These settings are made automatically if the "-sf omp" +:doc:`command-line switch ` is used. If it is not used, you must +invoke the package omp command in your input script or via the "-pk omp" +:doc:`command-line switch `. diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst new file mode 100644 index 0000000000..5cee40edda --- /dev/null +++ b/doc/src/pair_aip_water_2dm.rst @@ -0,0 +1,167 @@ +.. index:: pair_style aip/water/2dm +.. index:: pair_style aip/water/2dm/opt + +pair_style aip/water/2dm command +=================================== + +Accelerator Variant: *aip/water/2dm/opt* + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style [hybrid/overlay ...] aip/water/2dm 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 aip/water/2dm 16.0 1 + pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw + + pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 + pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O + pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H + pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H + pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw + +Description +""""""""""" + +.. versionadded:: 15Jun2023 + +The *aip/water/2dm* style computes the anisotropic interfacial potential +(AIP) potential for interfaces of water with two-dimensional (2D) +materials as described in :ref:`(Feng) `. + +.. 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 +`. + +.. note:: + + This pair style uses the atomic normal vector definition from + :ref:`(Feng) `), where the atomic normal vectors of the + hydrogen atoms are assumed to lie along the corresponding + oxygen-hydrogen bonds and the normal vector of the central oxygen + atom is defined as their average. + +The provided parameter file, ``COH.aip.water.2dm``, 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 the cutoff for an +internal, short distance neighbor list that is generated for speeding up +the calculation of the normals for all atom pairs. + +.. note:: + + The parameters presented in the provided parameter file, + ``COH.aip.water.2dm``, are fitted with the taper function enabled by + setting the cutoff equal to 16.0 Angstrom. Using a different cutoff + or taper function setting should be carefully checked as they can + lead to significant errors. These parameters provide a good + description in both short- and long-range interaction regimes. This + is essential for simulations in high pressure regime (i.e., the + interlayer distance is smaller than the equilibrium distance). + +This potential must be used in combination with hybrid/overlay. Other +interactions can be set to zero using :doc:`pair_coeff settings +` with the pair style set to *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 aip/water/2dm + variable Evdw equal c_0[1] + variable Erep equal c_0[2] + thermo_style custom step temp epair v_Erep v_Evdw + +---------- + +.. include:: accel_styles.rst + +---------- + +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 ``COH.aip.water.2dm`` potential file provided with LAMMPS is +parameterized for *metal* units. You can use this pair style with any +LAMMPS units, but you would need to create your own potential file with +parameters 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 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 + +---------- + +.. _Feng: + +**(Feng)** Z. Feng and W. Ouyang et al., J. Phys. Chem. C. 127, 8704-8713 (2023). diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 21afc1b4fc..bc469412d9 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -641,22 +641,36 @@ The optional *heat* keyword enables heat conduction. The options currently supported are: 1. *none* -2. *area* : :math:`k_{s}` +2. *radius* : :math:`k_{s}` +3. *area* : :math:`h_{s}` If the *heat* keyword is not specified, the model defaults to *none*. +For *heat* *radius*, the heat +:math:`Q` conducted between two particles is given by + +.. math:: + + Q = 2 k_{s} a \Delta T + +where :math:`\Delta T` is the difference in the two particles' temperature, +:math:`k_{s}` is a non-negative numeric value for the conductivity (in units +of power/(length*temperature)), and :math:`a` is the radius of the contact and +depends on the normal force model. This is the model proposed by +:ref:`Vargas and McCarthy `. + For *heat* *area*, the heat :math:`Q` conducted between two particles is given by .. math:: - Q = k_{s} A \Delta T - + Q = h_{s} A \Delta T where :math:`\Delta T` is the difference in the two particles' temperature, -:math:`k_{s}` is a non-negative numeric value for the conductivity, and -:math:`A` is the area of the contact and depends on the normal force model. +:math:`h_{s}` is a non-negative numeric value for the heat transfer +coefficient (in units of power/(area*temperature)), and :math:`A=\pi a^2` is +the area of the contact and depends on the normal force model. Note that the option *none* must either be used in all or none of of the *pair_coeff* calls. See :doc:`fix heat/flow ` and @@ -736,7 +750,7 @@ or .. math:: - E_{eff,ij} = \frac{E_{ij}}{2(1-\nu_{ij})} + E_{eff,ij} = \frac{E_{ij}}{2(1-\nu_{ij}^2)} These pair styles write their information to :doc:`binary restart files `, so a pair_style command does not need to be specified in an input script that reads a restart file. @@ -749,15 +763,17 @@ The single() function of these pair styles returns 0.0 for the energy of a pairwise interaction, since energy is not conserved in these dissipative potentials. It also returns only the normal component of the pairwise interaction force. However, the single() function also -calculates 12 extra pairwise quantities. The first 3 are the +calculates 13 extra pairwise quantities. The first 3 are the components of the tangential force between particles I and J, acting on particle I. The fourth is the magnitude of this tangential force. The next 3 (5-7) are the components of the rolling torque acting on particle I. The next entry (8) is the magnitude of the rolling torque. The next entry (9) is the magnitude of the twisting torque acting about the vector connecting the two particle centers. -The last 3 (10-12) are the components of the vector connecting -the centers of the two particles (x_I - x_J). +The next 3 (10-12) are the components of the vector connecting +the centers of the two particles (x_I - x_J). The last quantity (13) +is the heat flow between the two particles, set to 0 if no heat model +is active. These extra quantities can be accessed by the :doc:`compute pair/local ` command, as *p1*, *p2*, ..., *p12*\ . @@ -894,3 +910,10 @@ J. Appl. Mech., ASME 20, 327-344. **(Agnolin and Roux 2007)** Agnolin, I. & Roux, J-N. (2007). Internal states of model isotropic granular packings. I. Assembling process, geometry, and contact networks. Phys. Rev. E, 76, 061302. + +.. _VargasMcCarthy2001: + +**(Vargas and McCarthy 2001)** Vargas, W.L. and McCarthy, J.J. (2001). +Heat conduction in granular materials. +AIChE Journal, 47(5), 1052-1059. + diff --git a/doc/src/pair_ilp_graphene_hbn.rst b/doc/src/pair_ilp_graphene_hbn.rst index de088f2926..36e971ef62 100644 --- a/doc/src/pair_ilp_graphene_hbn.rst +++ b/doc/src/pair_ilp_graphene_hbn.rst @@ -155,8 +155,8 @@ interactions. The BNCH.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 +potential with any LAMMPS units, but you would need to create your own +custom BNCH.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands @@ -181,6 +181,14 @@ tap_flag = 1 ---------- +.. _Ouyang1: + +**(Ouyang1)** W. Ouyang, D. Mandelli, M. Urbakh and O. Hod, Nano Lett. 18, 6009-6016 (2018). + +.. _Ouyang2: + +**(Ouyang2)** W. Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020). + .. _Leven1: **(Leven1)** I. Leven, I. Azuri, L. Kronik and O. Hod, J. Chem. Phys. 140, 104106 (2014). @@ -196,11 +204,3 @@ tap_flag = 1 .. _Kolmogorov2: **(Kolmogorov)** A. N. Kolmogorov, V. H. Crespi, Phys. Rev. B 71, 235415 (2005). - -.. _Ouyang1: - -**(Ouyang1)** W. Ouyang, D. Mandelli, M. Urbakh and O. Hod, Nano Lett. 18, 6009-6016 (2018). - -.. _Ouyang2: - -**(Ouyang2)** W. Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020). diff --git a/doc/src/pair_ilp_tmd.rst b/doc/src/pair_ilp_tmd.rst index 77fa8bbfd5..482d75a100 100644 --- a/doc/src/pair_ilp_tmd.rst +++ b/doc/src/pair_ilp_tmd.rst @@ -135,8 +135,8 @@ 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 +potential with any LAMMPS units, but you would need to create your own +custom TMD.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands diff --git a/doc/src/pair_kolmogorov_crespi_full.rst b/doc/src/pair_kolmogorov_crespi_full.rst index 1a33a3f4bb..1a4706dd6f 100644 --- a/doc/src/pair_kolmogorov_crespi_full.rst +++ b/doc/src/pair_kolmogorov_crespi_full.rst @@ -129,7 +129,7 @@ interactions. The CH.KC potential file provided with LAMMPS (see the potentials folder) is parameterized for metal units. You can use this pair style with any LAMMPS units, but you would need to create your own custom -CC.KC potential file with all coefficients converted to the appropriate +CH.KC potential file with all coefficients converted to the appropriate units. Related commands diff --git a/doc/src/pair_lepton.rst b/doc/src/pair_lepton.rst index 608265ecbd..21e619a3d9 100644 --- a/doc/src/pair_lepton.rst +++ b/doc/src/pair_lepton.rst @@ -61,9 +61,11 @@ Description .. versionadded:: 8Feb2023 -.. versionchanged:: TBD + added pair styles *lepton* and *lepton/coul* - added pair style lepton/sphere +.. versionchanged:: 15Jun2023 + + added pair style *lepton/sphere* Pair styles *lepton*, *lepton/coul*, *lepton/sphere* compute pairwise interactions between particles which depend on the distance and have a diff --git a/doc/src/pair_lj_cut_sphere.rst b/doc/src/pair_lj_cut_sphere.rst index 428047d5df..31f84bc40e 100644 --- a/doc/src/pair_lj_cut_sphere.rst +++ b/doc/src/pair_lj_cut_sphere.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *lj/cut/sphere* style compute the standard 12/6 Lennard-Jones potential, given by diff --git a/doc/src/pair_lj_expand_sphere.rst b/doc/src/pair_lj_expand_sphere.rst index c60cf160f0..2c01624251 100644 --- a/doc/src/pair_lj_expand_sphere.rst +++ b/doc/src/pair_lj_expand_sphere.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *lj/expand/sphere* style compute a 12/6 Lennard-Jones potential with a distance shifted by :math:`\Delta = \frac{1}{2} (d_i + d_j)`, the diff --git a/doc/src/pair_saip_metal.rst b/doc/src/pair_saip_metal.rst index 21bfeb0aa9..ed011894c9 100644 --- a/doc/src/pair_saip_metal.rst +++ b/doc/src/pair_saip_metal.rst @@ -134,8 +134,8 @@ 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 +potential with any LAMMPS units, but you would need to create your own +custom CHAu.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 441313b0b8..494a26aacf 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -114,6 +114,7 @@ accelerated styles exist. * :doc:`adp ` - angular dependent potential (ADP) of Mishin * :doc:`agni ` - AGNI machine-learning potential +* :doc:`aip/water/2dm ` - anisotropic interfacial potential for water in 2d geometries * :doc:`airebo ` - AIREBO potential of Stuart * :doc:`airebo/morse ` - AIREBO with Morse instead of LJ * :doc:`amoeba ` - diff --git a/doc/src/partition.rst b/doc/src/partition.rst index f05c3fa446..6b1866d8d8 100644 --- a/doc/src/partition.rst +++ b/doc/src/partition.rst @@ -6,7 +6,7 @@ partition command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS partition style N command ... diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index 41e2621fef..f8f668789d 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -6,7 +6,7 @@ plugin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS plugin command args diff --git a/doc/src/prd.rst b/doc/src/prd.rst index 7c6af3abb5..fd20fa4a3b 100644 --- a/doc/src/prd.rst +++ b/doc/src/prd.rst @@ -6,7 +6,7 @@ prd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS prd N t_event n_dephase t_dephase t_correlate compute-ID seed keyword value ... diff --git a/doc/src/print.rst b/doc/src/print.rst index f5a872e768..f5ba16d8b5 100644 --- a/doc/src/print.rst +++ b/doc/src/print.rst @@ -6,7 +6,7 @@ print command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS print string keyword value @@ -46,7 +46,7 @@ lines of output, the string can be enclosed in triple quotes, as in the last example above. If the text string contains variables, they will be evaluated and their current values printed. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 support for vector style variables diff --git a/doc/src/processors.rst b/doc/src/processors.rst index 676f339725..921bbcc667 100644 --- a/doc/src/processors.rst +++ b/doc/src/processors.rst @@ -6,7 +6,7 @@ processors command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS processors Px Py Pz keyword args ... diff --git a/doc/src/python.rst b/doc/src/python.rst index b05de7094d..99f32e7c80 100644 --- a/doc/src/python.rst +++ b/doc/src/python.rst @@ -6,7 +6,7 @@ python command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS python mode keyword args ... diff --git a/doc/src/quit.rst b/doc/src/quit.rst index ba6b4037be..2355fb238b 100644 --- a/doc/src/quit.rst +++ b/doc/src/quit.rst @@ -6,7 +6,7 @@ quit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS quit status diff --git a/doc/src/region.rst b/doc/src/region.rst index 4589e6deb1..36c7c799dc 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -6,7 +6,7 @@ region command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS region ID style args keyword arg ... diff --git a/doc/src/replicate.rst b/doc/src/replicate.rst index ed4e844c35..6bfbeab891 100644 --- a/doc/src/replicate.rst +++ b/doc/src/replicate.rst @@ -6,7 +6,7 @@ replicate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS replicate nx ny nz *keyword* diff --git a/doc/src/rerun.rst b/doc/src/rerun.rst index cfed2e2872..1c1b4fb570 100644 --- a/doc/src/rerun.rst +++ b/doc/src/rerun.rst @@ -6,7 +6,7 @@ rerun command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS rerun file1 file2 ... keyword args ... diff --git a/doc/src/restart.rst b/doc/src/restart.rst index 5de2d3d75c..10394de80e 100644 --- a/doc/src/restart.rst +++ b/doc/src/restart.rst @@ -6,7 +6,7 @@ restart command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS restart 0 restart N root keyword value ... diff --git a/doc/src/run.rst b/doc/src/run.rst index 8bcf469052..c3dd171f6b 100644 --- a/doc/src/run.rst +++ b/doc/src/run.rst @@ -6,7 +6,7 @@ run command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS run N keyword values ... diff --git a/doc/src/set.rst b/doc/src/set.rst index 2ba1057ef5..8a6510f88f 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -6,7 +6,7 @@ set command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS set style ID keyword values ... diff --git a/doc/src/shell.rst b/doc/src/shell.rst index fb9baffe08..378ebdc479 100644 --- a/doc/src/shell.rst +++ b/doc/src/shell.rst @@ -6,7 +6,7 @@ shell command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS shell command args diff --git a/doc/src/suffix.rst b/doc/src/suffix.rst index 4789229800..6c723657a5 100644 --- a/doc/src/suffix.rst +++ b/doc/src/suffix.rst @@ -6,7 +6,7 @@ suffix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS suffix style args diff --git a/doc/src/tad.rst b/doc/src/tad.rst index cc6d52d415..b35bc3dfbb 100644 --- a/doc/src/tad.rst +++ b/doc/src/tad.rst @@ -6,7 +6,7 @@ tad command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS tad N t_event T_lo T_hi delta tmax compute-ID keyword value ... diff --git a/doc/src/temper.rst b/doc/src/temper.rst index 363e0102fc..d8bbcb959b 100644 --- a/doc/src/temper.rst +++ b/doc/src/temper.rst @@ -6,7 +6,7 @@ temper command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS temper N M temp fix-ID seed1 seed2 index diff --git a/doc/src/temper_grem.rst b/doc/src/temper_grem.rst index 312df21254..0963ea98c1 100644 --- a/doc/src/temper_grem.rst +++ b/doc/src/temper_grem.rst @@ -6,7 +6,7 @@ temper/grem command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS temper/grem N M lambda fix-ID thermostat-ID seed1 seed2 index diff --git a/doc/src/temper_npt.rst b/doc/src/temper_npt.rst index a8f5999dbe..0659ba2c03 100644 --- a/doc/src/temper_npt.rst +++ b/doc/src/temper_npt.rst @@ -6,7 +6,7 @@ temper/npt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS temper/npt N M temp fix-ID seed1 seed2 pressure index diff --git a/doc/src/thermo.rst b/doc/src/thermo.rst index 5621b554c8..f918810cc2 100644 --- a/doc/src/thermo.rst +++ b/doc/src/thermo.rst @@ -6,7 +6,7 @@ thermo command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS thermo N diff --git a/doc/src/third_order.rst b/doc/src/third_order.rst index 2635c92f84..bbbf424c44 100644 --- a/doc/src/third_order.rst +++ b/doc/src/third_order.rst @@ -4,7 +4,7 @@ third_order command =================== -Accelerator Variants: third_order/kk +Accelerator Variant: third_order/kk Syntax """""" diff --git a/doc/src/timer.rst b/doc/src/timer.rst index a604cc2212..13d5a92473 100644 --- a/doc/src/timer.rst +++ b/doc/src/timer.rst @@ -6,7 +6,7 @@ timer command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS timer args diff --git a/doc/src/timestep.rst b/doc/src/timestep.rst index 3142509611..037b3f8642 100644 --- a/doc/src/timestep.rst +++ b/doc/src/timestep.rst @@ -6,7 +6,7 @@ timestep command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS timestep dt diff --git a/doc/src/uncompute.rst b/doc/src/uncompute.rst index 24b7c028d5..e65cbb2038 100644 --- a/doc/src/uncompute.rst +++ b/doc/src/uncompute.rst @@ -6,7 +6,7 @@ uncompute command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS uncompute compute-ID diff --git a/doc/src/undump.rst b/doc/src/undump.rst index 9320338854..89874457b0 100644 --- a/doc/src/undump.rst +++ b/doc/src/undump.rst @@ -6,7 +6,7 @@ undump command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS undump dump-ID diff --git a/doc/src/unfix.rst b/doc/src/unfix.rst index 419559a118..aeb640201d 100644 --- a/doc/src/unfix.rst +++ b/doc/src/unfix.rst @@ -6,7 +6,7 @@ unfix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS unfix fix-ID diff --git a/doc/src/units.rst b/doc/src/units.rst index 2554806fb5..3f0904f162 100644 --- a/doc/src/units.rst +++ b/doc/src/units.rst @@ -6,7 +6,7 @@ units command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS units style diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 7b49493fef..28c0d29799 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -6,7 +6,7 @@ variable command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS variable name style args ... @@ -1001,7 +1001,7 @@ map kind (atom, bond, angle, dihedral, or improper) and the second argument is the label. The function returns the corresponding numeric type or triggers an error if the queried label does not exist. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The is_typelabel(kind,label) function has the same arguments as label2type(), but returns 1 if the type label has been assigned, @@ -1320,7 +1320,7 @@ Vectors" discussion above. Vector Initialization --------------------- -.. versionadded:: TBD +.. versionadded:: 15Jun2023 *Vector*-style variables only can be initialized with a special syntax, instead of using a formula. The syntax is a bracketed, @@ -1441,7 +1441,7 @@ timestep that the variable needs the tallies. An input script can also request variables be evaluated before or after or in between runs, e.g. by including them in a :doc:`print ` command. -LAMMPS keeps track of all of this as it performs a doc:`run ` or +LAMMPS keeps track of all of this as it performs a :doc:`run ` or :doc:`minimize ` simulation, as well as in between simulations. An error will be generated if you attempt to evaluate a variable when LAMMPS knows it cannot produce accurate values. For @@ -1453,7 +1453,7 @@ command, then an error will occur. However, there are two special cases to be aware when a variable requires invocation of a compute (directly or indirectly). The first -is if the variable is evaluated before the first doc:`run ` or +is if the variable is evaluated before the first :doc:`run ` or :doc:`minimize ` command in the input script. In this case, LAMMPS will generate an error. This is because many computes require initializations which have not yet taken place. One example is the @@ -1463,10 +1463,10 @@ energy or virial quantities; these values are not tallied until the first simulation begins. The second special case is when a variable that depends on a compute -is evaluated in between doc:`run ` or :doc:`minimize ` +is evaluated in between :doc:`run ` or :doc:`minimize ` commands. It is possible for other input script commands issued following the previous run, but before the variable is evaluated, to -change the system. For example, the doc:`delete_atoms ` +change the system. For example, the :doc:`delete_atoms ` command could be used to remove atoms. Since the compute will not re-initialize itself until the next simulation or it may depend on energy/virial computations performed before the system was changed, it @@ -1481,7 +1481,7 @@ commands .. code-block:: LAMMPS # delete_atoms random fraction 0.5 yes all NULL 49839 - # run 0 + # run 0 post no variable t equal temp # this thermo keyword invokes a temperature compute print "Temperature of system = $t" run 1000 diff --git a/doc/src/velocity.rst b/doc/src/velocity.rst index ee1d546d79..48b0526df9 100644 --- a/doc/src/velocity.rst +++ b/doc/src/velocity.rst @@ -6,7 +6,7 @@ velocity command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS velocity group-ID style args keyword value ... diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index 3f7bc065d0..9c8522948b 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -2,7 +2,7 @@ Sphinx >= 5.3.0, <7.1.0 sphinxcontrib-spelling sphinxcontrib-jquery git+https://github.com/akohlmey/sphinx-fortran@parallel-read -git+https://github.com/executablebooks/sphinx-tabs@v3.4.1 +sphinx-tabs>=3.4.1 breathe Pygments six diff --git a/doc/utils/sphinx-config/LAMMPSLexer.py b/doc/utils/sphinx-config/LAMMPSLexer.py index c8826a9ed6..a7ba5d92a8 100644 --- a/doc/utils/sphinx-config/LAMMPSLexer.py +++ b/doc/utils/sphinx-config/LAMMPSLexer.py @@ -2,14 +2,15 @@ from pygments.lexer import RegexLexer, words, include, default from pygments.token import * LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify", - "atom_style", "balance", "bond_coeff", "bond_style", - "bond_write", "boundary", "clear", "comm_modify", - "comm_style", "compute_modify", "create_atoms", - "create_bonds", "create_box", "delete_atoms", - "delete_bonds", "dielectric", "dihedral_coeff", - "dihedral_style", "dimension", "displace_atoms", - "dump_modify", "dynamical_matrix", "echo", "elif", - "else", "fix_modify", "group2ndx", "hyper", "if", + "atom_style", "angle_write", "balance", "bond_coeff", + "bond_style", "bond_write", "boundary", "clear", + "comm_modify", "comm_style", "compute_modify", + "create_atoms", "create_bonds", "create_box", + "delete_atoms", "delete_bonds", "dielectric", + "dihedral_coeff", "dihedral_style", "dihedral_write", + "dimension", "displace_atoms", "dump_modify", + "dynamical_matrix", "echo", "fitpod", + "fix_modify", "group2ndx", "hyper", "improper_coeff", "improper_style", "include", "info", "jump", "kim", "kspace_modify", "kspace_style", "label", "labelmap", "lattice", @@ -23,7 +24,7 @@ LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify", "read_restart", "replicate", "rerun", "reset_atoms", "reset_timestep", "restart", "run", "run_style", "server", "set", "shell", "special_bonds", "suffix", - "tad", "temper", "temper/grem", "temper/npt", "then", + "tad", "temper", "temper/grem", "temper/npt", "thermo", "thermo_modify", "thermo_style", "third_order", "timer", "timestep", "units", "velocity", "write_coeff", "write_data", @@ -45,16 +46,34 @@ class LAMMPSLexer(RegexLexer): tokens = { 'root': [ (r'fix\s+', Keyword, 'fix'), + (r'fix_modify\s+', Keyword, 'modify_cmd'), (r'compute\s+', Keyword, 'compute'), + (r'compute_modify\s+', Keyword, 'modify_cmd'), (r'dump\s+', Keyword, 'dump'), + (r'dump_modify\s+', Keyword, 'modify_cmd'), (r'region\s+', Keyword, 'region'), - (r'^\s*variable\s+', Keyword, 'variable_cmd'), + (r'variable\s+', Keyword, 'variable_cmd'), (r'group\s+', Keyword, 'group'), (r'change_box\s+', Keyword, 'change_box'), - (r'uncompute\s+', Keyword, 'uncompute'), - (r'unfix\s+', Keyword, 'unfix'), - (r'undump\s+', Keyword, 'undump'), + (r'create_box\s+', Keyword, 'create_box'), + (r'delete_bonds\s+', Keyword, 'id_cmd'), + (r'displace_atoms\s+', Keyword, 'id_cmd'), + (r'dynamical_matrix\s+', Keyword, 'id_cmd'), + (r'group2ndx\s+', Keyword, 'ndx_cmd'), + (r'ndx2group\s+', Keyword, 'ndx_cmd'), + (r'jump\s+', Keyword, 'jump_cmd'), + (r'label\s+', Keyword, 'jump_cmd'), + (r'next\s+', Keyword, 'id_cmd'), + (r'kim\s+', Keyword, 'kim_cmd'), + (r'uncompute\s+', Keyword, 'id_cmd'), + (r'unfix\s+', Keyword, 'id_cmd'), + (r'undump\s+', Keyword, 'id_cmd'), + (r'velocity\s+', Keyword, 'id_cmd'), + (r'write_coeff\s+', Keyword, 'ndx_cmd'), + (r'write_data\s+', Keyword, 'ndx_cmd'), (r'write_dump\s+', Keyword, 'write_dump'), + (r'write_restart\s+', Keyword, 'ndx_cmd'), + include('conditionals'), include('keywords'), (r'#.*?\n', Comment), ('"', String, 'string'), @@ -69,8 +88,12 @@ class LAMMPSLexer(RegexLexer): (r'[\+\-\*\^\|\/\!%&=<>]', Operator), (r'[\~\.\w_:,@\-\/\\0-9]+', Text), ], + 'conditionals' : [ + (words(('if','else','elif','then'), suffix=r'\b', prefix=r'\b'), Keyword) + ] + , 'keywords' : [ - (words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^'), Keyword) + (words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^\s*'), Keyword) ] , 'variable' : [ @@ -90,6 +113,10 @@ class LAMMPSLexer(RegexLexer): ('\(', Name.Variable, 'expression'), ('\)', Name.Variable, '#pop'), ], + 'modify_cmd' : [ + (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), + default('#pop') + ], 'fix' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), (r'\s+', Whitespace, 'group_id'), @@ -121,16 +148,25 @@ class LAMMPSLexer(RegexLexer): (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], - 'unfix' : [ + 'create_box' : [ + (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), + (r'\s+', Whitespace, 'group_id'), + default('#pop') + ], + 'id_cmd' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], - 'undump' : [ + 'ndx_cmd' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], - 'uncompute' : [ - (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), + 'jump_cmd' : [ + (r'[\w_\-\.\[\]]+', Literal.String.Char), + default('#pop') + ], + 'kim_cmd' : [ + (r'[\w_\-\.\[\]]+', Literal.String.Single), default('#pop') ], 'write_dump' : [ diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 6c53226332..776792ec31 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -55,6 +55,7 @@ Ai Aidan aij aimd +aip airebo Aj ajaramil @@ -528,6 +529,7 @@ collisional Columic colvars Colvars +COH COLVARS comID Commun @@ -550,6 +552,7 @@ conformational Connor conp conq +const ConstMatrix Contrib cooperativity @@ -1090,6 +1093,7 @@ Fellinger femtosecond femtoseconds fene +Feng Fennell fep FEP @@ -1555,6 +1559,7 @@ intramolecular ints inumeric inv +invariance invariants inversed invertible @@ -1621,6 +1626,7 @@ Izumi Izvekov izz Izz +Jacobian Jacobsen Jadhao Jadhav @@ -2027,6 +2033,7 @@ Marchetti Marchi Mariella Marinica +Markland Marrink Marroquin Marsaglia @@ -3595,6 +3602,7 @@ THz Tigran Tij Tildesley +Timan timeI timespan timestamp @@ -4092,4 +4100,5 @@ zu zx zy Zybin +Zykova zz diff --git a/examples/ASPHERE/ellipsoid/in.ellipsoid b/examples/ASPHERE/ellipsoid/in.ellipsoid index 5e9a20f6e0..1ee59597da 100644 --- a/examples/ASPHERE/ellipsoid/in.ellipsoid +++ b/examples/ASPHERE/ellipsoid/in.ellipsoid @@ -1,23 +1,23 @@ # SRD diffusion demo - ellipsoids -units lj -atom_style ellipsoid -atom_modify first big -dimension 2 +units lj +atom_style ellipsoid +atom_modify first big +dimension 2 # create big ellipsoidal particles -lattice sq 0.14 -region box block 0 10 0 10 -0.5 0.5 -create_box 2 box -create_atoms 1 region box +lattice sq 0.14 +region box block 0 10 0 10 -0.5 0.5 +create_box 2 box +create_atoms 1 region box -set type 1 mass 1.0 -set type 1 shape 3.0 1.0 1.0 -group big type 1 -set group big quat/random 29898 +set type 1 mass 1.0 +set type 1 shape 3.0 1.0 1.0 +group big type 1 +set group big quat/random 29898 -velocity big create 1.44 87287 loop geom +velocity big create 1.44 87287 loop geom # equilibrate big particles @@ -26,57 +26,59 @@ pair_coeff 1 1 1.0 1.0 1 1 1 1 1 1 pair_coeff 1 2 1.0 1.0 1 1 1 1 1 1 0.0 pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 big nve/asphere -fix 2 all enforce2d +fix 1 big nve/asphere +fix 2 all enforce2d -compute rot big temp/asphere +compute rot big temp/asphere +compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 10 dump.ellipsoid.equil id type x y z c_0[*] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -thermo_style custom step temp c_rot epair etotal press -thermo 100 +thermo_style custom step temp c_rot epair etotal press +thermo 100 -run 1000 +run 1000 -#undump 1 -unfix 1 -unfix 2 +#undump 1 +unfix 1 +unfix 2 # add small particles as hi density lattice -region plane block INF INF INF INF -0.001 0.001 units box -lattice sq 120.0 -create_atoms 2 region plane +region plane block INF INF INF INF -0.001 0.001 units box +lattice sq 120.0 +create_atoms 2 region plane -set type 2 mass 0.01 -group small type 2 -velocity small create 1.0 593849 loop geom +set type 2 mass 0.01 +group small type 2 +velocity small create 1.0 593849 loop geom # delete overlaps # must set 1-2 cutoff to non-zero value -pair_style lj/cut 2.5 -pair_coeff 1 1 1.0 1.0 -pair_coeff 2 2 0.0 1.0 0.0 -pair_coeff 1 2 0.0 1.0 2.0 +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 +pair_coeff 2 2 0.0 1.0 0.0 +pair_coeff 1 2 0.0 1.0 2.0 -neigh_modify one 10000 +neigh_modify one 10000 -delete_atoms overlap 1.6 small big +delete_atoms overlap 1.6 small big # SRD run -reset_timestep 0 +reset_timestep 0 -neighbor 0.3 multi -neigh_modify delay 0 every 1 check yes +neighbor 0.3 multi +neigh_modify delay 0 every 1 check yes -comm_modify mode multi group big vel yes -neigh_modify include big +comm_modify mode multi group big vel yes +neigh_modify include big # no pairwise interactions with small particles @@ -88,29 +90,30 @@ pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 # use fix SRD to push small particles out from inside big ones # if comment out, big particles won't see SRD particles -timestep 0.0005 +timestep 0.0005 -fix 1 big nve/asphere -fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & - collision noslip search 0.2 inside ignore exact no bounce 50 -fix 3 all enforce2d +fix 1 big nve/asphere +fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & + collision noslip search 0.2 inside ignore exact no bounce 50 +fix 3 all enforce2d # diagnostics -compute tbig big temp/asphere -variable pebig equal pe*atoms/count(big) -variable ebig equal etotal*atoms/count(big) -thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & - f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & - f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] +compute tbig big temp/asphere +variable pebig equal pe*atoms/count(big) +variable ebig equal etotal*atoms/count(big) +thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & + f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & + f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] -thermo_modify temp tbig -thermo 1000 +thermo_modify temp tbig +thermo 1000 -#dump 1 all custom 1000 dump.ellipsoid id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 1000 dump.ellipsoid id type x y z c_0[*] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -#dump 1 all image 1000 image.*.jpg type type zoom 1.6 -#dump_modify 1 pad 6 adiam 1 1 adiam 2 0.2 +#dump 2 all image 1000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 6 adiam 1 1 adiam 2 0.2 -run 100000 +run 100000 diff --git a/examples/ASPHERE/ellipsoid/in.ellipsoid.mp b/examples/ASPHERE/ellipsoid/in.ellipsoid.mp index 7ce01ad4e1..31fe79eb58 100644 --- a/examples/ASPHERE/ellipsoid/in.ellipsoid.mp +++ b/examples/ASPHERE/ellipsoid/in.ellipsoid.mp @@ -1,23 +1,23 @@ # SRD viscosity demo - ellipsoids -units lj -atom_style ellipsoid -atom_modify first big -dimension 2 +units lj +atom_style ellipsoid +atom_modify first big +dimension 2 # create big ellipsoidal particles -lattice sq 0.14 -region box block 0 10 0 10 -0.5 0.5 -create_box 2 box -create_atoms 1 region box +lattice sq 0.14 +region box block 0 10 0 10 -0.5 0.5 +create_box 2 box +create_atoms 1 region box -set type 1 mass 1.0 -set type 1 shape 3.0 1.0 1.0 -group big type 1 -set group big quat/random 29898 +set type 1 mass 1.0 +set type 1 shape 3.0 1.0 1.0 +group big type 1 +set group big quat/random 29898 -velocity big create 1.44 87287 loop geom +velocity big create 1.44 87287 loop geom # equilibrate big particles @@ -26,57 +26,59 @@ pair_coeff 1 1 1.0 1.0 1 1 1 1 1 1 pair_coeff 1 2 1.0 1.0 1 1 1 1 1 1 0.0 pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 big nve/asphere -fix 2 all enforce2d +fix 1 big nve/asphere +fix 2 all enforce2d -compute rot big temp/asphere +compute rot big temp/asphere +compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 10 dump.ellipsoid.equil id type x y z c_0[*] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -thermo_style custom step temp c_rot epair etotal press -thermo 100 +thermo_style custom step temp c_rot epair etotal press +thermo 100 -run 1000 +run 1000 -#undump 1 -unfix 1 -unfix 2 +#undump 1 +unfix 1 +unfix 2 # add small particles as hi density lattice -region plane block INF INF INF INF -0.001 0.001 units box -lattice sq 120.0 -create_atoms 2 region plane +region plane block INF INF INF INF -0.001 0.001 units box +lattice sq 120.0 +create_atoms 2 region plane -set type 2 mass 0.01 -group small type 2 -velocity small create 1.0 593849 loop geom +set type 2 mass 0.01 +group small type 2 +velocity small create 1.0 593849 loop geom # delete overlaps # must set 1-2 cutoff to non-zero value -pair_style lj/cut 2.5 -pair_coeff 1 1 1.0 1.0 -pair_coeff 2 2 0.0 1.0 0.0 -pair_coeff 1 2 0.0 1.0 2.0 +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 +pair_coeff 2 2 0.0 1.0 0.0 +pair_coeff 1 2 0.0 1.0 2.0 -neigh_modify one 10000 +neigh_modify one 10000 -delete_atoms overlap 1.6 small big +delete_atoms overlap 1.6 small big # SRD run -reset_timestep 0 +reset_timestep 0 -neighbor 0.3 multi -neigh_modify delay 0 every 1 check yes +neighbor 0.3 multi +neigh_modify delay 0 every 1 check yes -comm_modify mode multi group big vel yes -neigh_modify include big +comm_modify mode multi group big vel yes +neigh_modify include big # no pairwise interactions with small particles @@ -88,30 +90,31 @@ pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 # use fix SRD to push small particles out from inside big ones # if comment out, big particles won't see SRD particles -timestep 0.0005 +timestep 0.0005 -fix 1 big nve/asphere -fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & +fix 1 big nve/asphere +fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & collision noslip search 0.2 inside ignore exact no bounce 50 -fix 3 small viscosity 20 x y 50 -fix 4 all enforce2d +fix 3 small viscosity 20 x y 50 +fix 4 all enforce2d # diagnostics -compute tbig big temp/asphere -variable pebig equal pe*atoms/count(big) -variable ebig equal etotal*atoms/count(big) -thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & - f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & - f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] +compute tbig big temp/asphere +variable pebig equal pe*atoms/count(big) +variable ebig equal etotal*atoms/count(big) +thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & + f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & + f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] -thermo_modify temp tbig -thermo 1000 +thermo_modify temp tbig +thermo 1000 -#dump 1 all custom 500 dump.ellipsoid.mp id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 500 dump.ellipsoid id type x y z c_0[*] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -#dump 1 all image 500 image.*.jpg type type zoom 1.6 -#dump_modify 1 pad 6 adiam 1 1 adiam 2 0.2 +#dump 1 all image 500 image.*.jpg type type zoom 1.6 +#dump_modify 1 pad 6 adiam 1 1 adiam 2 0.2 -run 50000 +run 50000 diff --git a/examples/COUPLE/README b/examples/COUPLE/README index adf46d027d..13e593d55d 100644 --- a/examples/COUPLE/README +++ b/examples/COUPLE/README @@ -19,12 +19,12 @@ See these sections of the LAMMPS manual for details: Build LAMMPS as a library (doc/html/Build_basics.html) Link LAMMPS as a library to another code (doc/html/Build_link.html) Coupling LAMMPS to other codes (doc/html/Howto_couple.html) -Using LAMMPS in client/server mode (doc/html/Howto_client_server.html) Library interface to LAMMPS (doc/html/Howto_library.html) +Detailed documentation of the LAMMPS interfaces (doc/html/Library.html) -The library interface to LAMMPS is in src/library.cpp. Routines can -be easily added to this file so an external program can perform the -LAMMPS tasks desired. +The core library interface to LAMMPS is in src/library.cpp. Routines +can be easily added to this file so an external program can perform +the LAMMPS tasks desired. ------------------------------------------------------------------- @@ -36,10 +36,5 @@ plugin example for loading LAMMPS at runtime from a shared library lammps_spparks grain-growth Monte Carlo with strain via MD, coupling to SPPARKS kinetic MC code library collection of useful inter-code communication routines -fortran2 a more sophisticated wrapper on the LAMMPS library API that - can be called from Fortran -fortran_dftb wrapper written by Nir Goldman (LLNL), as an - extension to fortran2, used for calling LAMMPS - from Fortran DFTB+ tight-binding code Each sub-directory has its own README with more details. diff --git a/examples/COUPLE/fortran2/.gitignore b/examples/COUPLE/fortran2/.gitignore deleted file mode 100644 index 63a7748cf4..0000000000 --- a/examples/COUPLE/fortran2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.mod diff --git a/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp b/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp deleted file mode 100644 index 4774cb6b49..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper.h" -#define LAMMPS_LIB_MPI 1 -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -void lammps_open_fortran_wrapper (int argc, char **argv, - MPI_Fint communicator, void **ptr) -{ - MPI_Comm C_communicator = MPI_Comm_f2c (communicator); - lammps_open (argc, argv, C_communicator, ptr); -} - -int lammps_get_ntypes (void *ptr) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ntypes = lmp->atom->ntypes; - return ntypes; -} - -void lammps_error_all (void *ptr, const char *file, int line, const char *str) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - lmp->error->all (file, line, str); -} - -int lammps_extract_compute_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_VECTOR); - if (size) return *size; - return 0; -} - -void lammps_extract_compute_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_ROWS); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_COLS); - if (tmp) *ncols = *tmp; - return; -} - -int lammps_extract_fix_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_VECTOR, 0, 0); - if (size) return *size; - return 0; -} - -void lammps_extract_fix_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_ROWS, 0, 0); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_COLS, 0, 0); - if (tmp) *ncols = *tmp; - return; -} - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran2/LAMMPS-wrapper.h b/examples/COUPLE/fortran2/LAMMPS-wrapper.h deleted file mode 100644 index 02e1a651a9..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS-wrapper.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_open_fortran_wrapper (int, char**, MPI_Fint, void**); -int lammps_get_ntypes (void*); -int lammps_extract_compute_vectorsize (void*, char*, int); -void lammps_extract_compute_arraysize (void*, char*, int, int*, int*); -int lammps_extract_fix_vectorsize (void*, char*, int); -void lammps_extract_fix_arraysize (void*, char*, int, int*, int*); -void lammps_error_all (void*, const char*, int, const char*); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran2/LAMMPS.F90 b/examples/COUPLE/fortran2/LAMMPS.F90 deleted file mode 100644 index 2f4ae2c95e..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS.F90 +++ /dev/null @@ -1,1788 +0,0 @@ -!! ----------------------------------------------------------------------- -! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator -! https://www.lammps.org/ Sandia National Laboratories -! LAMMPS Development team: developers@lammps.org -! -! Copyright (2003) Sandia Corporation. Under the terms of Contract -! DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains -! certain rights in this software. This software is distributed under -! the GNU General Public License. -! -! See the README file in the top-level LAMMPS directory. -!-------------------------------------------------------------------------- - -!! ------------------------------------------------------------------------ -! Contributing author: Karl D. Hammond -! University of Tennessee, Knoxville (USA), 2012 -! Updated October 2020 by the author (now at the University of Missouri). -!-------------------------------------------------------------------------- - -!! NOTE ------------------------------------------------------------------- -! This interface is obsolete and may be removed in a future release of -! LAMMPS. The interface in fortran/lammps.f90 replaces this one. That API -! is maintained by the LAMMPS developers and has documentation written for -! it; it is based loosely on this one, but binds all procedures to a lammps -! derived type. That interface was written in large -! part by the same author, but is also supported by other developers. -!-------------------------------------------------------------------------- - -!! LAMMPS, a Fortran 2003 module containing an interface between Fortran -!! programs and the C-style functions in library.cpp that ship with LAMMPS. -!! This file should be accompanied by LAMMPS-wrapper.cpp and LAMMPS-wrapper.h, -!! which define wrapper functions that ease portability and enforce array -!! dimensions. -!! -!! Everything in this module should be 100% portable by way of Fortran 2003's -!! ISO_C_BINDING intrinsic module. See the README for instructions for -!! compilation and use. -!! -!! Here are the PUBLIC functions and subroutines included in this module. -!! subroutine lammps_open (command_line, communicator, ptr) -!! subroutine lammps_open_no_mpi (command_line, ptr) -!! subroutine lammps_close (ptr) -!! integer (kind=C_int) lammps_version (ptr) -!! subroutine lammps_file (ptr, str) -!! subroutine lammps_command (ptr, str) -!! subroutine lammps_commands_list (ptr, cmds) -!! subroutine lammps_commands_string (ptr, str) -!! subroutine lammps_free (ptr) -!! integer function lammps_extract_setting (ptr, name) -!! subroutine lammps_extract_global (global, ptr, name) -!! subroutine lammps_extract_box (ptr, boxlo, boxhi, xy, yz, xz, & -!! periodicity, box_change) -!! subroutine lammps_extract_atom (atom, ptr, name) -!! subroutine lammps_extract_compute (compute, ptr, id, style, type) -!! subroutine lammps_extract_fix (fix, ptr, id, style, type, i, j) -!! subroutine lammps_extract_variable (variable, ptr, name, group) -!! double precision function lammps_get_thermo (ptr, name) -!! double precision function lammps_get_natoms (ptr) -!! subroutine lammps_set_variable (ptr, name, str, [err]) -!! subroutine lammps_reset_box (ptr, boxlo, boxhi, xy, yz, xz) -!! subroutine lammps_gather_atoms (ptr, name, count, data) -!! subroutine lammps_gather_atoms_concat (ptr, name, count, data) -!! subroutine lammps_gather_atoms_subset (ptr, name, count, ids, data) -!! subroutine lammps_scatter_atoms (ptr, name, data) -!! subroutine lammps_scatter_atoms_subset (ptr, name, ids, data) -!! logical function lammps_config_has_package (package_name) -!! integer function lammps_config_package_count () -!! logical function lammps_config_package_name (index, buffer) -!! logical function lammps_config_has_gzip_support () -!! logical function lammps_config_has_png_support () -!! logical function lammps_config_has_jpeg_support () -!! logical function lammps_config_has_ffmpeg_support () -!! logical function lammps_config_has_exceptions () -!! integer function lammps_find_pair_neighlist (ptr, style, exact, nsub, -!! request) -!! integer function lammps_find_fix_neighlist (ptr, id, request) -!! integer function lammps_find_compute_neighlist (ptr, id, request) -!! integer function lammps_neighlist_num_elements (ptr, idx) -!! subroutine lammps_neighlist_element_neighbors (ptr, idx, element, iatom, -!! numneigh, neighbors) -!! subroutine lammps_create_atoms (ptr, n, id, type, x, v, image, -!1 shrinkexceed) -!! -!! The following are also available if compiled with -DLAMMPS_EXCEPTIONS -!! function lammps_has_error (ptr) -!! function lammps_get_last_error_message (ptr, buffer) -!! -!! Note that the following function is not implemented from this interface: -!! lammps_set_fix_external_callback - -#define FLERR __FILE__,__LINE__ -! The above line allows for similar error checking as is done with standard -! LAMMPS files. - -! This should (?) allow this module to work with settings in lmptype.h -#if !defined(LAMMPS_SMALLSMALL) && !defined(LAMMPS_BIGBIG) && !defined(LAMMPS_SMALLBIG) -#define LAMMPS_SMALLBIG -#endif - -#ifdef LAMMPS_SMALLBIG -#define C_smallint C_int -#define C_imageint C_int -#define C_tagint C_int -#define C_bigint C_int64_t -#endif - -#ifdef LAMMPS_BIGBIG -#define C_smallint C_int -#define C_imageint C_int64_t -#define C_tagint C_int64_t -#define C_bigint C_int64_t -#endif - -#ifdef LAMMPS_SMALLSMALL -#define C_smallint C_int -#define C_imageint C_int -#define C_tagint C_int -#define C_bigint C_int -#endif - -module LAMMPS - - use, intrinsic :: ISO_C_binding, only : C_double, C_int, C_ptr, C_char, & - C_NULL_CHAR, C_NULL_PTR, C_loc, C_F_pointer, C_int64_t, & - lammps_instance => C_ptr - implicit none - private - - ! We inherit some ISO_C_BINDING entities for ease of use - public :: lammps_instance, C_ptr, C_double, C_int - ! Only the following functions may be called by the user: - public :: lammps_open, lammps_open_no_mpi, lammps_close, & - lammps_version, lammps_file, lammps_command, lammps_commands_list, & - lammps_commands_string, lammps_free, lammps_extract_setting, & - lammps_extract_global, lammps_extract_box, lammps_extract_atom, & - lammps_extract_compute, lammps_extract_fix, lammps_extract_variable, & - lammps_get_thermo, lammps_get_natoms, lammps_set_variable, & - lammps_reset_box, lammps_gather_atoms, lammps_gather_atoms_concat, & - lammps_gather_atoms_subset, lammps_scatter_atoms, & - lammps_scatter_atoms_subset, lammps_config_has_package, & - lammps_config_package_count, lammps_config_package_name, & - lammps_config_has_gzip_support, lammps_config_has_png_support, & - lammps_config_has_jpeg_support, lammps_config_has_ffmpeg_support, & - lammps_config_has_exceptions, lammps_find_pair_neighlist, & - lammps_find_fix_neighlist, lammps_find_compute_neighlist, & - lammps_neighlist_num_elements, lammps_neighlist_element_neighbors, & - lammps_create_atoms - -#ifdef LAMMPS_EXCEPTIONS - public :: lammps_has_error, lammps_get_last_error_message -#endif - - !! constants for extracting data from computes and fixes - !! and data types - - INTEGER, PARAMETER :: LMP_STYLE_GLOBAL = 0, LMP_STYLE_ATOM = 1, & - LMP_STYLE_LOCAL = 2, LMP_TYPE_SCALAR = 0, LMP_TYPE_VECTOR = 1, & - LMP_TYPE_ARRAY = 2, LMP_SIZE_VECTOR = 3, LMP_SIZE_ROWS = 4, & - LMP_SIZE_COLS = 5, LAMMPS_INT = 0, LAMMPS_INT_2D = 1, & - LAMMPS_DOUBLE = 2, LAMMPS_DOUBLE_2D = 3, LAMMPS_INT64 = 4, & - LAMMPS_INT64_2D = 5, LAMMPS_STRING = 6 - - PUBLIC :: LMP_STYLE_GLOBAL, LMP_STYLE_ATOM, LMP_STYLE_LOCAL, & - LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, & - LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS, LAMMPS_INT, & - LAMMPS_INT_2D, LAMMPS_DOUBLE, LAMMPS_DOUBLE_2D, LAMMPS_INT64, & - LAMMPS_INT64_2D, LAMMPS_STRING - - !! Functions supplemental to the prototypes in library.h. {{{1 - !! The function definitions (in C++) are contained in LAMMPS-wrapper.cpp. - !! I would have written the first in Fortran, but the MPI libraries (which - !! were written in C) have C-based functions to convert from Fortran MPI - !! handles to C MPI handles, and there is no Fortran equivalent for those - !! functions. - interface - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - bind (C, name='lammps_open_fortran_wrapper') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - integer, value :: communicator - type (C_ptr) :: ptr - end subroutine lammps_open_wrapper - subroutine lammps_actual_error_all (ptr, file, line, str) & - bind (C, name='lammps_error_all') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: file, str - integer (C_int), value :: line - end subroutine lammps_actual_error_all - function lammps_get_ntypes (ptr) result (ntypes) & - bind (C, name='lammps_get_ntypes') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: ntypes - end function lammps_get_ntypes - function lammps_actual_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_compute_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_compute_vectorsize - subroutine lammps_actual_extract_compute_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_compute_arraysize') - import :: C_int, C_char, C_ptr - integer (C_int) :: arraysize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_compute_arraysize - function lammps_actual_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_fix_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_fix_vectorsize - subroutine lammps_actual_extract_fix_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_fix_arraysize') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_fix_arraysize - end interface - - !! Functions/subroutines defined in library.h and library.cpp {{{1 - interface - subroutine lammps_actual_open_no_mpi (argc, argv, ptr) & - bind (C, name='lammps_open_no_mpi') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - type (C_ptr) :: ptr - end subroutine lammps_actual_open_no_mpi - - subroutine lammps_close (ptr) bind (C, name='lammps_close') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_close - - function lammps_version (ptr) result (version) & - bind (C, name='lammps_version') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (kind=C_int) :: version - end function lammps_version - - subroutine lammps_actual_file (ptr, str) bind (C, name='lammps_file') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_file - - function lammps_actual_command (ptr, str) result (command) & - bind (C, name='lammps_command') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - type (C_ptr) :: command - end function lammps_actual_command - - subroutine lammps_actual_commands_list (ptr, ncmd, cmds) & - bind (C, name='lammps_commands_list') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - type (C_ptr), dimension(*) :: cmds - integer (C_int), value :: ncmd - end subroutine lammps_actual_commands_list - - subroutine lammps_actual_commands_string (ptr, str) & - bind (C, name='lammps_commands_string') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_commands_string - - subroutine lammps_free (ptr) bind (C, name='lammps_free') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_free - - function lammps_actual_extract_setting (ptr, name) result (setting) & - bind(C, name='lammps_extract_setting') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - integer (kind=C_int) :: setting - end function lammps_actual_extract_setting - - function lammps_actual_extract_global (ptr, name) & - bind (C, name='lammps_extract_global') result (global) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: global - end function lammps_actual_extract_global - - subroutine lammps_actual_extract_box (ptr, boxlo, boxhi, xy, yz, & - xz, periodicity, box_change) bind (C, name='lammps_extract_box') - import :: C_ptr, C_double, C_int - type (C_ptr), value :: ptr - real (C_double) :: boxlo(3), boxhi(3), xy, yz, xz - integer (C_int) :: periodicity(3), box_change - end subroutine lammps_actual_extract_box - - function lammps_actual_extract_atom (ptr, name) & - bind (C, name='lammps_extract_atom') result (atom) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: atom - end function lammps_actual_extract_atom - - function lammps_actual_extract_compute (ptr, id, style, type) & - result (compute) bind (C, name='lammps_extract_compute') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type - type (C_ptr) :: compute - end function lammps_actual_extract_compute - - function lammps_actual_extract_fix (ptr, id, style, type, i, j) & - result (fix) bind (C, name='lammps_extract_fix') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type, i, j - type (C_ptr) :: fix - end function lammps_actual_extract_fix - - function lammps_actual_extract_variable (ptr, name, group) & - result (variable) bind (C, name='lammps_extract_variable') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, group - type (C_ptr) :: variable - end function lammps_actual_extract_variable - - function lammps_actual_get_thermo (ptr, name) result (dval) & - bind (C, name='lammps_get_thermo') - import :: C_ptr, C_char, C_double - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - real (C_double) :: dval - end function lammps_actual_get_thermo - - function lammps_get_natoms (ptr) result (natoms) & - bind (C, name='lammps_get_natoms') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real (C_double) :: natoms - end function lammps_get_natoms - - function lammps_actual_set_variable (ptr, name, str) result (err) & - bind (C, name='lammps_set_variable') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, str - integer (C_int) :: err - end function lammps_actual_set_variable - - subroutine lammps_actual_reset_box (ptr, boxlo, boxhi, xy, yz, xz) & - bind (C, name='lammps_reset_box') - import :: C_ptr, C_double, C_int - type (C_ptr), value :: ptr - real (C_double) :: boxlo(3), boxhi(3), xy, yz, xz - end subroutine lammps_actual_reset_box - - subroutine lammps_actual_gather_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_gather_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms - - subroutine lammps_actual_gather_atoms_concat (ptr, name, type, count, & - data) bind (C, name='lammps_gather_atoms_concat') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms_concat - - subroutine lammps_actual_gather_atoms_subset (ptr, name, type, count, & - ndata, ids, data) bind (C, name='lammps_gather_atoms_subset') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count, ndata - integer (C_int) :: ids(:) - end subroutine lammps_actual_gather_atoms_subset - - subroutine lammps_actual_scatter_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_scatter_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_scatter_atoms - - subroutine lammps_actual_scatter_atoms_subset (ptr, name, type, count, & - ndata, ids, data) bind (C, name='lammps_scatter_atoms_subset') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count, ndata - integer (C_int), dimension(*) :: ids - end subroutine lammps_actual_scatter_atoms_subset - - function lammps_actual_config_has_package (package_name) & - result (has_it) bind (C, name='lammps_config_has_package') - import :: C_char, C_int - character (len=1, kind=C_char), dimension(*) :: package_name - integer (C_int) :: has_it - end function lammps_actual_config_has_package - - function lammps_config_package_count () result (count) & - bind (C, name='lammps_config_package_count') - import :: C_int - integer (C_int) :: count - end function lammps_config_package_count - - function lammps_actual_config_package_name (index, buffer, max_size) & - result (num) bind (C, name='lammps_config_package_name') - import :: C_int, C_char - integer (C_int), value :: index, max_size - character (len=1, kind=C_char), dimension(*) :: buffer - integer (C_int) :: num - end function lammps_actual_config_package_name - - function lammps_actual_config_has_gzip_support () result (C_has_it) & - bind (C, name='lammps_config_has_gzip_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_gzip_support - - function lammps_actual_config_has_png_support () result (C_has_it) & - bind (C, name='lammps_config_has_png_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_png_support - - function lammps_actual_config_has_jpeg_support () result (C_has_it) & - bind (C, name='lammps_config_has_jpeg_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_jpeg_support - - function lammps_actual_config_has_ffmpeg_support () result (C_has_it) & - bind (C, name='lammps_config_has_ffmpeg_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_ffmpeg_support - - function lammps_actual_config_has_exceptions () result (C_has_it) & - bind (C, name='lammps_config_has_exceptions') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_exceptions - - function lammps_actual_find_pair_neighlist (ptr, style, exact, nsub, & - request) result (C_neighlist) & - bind (C, name='lammps_find_pair_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: style - integer (C_int), value :: exact, nsub, request - end function lammps_actual_find_pair_neighlist - - function lammps_actual_find_fix_neighlist (ptr, id, request) & - result (C_neighlist) bind (C, name='lammps_find_fix_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: id - integer (C_int), value :: request - end function lammps_actual_find_fix_neighlist - - function lammps_actual_find_compute_neighlist (ptr, id, request) & - result (C_neighlist) bind (C, name='lammps_find_compute_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: id - integer (C_int), value :: request - end function lammps_actual_find_compute_neighlist - - function lammps_actual_neighlist_num_elements (ptr, idx) & - result (nelements) bind (C, name='lammps_neighlist_num_elements') - import :: C_ptr, C_int - integer (C_int) :: nelements - type (C_ptr), value :: ptr - integer (C_int), value :: idx - end function lammps_actual_neighlist_num_elements - - subroutine lammps_actual_neighlist_element_neighbors (ptr, idx, & - element, iatom, numneigh, neighbors) & - bind (C, name='lammps_neighlist_element_neighbors') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: idx, element - integer (C_int) :: iatom, numneigh - type (C_ptr) :: neighbors - end subroutine lammps_actual_neighlist_element_neighbors - - subroutine lammps_actual_create_atoms (ptr, n, id, type, x, v, image, & - shrinkexceed) bind (C, name='lammps_create_atoms') - import :: C_ptr, C_int64_t, C_double, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: n - integer (C_tagint) :: id - integer (C_int) :: type - real (C_double), dimension(*) :: x, v - integer (C_imageint), dimension(*) :: image - integer (C_int), value :: shrinkexceed - end subroutine lammps_actual_create_atoms - -#ifdef LAMMPS_EXCEPTIONS - - function lammps_actual_has_error (ptr) result (C_has_it) & - bind (C, name='lammps_has_error') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: C_has_it - end function lammps_actual_has_error - - function lammps_actual_get_last_error_message (ptr, buffer, & - buffer_size) result (error_type) & - bind (C, name='lammps_get_last_error_message') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: buffer_size - character (len=1, kind=C_char), dimension(*) :: buffer - integer (C_int) :: error_type - end function lammps_actual_get_last_error_message - -#endif - - end interface - - ! Generic functions for the wrappers below {{{1 - - interface lammps_extract_global - module procedure lammps_extract_global_i, & - lammps_extract_global_dp - end interface lammps_extract_global - - interface lammps_extract_atom - module procedure lammps_extract_atom_ia, & - lammps_extract_atom_dpa, & - lammps_extract_atom_dp2a - end interface lammps_extract_atom - - interface lammps_extract_compute - module procedure lammps_extract_compute_dp, & - lammps_extract_compute_dpa, & - lammps_extract_compute_dp2a - end interface lammps_extract_compute - - interface lammps_extract_fix - module procedure lammps_extract_fix_dp, & - lammps_extract_fix_dpa, & - lammps_extract_fix_dp2a - end interface lammps_extract_fix - - interface lammps_extract_variable - module procedure lammps_extract_variable_dp, & - lammps_extract_variable_dpa - end interface lammps_extract_variable - - interface lammps_gather_atoms - module procedure lammps_gather_atoms_ia, lammps_gather_atoms_dpa - end interface lammps_gather_atoms - - interface lammps_gather_atoms_concat - module procedure lammps_gather_atoms_concat_ia, & - lammps_gather_atoms_concat_dpa - end interface lammps_gather_atoms_concat - - interface lammps_gather_atoms_subset - module procedure lammps_gather_atoms_subset_ia, & - lammps_gather_atoms_subset_dpa - end interface lammps_gather_atoms_subset - - interface lammps_scatter_atoms - module procedure lammps_scatter_atoms_ia, lammps_scatter_atoms_dpa - end interface lammps_scatter_atoms - - interface lammps_scatter_atoms_subset - module procedure lammps_scatter_atoms_subset_ia, & - lammps_scatter_atoms_subset_dpa - end interface lammps_scatter_atoms_subset - -contains !! Wrapper functions local to this module {{{1 - - subroutine lammps_open (command_line, communicator, ptr) - character (len=*), intent(in) :: command_line - integer, intent(in) :: communicator - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_open_wrapper (argc, argv, communicator, ptr) - deallocate (argv) - end subroutine lammps_open - -!----------------------------------------------------------------------------- - - subroutine lammps_open_no_mpi (command_line, ptr) - character (len=*), intent(in) :: command_line - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_actual_open_no_mpi (argc, argv, ptr) - deallocate (argv) - end subroutine lammps_open_no_mpi - -!----------------------------------------------------------------------------- - - subroutine lammps_file (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - Cstr = string2Cstring (str) - call lammps_actual_file (ptr, Cstr) - end subroutine lammps_file - -!----------------------------------------------------------------------------- - - subroutine lammps_command (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - type (C_ptr) :: dummy - Cstr = string2Cstring (str) - dummy = lammps_actual_command (ptr, Cstr) - end subroutine lammps_command - -!----------------------------------------------------------------------------- - - subroutine lammps_commands_list (ptr, cmds) - type (C_ptr), intent(in) :: ptr - character (len=*), dimension(:) :: cmds - integer (C_int) :: ncmd -! character (kind=C_char,len=1), dimension(size(cmds)) :: C_cmds - type (C_ptr), dimension(:), allocatable :: C_cmds - character (len=1, kind=C_char), allocatable, target :: C_strings(:,:) - integer :: i, max_len - ncmd = size(cmds) - allocate (C_cmds(ncmd)) - max_len = 0 - do i=1, size(cmds) - if ( len(cmds(i)) > max_len ) max_len = len(cmds(i)) - end do - allocate (C_strings(max_len + 1, ncmd)) - do i=1, size(cmds) - C_strings(:,i) = string2Cstring(cmds(i)) - C_cmds(i) = C_loc(C_strings(1,i)) - end do - call lammps_actual_commands_list (ptr, ncmd, C_cmds) - deallocate (C_strings) - deallocate (C_cmds) - end subroutine lammps_commands_list - -!----------------------------------------------------------------------------- - - subroutine lammps_commands_string (ptr, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: C_str - C_str = string2Cstring (str) - call lammps_actual_commands_string (ptr, C_str) - end subroutine lammps_commands_string - -!----------------------------------------------------------------------------- - - function lammps_extract_setting (ptr, name) result (setting) - integer :: setting - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: C_name - C_name = string2Cstring (name) - setting = lammps_actual_extract_setting (ptr, C_name) - end function lammps_extract_setting - -!----------------------------------------------------------------------------- - -! lammps_extract_global {{{2 - function lammps_extract_global_Cptr (ptr, name) result (global) - type (C_ptr) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - global = lammps_actual_extract_global (ptr, Cname) - end function lammps_extract_global_Cptr - subroutine lammps_extract_global_i (global, ptr, name) - integer (C_int), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_i - subroutine lammps_extract_global_dp (global, ptr, name) - real (C_double), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_dp - -!----------------------------------------------------------------------------- - -! lammps_extract_box {{{2 - subroutine lammps_extract_box (ptr, boxlo, boxhi, xy, yz, xz, & - periodicity, box_change) - type (C_ptr), intent(in) :: ptr - double precision, dimension(3), intent(out) :: boxlo, boxhi - double precision, intent(out) :: xy, yz, xz - logical, intent(out) :: periodicity(3), box_change - integer (kind=C_int) :: C_periodicity(3), C_box_change - real (C_double) :: C_boxlo(3), C_boxhi(3), C_xy, C_yz, C_xz - call lammps_actual_extract_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, & - C_xz, C_periodicity, C_box_change) - boxlo = C_boxlo - boxhi = C_boxhi - xy = C_xy - yz = C_yz - xz = C_xz - periodicity = (C_periodicity == 1) - box_change = (C_box_change == 1) - end subroutine - -!----------------------------------------------------------------------------- - -! lammps_extract_atom {{{2 - function lammps_extract_atom_Cptr (ptr, name) result (atom) - type (C_ptr) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - atom = lammps_actual_extract_atom (ptr, Cname) - end function lammps_extract_atom_Cptr - subroutine lammps_extract_atom_ia (atom, ptr, name) - integer (C_int), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nelements - call lammps_extract_global_i (nelements, ptr, 'nlocal') - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, atom, (/nelements/)) - end subroutine lammps_extract_atom_ia - subroutine lammps_extract_atom_dpa (atom, ptr, name) - real (C_double), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nlocal - integer :: nelements - real (C_double), dimension(:), pointer :: Fptr - if ( name == 'mass' ) then - nelements = lammps_get_ntypes (ptr) + 1 - else if ( name == 'x' .or. name == 'v' .or. name == 'f' .or. & - name == 'mu' .or. name == 'omega' .or. name == 'torque' .or. & - name == 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 1 array.') - return - else - ! Everything else we can get is probably nlocal units long - call lammps_extract_global_i (nlocal, ptr, 'nlocal') - nelements = nlocal - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, Fptr, (/nelements/)) - if ( name == 'mass' ) then - atom(0:) => Fptr - else - atom => Fptr - end if - end subroutine lammps_extract_atom_dpa - subroutine lammps_extract_atom_dp2a (atom, ptr, name) - real (C_double), dimension(:,:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - integer (C_int), pointer :: nelements - if ( name /= 'x' .and. name /= 'v' .and. name /= 'f' .and. & - name /= 'mu' .and. name /= 'omega' .and. name /= 'tandque' .and. & - name /= 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 2 array.') - return - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call lammps_extract_global_i (nelements, ptr, 'nlocal') - ! Catom will now be the array of void* pointers that the void** pointer - ! pointed to. Catom(1) is now the pointer to the first element. - call C_F_pointer (Cptr, Catom, (/nelements/)) - ! Now get the actual array, which has its shape transposed from what we - ! might think of it in C - call C_F_pointer (Catom(1), atom, (/3, nelements/)) - end subroutine lammps_extract_atom_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_compute {{{2 - function lammps_extract_compute_Cptr (ptr, id, style, type) result (compute) - type (C_ptr) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - integer (kind=C_int) :: Cstyle, Ctype - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - compute = lammps_actual_extract_compute (ptr, Cid, Cstyle, Ctype) - end function lammps_extract_compute_Cptr - subroutine lammps_extract_compute_dp (compute, ptr, id, style, type) - real (C_double), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - ! The only valid values of (style,type) are (0,0) for scalar 'compute' - if ( style /= 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot pack per-atom/local& - & data into a scalar.') - return - end if - if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & vector (rank 1) into a scalar.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a scalar.') - return - end if - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute) - end subroutine lammps_extract_compute_dp - subroutine lammps_extract_compute_dpa (compute, ptr, id, style, type) - real (C_double), dimension(:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - integer :: nelements - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 1 variable.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a rank 1 variable.') - return - end if - nelements = lammps_extract_compute_vectorsize (ptr, id, style) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute, (/nelements/)) - end subroutine lammps_extract_compute_dpa - subroutine lammps_extract_compute_dp2a (compute, ptr, id, style, type) - real (C_double), dimension(:,:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Ccompute - integer :: nr, nc - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_compute_arraysize (ptr, id, style, nr, nc) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, Ccompute, (/nr/)) - ! Note that the matrix is transposed, from Fortran's perspective - call C_F_pointer (Ccompute(1), compute, (/nc, nr/)) - end subroutine lammps_extract_compute_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_fix {{{2 - function lammps_extract_fix_Cptr (ptr, id, style, type, i, j) & - result (fix) - type (C_ptr) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - integer (kind=C_int) :: Cstyle, Ctype, Ci, Cj - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - Ci = i - 1 ! This is for consistency with the values from f_ID[i], - Cj = j - 1 ! which is different from what library.cpp uses! - if ( (type >= 1 .and. Ci < 0) .or. & - (type == 2 .and. (Ci < 0 .or. Cj < 0) ) ) then - call lammps_error_all (ptr, FLERR, 'Index out of range in& - & lammps_extract_fix') - end if - fix = lammps_actual_extract_fix (ptr, Cid, Cstyle, Ctype, Ci, Cj) - end function lammps_extract_fix_Cptr - subroutine lammps_extract_fix_dp (fix, ptr, id, style, type, i, j) - real (C_double), intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - ! Check for the correct dimensionality - if ( style /= 0 ) then - select case (type) - case (0) - call lammps_error_all (ptr, FLERR, 'There is no per-atom or local& - & scalar data available from fixes.') - case (1) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local vector (rank 1) into a scalar.') - case (2) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local array (rank 2) into a scalar.') - case default - call lammps_error_all (ptr, FLERR, 'Invalid extract_fix style/& - &type combination.') - end select - return - end if - Cptr = lammps_extract_fix_Cptr (ptr, id, style, type, i, j) - call C_F_pointer (Cptr, Fptr) - fix = Fptr - nullify (Fptr) - ! Memory is only allocated for "global" fix variables - if ( style == 0 ) call lammps_free (Cptr) - end subroutine lammps_extract_fix_dp - subroutine lammps_extract_fix_dpa (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - integer :: fix_len - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract the& - & whole vector from global fix data') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract a fix& - & scalar into a rank 1 variable') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & array into a rank 1 variable.') - return - else if ( type /= 1 ) then - call lammps_error_all (ptr, FLERR, 'Invalid type for fix extraction.') - return - end if - fix_len = lammps_extract_fix_vectorsize (ptr, id, style) - call C_F_pointer (Cptr, fix, (/fix_len/)) - ! Memory is only allocated for "global" fix variables, which we should - ! never get here, so no need to call lammps_free! - end subroutine lammps_extract_fix_dpa - subroutine lammps_extract_fix_dp2a (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:,:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Cfix - integer :: nr, nc - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'It is not possible to extract the& - & entire array from global fix data.') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & vector (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_fix_arraysize (ptr, id, style, nr, nc) - ! Extract pointer to first element as Cfix(1) - call C_F_pointer (Cptr, Cfix, (/nr/)) - ! Now extract the array, which is transposed - call C_F_pointer (Cfix(1), fix, (/nc, nr/)) - end subroutine lammps_extract_fix_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_variable {{{2 - function lammps_extract_variable_Cptr (ptr, name, group) result (variable) - type (C_ptr) :: ptr, variable - character (len=*) :: name - character (len=*), optional :: group - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - character (kind=C_char), dimension(:), allocatable :: Cgroup - Cname = string2Cstring (name) - if ( present(group) ) then - allocate (Cgroup(len_trim(group)+1)) - Cgroup = string2Cstring (group) - else - allocate (Cgroup(1)) - Cgroup(1) = C_NULL_CHAR - end if - variable = lammps_actual_extract_variable (ptr, Cname, Cgroup) - deallocate (Cgroup) - end function lammps_extract_variable_Cptr - subroutine lammps_extract_variable_dp (variable, ptr, name, group) - real (C_double), intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - call C_F_pointer (Cptr, Fptr) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dp - subroutine lammps_extract_variable_dpa (variable, ptr, name, group) - real (C_double), dimension(:), allocatable, intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), dimension(:), pointer :: Fptr - integer :: natoms - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - natoms = lammps_get_natoms (ptr) - allocate (variable(natoms)) - call C_F_pointer (Cptr, Fptr, (/natoms/)) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dpa - -!-------------------------------------------------------------------------2}}} - - function lammps_get_thermo (ptr, name) result (dval) - double precision :: dval - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - dval = lammps_actual_get_thermo (ptr, Cname) - end function lammps_get_thermo - - subroutine lammps_set_variable (ptr, name, str, err) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name, str - integer, optional :: err - integer (C_int) :: Cerr - character (kind=C_char) :: Cname(len_trim(name)+1), Cstr(len_trim(str)+1) - Cname = string2Cstring (name) - Cstr = string2Cstring (str) - Cerr = lammps_actual_set_variable (ptr, Cname, Cstr) - if ( present(err) ) err = Cerr - end subroutine lammps_set_variable - - subroutine lammps_reset_box (ptr, boxlo, boxhi, xy, yz, xz) - type (C_ptr), intent(in) :: ptr - double precision, dimension(3), intent(in) :: boxlo, boxhi - double precision, intent(in) :: xy, yz, xz - real (C_double) :: C_boxlo(3), C_boxhi(3), C_xy, C_yz, C_xz - C_boxlo = boxlo - C_boxhi = boxhi - C_xy = xy - C_xz = xz - C_yz = yz - call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, C_xz) - end subroutine lammps_reset_box - -! lammps_gather_atoms {{{2 - subroutine lammps_gather_atoms_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_ia - subroutine lammps_gather_atoms_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_dpa - -! lammps_gather_atoms_concat {{{2 - subroutine lammps_gather_atoms_concat_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_concat (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_concat_ia - subroutine lammps_gather_atoms_concat_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms_concat& - & requires count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_concat (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_concat_dpa - -!----------------------------------------------------------------------------- - -! lammps_gather_atoms_subset {{{2 - subroutine lammps_gather_atoms_subset_ia (ptr,name,count,ids,data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count, ids(:) - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: ndata, Cids(size(ids)) - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - ndata = size(ids) - Cname = string2Cstring (name) - Cids = ids - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms_subset& - & requires count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*ndata) ) - allocate ( data(count*ndata) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_subset_ia - subroutine lammps_gather_atoms_subset_dpa (ptr,name,count,ids,data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count, ids(:) - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: ndata, Cids(size(ids)) - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - ndata = size(ids) - Cname = string2Cstring (name) - Cids = ids - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*ndata) ) - allocate ( data(count*ndata) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_subset_dpa - -!----------------------------------------------------------------------------- - -! lammps_scatter_atoms {{{2 - subroutine lammps_scatter_atoms_ia (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_ia - subroutine lammps_scatter_atoms_dpa (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_dpa - -!----------------------------------------------------------------------------- - -! lammps_scatter_atoms_subset {{{2 - subroutine lammps_scatter_atoms_subset_ia (ptr, name, ids, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data, ids - integer (kind=C_int) :: ndata, Ccount, Cids(size(ids)) - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - ndata = size(ids) - Cname = string2Cstring (name) - Ccount = size(data) / ndata - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - Cids = ids - call lammps_actual_scatter_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - end subroutine lammps_scatter_atoms_subset_ia - subroutine lammps_scatter_atoms_subset_dpa (ptr, name, ids, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data, ids - integer (kind=C_int) :: ndata, Ccount, Cids(size(ids)) - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - ndata = size(ids) - Cname = string2Cstring (name) - Ccount = size(data) / ndata - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - end subroutine lammps_scatter_atoms_subset_dpa - -!----------------------------------------------------------------------------- - - subroutine lammps_create_atoms (ptr, id, type, x, v, image, shrinkexceed) - type (C_ptr), intent(in) :: ptr - integer (kind=C_tagint), dimension(:), optional :: id - integer, dimension(:) :: type - double precision, dimension(:,:) :: x - double precision, dimension(:,:), optional :: v - integer (kind=C_imageint), dimension(:), target, optional :: image - logical, optional :: shrinkexceed - real (C_double), dimension(size(x)) :: C_x, C_v - integer (C_int) :: C_shrinkexceed, n - integer (kind=C_tagint) :: C_id - integer (C_imageint), dimension(size(x)/3) :: C_image - integer (C_int) :: C_type - if (shrinkexceed) then - C_shrinkexceed = 1_C_int - else - C_shrinkexceed = 0_C_int - end if - C_x = reshape(transpose(x), shape(C_x)) - if ( present(v) ) then - C_v = reshape(transpose(v), shape(C_v)) - else - C_v = 0.0_C_double - end if - if ( present(image) ) then - C_image = image - else - C_image = int(0,kind=C_imageint) - end if - n = size(type) - call lammps_actual_create_atoms (ptr, n, C_id, C_type, C_x, C_v, & - C_image, C_shrinkexceed) - end subroutine lammps_create_atoms - -!----------------------------------------------------------------------------- - - function lammps_config_has_package (package_name) result (has_it) - character (len=*), intent(in) :: package_name - character (len=1, kind=C_char), dimension(len_trim(package_name)+1) :: & - C_package_name - logical :: has_it - integer (C_int) :: C_has_it - C_package_name = string2Cstring (package_name) - C_has_it = lammps_actual_config_has_package (C_package_name) - has_it = (C_has_it == 1) - end function lammps_config_has_package - -!----------------------------------------------------------------------------- - - function lammps_config_package_name (index, buffer) result (installed) - character (len=*), intent(inout) :: buffer - integer, intent(in) :: index - logical :: installed - integer (kind=C_int) :: C_installed, C_index, max_size - character (len=1, kind=C_char), dimension(len_trim(buffer)+1) :: C_buffer - C_buffer = string2Cstring (buffer) - max_size = len(buffer) - C_index = index - C_installed = lammps_actual_config_package_name (C_index, C_buffer, & - max_size) - installed = (C_installed == 1_C_int) - buffer = Cstring2string (C_buffer) - end function lammps_config_package_name - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_gzip_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_gzip_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_gzip_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_png_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_png_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_png_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_jpeg_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_jpeg_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_jpeg_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_ffmpeg_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_ffmpeg_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_ffmpeg_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_exceptions () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_exceptions () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_exceptions - -!----------------------------------------------------------------------------- - - function lammps_find_pair_neighlist (ptr, style, exact, nsub, request) & - result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: style - logical, intent(in) :: exact - integer, intent(in) :: nsub, request - integer (C_int) :: C_exact, C_nsub, C_neighlist, C_request - character (kind=C_char), dimension(len_trim(style)+1) :: C_style - if (exact) then - C_exact = 1_C_int - else - C_exact = 0_C_int - end if - C_nsub = nsub - C_request = request - C_style = string2Cstring (style) - C_neighlist = lammps_actual_find_pair_neighlist (ptr, C_style, C_exact, & - C_nsub, C_request) - neighlist = C_neighlist - end function lammps_find_pair_neighlist - -!----------------------------------------------------------------------------- - - function lammps_find_fix_neighlist (ptr, id, request) result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: request - integer (C_int) :: C_request, C_neighlist - character (kind=C_char), dimension(len_trim(id)+1) :: C_id - C_id = string2Cstring(id) - C_request = request - C_neighlist = lammps_actual_find_fix_neighlist (ptr, C_id, C_request) - neighlist = C_neighlist - end function lammps_find_fix_neighlist - -!----------------------------------------------------------------------------- - - function lammps_find_compute_neighlist (ptr, id, request) result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: request - integer (C_int) :: C_request - character (kind=C_char), dimension(len_trim(id)+1) :: C_id - C_id = string2Cstring(id) - C_request = request - neighlist = lammps_actual_find_compute_neighlist (ptr, C_id, C_request) - end function lammps_find_compute_neighlist - -!----------------------------------------------------------------------------- - - function lammps_neighlist_num_elements (ptr, idx) result (nelements) - integer :: nelements - type (C_ptr), intent(in) :: ptr - integer, intent(in) :: idx - integer (C_int) :: C_idx - C_idx = idx - nelements = lammps_actual_neighlist_num_elements (ptr, C_idx) - end function lammps_neighlist_num_elements - -!----------------------------------------------------------------------------- - - subroutine lammps_neighlist_element_neighbors (ptr, idx, element, iatom, & - numneigh, neighbors) - type (C_ptr), intent(in) :: ptr - integer, intent(in) :: idx, element - integer, intent(out) :: iatom, numneigh - integer (C_int), dimension(:), pointer, intent(out) :: neighbors - integer (C_int) :: C_idx, C_element, C_iatom, C_numneigh - type (C_ptr) :: C_neighbors - C_idx = idx - C_element = element - call lammps_actual_neighlist_element_neighbors (ptr, C_idx, C_element, & - C_iatom, C_numneigh, C_neighbors) - iatom = C_iatom - numneigh = C_numneigh - call C_F_pointer (C_neighbors, neighbors, [numneigh]) - end subroutine lammps_neighlist_element_neighbors - -!----------------------------------------------------------------------------- - -! These are only defined if -DLAMMPS_EXCEPTIONS was issued -#ifdef LAMMPS_EXCEPTIONS - logical function lammps_has_error (ptr) result (has_it) - type (C_ptr), intent(in) :: ptr - integer (kind=C_int) :: C_has_it - C_has_it = lammps_actual_has_error (ptr) - has_it = (C_has_it == 1_C_int) - end function lammps_has_error - -!----------------------------------------------------------------------------- - - function lammps_get_last_error_message (ptr, buffer) result (error_type) - integer (C_int) :: error_type - type (C_ptr), intent(in) :: ptr - character (len=*), intent(out) :: buffer - integer (C_int) :: buffer_size - character (len=1, kind=C_char), dimension(len(buffer)+1) :: C_buffer - buffer_size = len(buffer) - error_type = lammps_actual_get_last_error_message (ptr, C_buffer, & - buffer_size) - buffer = Cstring2string (C_buffer) - end function lammps_get_last_error_message -#endif -!-------------------------------------------------------------------------2}}} - - function lammps_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_compute_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_compute_vectorsize - -!----------------------------------------------------------------------------- - - function lammps_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_fix_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_fix_vectorsize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_compute_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, C_int) - call lammps_actual_extract_compute_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_compute_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_fix_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, kind(Cstyle)) - call lammps_actual_extract_fix_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_fix_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_error_all (ptr, file, line, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: file, str - integer, intent(in) :: line - character (kind=C_char), dimension(len_trim(file)+1) :: Cfile - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - integer (C_int) :: Cline - Cline = int(line, kind(Cline)) - Cfile = string2Cstring (file) - Cstr = string2Cstring (str) - call lammps_actual_error_all (ptr, Cfile, Cline, Cstr) - end subroutine lammps_error_all - -!----------------------------------------------------------------------------- - -! Locally defined helper functions {{{1 - - pure function string2Cstring (string) result (C_string) - use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=*), intent(in) :: string - character (len=1, kind=C_char) :: C_string (len_trim(string)+1) - integer :: i, n - n = len_trim (string) - forall (i = 1:n) - C_string(i) = string(i:i) - end forall - C_string(n+1) = C_NULL_CHAR - end function string2Cstring - -!----------------------------------------------------------------------------- - - pure function Cstrlen (Cstring) result (n) - character (len=1, kind=C_char), dimension(:), intent(in) :: Cstring - integer :: n, i - n = size(Cstring) - do i = 1, size(Cstring) - if ( Cstring(i) == C_NULL_CHAR ) then - n = i - 1 - return - end if - end do - end function Cstrlen - -!----------------------------------------------------------------------------- - - pure function Cstring2string (Cstring) result (string) - !use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=1, kind=C_char), intent(in) :: Cstring (:) - character (len=Cstrlen(Cstring)) :: string - integer :: i, n - n = Cstrlen(Cstring) - string = '' - forall (i = 1:n) - string(i:i) = Cstring(i) - end forall - end function Cstring2string - -!----------------------------------------------------------------------------- - - subroutine Cstring2argcargv (Cstring, argc, argv) - !! Converts a C-style string to argc and argv, that is, words in Cstring - !! become C-style strings in argv. IMPORTANT: Cstring is modified by - !! this routine! I would make Cstring local TO this routine and accept - !! a Fortran-style string instead, but we run into scoping and - !! allocation problems that way. This routine assumes the string is - !! null-terminated, as all C-style strings must be. - - character (kind=C_char), dimension(*), target, intent(inout) :: Cstring - integer (C_int), intent(out) :: argc - type (C_ptr), dimension(:), allocatable, intent(out) :: argv - - integer :: StringStart, SpaceIndex, strlen, argnum - - argc = 1_C_int - - ! Find the length of the string - strlen = 1 - do while ( Cstring(strlen) /= C_NULL_CHAR ) - strlen = strlen + 1 - end do - - ! Find the number of non-escaped spaces - SpaceIndex = 2 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - argc = argc + 1_C_int - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - end if - SpaceIndex = SpaceIndex + 1 - end do - - ! Now allocate memory for argv - allocate (argv(argc)) - - ! Now find the string starting and ending locations - StringStart = 1 - SpaceIndex = 2 - argnum = 1 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - ! Found a real space => split strings and store this one - Cstring(Spaceindex) = C_NULL_CHAR ! Replaces space with NULL - argv(argnum) = C_loc(Cstring(StringStart)) - argnum = argnum + 1 - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - StringStart = SpaceIndex + 1 - else if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) == '\' ) then - ! Escaped space => remove backslash and move rest of array - Cstring(SpaceIndex-1:strlen-1) = Cstring(SpaceIndex:strlen) - strlen = strlen - 1 ! Last character is still C_NULL_CHAR - end if - SpaceIndex = SpaceIndex + 1 - end do - ! Now handle the last argument - argv(argnum) = C_loc(Cstring(StringStart)) - - end subroutine Cstring2argcargv - -! 1}}} - -end module LAMMPS - -! vim: foldmethod=marker tabstop=3 softtabstop=3 shiftwidth=3 expandtab diff --git a/examples/COUPLE/fortran2/Makefile b/examples/COUPLE/fortran2/Makefile deleted file mode 100644 index 8ac957a4c1..0000000000 --- a/examples/COUPLE/fortran2/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -SHELL = /bin/sh - -# Path to LAMMPS extraction directory -LAMMPS_ROOT = ../../.. -LAMMPS_SRC = $(LAMMPS_ROOT)/src - -# Uncomment the line below if using the MPI stubs library -MPI_STUBS = #-I$(LAMMPS_SRC)/STUBS - -FC = mpifort # replace with your Fortran compiler -CXX = mpicxx # replace with your C++ compiler -CXXLIB = -lstdc++ # replace with your C++ runtime libs - -# Flags for Fortran compiler, C++ compiler, and C preprocessor, respectively -FFLAGS = -O2 -fPIC -CXXFLAGS = -O2 -fPIC -CPPFLAGS = -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX - -all : liblammps_fortran.a liblammps_fortran.so - @echo "WARNING: this Fortran interface is obsolete and is no longer -maintained. See $(LAMMPS_ROOT)/fortran for the new, maintained interface -(largely written by the same author). You may continue to use this interface if -desired, but it may eventually be removed from LAMMPS." - -liblammps_fortran.so : LAMMPS.o LAMMPS-wrapper.o - $(FC) $(FFLAGS) -shared -o $@ $^ $(CXXLIB) - -liblammps_fortran.a : LAMMPS.o LAMMPS-wrapper.o - $(AR) rs $@ $^ - -LAMMPS.o lammps.mod : LAMMPS.F90 - $(FC) $(CPPFLAGS) $(FFLAGS) -c $< - -LAMMPS-wrapper.o : LAMMPS-wrapper.cpp LAMMPS-wrapper.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -clean : - $(RM) *.o *.mod liblammps_fortran.a liblammps_fortran.so - -dist : - tar -czf Fortran-interface.tar.gz LAMMPS-wrapper.h LAMMPS-wrapper.cpp LAMMPS.F90 makefile README diff --git a/examples/COUPLE/fortran2/README b/examples/COUPLE/fortran2/README deleted file mode 100644 index b36cb43746..0000000000 --- a/examples/COUPLE/fortran2/README +++ /dev/null @@ -1,273 +0,0 @@ -!! NOTE ------------------------------------------------------------------- -! This interface is obsolete and may be removed in a future release of -! LAMMPS. The interface in fortran/lammps.f90 replaces this one. That API -! is maintained by the LAMMPS developers and has documentation written for -! it; it is based loosely on this one, but binds all procedures to a lammps -! derived type. That interface was written in large -! part by the same author, but is also supported by other developers. -!-------------------------------------------------------------------------- - -LAMMPS.F90 defines a Fortran 2003 module, LAMMPS, which wraps all functions in -src/library.h so they can be used directly from Fortran-encoded programs. - -All functions in src/library.h that use and/or return C-style pointers have -Fortran wrapper functions that use Fortran-style arrays, pointers, and -strings; all C-style memory management is handled internally with no user -intervention. See --USE-- for notes on how this interface differs from the -C interface (and the Python interface). - -This interface was created by Karl Hammond who you can contact with -questions: - -Karl D. Hammond -University of Missouri -hammondkd at missouri.edu - -------------------------------------- - ---COMPILATION-- - -First, be advised that mixed-language programming is not trivial. It requires -you to link in the required libraries of all languages you use (in this case, -those for Fortran, C, and C++), as well as any other libraries required. -You are also advised to read the --USE-- section below before trying to -compile. - -The following steps will work to compile this module (replace ${LAMMPS_SRC} -with the path to your LAMMPS source directory). - -Steps 3-5 are accomplished, possibly after some modifications to -the makefile, by make using the attached makefile. Said makefile also builds -the dynamically-linkable library (liblammps_fortran.so). - -** STATIC LIBRARY INSTRUCTIONS ** - (1) Compile LAMMPS as a static library. - Call the resulting file ${LAMMPS_LIB}, which will have an actual name - like liblmp_openmpi.a. If compiling using the MPI stubs in - ${LAMMPS_SRC}/STUBS, you will need to know where libmpi_stubs.a - is as well (I'll call it ${MPI_STUBS} hereafter) - (2) Copy said library to your Fortran program's source directory or replace - ${LAMMPS_LIB} with its full path in the instructions below. - (3) Compile (but don't link!) LAMMPS.F90. Example: - mpifort -c LAMMPS.f90 - OR - gfortran -c LAMMPS.F90 - NOTE: you may get a warning such as, - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - Variable 'communicator' at (1) is a parameter to the BIND(C) - procedure 'lammps_open_wrapper' but may not be C interoperable - This is normal (see --IMPLEMENTATION NOTES--). - - (4) Compile (but don't link) LAMMPS-wrapper.cpp. You will need its header - file as well. You will have to provide the locations of LAMMPS's - header files. For example, - mpicxx -c -I${LAMMPS_SRC} LAMMPS-wrapper.cpp - OR - g++ -c -I${LAMMPS_SRC} -I${LAMMPS_SRC}/STUBS LAMMPS-wrapper.cpp - OR - icpc -c -I${LAMMPS_SRC} -I${LAMMPS_SRC}/STUBS LAMMPS-wrapper.cpp - (5) OPTIONAL: Make a library from the object files so you can carry around - two files instead of three. Example: - ar rs liblammps_fortran.a LAMMPS.o LAMMPS-wrapper.o - This will create the file liblammps_fortran.a that you can use in place - of "LAMMPS.o LAMMPS-wrapper.o" later. Note that you will still - need to have the .mod file from part (3). - - It is also possible to add LAMMPS.o and LAMMPS-wrapper.o into the - LAMMPS library (e.g., liblmp_openmpi.a) instead of creating a separate - library, like so: - ar rs ${LAMMPS_LIB} LAMMPS.o LAMMPS-wrapper.o - In this case, you can now use the Fortran wrapper functions as if they - were part of the usual LAMMPS library interface (if you have the module - file visible to the compiler, that is). - (6) Compile (but don't link) your Fortran program. Example: - mpifort -c myfreeformatfile.f90 - mpifort -c myfixedformatfile.f - OR - gfortran -c myfreeformatfile.f90 - gfortran -c myfixedformatfile.f - The object files generated by these steps are collectively referred to - as ${my_object_files} in the next step(s). - - IMPORTANT: If the Fortran module from part (3) is not in the current - directory or in one searched by the compiler for module files, you will - need to include that location via the -I flag to the compiler, like so: - mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 - - (7) Link everything together, including any libraries needed by LAMMPS (such - as the C++ standard library, the C math library, the JPEG library, fftw, - etc.) For example, - mpifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} -lmpi_cxx -lstdc++ -lm - OR - gfortran LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} ${MPI_STUBS} -lstdc++ -lm - OR - ifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} ${MPI_STUBS} -cxxlib -lm - Any other required libraries (e.g. -ljpeg, -lfftw) should be added to - the end of this line. - -You should now have a working executable. - -** DYNAMIC LIBRARY INSTRUCTIONS ** - (1) Compile LAMMPS as a dynamic library - (make makeshlib && make -f Makefile.shlib [targetname]). - (2) Compile, but don't link, LAMMPS.F90 using the -fPIC flag, such as - mpifort -fPIC -c LAMMPS.f90 - (3) Compile, but don't link, LAMMPS-wrapper.cpp in the same manner, e.g. - mpicxx -fPIC -c LAMMPS-wrapper.cpp - (4) Make the dynamic library, like so: - mpifort -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o - (5) Compile your program, such as, - mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 - where ${LAMMPS_SRC}/examples/COUPLE/fortran2 contains the .mod file from - step (3) - (6) Link everything together, such as - mpifort ${my_object_files} -L${LAMMPS_SRC} \ - -L${LAMMPS_SRC}/examples/COUPLE/fortran2 -llammps_fortran \ - -llammps_openmpi -lmpi_cxx -lstdc++ -lm - -If you wish to avoid the -L flags, add the directories containing your -shared libraries to the LIBRARY_PATH environment variable. At run time, you -will have to add these directories to LD_LIBRARY_PATH as well; otherwise, -your executable will not find the libraries it needs. - -------------------------------------- - ---USAGE-- - -To use this API, your program unit (PROGRAM/SUBROUTINE/FUNCTION/MODULE/etc.) -should look something like this: - program call_lammps - use LAMMPS - ! Other modules, etc. - implicit none - type (lammps_instance) :: lmp ! This is a pointer to your LAMMPS instance - real (C_double) :: fix - real (C_double), dimension(:), pointer :: fix2 - ! Rest of declarations - call lammps_open_no_mpi ('lmp -in /dev/null -screen out.lammps',lmp) - ! Set up rest of program here - call lammps_file (lmp, 'in.example') - call lammps_extract_fix (fix, lmp, '2', 0, 1, 1, 1) - call lammps_extract_fix (fix2, lmp, '4', 0, 2, 1, 1) - call lammps_close (lmp) - end program call_lammps - -Important notes: - * Though I dislike the use of pointers, they are necessary when communicating - with C and C++, which do not support Fortran's ALLOCATABLE attribute. - * There is no need to deallocate C-allocated memory; this is done for you in - the cases when it is done (which are all cases when pointers are not - accepted, such as global fix data) - * All arguments which are char* variables in library.cpp are character (len=*) - variables here. For example, - call lammps_command (lmp, 'units metal') - will work as expected. - * The public functions (the only ones you can use) have interfaces as - described in the comments at the top of LAMMPS.F90. They are not always - the same as those in library.h, since C strings are replaced by Fortran - strings and the like. - * The module attempts to check whether you have done something stupid (such - as assign a 2D array to a scalar), but it's not perfect. For example, the - command - call lammps_extract_global (nlocal, ptr, 'nlocal') - will give nlocal correctly if nlocal is a pointer to type INTEGER, but it - will give the wrong answer if nlocal is a pointer to type REAL. This is a - feature of the (void*) type cast in library.cpp. There is no way I can - check this for you! It WILL catch you if you pass it an allocatable or - fixed-size array when it expects a pointer. - * Arrays constructed from temporary data from LAMMPS are ALLOCATABLE, and - represent COPIES of data, not the originals. Functions like - lammps_extract_atom, which return actual LAMMPS data, are pointers. - * IMPORTANT: Due to the differences between C and Fortran arrays (C uses - row-major vectors, Fortran uses column-major vectors), all arrays returned - from LAMMPS have their indices swapped. - * An example of a complete program, simple.f90, is included with this - package. - -------------------------------------- - ---TROUBLESHOOTING-- - -Compile-time errors (when compiling LAMMPS.F90, that is) probably indicate -that your compiler is not new enough to support Fortran 2003 features. For -example, GCC 4.1.2 will not compile this module, but GCC 4.4.0 will. - -If your compiler balks at 'use, intrinsic :: ISO_C_binding,' try removing the -intrinsic part so it looks like an ordinary module. However, it is likely -that such a compiler will also have problems with everything else in the -file as well. - -If you get a segfault as soon as the lammps_open call is made, check that you -compiled your program AND LAMMPS-wrapper.cpp using the same MPI headers. Using -the stubs for one and the actual MPI library for the other will cause Bad -Things to happen. - -If you find run-time errors, please pass them along via the LAMMPS Users -mailing list (please CC me as well; address above). Please provide a minimal -working example along with the names and versions of the compilers you are -using. Please make sure the error is repeatable and is in MY code, not yours -(generating a minimal working example will usually ensure this anyway). - -------------------------------------- - ---IMPLEMENTATION NOTES-- - -The Fortran procedures have the same names as the C procedures, and -their purpose is the same, but they may take different arguments. Here are -some of the important differences: - * lammps_open and lammps_open_no_mpi take a string instead of argc and - argv. This is necessary because C and C++ have a very different way - of treating strings than Fortran. If you want the command line to be - passed to lammps_open (as it often would be from C/C++), use the - GET_COMMAND intrinsic to obtain it. - * All C++ functions that accept char* pointers now accept Fortran-style - strings within this interface instead. - * All of the lammps_extract_[something] functions, which return void* - C-style pointers, have been replaced by generic subroutines that return - Fortran variables (which may be arrays). The first argument houses the - variable/pointer to be returned (pretend it's on the left-hand side); all - other arguments are identical except as stipulated above. - Note that it is not possible to declare generic functions that are selected - based solely on the type/kind/rank (TKR) signature of the return value, - only based on the TKR of the arguments. - * The SHAPE of the first argument to lammps_extract_[something] is checked - against the "shape" of the C array (e.g., double vs. double* vs. double**). - Calling a subroutine with arguments of inappropriate rank will result in an - error at run time. - * The indices i and j in lammps_extract_fix are used the same way they - are in f_ID[i][j] references in LAMMPS (i.e., starting from 1). This is - different than the way library.cpp uses these numbers, but is more - consistent with the way arrays are accessed in LAMMPS and in Fortran. - * The char* pointer normally returned by lammps_command is thrown away - in this version; note also that lammps_command is now a subroutine - instead of a function. - * The pointer to LAMMPS itself is of type(lammps_instance), which is itself - a synonym for type(C_ptr), part of ISO_C_BINDING. Type (C_ptr) is - C's void* data type. - * This module will almost certainly generate a compile-time warning, - such as, - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - Variable 'communicator' at (1) is a parameter to the BIND(C) - procedure 'lammps_open_wrapper' but may not be C interoperable - This happens because lammps_open_wrapper actually takes a Fortran - INTEGER argument, whose type is defined by the MPI library itself. The - Fortran integer is converted to a C integer by the MPI library (if such - conversion is actually necessary). - * lammps_extract_global returns COPIES of the (scalar) data, as does the - C version. - * lammps_extract_atom, lammps_extract_compute, and lammps_extract_fix - have a first argument that will be associated with ACTUAL LAMMPS DATA. - This means the first argument must be: - * The right rank (via the DIMENSION modifier) - * A C-interoperable POINTER type (i.e., INTEGER (C_int) or - REAL (C_double)). - * lammps_extract_variable returns COPIES of the data, as the C library - interface does. There is no need to deallocate using lammps_free. - * The 'data' argument to lammps_gather_atoms and lammps_scatter atoms must - be ALLOCATABLE. It should be of type INTEGER or DOUBLE PRECISION. It - does NOT need to be C inter-operable (and indeed should not be). - * The 'count' argument of lammps_scatter_atoms is unnecessary; the shape of - the array determines the number of elements LAMMPS will read. diff --git a/examples/COUPLE/fortran2/in.simple b/examples/COUPLE/fortran2/in.simple deleted file mode 100644 index 5982cbaac1..0000000000 --- a/examples/COUPLE/fortran2/in.simple +++ /dev/null @@ -1,16 +0,0 @@ -units lj -atom_modify map array -lattice bcc 1.0 -region simbox block 0 10 0 10 0 10 -create_box 2 simbox -create_atoms 1 region simbox -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 -mass 1 58.2 # These are made-up numbers -mass 2 28.3 -velocity all create 1200.0 7474848 dist gaussian -fix 1 all nve -fix 2 all dt/reset 1 1E-5 1E-3 0.01 units box -fix 4 all ave/histo 10 5 100 0.5 1.5 50 f_2 file temp.histo ave running -thermo_style custom step dt temp press etotal f_4[1][1] -thermo 100 diff --git a/examples/COUPLE/fortran2/simple.f90 b/examples/COUPLE/fortran2/simple.f90 deleted file mode 100644 index 0b84a1ecc1..0000000000 --- a/examples/COUPLE/fortran2/simple.f90 +++ /dev/null @@ -1,112 +0,0 @@ -program simple - - use MPI - use LAMMPS - - ! The following line is unnecessary, as I have included these three entities - ! with the LAMMPS module, but I leave them in anyway to remind people where - ! they came from - use, intrinsic :: ISO_C_binding, only : C_double, C_ptr, C_int - - implicit none - - ! Notes: - ! * If LAMMPS returns a scalar that is allocated by the library interface - ! (see library.cpp), then that memory is deallocated automatically and - ! the argument to lammps_extract_fix must be a SCALAR. - ! * If LAMMPS returns a pointer to an array, consisting of internal LAMMPS - ! data, then the argument must be an interoperable Fortran pointer. - ! Interoperable means it is of type INTEGER (C_INT) or of type - ! REAL (C_DOUBLE) in this context. - ! * Pointers should NEVER be deallocated, as that would deallocate internal - ! LAMMPS data! - ! * Note that just because you can read the values of, say, a compute at - ! any time does not mean those values represent the "correct" values. - ! LAMMPS will abort you if you try to grab a pointer to a non-current - ! entity, but once it's bound, it's your responsibility to check that - ! it's current before evaluating. - ! * IMPORTANT: Two-dimensional arrays (such as 'x' from extract_atom) - ! will be transposed from what they might look like in C++. This is - ! because of different bookkeeping conventions between Fortran and C - ! that date back to about 1970 or so (when C was written). - ! * Arrays start from 1, EXCEPT for mass from extract_atom, which - ! starts from 0. This is because the C array actually has a blank - ! first element (and thus mass[1] corresponds to the mass of type 1) - - type (C_ptr) :: lmp - real (C_double), pointer :: compute => NULL() - real (C_double) :: fix, fix2 - real (C_double), dimension(:), pointer :: compute_v => NULL() - real (C_double), dimension(:,:), pointer :: x => NULL() - real (C_double), dimension(:), pointer :: mass => NULL() - integer, dimension(:), allocatable :: types - double precision, dimension(:), allocatable :: r - integer :: error, narg, me, nprocs - character (len=1024) :: command_line - - call MPI_Init (error) - call MPI_Comm_rank (MPI_COMM_WORLD, me, error) - call MPI_Comm_size (MPI_COMM_WORLD, nprocs, error) - - ! You are free to pass any string you like to lammps_open or - ! lammps_open_no_mpi; here is how you pass it the command line - !call get_command (command_line) - !call lammps_open (command_line, MPI_COMM_WORLD, lmp) - - ! And here's how to to it with a string constant of your choice - call lammps_open_no_mpi ('lmp -log log.simple', lmp) - - call lammps_file (lmp, 'in.simple') - call lammps_command (lmp, 'run 500') - - ! This extracts f_2 as a scalar (the last two arguments can be arbitrary) - call lammps_extract_fix (fix, lmp, '2', LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR, 1, 1) - print *, 'Fix is ', fix - - ! This extracts f_4[1][1] as a scalar - call lammps_extract_fix (fix2, lmp, '4', LMP_STYLE_GLOBAL, LMP_TYPE_ARRAY, 1, 1) - print *, 'Fix 2 is ', fix2 - - ! This extracts the scalar compute of compute thermo_temp - call lammps_extract_compute (compute, lmp, 'thermo_temp', LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR) - print *, 'Compute is ', compute - - ! This extracts the vector compute of compute thermo_temp - call lammps_extract_compute (compute_v, lmp, 'thermo_temp', LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR) - print *, 'Vector is ', compute_v - - ! This extracts the masses - call lammps_extract_atom (mass, lmp, 'mass') - print *, 'Mass is ', mass(1:) - - ! Extracts a pointer to the arrays of positions for all atoms - call lammps_extract_atom (x, lmp, 'x') - if ( .not. associated (x) ) print *, 'x is not associated' - print *, 'x is ', x(:,1) ! Prints x, y, z for atom 1 - - ! Extracts pointer to atom types - call lammps_gather_atoms (lmp, 'type', 1, types) - print *, 'types is ', types(1:3) - - ! Allocates an array and assigns all positions to it - call lammps_gather_atoms (lmp, 'x', 3, r) - print *, 'natoms = ', int(lammps_get_natoms(lmp)) - print *, 'size(r) = ', size(r) - print *, 'r is ', r(1:6) - - ! Puts those position data back - call lammps_scatter_atoms (lmp, 'x', r) - - call lammps_command (lmp, 'run 1') - print *, 'x is ', x(:,1) ! Note that the position updates! - print *, 'Compute is ', compute ! This did only because "temp" is part of - ! the thermo output; the vector part did - ! not, and won't until we give LAMMPS a - ! thermo output or other command that - ! requires its value - - call lammps_close (lmp) - - call MPI_Finalize (error) - -end program simple diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp deleted file mode 100644 index 4774cb6b49..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper.h" -#define LAMMPS_LIB_MPI 1 -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -void lammps_open_fortran_wrapper (int argc, char **argv, - MPI_Fint communicator, void **ptr) -{ - MPI_Comm C_communicator = MPI_Comm_f2c (communicator); - lammps_open (argc, argv, C_communicator, ptr); -} - -int lammps_get_ntypes (void *ptr) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ntypes = lmp->atom->ntypes; - return ntypes; -} - -void lammps_error_all (void *ptr, const char *file, int line, const char *str) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - lmp->error->all (file, line, str); -} - -int lammps_extract_compute_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_VECTOR); - if (size) return *size; - return 0; -} - -void lammps_extract_compute_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_ROWS); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_COLS); - if (tmp) *ncols = *tmp; - return; -} - -int lammps_extract_fix_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_VECTOR, 0, 0); - if (size) return *size; - return 0; -} - -void lammps_extract_fix_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_ROWS, 0, 0); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_COLS, 0, 0); - if (tmp) *ncols = *tmp; - return; -} - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h deleted file mode 100644 index e1eec9fc72..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_open_fortran_wrapper (int, char**, MPI_Fint, void**); -int lammps_get_ntypes (void*); -int lammps_extract_compute_vectorsize (void*, char*, int); -void lammps_extract_compute_arraysize (void*, char*, int, int*, int*); -int lammps_extract_fix_vectorsize (void*, char*, int); -void lammps_extract_fix_arraysize (void*, char*, int, int*, int*); -void lammps_error_all (void*, const char*, int, const char*); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp deleted file mode 100644 index 83d594df60..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Nir Goldman, LLNL , 2016 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper2.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -extern "C" void f_callback(void *, bigint, int, tagint *, double **, double **); - -void lammps_set_callback (void *ptr) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_callback(f_callback, ptr); - return; -} - -void lammps_set_external_vector_length (void *ptr, int n) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_vector_length(n); - return; -} - -void lammps_set_external_vector (void *ptr, int n, double val) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_vector (n, val); - return; -} - -void lammps_set_user_energy (void *ptr, double energy) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_energy_global(energy); - return; -} - -void lammps_set_user_virial (void *ptr, double *virial) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_virial_global(virial); - return; -} - diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h deleted file mode 100644 index 45c41b569a..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h +++ /dev/null @@ -1,37 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Nir Goldman, LLNL , 2016 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_set_callback (void *); -void lammps_set_user_energy (void*, double); -void lammps_set_user_virial (void*, double*); -void lammps_set_external_vector_length (void*, int); -void lammps_set_external_vector (void*, int, double); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS.F90 b/examples/COUPLE/fortran_dftb/LAMMPS.F90 deleted file mode 100644 index 188fff9d60..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS.F90 +++ /dev/null @@ -1,982 +0,0 @@ -!! ----------------------------------------------------------------------- -! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator -! www.cs.sandia.gov/~sjplimp/lammps.html -! Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories -! -! 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: Karl D. Hammond -! University of Missouri (USA), 2012 -!-------------------------------------------------------------------------- - -!! LAMMPS, a Fortran 2003 module containing an interface between Fortran -!! programs and the C-style functions in library.cpp that ship with LAMMPS. -!! This file should be accompanied by LAMMPS-wrapper.cpp and LAMMPS-wrapper.h, -!! which define wrapper functions that ease portability and enforce array -!! dimensions. -!! -!! Everything in this module should be 100% portable by way of Fortran 2003's -!! ISO_C_BINDING intrinsic module. See the README for instructions for -!! compilation and use. -!! -!! Here are the PUBLIC functions and subroutines included in this module. -!! subroutine lammps_open (command_line, communicator, ptr) -!! subroutine lammps_open_no_mpi (command_line, ptr) -!! subroutine lammps_close (ptr) -!! subroutine lammps_file (ptr, str) -!! subroutine lammps_command (ptr, str) -!! subroutine lammps_free (ptr) -!! subroutine lammps_extract_global (global, ptr, name) -!! subroutine lammps_extract_atom (atom, ptr, name) -!! subroutine lammps_extract_fix (fix, ptr, id, style, type, i, j) -!! subroutine lammps_extract_compute (compute, ptr, id, style, type) -!! subroutine lammps_extract_variable (variable, ptr, name, group) -!! function lammps_get_natoms (ptr) -!! subroutine lammps_gather_atoms (ptr, name, count, data) -!! subroutine lammps_scatter_atoms (ptr, name, data) - -#define FLERR __FILE__,__LINE__ -! The above line allows for similar error checking as is done with standard -! LAMMPS files. - -module LAMMPS - - use, intrinsic :: ISO_C_binding, only : C_double, C_int, C_ptr, C_char, & - C_NULL_CHAR, C_loc, C_F_pointer, lammps_instance => C_ptr - implicit none - private - public :: lammps_set_user_virial - public :: lammps_set_external_vector_length - public :: lammps_set_external_vector - public :: lammps_set_user_energy - public :: lammps_open, lammps_open_no_mpi, lammps_close, lammps_file, & - lammps_command, lammps_free, lammps_extract_global, & - lammps_extract_atom, lammps_extract_compute, lammps_extract_fix, & - lammps_extract_variable, lammps_get_natoms, lammps_gather_atoms, & - lammps_set_callback - public :: lammps_scatter_atoms, lammps_instance, C_ptr, C_double, C_int - - !! Functions supplemental to the prototypes in library.h. {{{1 - !! The function definitions (in C++) are contained in LAMMPS-wrapper.cpp. - !! I would have written the first in Fortran, but the MPI libraries (which - !! were written in C) have C-based functions to convert from Fortran MPI - !! handles to C MPI handles, and there is no Fortran equivalent for those - !! functions. - interface - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - bind (C, name='lammps_open_fortran_wrapper') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - integer, value :: communicator - type (C_ptr) :: ptr - end subroutine lammps_open_wrapper - subroutine lammps_actual_error_all (ptr, file, line, str) & - bind (C, name='lammps_error_all') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*), intent(in) :: file, str - integer (C_int), value :: line - end subroutine lammps_actual_error_all - function lammps_get_ntypes (ptr) result (ntypes) & - bind (C, name='lammps_get_ntypes') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: ntypes - end function lammps_get_ntypes - function lammps_actual_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_compute_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_compute_vectorsize - subroutine lammps_actual_extract_compute_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_compute_arraysize') - import :: C_int, C_char, C_ptr - integer (C_int) :: arraysize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_compute_arraysize - function lammps_actual_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_fix_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_fix_vectorsize - subroutine lammps_actual_extract_fix_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_fix_arraysize') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_fix_arraysize - end interface - - !! Functions/subroutines defined in library.h and library.cpp {{{1 - interface - subroutine lammps_actual_open_no_mpi (argc, argv, ptr) & - bind (C, name='lammps_open_no_mpi') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - type (C_ptr) :: ptr - end subroutine lammps_actual_open_no_mpi - - subroutine lammps_close (ptr) bind (C, name='lammps_close') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_close - - subroutine lammps_actual_file (ptr, str) bind (C, name='lammps_file') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_file - - function lammps_actual_command (ptr, str) result (command) & - bind (C, name='lammps_command') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - type (C_ptr) :: command - end function lammps_actual_command - - subroutine lammps_free (ptr) bind (C, name='lammps_free') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_free - - function lammps_actual_extract_global (ptr, name) & - bind (C, name='lammps_extract_global') result (global) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: global - end function lammps_actual_extract_global - - function lammps_actual_extract_atom (ptr, name) & - bind (C, name='lammps_extract_atom') result (atom) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: atom - end function lammps_actual_extract_atom - - function lammps_actual_extract_compute (ptr, id, style, type) & - result (compute) bind (C, name='lammps_extract_compute') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type - type (C_ptr) :: compute - end function lammps_actual_extract_compute - - function lammps_actual_extract_fix (ptr, id, style, type, i, j) & - result (fix) bind (C, name='lammps_extract_fix') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type, i, j - type (C_ptr) :: fix - end function lammps_actual_extract_fix - - function lammps_actual_extract_variable (ptr, name, group) & - result (variable) bind (C, name='lammps_extract_variable') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, group - type (C_ptr) :: variable - end function lammps_actual_extract_variable - - function lammps_get_natoms (ptr) result (natoms) & - bind (C, name='lammps_get_natoms') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (C_int) :: natoms - end function lammps_get_natoms - - subroutine lammps_set_callback (ptr) & - bind (C, name='lammps_set_callback') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_set_callback - - subroutine lammps_set_user_energy (ptr, energy) & - bind (C, name='lammps_set_user_energy') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real(C_double), value :: energy - end subroutine lammps_set_user_energy - - subroutine lammps_set_user_virial (ptr, virial) & - bind (C, name='lammps_set_user_virial') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real(C_double) :: virial(6) - end subroutine lammps_set_user_virial - - subroutine lammps_set_external_vector_length (ptr, n) & - bind (C, name='lammps_set_external_vector_length') - import :: C_ptr, C_double, C_int - type(C_ptr), value :: ptr - integer (C_int), value :: n - end subroutine lammps_set_external_vector_length - - subroutine lammps_set_external_vector (ptr, n, val) & - bind (C, name='lammps_set_external_vector') - import :: C_ptr, C_int, C_double - type (C_ptr), value :: ptr - integer (C_int), value :: n - real(C_double), value :: val - end subroutine lammps_set_external_vector - - subroutine lammps_actual_gather_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_gather_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms - - subroutine lammps_actual_scatter_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_scatter_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_scatter_atoms - end interface - - ! Generic functions for the wrappers below {{{1 - - interface lammps_extract_global - module procedure lammps_extract_global_i, & - lammps_extract_global_dp - end interface lammps_extract_global - - interface lammps_extract_atom - module procedure lammps_extract_atom_ia, & - lammps_extract_atom_dpa, & - lammps_extract_atom_dp2a - end interface lammps_extract_atom - - interface lammps_extract_compute - module procedure lammps_extract_compute_dp, & - lammps_extract_compute_dpa, & - lammps_extract_compute_dp2a - end interface lammps_extract_compute - - interface lammps_extract_fix - module procedure lammps_extract_fix_dp, & - lammps_extract_fix_dpa, & - lammps_extract_fix_dp2a - end interface lammps_extract_fix - - interface lammps_extract_variable - module procedure lammps_extract_variable_dp, & - lammps_extract_variable_dpa - end interface lammps_extract_variable - - interface lammps_gather_atoms - module procedure lammps_gather_atoms_ia, lammps_gather_atoms_dpa - end interface lammps_gather_atoms - - interface lammps_scatter_atoms - module procedure lammps_scatter_atoms_ia, lammps_scatter_atoms_dpa - end interface lammps_scatter_atoms - -contains !! Wrapper functions local to this module {{{1 - - subroutine lammps_open (command_line, communicator, ptr) - character (len=*), intent(in) :: command_line - integer, intent(in) :: communicator - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_open_wrapper (argc, argv, communicator, ptr) - deallocate (argv) - end subroutine lammps_open - -!----------------------------------------------------------------------------- - - subroutine lammps_open_no_mpi (command_line, ptr) - character (len=*), intent(in) :: command_line - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_actual_open_no_mpi (argc, argv, ptr) - deallocate (argv) - end subroutine lammps_open_no_mpi - -!----------------------------------------------------------------------------- - - subroutine lammps_file (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - Cstr = string2Cstring (str) - call lammps_actual_file (ptr, Cstr) - end subroutine lammps_file - -!----------------------------------------------------------------------------- - - subroutine lammps_command (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - type (C_ptr) :: dummy - Cstr = string2Cstring (str) - dummy = lammps_actual_command (ptr, Cstr) - end subroutine lammps_command - -!----------------------------------------------------------------------------- - -! lammps_extract_global {{{2 - function lammps_extract_global_Cptr (ptr, name) result (global) - type (C_ptr) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - global = lammps_actual_extract_global (ptr, Cname) - end function lammps_extract_global_Cptr - subroutine lammps_extract_global_i (global, ptr, name) - integer (C_int), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_i - subroutine lammps_extract_global_dp (global, ptr, name) - real (C_double), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_dp - -!----------------------------------------------------------------------------- - -! lammps_extract_atom {{{2 - function lammps_extract_atom_Cptr (ptr, name) result (atom) - type (C_ptr) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - atom = lammps_actual_extract_atom (ptr, Cname) - end function lammps_extract_atom_Cptr - subroutine lammps_extract_atom_ia (atom, ptr, name) - integer (C_int), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nelements - call lammps_extract_global_i (nelements, ptr, 'nlocal') - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, atom, (/nelements/)) - end subroutine lammps_extract_atom_ia - subroutine lammps_extract_atom_dpa (atom, ptr, name) - real (C_double), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nlocal - integer :: nelements - real (C_double), dimension(:), pointer :: Fptr - if ( name == 'mass' ) then - nelements = lammps_get_ntypes (ptr) + 1 - else if ( name == 'x' .or. name == 'v' .or. name == 'f' .or. & - name == 'mu' .or. name == 'omega' .or. name == 'torque' .or. & - name == 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 1 array.') - return - else - ! Everything else we can get is probably nlocal units long - call lammps_extract_global_i (nlocal, ptr, 'nlocal') - nelements = nlocal - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, Fptr, (/nelements/)) - if ( name == 'mass' ) then - !atom(0:) => Fptr - atom => Fptr - else - atom => Fptr - end if - end subroutine lammps_extract_atom_dpa - subroutine lammps_extract_atom_dp2a (atom, ptr, name) - real (C_double), dimension(:,:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - integer (C_int), pointer :: nelements - if ( name /= 'x' .and. name /= 'v' .and. name /= 'f' .and. & - name /= 'mu' .and. name /= 'omega' .and. name /= 'tandque' .and. & - name /= 'angmom' .and. name /= 'fexternal' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 2 array.') - return - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call lammps_extract_global_i (nelements, ptr, 'nlocal') - ! Catom will now be the array of void* pointers that the void** pointer - ! pointed to. Catom(1) is now the pointer to the first element. - call C_F_pointer (Cptr, Catom, (/nelements/)) - ! Now get the actual array, which has its shape transposed from what we - ! might think of it in C - call C_F_pointer (Catom(1), atom, (/3, nelements/)) - end subroutine lammps_extract_atom_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_compute {{{2 - function lammps_extract_compute_Cptr (ptr, id, style, type) result (compute) - type (C_ptr) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - integer (kind=C_int) :: Cstyle, Ctype - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - compute = lammps_actual_extract_compute (ptr, Cid, Cstyle, Ctype) - end function lammps_extract_compute_Cptr - subroutine lammps_extract_compute_dp (compute, ptr, id, style, type) - real (C_double), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - ! The only valid values of (style,type) are (0,0) for scalar 'compute' - if ( style /= 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot pack per-atom/local& - & data into a scalar.') - return - end if - if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & vector (rank 1) into a scalar.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a scalar.') - return - end if - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute) - end subroutine lammps_extract_compute_dp - subroutine lammps_extract_compute_dpa (compute, ptr, id, style, type) - real (C_double), dimension(:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - integer :: nelements - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 1 variable.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a rank 1 variable.') - return - end if - nelements = lammps_extract_compute_vectorsize (ptr, id, style) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute, (/nelements/)) - end subroutine lammps_extract_compute_dpa - subroutine lammps_extract_compute_dp2a (compute, ptr, id, style, type) - real (C_double), dimension(:,:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Ccompute - integer :: nr, nc - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_compute_arraysize (ptr, id, style, nr, nc) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, Ccompute, (/nr/)) - ! Note that the matrix is transposed, from Fortran's perspective - call C_F_pointer (Ccompute(1), compute, (/nc, nr/)) - end subroutine lammps_extract_compute_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_fix {{{2 - function lammps_extract_fix_Cptr (ptr, id, style, type, i, j) & - result (fix) - type (C_ptr) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - integer (kind=C_int) :: Cstyle, Ctype, Ci, Cj - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - Ci = i - 1 ! This is for consistency with the values from f_ID[i], - Cj = j - 1 ! which is different from what library.cpp uses! - if ( (type >= 1 .and. Ci < 0) .or. & - (type == 2 .and. (Ci < 0 .or. Cj < 0) ) ) then - call lammps_error_all (ptr, FLERR, 'Index out of range in& - & lammps_extract_fix') - end if - fix = lammps_actual_extract_fix (ptr, Cid, Cstyle, Ctype, Ci, Cj) - end function lammps_extract_fix_Cptr - subroutine lammps_extract_fix_dp (fix, ptr, id, style, type, i, j) - real (C_double), intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - ! Check for the correct dimensionality - if ( style /= 0 ) then - select case (type) - case (0) - call lammps_error_all (ptr, FLERR, 'There is no per-atom or local& - & scalar data available from fixes.') - case (1) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local vector (rank 1) into a scalar.') - case (2) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local array (rank 2) into a scalar.') - case default - call lammps_error_all (ptr, FLERR, 'Invalid extract_fix style/& - &type combination.') - end select - return - end if - Cptr = lammps_extract_fix_Cptr (ptr, id, style, type, i, j) - call C_F_pointer (Cptr, Fptr) - fix = Fptr - nullify (Fptr) - ! Memory is only allocated for "global" fix variables - if ( style == 0 ) call lammps_free (Cptr) - end subroutine lammps_extract_fix_dp - subroutine lammps_extract_fix_dpa (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - integer :: fix_len - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract the& - & whole vector from global fix data') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract a fix& - & scalar into a rank 1 variable') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & array into a rank 1 variable.') - return - else if ( type /= 1 ) then - call lammps_error_all (ptr, FLERR, 'Invalid type for fix extraction.') - return - end if - fix_len = lammps_extract_fix_vectorsize (ptr, id, style) - call C_F_pointer (Cptr, fix, (/fix_len/)) - ! Memory is only allocated for "global" fix variables, which we should - ! never get here, so no need to call lammps_free! - end subroutine lammps_extract_fix_dpa - subroutine lammps_extract_fix_dp2a (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:,:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Cfix - integer :: nr, nc - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'It is not possible to extract the& - & entire array from global fix data.') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & vector (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_fix_arraysize (ptr, id, style, nr, nc) - ! Extract pointer to first element as Cfix(1) - call C_F_pointer (Cptr, Cfix, (/nr/)) - ! Now extract the array, which is transposed - call C_F_pointer (Cfix(1), fix, (/nc, nr/)) - end subroutine lammps_extract_fix_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_variable {{{2 - function lammps_extract_variable_Cptr (ptr, name, group) result (variable) - type (C_ptr) :: ptr, variable - character (len=*) :: name - character (len=*), optional :: group - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - character (kind=C_char), dimension(:), allocatable :: Cgroup - Cname = string2Cstring (name) - if ( present(group) ) then - allocate (Cgroup(len_trim(group)+1)) - Cgroup = string2Cstring (group) - else - allocate (Cgroup(1)) - Cgroup(1) = C_NULL_CHAR - end if - variable = lammps_actual_extract_variable (ptr, Cname, Cgroup) - deallocate (Cgroup) - end function lammps_extract_variable_Cptr - subroutine lammps_extract_variable_dp (variable, ptr, name, group) - real (C_double), intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - call C_F_pointer (Cptr, Fptr) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dp - subroutine lammps_extract_variable_dpa (variable, ptr, name, group) - real (C_double), dimension(:), allocatable, intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), dimension(:), pointer :: Fptr - integer :: natoms - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - natoms = lammps_get_natoms (ptr) - allocate (variable(natoms)) - call C_F_pointer (Cptr, Fptr, (/natoms/)) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dpa - -!-------------------------------------------------------------------------2}}} - - subroutine lammps_gather_atoms_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_ia - subroutine lammps_gather_atoms_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_dpa - -!----------------------------------------------------------------------------- - - subroutine lammps_scatter_atoms_ia (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_ia - subroutine lammps_scatter_atoms_dpa (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_dpa - -!----------------------------------------------------------------------------- - - function lammps_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_compute_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_compute_vectorsize - -!----------------------------------------------------------------------------- - - function lammps_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_fix_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_fix_vectorsize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_compute_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, C_int) - call lammps_actual_extract_compute_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_compute_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_fix_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, kind(Cstyle)) - call lammps_actual_extract_fix_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_fix_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_error_all (ptr, file, line, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: file, str - integer, intent(in) :: line - character (kind=C_char), dimension(len_trim(file)+1) :: Cfile - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - integer (C_int) :: Cline - Cline = int(line, kind(Cline)) - Cfile = string2Cstring (file) - Cstr = string2Cstring (str) - call lammps_actual_error_all (ptr, Cfile, Cline, Cstr) - end subroutine lammps_error_all - -!----------------------------------------------------------------------------- - -! Locally defined helper functions {{{1 - - pure function string2Cstring (string) result (C_string) - use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=*), intent(in) :: string - character (len=1, kind=C_char) :: C_string (len_trim(string)+1) - integer :: i, n - n = len_trim (string) - forall (i = 1:n) - C_string(i) = string(i:i) - end forall - C_string(n+1) = C_NULL_CHAR - end function string2Cstring - -!----------------------------------------------------------------------------- - - subroutine Cstring2argcargv (Cstring, argc, argv) - !! Converts a C-style string to argc and argv, that is, words in Cstring - !! become C-style strings in argv. IMPORTANT: Cstring is modified by - !! this routine! I would make Cstring local TO this routine and accept - !! a Fortran-style string instead, but we run into scoping and - !! allocation problems that way. This routine assumes the string is - !! null-terminated, as all C-style strings must be. - - character (kind=C_char), dimension(*), target, intent(inout) :: Cstring - integer (C_int), intent(out) :: argc - type (C_ptr), dimension(:), allocatable, intent(out) :: argv - - integer :: StringStart, SpaceIndex, strlen, argnum - - argc = 1_C_int - - ! Find the length of the string - strlen = 1 - do while ( Cstring(strlen) /= C_NULL_CHAR ) - strlen = strlen + 1 - end do - - ! Find the number of non-escaped spaces - SpaceIndex = 2 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - argc = argc + 1_C_int - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - end if - SpaceIndex = SpaceIndex + 1 - end do - - ! Now allocate memory for argv - allocate (argv(argc)) - - ! Now find the string starting and ending locations - StringStart = 1 - SpaceIndex = 2 - argnum = 1 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - ! Found a real space => split strings and store this one - Cstring(Spaceindex) = C_NULL_CHAR ! Replaces space with NULL - argv(argnum) = C_loc(Cstring(StringStart)) - argnum = argnum + 1 - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - StringStart = SpaceIndex + 1 - else if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) == '\' ) then - ! Escaped space => remove backslash and move rest of array - Cstring(SpaceIndex-1:strlen-1) = Cstring(SpaceIndex:strlen) - strlen = strlen - 1 ! Last character is still C_NULL_CHAR - end if - SpaceIndex = SpaceIndex + 1 - end do - ! Now handle the last argument - argv(argnum) = C_loc(Cstring(StringStart)) - - end subroutine Cstring2argcargv - -! 1}}} - -end module LAMMPS - -! vim: foldmethod=marker tabstop=3 softtabstop=3 shiftwidth=3 expandtab diff --git a/examples/COUPLE/fortran_dftb/README b/examples/COUPLE/fortran_dftb/README deleted file mode 100644 index 39a2f18169..0000000000 --- a/examples/COUPLE/fortran_dftb/README +++ /dev/null @@ -1,37 +0,0 @@ -This directory has an example of using a callback function to obtain -forces from a fortran code for a LAMMPS simulation. The reader should -refer to the README file in COUPLE/fortran2 before proceeding. Here, -the LAMMPS.F90 file has been modified slightly and additional files -named LAMMPS-wrapper2.h and LAMMPS-wrapper2.cpp have been included in -order to supply wrapper functions to set the LAMMPS callback function, -total energy, virial, and electronic entropy contribution (needed for -MSST simulations with a quantum code). - -In this example, the callback function is set to run the -semi-empirical quantum code DFTB+ in serial and then read in the total -energy, forces, and stress tensor from file. In this case, nlocal = -the total number of atoms in the system, so particle positions can be -read from the pos array directly, and DFTB+ forces can simply be -included via the fext array. The user should take care in the case of -a parallel calculation, where LAMMPS can assign different particules -to each processor. For example, the user should use functions such as -lammps_gather_atoms() and lammps_scatter_atoms() in the case where the -fortran force calculating code requires the positions of all atoms, -etc. - -A few more important notes: - --Calling the subroutine lammps_set_callback() is required in order to set - a pointer to the callback function in LAMMPS. --The subroutine lammps_set_user_energy() passes in the potential energy - from DFTB+ to LAMMPS. Similarly, lammps_set_user_virial passes the stress tensor. - --The electronic entropy contribution is set via lammps_set_external_vector(). Their needs - to be a call to lammps_set_external_vector_length() before this value can be - passed to LAMMPS. - -This example was created by Nir Goldman, whom you can contact with -questions: - -Nir Goldman, LLNL -ngoldman@llnl.gov diff --git a/examples/COUPLE/fortran_dftb/data.diamond b/examples/COUPLE/fortran_dftb/data.diamond deleted file mode 100644 index b3dd599cf4..0000000000 --- a/examples/COUPLE/fortran_dftb/data.diamond +++ /dev/null @@ -1,148 +0,0 @@ -# Position data file - -64 atoms -1 atom types - -0 7.134 xlo xhi -0 7.134 ylo yhi -0 7.134 zlo zhi - -0.00000000 0.00000000 0.00000000 xy xz yz - -Masses - -1 12.010000 - -Atoms - - 1 1 0 0 0 0 - 2 1 0 0.89175 0.89175 0.89175 - 3 1 0 1.7835 1.7835 0 - 4 1 0 2.67525 2.67525 0.89175 - 5 1 0 0 1.7835 1.7835 - 6 1 0 0.89175 2.67525 2.67525 - 7 1 0 1.7835 0 1.7835 - 8 1 0 2.67525 0.89175 2.67525 - 9 1 0 0 0 3.567 - 10 1 0 0.89175 0.89175 4.45875 - 11 1 0 1.7835 1.7835 3.567 - 12 1 0 2.67525 2.67525 4.45875 - 13 1 0 0 1.7835 5.3505 - 14 1 0 0.89175 2.67525 6.24225 - 15 1 0 1.7835 0 5.3505 - 16 1 0 2.67525 0.89175 6.24225 - 17 1 0 0 3.567 0 - 18 1 0 0.89175 4.45875 0.89175 - 19 1 0 1.7835 5.3505 0 - 20 1 0 2.67525 6.24225 0.89175 - 21 1 0 0 5.3505 1.7835 - 22 1 0 0.89175 6.24225 2.67525 - 23 1 0 1.7835 3.567 1.7835 - 24 1 0 2.67525 4.45875 2.67525 - 25 1 0 0 3.567 3.567 - 26 1 0 0.89175 4.45875 4.45875 - 27 1 0 1.7835 5.3505 3.567 - 28 1 0 2.67525 6.24225 4.45875 - 29 1 0 0 5.3505 5.3505 - 30 1 0 0.89175 6.24225 6.24225 - 31 1 0 1.7835 3.567 5.3505 - 32 1 0 2.67525 4.45875 6.24225 - 33 1 0 3.567 0 0 - 34 1 0 4.45875 0.89175 0.89175 - 35 1 0 5.3505 1.7835 0 - 36 1 0 6.24225 2.67525 0.89175 - 37 1 0 3.567 1.7835 1.7835 - 38 1 0 4.45875 2.67525 2.67525 - 39 1 0 5.3505 0 1.7835 - 40 1 0 6.24225 0.89175 2.67525 - 41 1 0 3.567 0 3.567 - 42 1 0 4.45875 0.89175 4.45875 - 43 1 0 5.3505 1.7835 3.567 - 44 1 0 6.24225 2.67525 4.45875 - 45 1 0 3.567 1.7835 5.3505 - 46 1 0 4.45875 2.67525 6.24225 - 47 1 0 5.3505 0 5.3505 - 48 1 0 6.24225 0.89175 6.24225 - 49 1 0 3.567 3.567 0 - 50 1 0 4.45875 4.45875 0.89175 - 51 1 0 5.3505 5.3505 0 - 52 1 0 6.24225 6.24225 0.89175 - 53 1 0 3.567 5.3505 1.7835 - 54 1 0 4.45875 6.24225 2.67525 - 55 1 0 5.3505 3.567 1.7835 - 56 1 0 6.24225 4.45875 2.67525 - 57 1 0 3.567 3.567 3.567 - 58 1 0 4.45875 4.45875 4.45875 - 59 1 0 5.3505 5.3505 3.567 - 60 1 0 6.24225 6.24225 4.45875 - 61 1 0 3.567 5.3505 5.3505 - 62 1 0 4.45875 6.24225 6.24225 - 63 1 0 5.3505 3.567 5.3505 - 64 1 0 6.24225 4.45875 6.24225 - -Velocities - -1 -0.00733742 -0.0040297 -0.00315229 -2 -0.00788609 -0.00567535 -0.00199152 -3 -0.00239042 0.00710139 -0.00335049 -4 0.00678551 0.0019976 0.00219289 -5 0.00413717 0.00275709 0.000937637 -6 -0.00126313 0.00485636 0.00727862 -7 0.00337547 -0.00234623 -0.000922223 -8 -0.00792183 -0.00509186 -0.00104168 -9 0.00414091 0.00390285 0.000845961 -10 -0.000284543 0.0010771 -0.00458404 -11 -0.00394968 -0.00446363 -0.00361688 -12 0.00067088 -0.00655175 -0.00752464 -13 0.00306632 -0.00245545 -0.00183867 -14 -0.0082145 -0.00564127 0.000281191 -15 0.00504454 0.0045835 0.000495763 -16 0.0035767 0.00320441 -0.00486426 -17 0.00420597 0.00262005 -0.0049459 -18 0.00440579 -1.76783e-05 0.00449311 -19 -0.00406463 0.00613304 0.00285599 -20 0.00171215 -0.00517887 0.00124326 -21 0.0011118 0.00334129 -0.0015222 -22 -0.00838394 -0.00112906 -0.00353379 -23 -0.00578527 -0.00415501 0.00297043 -24 -0.00211466 0.000964108 -0.00716523 -25 -0.000204107 -0.00380986 0.00681648 -26 0.00677838 0.00540935 0.0044354 -27 -0.00266809 -0.00358382 -0.00241889 -28 -0.0003973 0.00236566 0.00558871 -29 0.000754103 0.00457797 0.000105531 -30 -0.00246049 0.00110428 0.00511088 -31 0.00248891 0.00623314 0.00461597 -32 -0.00509423 0.000570503 0.00720856 -33 -0.00244427 -0.00374384 0.00618767 -34 -0.000360752 -8.10558e-05 0.00314052 -35 0.00435313 -0.00630587 -0.0070309 -36 0.00651087 -0.00389833 3.72525e-05 -37 0.00631828 -0.00316064 0.00231522 -38 -0.00579624 -0.00345068 -0.000277486 -39 0.00483974 0.000715028 0.000206355 -40 -0.00388164 -0.00189242 -0.00554862 -41 0.00398115 0.00152915 0.00756919 -42 -0.000552263 0.00352025 -0.000246143 -43 -0.00800284 0.00555703 0.00425716 -44 -0.00734405 -0.00752512 0.00667173 -45 -0.00545636 0.00421035 0.00399552 -46 0.00480246 0.00621147 -0.00492715 -47 -0.00424168 0.00621818 -9.37733e-05 -48 -0.00649561 0.00612908 -0.0020753 -49 -0.0075007 -0.00384737 -0.00687913 -50 -0.00203903 -0.00764372 0.0023883 -51 0.00442642 0.00744072 -0.0049344 -52 -0.00280486 -0.00509128 -0.00678045 -53 0.00679491 0.00583493 0.00333875 -54 0.00574665 -0.00521074 0.00523475 -55 0.00305618 -0.00320094 0.00341297 -56 0.004304 0.000615544 -0.00668787 -57 0.00564532 0.00327373 0.00388611 -58 0.000676899 0.00210326 0.00495295 -59 0.000160781 -0.00744313 -0.00279828 -60 0.00623521 0.00371301 0.00178015 -61 0.00520759 0.000642669 0.00207913 -62 0.00398042 0.0046438 -0.00359978 -63 -0.00478071 -0.00304932 -0.00765125 -64 0.00282671 -0.00548392 -0.00692691 diff --git a/examples/COUPLE/fortran_dftb/dftb_in.hsd b/examples/COUPLE/fortran_dftb/dftb_in.hsd deleted file mode 100644 index 104a4c04ce..0000000000 --- a/examples/COUPLE/fortran_dftb/dftb_in.hsd +++ /dev/null @@ -1,40 +0,0 @@ -#sample DFTB+ script to run this test code -Geometry = GenFormat { -<<< "lammps.gen" -} - -Driver = { -} - -Hamiltonian = DFTB { - LAMMPS = Yes # keyword to print energy, forces, and stress tensor to file(results.out) - SCC = No - MaxAngularMomentum = { - C = "p" - } - Charge = 0.0 - Eigensolver = Standard {} - Filling = Fermi { - Temperature [Kelvin] = 298.0 - } - SlaterKosterFiles = Type2FileNames { - Prefix = "~/slako/mio-1-1/" # the user must define the location of the skf files - Separator = "-" - Suffix = ".skf" - LowerCaseTypeName = No - } - KPointsAndWeights = { - 0.0000000000000 0.0000000000000 0.0000000000000 1.00000000000000 - } -} - -Options = { - CalculateForces = Yes - WriteDetailedOut = No - WriteBandOut = No - RandomSeed = 12345 -} - -ParserOptions = { - ParserVersion = 3 -} diff --git a/examples/COUPLE/fortran_dftb/dftb_pin.hsd b/examples/COUPLE/fortran_dftb/dftb_pin.hsd deleted file mode 100644 index 6d9dea4a15..0000000000 --- a/examples/COUPLE/fortran_dftb/dftb_pin.hsd +++ /dev/null @@ -1,129 +0,0 @@ -Geometry = GenFormat { -64 S -C -1 1 7.099007 7.117657 7.119139 -2 1 0.858709 0.867233 0.882294 -3 1 1.772527 1.811776 7.120239 -4 1 2.702145 2.681271 0.901362 -5 1 0.017539 1.794455 1.788454 -6 1 0.885593 2.694118 2.707994 -7 1 1.795055 7.120787 1.777896 -8 1 2.642849 0.868278 2.670699 -9 1 0.016060 0.017156 3.568644 -10 1 0.891891 0.896406 4.439286 -11 1 1.766086 1.764402 3.550134 -12 1 2.677349 2.648926 4.427174 -13 1 0.010133 1.771283 5.342173 -14 1 0.858153 2.653565 6.241596 -15 1 1.804087 0.020636 5.353268 -16 1 2.689680 0.907188 6.224575 -17 1 0.017845 3.577563 7.113016 -18 1 0.910027 4.459286 0.910286 -19 1 1.766394 5.376046 0.015526 -20 1 2.683727 6.220728 0.898553 -21 1 0.003357 5.363423 1.774139 -22 1 0.856735 6.238324 2.660213 -23 1 1.761079 3.549776 1.797054 -24 1 2.667227 4.463441 2.646074 -25 1 7.132499 3.551558 3.599764 -26 1 0.920387 4.482191 4.479257 -27 1 1.772194 5.337132 3.555569 -28 1 2.675010 6.251629 4.483124 -29 1 0.005702 5.371095 5.351147 -30 1 0.880807 6.249819 6.264231 -31 1 1.793177 3.592396 5.369939 -32 1 2.653179 4.463595 6.274044 -33 1 3.557243 7.118913 0.026006 -34 1 4.458971 0.889331 0.904950 -35 1 5.367903 1.759757 7.104941 -36 1 6.271565 2.658454 0.890168 -37 1 3.591915 1.768681 1.793880 -38 1 4.435612 2.662184 2.676722 -39 1 5.371040 0.000196 1.783464 -40 1 6.226453 0.886640 2.653384 -41 1 3.583339 0.005449 3.600177 -42 1 4.453692 0.909417 4.459713 -43 1 5.314554 1.805409 3.584215 -44 1 6.210181 2.642660 4.486206 -45 1 3.545704 1.802745 5.365369 -46 1 4.476660 2.701226 6.220451 -47 1 5.332820 0.029557 5.347965 -48 1 6.215725 0.915081 6.230289 -49 1 3.536446 3.551469 7.106600 -50 1 4.451181 4.426439 0.900180 -51 1 5.368735 5.377996 7.109524 -52 1 6.230666 6.220985 0.862175 -53 1 3.596626 5.372822 1.797613 -54 1 4.485613 6.221252 2.699652 -55 1 5.364421 3.549838 1.796281 -56 1 6.261739 4.459046 2.648152 -57 1 3.588752 3.581054 3.581755 -58 1 4.462342 4.467270 4.478800 -59 1 5.355202 5.318323 3.556531 -60 1 6.268570 6.259831 4.465795 -61 1 3.588636 5.354278 5.362327 -62 1 4.475747 6.263866 6.227803 -63 1 5.331158 3.554349 5.318368 -64 1 6.254581 4.436344 6.209681 -0.0 0.0 0.0 -7.13400000000000 0 0 -0 7.13400000000000 0 -0 0 7.13400000000000 -} -Driver = {} -Hamiltonian = DFTB { - LAMMPS = Yes - SCC = No - MaxAngularMomentum = { - C = "p" - } - Charge = 0.0 - Eigensolver = Standard {} - Filling = Fermi { - Temperature [Kelvin] = 298.0 - IndependentKFilling = No - } - SlaterKosterFiles = Type2FileNames { - Prefix = "~/slako/mio-1-1/" - Separator = "-" - Suffix = ".skf" - LowerCaseTypeName = No - } - KPointsAndWeights = { -0.0000000000000 0.0000000000000 0.0000000000000 1.00000000000000 - } - PolynomialRepulsive = {} - OldRepulsiveSum = No - OrbitalResolvedSCC = No - OldSKInterpolation = No - NoErep = No - Dispersion = {} - ThirdOrder = No - ThirdOrderFull = No -} -Options = { - CalculateForces = Yes - WriteDetailedOut = No - WriteBandOut = No - RandomSeed = 12345 - MullikenAnalysis = No - WriteEigenvectors = No - WriteAutotestTag = No - WriteDetailedXML = No - WriteResultsTag = No - AtomResolvedEnergies = No - WriteHS = No - WriteRealHS = No - MinimiseMemoryUsage = No - ShowFoldedCoords = No -} -ParserOptions = { - ParserVersion = 3 - WriteHSDInput = Yes - WriteXMLInput = No - StopAfterParsing = No - IgnoreUnprocessedNodes = No -} -Analysis = { - ProjectStates = {} -} diff --git a/examples/COUPLE/fortran_dftb/in.simple b/examples/COUPLE/fortran_dftb/in.simple deleted file mode 100644 index 894a490cf8..0000000000 --- a/examples/COUPLE/fortran_dftb/in.simple +++ /dev/null @@ -1,16 +0,0 @@ -units real -atom_style charge -atom_modify map array -atom_modify sort 0 0.0 -read_data data.diamond -neighbor 1.0 bin -neigh_modify delay 0 every 5 check no -fix 1 all nve -fix 2 all external pf/callback 1 1 - -fix_modify 2 energy yes -thermo_style custom step temp etotal ke pe lx ly lz pxx pyy pzz press - -thermo 1 -timestep 0.5 - diff --git a/examples/COUPLE/fortran_dftb/log.simple b/examples/COUPLE/fortran_dftb/log.simple deleted file mode 100644 index 3496e94ebe..0000000000 --- a/examples/COUPLE/fortran_dftb/log.simple +++ /dev/null @@ -1,71 +0,0 @@ -LAMMPS (6 Jul 2017) -units real -atom_style charge -atom_modify map array -atom_modify sort 0 0.0 -read_data data.diamond - triclinic box = (0 0 0) to (7.134 7.134 7.134) with tilt (0 0 0) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 64 atoms - reading velocities ... - 64 velocities -neighbor 1.0 bin -neigh_modify delay 0 every 5 check no -fix 1 all nve -fix 2 all external pf/callback 1 1 - -fix_modify 2 energy yes -thermo_style custom step temp etotal ke pe lx ly lz pxx pyy pzz press - -thermo 1 -timestep 0.5 - -run 10 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 7.134, bins = 1 1 1 - 0 neighbor lists, perpetual/occasional/extra = 0 0 0 -Per MPI rank memory allocation (min/avg/max) = 2.3 | 2.3 | 2.3 Mbytes -Step Temp TotEng KinEng PotEng Lx Ly Lz Pxx Pyy Pzz Press - 0 298.24835 -69593.587 56.008365 -69649.595 7.134 7.134 7.134 -19980.19 -21024.038 -21097.458 -20700.562 - 1 295.24358 -69593.585 55.444098 -69649.029 7.134 7.134 7.134 -19778.833 -20799.657 -20854.156 -20477.549 - 2 286.37211 -69593.58 53.778115 -69647.358 7.134 7.134 7.134 -19227.52 -20177.28 -20176.12 -19860.306 - 3 272.062 -69593.572 51.090804 -69644.663 7.134 7.134 7.134 -18360.869 -19189.684 -19100.021 -18883.525 - 4 253.01834 -69593.561 47.514575 -69641.075 7.134 7.134 7.134 -17198.143 -17855.03 -17652.036 -17568.403 - 5 230.19242 -69593.547 43.228073 -69636.775 7.134 7.134 7.134 -15750.247 -16183.764 -15854.145 -15929.386 - 6 204.71787 -69593.533 38.44418 -69631.977 7.134 7.134 7.134 -14083.498 -14247.434 -13789.835 -14040.256 - 7 177.82397 -69593.518 33.393748 -69626.911 7.134 7.134 7.134 -12340.963 -12202.878 -11623.171 -12055.671 - 8 150.76736 -69593.503 28.312758 -69621.816 7.134 7.134 7.134 -10637.824 -10180.827 -9495.0496 -10104.567 - 9 124.7737 -69593.49 23.431383 -69616.921 7.134 7.134 7.134 -9113.3842 -8339.0492 -7572.8076 -8341.747 - 10 100.98183 -69593.478 18.963481 -69612.442 7.134 7.134 7.134 -7833.9349 -6756.9749 -5945.8968 -6845.6022 -Loop time of 2.20497 on 1 procs for 10 steps with 64 atoms - -Performance: 0.196 ns/day, 122.499 hours/ns, 4.535 timesteps/s -0.2% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0 | 0 | 0 | 0.0 | 0.00 -Neigh | 1.4305e-06 | 1.4305e-06 | 1.4305e-06 | 0.0 | 0.00 -Comm | 4.22e-05 | 4.22e-05 | 4.22e-05 | 0.0 | 0.00 -Output | 0.00067687 | 0.00067687 | 0.00067687 | 0.0 | 0.03 -Modify | 2.2042 | 2.2042 | 2.2042 | 0.0 | 99.96 -Other | | 6.533e-05 | | | 0.00 - -Nlocal: 64 ave 64 max 64 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 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 - -Total # of neighbors = 0 -Ave neighs/atom = 0 -Neighbor list builds = 2 -Dangerous builds not checked -Total wall time: 0:00:02 diff --git a/examples/COUPLE/fortran_dftb/makefile b/examples/COUPLE/fortran_dftb/makefile deleted file mode 100644 index 225bd0025a..0000000000 --- a/examples/COUPLE/fortran_dftb/makefile +++ /dev/null @@ -1,45 +0,0 @@ -SHELL = /bin/sh - -# Path to LAMMPS extraction directory -LAMMPS_ROOT = ../../.. -LAMMPS_SRC = $(LAMMPS_ROOT)/src - -# Uncomment the line below if using the MPI stubs library -MPI_STUBS = #-I$(LAMMPS_SRC)/STUBS - -FC = mpif90 # replace with your Fortran compiler -CXX = mpicc # replace with your C++ compiler - -# Flags for Fortran compiler, C++ compiler, and C preprocessor, respectively -FFLAGS = -O2 -fPIC -CXXFLAGS = -O2 -fPIC -CPPFLAGS = -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX - -all : liblammps_fortran.a liblammps_fortran.so simpleF.x - -liblammps_fortran.so : LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(FC) $(FFLAGS) -shared -o $@ $^ - -simpleF.x: simple.o LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(FC) $(FFLAGS) simple.o -o simpleF.x liblammps_fortran.a $(LAMMPS_SRC)/liblammps_mvapich.a -lstdc++ /usr/lib64/libfftw3.a - -liblammps_fortran.a : LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(AR) rs $@ $^ - -LAMMPS.o lammps.mod : LAMMPS.F90 - $(FC) $(CPPFLAGS) $(FFLAGS) -c $< - -simple.o : simple.f90 - $(FC) $(FFLAGS) -c $< - -LAMMPS-wrapper.o : LAMMPS-wrapper.cpp LAMMPS-wrapper.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -LAMMPS-wrapper2.o : LAMMPS-wrapper2.cpp LAMMPS-wrapper2.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -clean : - $(RM) *.o *.mod liblammps_fortran.a liblammps_fortran.so - -dist : - tar -czvf fortran-interface-callback.tar.gz LAMMPS-wrapper.h LAMMPS-wrapper.cpp LAMMPS-wrapper2.h LAMMPS-wrapper2.cpp LAMMPS.F90 makefile README simple.f90 diff --git a/examples/COUPLE/fortran_dftb/simple.f90 b/examples/COUPLE/fortran_dftb/simple.f90 deleted file mode 100644 index 4604b4e4a9..0000000000 --- a/examples/COUPLE/fortran_dftb/simple.f90 +++ /dev/null @@ -1,110 +0,0 @@ - module callback - implicit none - contains - subroutine fortran_callback(lmp, timestep, nlocal, ids, c_pos, c_fext) & - & bind(C, name='f_callback') - use, intrinsic :: ISO_C_binding - use LAMMPS - implicit none - type (C_ptr), value :: lmp - integer(C_int64_t), intent(in), value :: timestep - integer(C_int), intent(in), value :: nlocal - real (C_double), dimension(:,:), pointer :: x - type(c_ptr) :: c_pos, c_fext, c_ids - double precision, pointer :: fext(:,:), pos(:,:) - integer, intent(in) :: ids(nlocal) - real(C_double) :: virial(6) - real (C_double) :: etot - real(C_double), pointer :: ts_lmp - double precision :: stress(3,3), ts_dftb - integer :: natom , i - real (C_double), parameter :: econv = 627.4947284155114 ! converts from Ha to - double precision, parameter :: fconv = 1185.793095983065 ! converts from Ha/bohr to - double precision, parameter :: autoatm = 2.9037166638E8 - double precision lx, ly, lz - real (C_double), pointer :: boxxlo, boxxhi - real (C_double), pointer :: boxylo, boxyhi - real (C_double), pointer :: boxzlo, boxzhi - double precision, parameter :: nktv2p = 68568.4149999999935972 - double precision :: volume - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - - call c_f_pointer(c_pos, pos, [3,nlocal]) - call c_f_pointer(c_fext, fext, [3,nlocal]) - call lammps_extract_global(boxxlo, lmp, 'boxxlo') - call lammps_extract_global(boxxhi, lmp, 'boxxhi') - call lammps_extract_global(boxylo, lmp, 'boxylo') - call lammps_extract_global(boxyhi, lmp, 'boxyhi') - call lammps_extract_global(boxzlo, lmp, 'boxzlo') - call lammps_extract_global(boxzhi, lmp, 'boxzhi') - lx = boxxhi - boxxlo - ly = boxyhi - boxylo - lz = boxzhi - boxzlo - volume = lx*ly*lz - open (unit = 10, status = 'replace', action = 'write', file='lammps.gen') - write(10,*)nlocal,"S" - write(10,*) "C" - do i = 1, nlocal - write(10,'(2I,3F15.6)')i,1,pos(:,ids(i)) - enddo - write(10,*)"0.0 0.0 0.0" - write(10,*)lx,0,0 - write(10,*)0,ly,0 - write(10,*)0,0,lz - close(10) - call system("./dftb+ > dftb.out") - open (unit = 10, status = 'old', file = 'results.out') - read(10,*)etot - read(10,*)ts_dftb - do i = 1, 3 - read(10,*)stress(i,:) - enddo - stress (:,:) = stress(:,:)*autoatm - virial(1) = stress(1,1)/(nktv2p/volume) - virial(2) = stress(2,2)/(nktv2p/volume) - virial(3) = stress(3,3)/(nktv2p/volume) - virial(4) = stress(1,2)/(nktv2p/volume) - virial(5) = stress(1,3)/(nktv2p/volume) - virial(6) = stress(2,3)/(nktv2p/volume) - etot = etot*econv - call lammps_set_external_vector(lmp,1,ts_dftb*econv) - do i = 1, nlocal - read(10,*)fext(:,ids(i)) - fext(:,ids(i)) = fext(:,ids(i))*fconv - enddo - close(10) - call lammps_set_user_energy (lmp, etot) - call lammps_set_user_virial (lmp, virial) - - end subroutine - end module callback - - -program simple_fortran_callback - - use MPI - use LAMMPS - use callback - use, intrinsic :: ISO_C_binding, only : C_double, C_ptr, C_int, C_FUNPTR - implicit none - type (C_ptr) :: lmp - integer :: error, narg, me, nprocs - - call MPI_Init (error) - call MPI_Comm_rank (MPI_COMM_WORLD, me, error) - call MPI_Comm_size (MPI_COMM_WORLD, nprocs, error) - - call lammps_open_no_mpi ('lmp -log log.simple', lmp) - call lammps_file (lmp, 'in.simple') - call lammps_set_callback(lmp) - call lammps_set_external_vector_length(lmp,2) - - call lammps_command (lmp, 'run 10') - call lammps_close (lmp) - call MPI_Finalize (error) - - -end program simple_fortran_callback - - diff --git a/examples/COUPLE/plugin/liblammpsplugin.c b/examples/COUPLE/plugin/liblammpsplugin.c index d446f9cd2f..0cf9bea512 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.c +++ b/examples/COUPLE/plugin/liblammpsplugin.c @@ -90,6 +90,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib) ADDSYM(get_natoms); ADDSYM(get_thermo); + ADDSYM(last_thermo); ADDSYM(extract_box); ADDSYM(reset_box); diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index c6ec03e498..1520ef638d 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -37,12 +37,13 @@ #endif /* The following enums must be kept in sync with the equivalent enums - * or constants in python/lammps/constants.py, fortran/lammps.f90, - * tools/swig/lammps.i, and examples/COUPLE/plugin/liblammpsplugin.h */ + * or constants in src/library.h, src/lmptype.h, python/lammps/constants.py, + * fortran/lammps.f90, and tools/swig/lammps.i */ /* Data type constants for extracting data from atoms, computes and fixes */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ @@ -133,6 +134,7 @@ struct _liblammpsplugin { double (*get_natoms)(void *); double (*get_thermo)(void *, const char *); + void *(*last_thermo)(void *, const char *, int); void (*extract_box)(void *, double *, double *, double *, double *, double *, int *, int *); diff --git a/examples/COUPLE/simple/simple.f90 b/examples/COUPLE/simple/simple.f90 index 3aafbee01b..d9505fff4d 100644 --- a/examples/COUPLE/simple/simple.f90 +++ b/examples/COUPLE/simple/simple.f90 @@ -30,7 +30,7 @@ PROGRAM f_driver REAL (kind=8), ALLOCATABLE :: x(:) REAL (kind=8), PARAMETER :: epsilon=0.1 - CHARACTER (len=64) :: arg + CHARACTER (len=1024) :: arg CHARACTER (len=1024) :: line ! setup MPI and various communicators diff --git a/examples/PACKAGES/atc/cauchy_born/in.flying_cube b/examples/PACKAGES/atc/cauchy_born/in.flying_cube index 23bd7a5ae0..9b81fcf6a0 100644 --- a/examples/PACKAGES/atc/cauchy_born/in.flying_cube +++ b/examples/PACKAGES/atc/cauchy_born/in.flying_cube @@ -1,11 +1,11 @@ # This test evaluates Hardy fields for a small block of LJ material -# that's undergoing translation in the x-direction through the +# that's undergoing translation in the x-direction through the # periodic boundary. echo both -log log.flying_cube +log log.flying_cube units real atom_style atomic -variable lattice_constant equal 5.256227487 +variable lattice_constant equal 5.256227487 variable c equal 6 variable L equal (${lattice_constant}*$c) variable V equal $L*$L*$L @@ -23,15 +23,15 @@ create_box 1 box create_atoms 1 region box mass 1 $m group all region box -pair_style lj/cut 13.5 -pair_coeff 1 1 0.238 3.405 +pair_style lj/cut 13.5 +pair_coeff 1 1 0.238 3.405 # define region neighbor 1.0 bin neigh_modify delay 0 every 200 check no # neigh_modify delay 0 every $n reset_timestep 0 thermo $s -compute_modify thermo_temp extra 0 +compute_modify thermo_temp extra/dof 0 thermo_style custom step temp pxx pyy pzz etotal lx ly lz timestep ${dt} min_modify line quadratic @@ -46,10 +46,10 @@ variable zHI equal zhi # region BOX block ${xLO} ${xHI} ${yLO} ${yHI} ${zLO} ${zHI} units box region BOX block ${xLO} ${xHI} -0.5 31.7 -0.5 31.7 units box fix ATC all atc field -fix_modify ATC mesh create 1 1 1 box p p p +fix_modify ATC mesh create 1 1 1 box p p p fix_modify ATC fields add stress velocity displacement fix_modify ATC fields add temperature kinetic_temperature -fix_modify ATC fields add internal_energy energy +fix_modify ATC fields add internal_energy energy fix_modify ATC output flying_cubeFE $s text binary tensor_components # fix_modify ATC atomic_output flying_cubeMD $m text binary tensor_components dump dumpfc all atom $s flying_cube.dmp diff --git a/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV b/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV index 431fe15ddd..2b54a50739 100644 --- a/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV +++ b/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV @@ -1,34 +1,34 @@ # This test compares Hardy and Cauchy-Born metrics of energy density and stress # for an Ar system undergoing dynamics at a finite temperature. echo both -log ftcb_constV.log +log ftcb_constV.log units real atom_style atomic -variable lattice_constant equal 5.256227487 +variable lattice_constant equal 5.256227487 variable c equal 6 variable L equal (${lattice_constant}*$c) variable V equal $L*$L*$L print "Volume : $V" -variable Ti equal 0.0001 +variable Ti equal 0.0001 variable dT equal 0.2 variable n equal 10000 variable m equal 200 variable dt equal 0.1 # create system -lattice fcc ${lattice_constant} +lattice fcc ${lattice_constant} region box block 0 $c 0 $c 0 $c boundary p p p -pair_style lj/cut 13.5 +pair_style lj/cut 13.5 read_data ftcb_constV_setup.init mass 1 39.95 -pair_coeff 1 1 0.238 3.405 +pair_coeff 1 1 0.238 3.405 # define region neighbor 1.0 bin neigh_modify delay 0 every 2000 check no reset_timestep 0 thermo $m -compute_modify thermo_temp extra 0 -variable nrepeat equal $n/$m +compute_modify thermo_temp extra/dof 0 +variable nrepeat equal $n/$m variable sxx equal -pxx variable intenergy equal etotal fix TDAVE all ave/time $m ${nrepeat} $n c_thermo_temp v_sxx v_intenergy ave one file ftcb_constV.profile @@ -37,7 +37,7 @@ timestep ${dt} # filtered fix ATCFILT all atc field Ar_CauchyBorn.mat #fix_modify ATCFILT reset_atomic_reference_positions ftcb_constV_setup.data -fix_modify ATCFILT mesh create 1 1 1 box p p p +fix_modify ATCFILT mesh create 1 1 1 box p p p fix_modify ATCFILT fields none fix_modify ATCFILT fields add internal_energy stress cauchy_born_energy cauchy_born_stress fix_modify ATCFILT fields add temperature displacement @@ -51,7 +51,7 @@ fix_modify ATCFILT filter type step # not filtered fix ATC all atc field Ar_CauchyBorn.mat #fix_modify ATC reset_atomic_reference_positions ftcb_constV_setup.data -fix_modify ATC mesh create 1 1 1 box p p p +fix_modify ATC mesh create 1 1 1 box p p p fix_modify ATC fields none fix_modify ATC fields add internal_energy stress cauchy_born_energy cauchy_born_stress fix_modify ATC fields add temperature displacement @@ -59,7 +59,7 @@ fix_modify ATC gradients add displacement fix_modify ATC output ftcb_constVFE $m text binary tensor_components velocity all create ${Ti} 102486 mom yes rot yes dist gaussian # step iu T,V space -variable i loop 1 +variable i loop 1 label loop_i print ">>> step $i, T: ${Ti}, V: $V" variable Tf equal ${Ti}+${dT} @@ -69,6 +69,6 @@ label loop_i fix NVT all nvt temp ${Tf} ${Tf} 20 drag 0.5 tchain 1 run $n unfix NVT - variable Ti equal ${Tf} + variable Ti equal ${Tf} next i jump in.ftcb_constV loop_i diff --git a/examples/PACKAGES/atc/fluids/in.bar1d_fluids b/examples/PACKAGES/atc/fluids/in.bar1d_fluids index 79a6c8a4c2..69a2df6900 100644 --- a/examples/PACKAGES/atc/fluids/in.bar1d_fluids +++ b/examples/PACKAGES/atc/fluids/in.bar1d_fluids @@ -5,50 +5,50 @@ # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. log bar1d_fluids.log -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init -#read_restart post_eq.dat +#read_restart post_eq.dat lattice fcc 5.405 origin 0.25 0.25 0.25 # create atoms, NOTE commented out for restart -#region mdRegion block -7 7 -3 3 -3 3 -#boundary f p p -#create_box 2 mdRegion -#create_atoms 1 region mdRegion -#mass * 39.95 +#region mdRegion block -7 7 -3 3 -3 3 +#boundary f p p +#create_box 2 mdRegion +#create_atoms 1 region mdRegion +#mass * 39.95 # specify interal/ghost atoms -#region mdInternal block -6 6 -3 3 -3 3 -#region mdGhost block -6 6 -3 3 -3 3 side out +#region mdInternal block -6 6 -3 3 -3 3 +#region mdGhost block -6 6 -3 3 -3 3 side out #create_atoms 1 region mdGhost #lattice fcc 6.5 origin 0.25 0.25 0.25 -#create_atoms 2 region mdInternal -group internal type 2 -group ghost type 1 +#create_atoms 2 region mdInternal +group internal type 2 +group ghost type 1 # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 100. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff * * .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no -#write_restart tinit.dat +#velocity internal create 100. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff * * .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no +#write_restart tinit.dat # ID group atc PhysicsType ParameterFile lattice fcc 5.405 origin 0.25 0.25 0.25 -region atcRegion block -6.25 6.25 -3 3 -3 3 +region atcRegion block -6.25 6.25 -3 3 -3 3 fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region periodicity fix_modify AtC mesh create 6 1 1 atcRegion f p p fix_modify AtC time_integration fractional_step -fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature +fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature fix_modify AtC internal_quadrature off -#fix_modify AtC mass_matrix fe +#fix_modify AtC mass_matrix fe # fix a temperature -fix_modify AtC fix temperature all 100. +fix_modify AtC fix temperature all 100. # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -6.3 -6.2 -INF INF -INF INF @@ -56,43 +56,43 @@ fix_modify AtC mesh create_nodeset rbc 6.2 6.3 -INF INF -INF INF #fix_modify AtC fix temperature lbc 120. #fix_modify AtC fix temperature rbc 100. #used for restarting -#fix_modify AtC consistent_fe_initialization on +#fix_modify AtC consistent_fe_initialization on #fix_modify AtC initial temperature all 100. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g #fix_modify AtC output bar1d_fluids_eqFE 200 text binary #dump D1 all atom 200 dump_eq.bar1d -timestep 2 -thermo 200 -run 2000 -#write_restart post_eq.dat +timestep 2 +thermo 200 +run 2000 +#write_restart post_eq.dat # change thermostat to hoover reset_timestep 0 -fix_modify AtC reset_time +fix_modify AtC reset_time fix_modify AtC unfix temperature all variable deltaT equal 2.*2000. fix_modify AtC fix temperature lbc temporal_ramp 100. 120. ${deltaT} -#fix_modify AtC fix temperature lbc 100. +#fix_modify AtC fix temperature lbc 100. fix_modify AtC fix temperature rbc 100. fix_modify AtC control thermal flux no_boundary -fix_modify AtC control tolerance 1.e-14 -fix_modify AtC control localized_lambda on +fix_modify AtC control tolerance 1.e-14 +fix_modify AtC control localized_lambda on fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 fix_modify AtC filter on # output commands fix_modify AtC output bar1d_fluidsFE 100 text #undump D1 -#dump D2 all atom 200 dump.bar1d -#dump D2 all custom 200 dump.bar1d id type xs ys zs vx vy vz +#dump D2 all atom 200 dump.bar1d +#dump D2 all custom 200 dump.bar1d id type xs ys zs vx vy vz # set-up non-equilibrium IC -thermo 100 -run 2000 +thermo 100 +run 2000 # run non-equilibrium condition -fix_modify AtC fix temperature lbc 120. -run 4000 +fix_modify AtC fix temperature lbc 120. +run 4000 diff --git a/examples/PACKAGES/atc/fluids/in.concentration b/examples/PACKAGES/atc/fluids/in.concentration index 255524bc0a..f5c2a37cbb 100644 --- a/examples/PACKAGES/atc/fluids/in.concentration +++ b/examples/PACKAGES/atc/fluids/in.concentration @@ -1,10 +1,10 @@ echo both -units real +units real atom_style full # charge ### NOTE p p p is required for both lammps & atc since periodic images are employed in ExtrinsicModelElectrostatic::correct_electrostatic_forces ########### BEGIN PARAMETERS #################################### -variable T equal 300 -variable a equal 1.0 # 5.719025032 +variable T equal 300 +variable a equal 1.0 # 5.719025032 variable i equal 10 # thermo variable f equal 50 # neighbor & conc interval variable s equal 100 # 10 # 100 # output @@ -12,18 +12,18 @@ variable n equal 800 # 20 # 200 # 300 # duration variable x equal 4 # 40 # 2 # 4 # exchanges variable e equal 100. # 1. # 100. # 10. # energy variable h equal 5 # nelems -variable dt equal 4. #1. # 0 # 4.0 +variable dt equal 4. #1. # 0 # 4.0 ############## END PARAMETERS ################################# -dimension 3 -boundary p p p -pair_style lj/cut/coul/cut 13.0 -lattice sc $a +dimension 3 +boundary p p p +pair_style lj/cut/coul/cut 13.0 +lattice sc $a read_data concentration_init.data atom_modify sort 0 1 mass * 39.948 pair_coeff * * 0.2381 3.405 pair_coeff 1 * 0.4 3.405 -dielectric 80.0 +dielectric 80.0 variable xlo equal xlo variable xhi equal xhi variable xmid equal 0.5*(${xhi}+${xlo}) @@ -37,9 +37,9 @@ region FLUID block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} units box region R block ${xmid} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} units box group SOLID type 1 variable xdof equal 3*count(SOLID) -compute_modify thermo_temp extra ${xdof} -#set group SOLID charge 0 -group NEUTRAL type 2 +compute_modify thermo_temp extra/dof ${xdof} +#set group SOLID charge 0 +group NEUTRAL type 2 group FLUID type 2 3 4 group NION type 3 group PION type 4 @@ -72,16 +72,16 @@ compute PMIN PION reduce min x compute PMAX PION reduce max x compute NMIN NION reduce min x compute NMAX NION reduce max x -timestep ${dt} +timestep ${dt} #neighbor 13 bin neigh_modify every $i check no # coulombic interactions -fix ATC FLUID atc species_electrostatic Ar_electrostatic.mat +fix ATC FLUID atc species_electrostatic Ar_electrostatic.mat #fix_modify ATC parallel_consistency off fix_modify ATC extrinsic short_range off #fix_modify ATC boundary SOLID fix_modify ATC atom_element_map eulerian $i -fix_modify ATC internal_quadrature off +fix_modify ATC internal_quadrature off fix_modify ATC consistent_fe_initialization on fix_modify ATC filter type exponential fix_modify ATC filter scale $i @@ -97,31 +97,31 @@ fix_modify ATC mesh create_elementset BOX BOX fix_modify ATC mass_matrix fe fix_modify ATC include atomic_charge fix_modify ATC add_species N type 3 -fix_modify ATC add_species P type 4 +fix_modify ATC add_species P type 4 fix_modify ATC add_species Nt type 5 -fix_modify ATC add_species Pt type 6 +fix_modify ATC add_species Pt type 6 ## CC fix_modify ATC control concentration N R 0.001 Nt # deletions R -fix_modify ATC control concentration N frequency $f -fix_modify ATC control concentration N max_energy $e +fix_modify ATC control concentration N frequency $f +fix_modify ATC control concentration N max_energy $e fix_modify ATC control concentration N max_attempts 100 fix_modify ATC control concentration N max_exchanges $x #- fix_modify ATC control concentration P R 0.002 Pt # addtions R -fix_modify ATC control concentration P frequency $f +fix_modify ATC control concentration P frequency $f fix_modify ATC control concentration P max_energy $e -fix_modify ATC control concentration P max_attempts 100 +fix_modify ATC control concentration P max_attempts 100 fix_modify ATC control concentration P max_exchanges $x fix_modify ATC output volume_integral all mass_density fix_modify ATC output volume_integral all charge_density # data reduction fix PP all atc field -#fix_modify PP add_species ions type 3 4 +#fix_modify PP add_species ions type 3 4 #fix_modify PP add_species IONS type 3 4 1 2 -fix_modify PP add_species n type 3 -fix_modify PP add_species p type 4 -fix_modify PP add_species s type 1 -fix_modify PP add_species o type 2 +fix_modify PP add_species n type 3 +fix_modify PP add_species p type 4 +fix_modify PP add_species s type 1 +fix_modify PP add_species o type 2 fix_modify PP fields add species_concentration mass_density charge_density temperature fix_modify PP fields add charge_flux species_flux fix_modify PP output volume_integral all mass_density @@ -129,7 +129,7 @@ fix_modify PP output volume_integral all charge_density fix_modify PP mesh create $h 1 1 BOX f p p fix_modify PP atom_element_map eulerian $i # output -thermo $i +thermo $i variable dN equal f_ATC[1] variable dP equal f_ATC[2] variable Nc equal f_ATC[3] @@ -141,19 +141,19 @@ variable Nu equal f_ATC[7] variable Pu equal f_ATC[8] variable Ng equal f_ATC[9] variable Pg equal f_ATC[10] -thermo_style custom step temp etotal & +thermo_style custom step temp etotal & atoms v_F v_P v_N v_dP v_dN v_Pc v_Nc v_Pr v_Nr v_Pt v_Nt & c_PMIN c_NMIN c_PMAX c_NMAX c_Q c_M c_Qf c_Mf v_Pu v_Nu v_Pg v_Ng -# NOTE this doesn't seem to work -#thermo_modify format 4 %5d format 5 %5d format 6 %5d format 7 %5d format 8 %5d -#thermo_modify format 4 %5d -#thermo_modify format 5 %5d -#thermo_modify format 6 %5d -#thermo_modify format 7 %5d -#thermo_modify format 8 %5d -#thermo_modify format 9 %5d -#thermo_modify format 10 %5d -#thermo_modify format 11 %5d +# NOTE this doesn't seem to work +#thermo_modify format 4 %5d format 5 %5d format 6 %5d format 7 %5d format 8 %5d +#thermo_modify format 4 %5d +#thermo_modify format 5 %5d +#thermo_modify format 6 %5d +#thermo_modify format 7 %5d +#thermo_modify format 8 %5d +#thermo_modify format 9 %5d +#thermo_modify format 10 %5d +#thermo_modify format 11 %5d log concentration.log fix_modify ATC output concentrationFE $s text binary fix_modify PP output concentrationPP $s text diff --git a/examples/PACKAGES/atc/fluids/in.shear_flow b/examples/PACKAGES/atc/fluids/in.shear_flow index 3c06676c64..29327dfb1c 100644 --- a/examples/PACKAGES/atc/fluids/in.shear_flow +++ b/examples/PACKAGES/atc/fluids/in.shear_flow @@ -2,42 +2,42 @@ # This benchmark tests momentum flux as a BC to the MD region to generate shear flow. # Currently heat will be generated as it will have no where to go. log shear_flow.log -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 #read_data temp.init -read_data post_eq.init +read_data post_eq.init lattice fcc 5.405 origin 0.25 0.25 0.25 # create atoms, NOTE commented out for restart -#region mdRegion block -8 8 -3 3 -3 3 -#boundary f p p -#create_box 2 mdRegion -#create_atoms 1 region mdRegion -#mass * 39.95 +#region mdRegion block -8 8 -3 3 -3 3 +#boundary f p p +#create_box 2 mdRegion +#create_atoms 1 region mdRegion +#mass * 39.95 # specify interal/ghost atoms -#region mdInternal block -6 6 -3 3 -3 3 -#region mdGhost block -6 6 -3 3 -3 3 side out +#region mdInternal block -6 6 -3 3 -3 3 +#region mdGhost block -6 6 -3 3 -3 3 side out #create_atoms 1 region mdGhost #lattice fcc 6.5 origin 0.25 0.25 0.25 -#create_atoms 2 region mdInternal -group internal type 2 -group ghost type 1 +#create_atoms 2 region mdInternal +group internal type 2 +group ghost type 1 # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 100. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff * * .238 3.405 13.5 +#velocity internal create 100. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff * * .238 3.405 13.5 #write_restart tinit.dat -neighbor 5. bin -neigh_modify every 10 delay 0 check no +neighbor 5. bin +neigh_modify every 10 delay 0 check no # equilibrate MD field variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe temp thermo_modify format 1 %6i format 2 %7.2g #fix NVT internal nvt temp 100 100 10 drag 0.2 @@ -49,28 +49,28 @@ timestep 2 # ID group atc PhysicsType ParameterFile lattice fcc 5.405 origin 0.25 0.25 0.25 -region atcRegion block -6.25 6.25 -3 3 -3 3 +region atcRegion block -6.25 6.25 -3 3 -3 3 fix AtC internal atc shear Ar_viscosity.mat # ID part keywords nx ny nz region periodicity fix_modify AtC mesh create 6 1 1 atcRegion f p p #fix_modify AtC time_integration fractional_step -##fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature +##fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature fix_modify AtC internal_quadrature off -#fix_modify AtC mass_matrix fe +#fix_modify AtC mass_matrix fe # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_elementset rbc 4.12 6.3 -INF INF -INF INF #used for restarting -fix_modify AtC consistent_fe_initialization on +fix_modify AtC consistent_fe_initialization on #fix_modify AtC initial velocity x all 0. # turn on kinetostat reset_timestep 0 -fix_modify AtC reset_time -fix_modify AtC source velocity y rbc .0000001 +fix_modify AtC reset_time +fix_modify AtC source velocity y rbc .0000001 fix_modify AtC control momentum flux no_boundary -fix_modify AtC control tolerance 1.e-14 -fix_modify AtC control localized_lambda on +fix_modify AtC control tolerance 1.e-14 +fix_modify AtC control localized_lambda on #fix_modify AtC filter type exponential #fix_modify AtC filter scale 1000.0 #fix_modify AtC filter on @@ -78,7 +78,7 @@ fix_modify AtC control localized_lambda on # output commands fix_modify AtC output shear_flowFE 100 text #binary #undump D1 -#dump D1 all custom 100 shear_flow.dmp id type xs ys zs vx vy vz +#dump D1 all custom 100 shear_flow.dmp id type xs ys zs vx vy vz # set-up non-equilibrium IC -thermo 100 -run 2000 +thermo 100 +run 2000 diff --git a/examples/PACKAGES/atc/hardy/in.eshelby_static b/examples/PACKAGES/atc/hardy/in.eshelby_static index b0ccc94af5..b00dcd1185 100644 --- a/examples/PACKAGES/atc/hardy/in.eshelby_static +++ b/examples/PACKAGES/atc/hardy/in.eshelby_static @@ -1,4 +1,4 @@ -# This test calculates the J-integral for a sequence of different loads +# This test calculates the J-integral for a sequence of different loads # for a system with a crack tip. # # loops around crack and one around undefected material @@ -7,17 +7,17 @@ # loop 2 - medium contour around left crack tip # loop 3 - largest contour around left crack tip # loop 4 - medium contour around right crack tip -#for Lennard-Jones potential for gold: -# surface energy (gamma) of 0.1599 eV/Ã…^2 = 2.56191 J/m2. +#for Lennard-Jones potential for gold: +# surface energy (gamma) of 0.1599 eV/Ã…^2 = 2.56191 J/m2. # 2*gamma = 0.3198 eV/Ã…^2 = 5.12382 J/m2 -# using the internal nktv2p conversion factor, +# using the internal nktv2p conversion factor, # the units of eshelby_stress are eV/Ã…^3, and # the resulting boundary integral is eV/Ã… since we also include thickness (a # boundary surface area rather than a periphery). If we multiply the 2*gamma # quantity times the thickness t = 3*4.08 = 12.24 Ã…, we obtain 2*gamma*t = -# 3.914352 eV/Ã…, which agrees with the mesh calculation. +# 3.914352 eV/Ã…, which agrees with the mesh calculation. echo both -log eshelby_static.log +log eshelby_static.log units metal dimension 3 boundary p p p @@ -29,12 +29,12 @@ lattice fcc 4.08 origin 0.25 0.25 0.25 region SYSTEM block -10 10 -10 10 0 3 region UPPER block -10 10 0 10 0 3 region LOWER block -10 0 -10 10 0 3 -create_box 1 SYSTEM +create_box 1 SYSTEM create_atoms 1 region SYSTEM mass 1 63.55 -group internal region SYSTEM -group upper region UPPER -group lower region LOWER +group internal region SYSTEM +group upper region UPPER +group lower region LOWER #pair_style eam #pair_coeff * * ../../../../potentials/Cu_u3.eam #pair_style lj/smooth 8.0 10.0 @@ -42,27 +42,27 @@ group lower region LOWER pair_style lj/smooth/linear 5.456108274435118 pair_coeff * * 0.7242785984051078 2.598146797350056 # define region -region abovecrack block -2.01 2.01 0 8 INF INF units lattice +region abovecrack block -2.01 2.01 0 8 INF INF units lattice group abovecrack region abovecrack -region belowcrack block -2.01 2.01 -8 0 INF INF units lattice +region belowcrack block -2.01 2.01 -8 0 INF INF units lattice group belowcrack region belowcrack neighbor 1.0 bin neigh_modify delay 1000000 -neigh_modify exclude group abovecrack belowcrack +neigh_modify exclude group abovecrack belowcrack thermo 10 -compute_modify thermo_temp extra 0 +compute_modify thermo_temp extra/dof 0 region FORCECHECK block -6 0 6 10 0 3 group FORCECHECK region FORCECHECK compute fxsum FORCECHECK reduce sum fx compute fysum FORCECHECK reduce sum fy compute fzsum FORCECHECK reduce sum fz thermo_style custom step ke pe press c_fxsum c_fysum c_fzsum -thermo_modify format 1 %4i format 2 %3.1g format 3 %20.16g +thermo_modify format 1 %4i format 2 %3.1g format 3 %20.16g timestep 0.0 # (1) minimize the system to get a relaxed configuration min_modify line quadratic variable tol equal 1.e-11 -minimize 0.0 ${tol} 100000 1000000 +minimize 0.0 ${tol} 100000 1000000 write_restart eshelby.restart # (2) pull crack apart reset_timestep 0 @@ -70,13 +70,13 @@ fix PK1 internal atc field # NOTE tune this relative to lattice size fix_modify PK1 mesh create 10 10 1 SYSTEM p f p fix_modify PK1 fields none -fix_modify PK1 fields add mass_density internal_energy temperature stress displacement -fix_modify PK1 fields add eshelby_stress transformed_stress -fix_modify PK1 gradients add displacement +fix_modify PK1 fields add mass_density internal_energy temperature stress displacement +fix_modify PK1 fields add eshelby_stress transformed_stress +fix_modify PK1 gradients add displacement fix_modify PK1 set reference_potential_energy fix_modify PK1 output eshelby_staticFE 1 text binary tensor_components -#fix_modify PK1 on_the_fly -#-- make concentric loops around one/both of the crack tips +#fix_modify PK1 on_the_fly +#-- make concentric loops around one/both of the crack tips #-- & another around undefected material (loop0) fix_modify PK1 mesh create_faceset loop0 box -6 0 6 10 -INF INF outward fix_modify PK1 output boundary_integral eshelby_stress faceset loop0 diff --git a/examples/PACKAGES/atc/hardy/in.nvt b/examples/PACKAGES/atc/hardy/in.nvt index 68ba2eba17..c6de0842f9 100644 --- a/examples/PACKAGES/atc/hardy/in.nvt +++ b/examples/PACKAGES/atc/hardy/in.nvt @@ -5,12 +5,12 @@ atom_style atomic echo both dimension 3 boundary p p p -lattice fcc 5.376 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 -region box block 0 5 0 5 0 5 -read_data nvt.init +lattice fcc 5.376 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 +region box block 0 5 0 5 0 5 +read_data nvt.init pair_style lj/cut 13.0 -pair_coeff 1 1 0.2381 3.405 -group internal region box +pair_coeff 1 1 0.2381 3.405 +group internal region box fix ATC internal atc field fix_modify ATC mesh create 1 1 1 box p p p @@ -27,12 +27,12 @@ fix_modify PP atom_element_map eulerian 100 fix_modify PP fields add mass_density energy stress temperature kinetic_temperature fix_modify PP fields add velocity thermal_energy kinetic_energy fix_modify PP output nvtPP 100 text -thermo 100 -compute_modify thermo_temp extra 0 -thermo_style custom step temp etotal ke pe press vol -timestep 4.0 -reset_timestep 0 +thermo 100 +compute_modify thermo_temp extra/dof 0 +thermo_style custom step temp etotal ke pe press vol +timestep 4.0 +reset_timestep 0 # NOTE fixes performing time integration (init_integrate/final_integrate) should be defined after atc -fix NVT all nvt temp 30 30 10.0 drag 0.2 tchain 1 -log nvt.log -run 1000 +fix NVT all nvt temp 30 30 10.0 drag 0.2 tchain 1 +log nvt.log +run 1000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d b/examples/PACKAGES/atc/thermal/in.bar1d index 3f70577ec3..9fe5617ec3 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d +++ b/examples/PACKAGES/atc/thermal/in.bar1d @@ -1,38 +1,38 @@ #AtC Thermal Coupling # This benchmark tests heat conducting into and out of the MD region. The # temperature is initially 20 everywhere and the left boundary BC is fixed at 40. -# The result should show heat diffusing through the FEM to the MD and back out -# to the FEM on the right. Insufficient time is captured to reach the linear +# The result should show heat diffusing through the FEM to the MD and back out +# to the FEM on the right. Insufficient time is captured to reach the linear # steady state, but heat crossing both boundaries should be observed. - -units real -atom_style atomic + +units real +atom_style atomic echo both # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost @@ -40,26 +40,26 @@ fix_modify AtC boundary ghost fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC internal_quadrature off # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field #dump D1 all atom 100 dump.bar1d #fix_modify AtC output bar1dfe 100 -timestep 5 +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} -thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] +compute_modify thermo_temp extra/dof ${xdof} +thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover -fix_modify AtC unfix temperature all -fix_modify AtC control thermal hoover -#fix_modify AtC localized_lambda on -fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -fix_modify AtC filter on +fix_modify AtC unfix temperature all +fix_modify AtC control thermal hoover +#fix_modify AtC localized_lambda on +fix_modify AtC filter type exponential +fix_modify AtC filter scale 10000.0 +fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -67,13 +67,13 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # initialize filter -thermo 1 -run 100 +thermo 1 +run 100 # set up output, should be before a "run" fix_modify AtC output bar1dFE 100 text binary # output command #dump D1 all atom 1000 dump.bar1d # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms b/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms index 2219b803ec..1faf24427d 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms +++ b/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms @@ -4,33 +4,33 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data all_atoms.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -7 7 -3 3 -3 3 +region simRegion block -7 7 -3 3 -3 3 # create atoms, NOTE commented out for restart -#boundary f p p -#create_box 1 simRegion -#create_atoms 1 region simRegion -#mass 1 39.95 +#boundary f p p +#create_box 1 simRegion +#create_atoms 1 region simRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -6 6 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -6 6 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -#write_restart all_atoms.init -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +#write_restart all_atoms.init +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region @@ -39,34 +39,34 @@ fix_modify AtC mesh create_faceset obndy box -6.0 6.0 -INF INF -INF INF out fix_modify AtC mesh create_faceset lbndy box -6.0 16.0 -INF INF -INF INF outward fix_modify AtC mesh create_faceset rbndy box -16.0 6.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 fix_modify AtC internal_quadrature off # equilibrate MD field #dump D1 all atom 100 dump.bar1d #fix_modify AtC output bar1dfe 100 -#fix_modify AtC time_integration frac_step -timestep 5 +#fix_modify AtC time_integration frac_step +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover -fix_modify AtC control thermal hoover -#fix_modify AtC thermal control flux interpolate -#fix_modify AtC thermal control flux faceset obndy -fix_modify AtC filter scale 1000.0 -#fix_modify AtC filter equilibrate -#fix_modify AtC filter on -#fix_modify AtC localized_lambda on +fix_modify AtC control thermal hoover +#fix_modify AtC thermal control flux interpolate +#fix_modify AtC thermal control flux faceset obndy +fix_modify AtC filter scale 1000.0 +#fix_modify AtC filter equilibrate +#fix_modify AtC filter on +#fix_modify AtC localized_lambda on fix_modify AtC boundary_faceset is obndy # initialize filter #fix_modify AtC output bar1d_all_atoms_preqFE 1 reset_timestep 0 -thermo 1 +thermo 1 #run 5000 # add nodesets and ramp temperature # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax @@ -76,26 +76,26 @@ thermo 1 #fix_modify AtC fix temperature rbc 20. # initialize filter #fix_modify AtC output bar1d_all_atoms_eqFE 200 -reset_timestep 0 -fix_modify AtC reset_time +reset_timestep 0 +fix_modify AtC reset_time #run 5000 # release and let run -#fix_modify AtC filter on -fix_modify AtC unfix temperature all +#fix_modify AtC filter on +fix_modify AtC unfix temperature all #fix_modify AtC localized_lambda on -fix_modify AtC control lumped_lambda_solve on +fix_modify AtC control lumped_lambda_solve on # dirichlet boundaries #fix_modify AtC fix temperature lbc 40. #fix_modify AtC fix temperature rbc 20. # neumann boundaries fix_modify AtC control thermal flux no_boundary -fix_modify AtC fix_flux temperature lbndy 0.0000000001 +fix_modify AtC fix_flux temperature lbndy 0.0000000001 fix_modify AtC fix_flux temperature rbndy -0.0000000001 # set up output, should be before a "run" fix_modify AtC output bar1d_all_atomsFE 200 text binary # output command #dump D1 all atom 1000 dump.bar1d # run with FE -reset_timestep 0 -thermo 200 -run 5000 +reset_timestep 0 +thermo 200 +run 5000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_combined b/examples/PACKAGES/atc/thermal/in.bar1d_combined index 70dafe72be..23b01139f2 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_combined +++ b/examples/PACKAGES/atc/thermal/in.bar1d_combined @@ -6,62 +6,62 @@ # linear # steady state, but heat crossing the boundaries should be observed, # as should the interaction of the two themostat types. #echo both -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart -boundary f p p -pair_style lj/cut 13.5 +boundary f p p +pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -16 4 -3 3 -3 3 +region simRegion block -16 4 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -region mdGhost block -5 -4 -3 3 -3 3 -group ghost region mdGhost +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +region mdGhost block -5 -4 -3 3 -3 3 +group ghost region mdGhost # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no -#write_restart tinit.dat +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no +#write_restart tinit.dat # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost fix_modify AtC time_integration fractional_step -fix_modify AtC internal_quadrature off +fix_modify AtC internal_quadrature off # ID part keywords nx ny nz region fix_modify AtC mesh create 10 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 40.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 40.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g # equilibrate MD field #fix_modify AtC output bar1dfe_combined_init 100 -timestep 5 -thermo 10 -run 400 +timestep 5 +thermo 10 +run 400 # change thermostat to flux -fix_modify AtC unfix temperature all -fix_modify AtC control thermal flux faceset obndy -#fix_modify AtC control thermal hoover -fix_modify AtC control localized_lambda on +fix_modify AtC unfix temperature all +fix_modify AtC control thermal flux faceset obndy +#fix_modify AtC control thermal hoover +fix_modify AtC control localized_lambda on #fix_modify AtC control tolerance 1.e-16 # this tolerance seems necessary to prevent noticeable drift # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax @@ -74,8 +74,8 @@ fix_modify AtC fix temperature rbc 20. fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 #fix_modify AtC filter on -thermo 100 -#run 100 +thermo 100 +#run 100 # set up output, should be before a "run" fix_modify AtC output bar1d_combinedFE 100 text @@ -83,5 +83,5 @@ fix_modify AtC output bar1d_combinedFE 100 text #dump D1 all atom 100 dump.bar1d_combined # run with FE reset_timestep 0 -thermo 100 -run 5000 +thermo 100 +run 5000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_flux b/examples/PACKAGES/atc/thermal/in.bar1d_flux index 2b79aa6339..6f7fdcca21 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_flux +++ b/examples/PACKAGES/atc/thermal/in.bar1d_flux @@ -5,34 +5,34 @@ # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. #echo both -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart -boundary f p p -pair_style lj/cut 13.5 +boundary f p p +pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no -#write_restart tinit.dat +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no +#write_restart tinit.dat # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost @@ -42,25 +42,25 @@ fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 4.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. +fix_modify AtC fix temperature all 20. +#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g # equilibrate MD field #fix_modify AtC output bar1dfe_flux_init 100 -timestep 5 -thermo 10 -run 400 +timestep 5 +thermo 10 +run 400 # change thermostat to hoover -fix_modify AtC unfix temperature all -fix_modify AtC control thermal flux faceset obndy +fix_modify AtC unfix temperature all +fix_modify AtC control thermal flux faceset obndy fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -#fix_modify AtC filter on +fix_modify AtC filter scale 10000.0 +#fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -68,12 +68,12 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # initialize filter -run 100 +run 100 # set up output, should be before a "run" fix_modify AtC output bar1d_fluxFE 100 text binary # output command #dump D1 all atom 1000 dump.bar1d # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_frac_step b/examples/PACKAGES/atc/thermal/in.bar1d_frac_step index e8540d9151..09295cab24 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_frac_step +++ b/examples/PACKAGES/atc/thermal/in.bar1d_frac_step @@ -4,33 +4,33 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region @@ -40,7 +40,7 @@ fix_modify AtC internal_atom_integrate off fix iNVE internal nve fix_modify AtC internal_quadrature off # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -4.1 -3.9 -INF INF -INF INF @@ -48,25 +48,25 @@ fix_modify AtC mesh create_nodeset rbc 3.9 4.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field #dump D1 all atom 100 dump.bar1d #fix_modify AtC output bar1dfe 100 text -timestep 5 +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover fix_modify AtC unfix temperature all fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. fix_modify AtC control thermal flux no_boundary -fix_modify AtC control tolerance 1.e-9 # this is to remove looser benchmark tolerance because the lambda solution was reacting to numerical noise, but it results in a slight drift in the constraints -#fix_modify AtC thermal control none -fix_modify AtC control localized_lambda on +fix_modify AtC control tolerance 1.e-9 # this is to remove looser benchmark tolerance because the lambda solution was reacting to numerical noise, but it results in a slight drift in the constraints +#fix_modify AtC thermal control none +fix_modify AtC control localized_lambda on fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 fix_modify AtC filter on @@ -76,5 +76,5 @@ fix_modify AtC output bar1d_frac_stepFE 200 text #dump D1 all atom 1000 dump.bar1d # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_hoover b/examples/PACKAGES/atc/thermal/in.bar1d_hoover index 2f0518d0d2..477a2bf08d 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_hoover +++ b/examples/PACKAGES/atc/thermal/in.bar1d_hoover @@ -4,35 +4,35 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic log bar1d_hoover.log # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data all_atoms.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -7 7 -3 3 -3 3 +region simRegion block -7 7 -3 3 -3 3 # create atoms, NOTE commented out for restart -#boundary f p p -#create_box 1 simRegion -#create_atoms 1 region simRegion -#mass 1 39.95 -#atom_modify sort 0 0 +#boundary f p p +#create_box 1 simRegion +#create_atoms 1 region simRegion +#mass 1 39.95 +#atom_modify sort 0 0 # specify interal/ghost atoms -region mdInternal block -6 6 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -6 6 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -#write_restart all_atoms.init -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +#write_restart all_atoms.init +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region @@ -40,9 +40,9 @@ fix AtC internal atc thermal Ar_thermal.mat # switch depending on application of BCs or coupling #variable nEls equal 6 # for boundary conditions variable nEls equal 12 # for coupling -fix_modify AtC boundary ghost # for coupling +fix_modify AtC boundary ghost # for coupling -region atcRegion block -${nEls} ${nEls} -3 3 -3 3 +region atcRegion block -${nEls} ${nEls} -3 3 -3 3 fix_modify AtC mesh create ${nEls} 1 1 atcRegion f p p fix_modify AtC mesh create_faceset obndy box -6.0 6.0 -INF INF -INF INF outward fix_modify AtC mesh create_faceset lbndy box -6.0 16.0 -INF INF -INF INF outward @@ -50,39 +50,39 @@ fix_modify AtC mesh create_faceset rbndy box -16.0 6.0 -INF INF -INF INF ou variable tol equal 0.1 variable uBnd equal ${nEls}+${tol} variable lBnd equal ${nEls}-${tol} -fix_modify AtC mesh create_nodeset lbc -${uBnd} -${lBnd} -INF INF -INF INF +fix_modify AtC mesh create_nodeset lbc -${uBnd} -${lBnd} -INF INF -INF INF fix_modify AtC mesh create_nodeset rbc ${lBnd} ${uBnd} -INF INF -INF INF # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC initial temperature all 20. -#fix_modify AtC consistent_fe_initialization on +fix_modify AtC fix temperature all 20. +#fix_modify AtC initial temperature all 20. +#fix_modify AtC consistent_fe_initialization on # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 fix_modify AtC internal_quadrature off # equilibrate MD field #dump D1 all atom 100 dump.bar1d_hoover_init #fix_modify AtC output bar1d_hoover_init 100 text binary -fix_modify AtC time_integration fractional_step -fix_modify AtC temperature_definition total -timestep 5 +fix_modify AtC time_integration fractional_step +fix_modify AtC temperature_definition total +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 -fix_modify AtC unfix temperature all +fix_modify AtC unfix temperature all -fix_modify AtC filter type exponential +fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 fix_modify AtC filter on # boundary conditions------------------------ # dirichlet with ramp (unstable when filtered due to instantaneous change in rate) -#fix_modify AtC fix temperature lbc temporal_ramp 20. 40. 25000. -#fix_modify AtC fix temperature rbc 20. +#fix_modify AtC fix temperature lbc temporal_ramp 20. 40. 25000. +#fix_modify AtC fix temperature rbc 20. #fix_modify AtC localized_lambda on #fix_modify AtC control thermal flux no_boundary #fix_modify AtC output test_rampFE 200 text binary @@ -94,7 +94,7 @@ fix_modify AtC filter on #fix_modify AtC fix temperature lbc 40. # dirichlet with rescaling -#fix_modify AtC filter off +#fix_modify AtC filter off #fix_modify AtC fix temperature all 20. #fix_modify AtC fix temperature lbc 40. #fix_modify AtC output test_rampFE 200 text binary @@ -126,13 +126,13 @@ fix_modify AtC fix temperature rbc 20. #fix_modify AtC lumped_lambda_solve on # hoover -fix_modify AtC control thermal hoover +fix_modify AtC control thermal hoover fix_modify AtC control localized_lambda on -fix_modify AtC control tolerance 1.e-14 +fix_modify AtC control tolerance 1.e-14 fix_modify AtC output bar1d_hooverFE 200 text binary #dump D1 all atom 200 dump.bar1d_hoover reset_timestep 0 fix_modify AtC reset_time -thermo 100 +thermo 100 run 5000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_interpolate b/examples/PACKAGES/atc/thermal/in.bar1d_interpolate index 0333bf117d..7e1d6295b4 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_interpolate +++ b/examples/PACKAGES/atc/thermal/in.bar1d_interpolate @@ -4,65 +4,65 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next three lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost # numerical parameters -fix_modify AtC time_integration fractional_step +fix_modify AtC time_integration fractional_step # ID part keywords nx ny nz region fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 4.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. -#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 +fix_modify AtC fix temperature all 20. +#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. +#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field #fix_modify AtC output bar1dfe_flux_init 100 -timestep 5 +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover -fix_modify AtC unfix temperature all -fix_modify AtC control thermal none -fix_modify AtC control thermal flux interpolate -fix_modify AtC control localized_lambda on -#fix_modify AtC thermal control flux faceset obndy +fix_modify AtC unfix temperature all +fix_modify AtC control thermal none +fix_modify AtC control thermal flux interpolate +fix_modify AtC control localized_lambda on +#fix_modify AtC thermal control flux faceset obndy fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -fix_modify AtC filter on +fix_modify AtC filter scale 10000.0 +fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -70,11 +70,11 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # initialize filter -run 100 +run 100 # set up output, should be before a "run" fix_modify AtC output bar1d_interpolateFE 100 text # run with FE reset_timestep 0 -thermo 100 -#run 10 -run 10000 +thermo 100 +#run 10 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_lumped b/examples/PACKAGES/atc/thermal/in.bar1d_lumped index 153f7b632d..5321c45eb4 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_lumped +++ b/examples/PACKAGES/atc/thermal/in.bar1d_lumped @@ -5,32 +5,32 @@ # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. echo both -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next three lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost @@ -42,30 +42,30 @@ fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 4.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. -#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 +fix_modify AtC fix temperature all 20. +#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. +#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # output -thermo 100 +thermo 100 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g # equilibrate MD field #fix_modify AtC output bar1d_lumped_initFE 1 text -timestep 5 -run 400 -#run 100 +timestep 5 +run 400 +#run 100 # change thermostat to hoover -fix_modify AtC unfix temperature all -#fix_modify AtC thermal control flux interpolate -fix_modify AtC control thermal flux faceset obndy -fix_modify AtC control localized_lambda on +fix_modify AtC unfix temperature all +#fix_modify AtC thermal control flux interpolate +fix_modify AtC control thermal flux faceset obndy +fix_modify AtC control localized_lambda on fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -fix_modify AtC filter on +fix_modify AtC filter scale 10000.0 +fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -73,13 +73,13 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 80. fix_modify AtC fix temperature rbc 80. # initialize -thermo 10 -run 100 +thermo 10 +run 100 # relax fix_modify AtC unfix temperature all # output fix_modify AtC output bar1d_lumpedFE 100 text # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/two_temperature/in.uniform_heating b/examples/PACKAGES/atc/two_temperature/in.uniform_heating index 0565fe8449..81a649e847 100644 --- a/examples/PACKAGES/atc/two_temperature/in.uniform_heating +++ b/examples/PACKAGES/atc/two_temperature/in.uniform_heating @@ -1,41 +1,41 @@ # needs description #AtC Thermal Coupling echo both -units real -atom_style atomic -boundary f p p +units real +atom_style atomic +boundary f p p # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) -pair_style lj/cut 13.5 -read_data uniform_heating.init +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +pair_style lj/cut 13.5 +read_data uniform_heating.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region mdRegion block -8 8 -3 3 -3 3 -region mdInternal block -6 6 -3 3 -3 3 -group internal region mdInternal -neighbor 5. bin -neigh_modify every 10 delay 0 check no +region mdRegion block -8 8 -3 3 -3 3 +region mdInternal block -6 6 -3 3 -3 3 +group internal region mdInternal +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc two_temperature Ar_ttm.mat # ID part keywords nx ny nz region fix_modify AtC mesh create 6 1 1 mdInternal f p p fix_modify AtC internal_quadrature on # fix a temperature -fix_modify AtC initial temperature all 20. -fix_modify AtC fix temperature all 20. -fix_modify AtC initial electron_temperature all 20. -fix_modify AtC fix electron_temperature all 20. +fix_modify AtC initial temperature all 20. +fix_modify AtC fix temperature all 20. +fix_modify AtC initial electron_temperature all 20. +fix_modify AtC fix electron_temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # output thermo_style custom step cpu pe etotal temp f_AtC[1] f_AtC[2] -thermo 100 +thermo 100 log uniform_heating.log # make thermo output the correct temperature by removing ghost dof # variable xdof equal 3*count(ghost) -# compute_modify thermo_temp extra ${xdof} +# compute_modify thermo_temp extra/dof ${xdof} # equilibrate MD field -timestep 5 -run 400 +timestep 5 +run 400 # change thermostat fix_modify AtC output uniform_heatingFE 100 text fix_modify AtC unfix temperature all @@ -50,4 +50,4 @@ fix_modify AtC fix temperature rbc 20. fix_modify AtC source temperature all 6.3363e-10 # run with FE reset_timestep 0 -run 1000 +run 1000 diff --git a/examples/PACKAGES/charge_regulation/in.chreg-acid b/examples/PACKAGES/charge_regulation/in.chreg-acid index 68ef5e1b7c..30ae13c6da 100644 --- a/examples/PACKAGES/charge_regulation/in.chreg-acid +++ b/examples/PACKAGES/charge_regulation/in.chreg-acid @@ -25,7 +25,7 @@ pair_modify shift yes ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve compute dtemp all temp -compute_modify dtemp dynamic yes +compute_modify dtemp dynamic/dof yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp diff --git a/examples/PACKAGES/charge_regulation/in.chreg-acid-real b/examples/PACKAGES/charge_regulation/in.chreg-acid-real index d7225f33ea..361027c596 100644 --- a/examples/PACKAGES/charge_regulation/in.chreg-acid-real +++ b/examples/PACKAGES/charge_regulation/in.chreg-acid-real @@ -6,12 +6,12 @@ neighbor 10.0 bin read_data data.chreg-acid-real #real units -variable sigma equal 7.2 # particle diameter 0.72 nm -variable temperature equal 298 # temperature 298 K +variable sigma equal 7.2 # particle diameter 0.72 nm +variable temperature equal 298 # temperature 298 K variable kb index 0.0019872067 # kB in Kcal/mol/K -variable epsilon equal ${kb}*${temperature} -variable tunit equal 2000 # time unit is 2000 fs -variable timestep equal 0.005*${tunit} +variable epsilon equal ${kb}*${temperature} +variable tunit equal 2000 # time unit is 2000 fs +variable timestep equal 0.005*${tunit} variable cut_long equal 12.5*${sigma} variable nevery equal 100 @@ -27,13 +27,13 @@ velocity all create ${temperature} 8008 loop geom pair_style lj/cut/coul/long ${cut_lj} ${cut_long} pair_coeff * * ${epsilon} ${sigma} kspace_style pppm 1.0e-3 -dielectric 78 +dielectric 78 pair_modify shift yes ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve compute dtemp all temp -compute_modify dtemp dynamic yes +compute_modify dtemp dynamic/dof yes fix fT all langevin $(v_temperature) $(v_temperature) $(v_tunit) 123 fix_modify fT temp dtemp diff --git a/examples/PACKAGES/charge_regulation/in.chreg-polymer b/examples/PACKAGES/charge_regulation/in.chreg-polymer index 055032c018..068fe35c90 100644 --- a/examples/PACKAGES/charge_regulation/in.chreg-polymer +++ b/examples/PACKAGES/charge_regulation/in.chreg-polymer @@ -17,7 +17,7 @@ dielectric 1.0 ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve compute dtemp all temp -compute_modify dtemp dynamic yes +compute_modify dtemp dynamic/dof yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps index 138f7b5338..dd50a5e69f 100644 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps @@ -1,6 +1,6 @@ dimension 2 units micro -atom_style meso +atom_style sph variable R equal 0.5 # radius of sphere micrometers variable a equal $R/5 # lattice spacing micrometers @@ -37,12 +37,12 @@ group upper_wall type 3 group lower_wall type 4 mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} -fix 1 fluid meso +fix 1 fluid sph fix 2 sphere rigid/meso single fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 deleted file mode 100644 index cd01601292..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 +++ /dev/null @@ -1,247 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable Lf equal $R*3 -variable Lf equal 0.5*3 -variable Lb equal $R*4 -variable Lb equal 0.5*4 -variable wall_velocity equal 0.01 # micrometers/microsecond -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -2 ${Lb} 0 ${a} units box -region box block -2 2 -2 2 0 ${a} units box -region box block -2 2 -2 2 0 0.1 units box -create_box 4 box -Created orthogonal box = (-2 -2 0) to (2 2 0.1) - 1 by 1 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 1600 atoms - Time spent = 0.00169706 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -region upper_wall block INF INF +${Lf} INF INF INF units box -region upper_wall block INF INF +1.5 INF INF INF units box -set region upper_wall type 3 - 200 settings made for type - -region lower_wall block INF INF INF -${Lf} INF INF units box -region lower_wall block INF INF INF -1.5 INF INF units box -set region lower_wall type 4 - 240 settings made for type - -group fluid type 1 -1079 atoms in group fluid -group sphere type 2 -81 atoms in group sphere -group upper_wall type 3 -200 atoms in group upper_wall -group lower_wall type 4 -240 atoms in group lower_wall - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 1600 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms -fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box -fix 3 upper_wall meso/move linear +0.01 0 0 units box -fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box -fix 4 lower_wall meso/move linear -0.01 0 0 units box - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 15 15 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.937 | 6.937 | 6.937 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 0 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 5 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 6 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 14 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 17 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 21 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 22 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 23 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 24 0 - 7200 7.2 24 0 - 7300 7.3 25 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 26 0 - 7700 7.7 26 0 - 7800 7.8 26 0 - 7900 7.9 27 0 - 8000 8 27 0 - 8100 8.1 27 0 - 8200 8.2 28 0 - 8300 8.3 28 0 - 8400 8.4 28 0 - 8500 8.5 29 0 - 8600 8.6 29 0 - 8700 8.7 30 0 - 8800 8.8 30 0 - 8900 8.9 30 0 - 9000 9 31 0 - 9100 9.1 31 0 - 9200 9.2 31 0 - 9300 9.3 32 0 - 9400 9.4 32 0 - 9500 9.5 32 0 - 9600 9.6 33 0 - 9700 9.7 33 0 - 9800 9.8 33 0 - 9900 9.9 34 0 - 10000 10 34 0 -Loop time of 144.208 on 1 procs for 10000 steps with 1600 atoms - -Performance: 5991348.580 ns/day, 0.000 hours/ns, 69.344 timesteps/s -99.7% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 143.08 | 143.08 | 143.08 | 0.0 | 99.22 -Neigh | 0.033195 | 0.033195 | 0.033195 | 0.0 | 0.02 -Comm | 0.24139 | 0.24139 | 0.24139 | 0.0 | 0.17 -Output | 0.11687 | 0.11687 | 0.11687 | 0.0 | 0.08 -Modify | 0.61566 | 0.61566 | 0.61566 | 0.0 | 0.43 -Other | | 0.117 | | | 0.08 - -Nlocal: 1600 ave 1600 max 1600 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 993 ave 993 max 993 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 73236 ave 73236 max 73236 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 73236 -Ave neighs/atom = 45.7725 -Neighbor list builds = 34 -Dangerous builds = 0 -Total wall time: 0:02:24 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 deleted file mode 100644 index 77823e00fc..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 +++ /dev/null @@ -1,247 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable Lf equal $R*3 -variable Lf equal 0.5*3 -variable Lb equal $R*4 -variable Lb equal 0.5*4 -variable wall_velocity equal 0.01 # micrometers/microsecond -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -2 ${Lb} 0 ${a} units box -region box block -2 2 -2 2 0 ${a} units box -region box block -2 2 -2 2 0 0.1 units box -create_box 4 box -Created orthogonal box = (-2 -2 0) to (2 2 0.1) - 2 by 2 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 1600 atoms - Time spent = 0.000589566 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -region upper_wall block INF INF +${Lf} INF INF INF units box -region upper_wall block INF INF +1.5 INF INF INF units box -set region upper_wall type 3 - 200 settings made for type - -region lower_wall block INF INF INF -${Lf} INF INF units box -region lower_wall block INF INF INF -1.5 INF INF units box -set region lower_wall type 4 - 240 settings made for type - -group fluid type 1 -1079 atoms in group fluid -group sphere type 2 -81 atoms in group sphere -group upper_wall type 3 -200 atoms in group upper_wall -group lower_wall type 4 -240 atoms in group lower_wall - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 1600 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms -fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box -fix 3 upper_wall meso/move linear +0.01 0 0 units box -fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box -fix 4 lower_wall meso/move linear -0.01 0 0 units box - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 15 15 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.854 | 6.854 | 6.854 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 4 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 5 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 6 0 - 2200 2.2 6 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 7 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 8 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 9 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 10 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 11 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 12 0 - 4100 4.1 13 0 - 4200 4.2 13 0 - 4300 4.3 13 0 - 4400 4.4 14 0 - 4500 4.5 14 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 15 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 17 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 18 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 20 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 21 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 22 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 23 0 - 7200 7.2 24 0 - 7300 7.3 24 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 25 0 - 7700 7.7 25 0 - 7800 7.8 26 0 - 7900 7.9 26 0 - 8000 8 26 0 - 8100 8.1 27 0 - 8200 8.2 27 0 - 8300 8.3 27 0 - 8400 8.4 28 0 - 8500 8.5 28 0 - 8600 8.6 28 0 - 8700 8.7 29 0 - 8800 8.8 29 0 - 8900 8.9 29 0 - 9000 9 30 0 - 9100 9.1 30 0 - 9200 9.2 31 0 - 9300 9.3 31 0 - 9400 9.4 31 0 - 9500 9.5 32 0 - 9600 9.6 32 0 - 9700 9.7 32 0 - 9800 9.8 32 0 - 9900 9.9 33 0 - 10000 10 33 0 -Loop time of 63.2372 on 4 procs for 10000 steps with 1600 atoms - -Performance: 13662841.706 ns/day, 0.000 hours/ns, 158.135 timesteps/s -94.3% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 51.576 | 53.662 | 55.484 | 23.9 | 84.86 -Neigh | 0.011519 | 0.012395 | 0.013405 | 0.7 | 0.02 -Comm | 6.8389 | 8.5423 | 10.517 | 56.1 | 13.51 -Output | 0.12342 | 0.12513 | 0.1302 | 0.8 | 0.20 -Modify | 0.58708 | 0.69128 | 0.78806 | 11.3 | 1.09 -Other | | 0.2038 | | | 0.32 - -Nlocal: 400 ave 411 max 388 min -Histogram: 1 1 0 0 0 0 0 0 0 2 -Nghost: 552.25 ave 567 max 539 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Neighs: 18298.8 ave 18781 max 17829 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 73195 -Ave neighs/atom = 45.7469 -Neighbor list builds = 33 -Dangerous builds = 0 -Total wall time: 0:01:03 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 new file mode 100644 index 0000000000..c4c11205e1 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 @@ -0,0 +1,253 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable Lf equal $R*3 +variable Lf equal 0.5*3 +variable Lb equal $R*4 +variable Lb equal 0.5*4 +variable wall_velocity equal 0.01 # micrometers/microsecond +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -2 ${Lb} 0 ${a} units box +region box block -2 2 -2 2 0 ${a} units box +region box block -2 2 -2 2 0 0.1 units box +create_box 4 box +Created orthogonal box = (-2 -2 0) to (2 2 0.1) + 1 by 1 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 1600 atoms + using lattice units in orthogonal box = (-2 -2 0) to (2 2 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +region upper_wall block INF INF +${Lf} INF INF INF units box +region upper_wall block INF INF +1.5 INF INF INF units box +set region upper_wall type 3 +Setting atom values ... + 200 settings made for type + +region lower_wall block INF INF INF -${Lf} INF INF units box +region lower_wall block INF INF INF -1.5 INF INF units box +set region lower_wall type 4 +Setting atom values ... + 240 settings made for type + +group fluid type 1 +1079 atoms in group fluid +group sphere type 2 +81 atoms in group sphere +group upper_wall type 3 +200 atoms in group upper_wall +group lower_wall type 4 +240 atoms in group lower_wall + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 1600 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms +fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box +fix 3 upper_wall meso/move linear +0.01 0 0 units box +fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box +fix 4 lower_wall meso/move linear -0.01 0 0 units box + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 15 15 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 7.313 | 7.313 | 7.313 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 0 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 10 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 11 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 19 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 20 0 + 6100 6.1 20 0 + 6200 6.2 21 0 + 6300 6.3 21 0 + 6400 6.4 21 0 + 6500 6.5 22 0 + 6600 6.6 22 0 + 6700 6.7 22 0 + 6800 6.8 23 0 + 6900 6.9 23 0 + 7000 7 23 0 + 7100 7.1 24 0 + 7200 7.2 24 0 + 7300 7.3 25 0 + 7400 7.4 25 0 + 7500 7.5 25 0 + 7600 7.6 26 0 + 7700 7.7 26 0 + 7800 7.8 26 0 + 7900 7.9 27 0 + 8000 8 27 0 + 8100 8.1 27 0 + 8200 8.2 28 0 + 8300 8.3 28 0 + 8400 8.4 28 0 + 8500 8.5 29 0 + 8600 8.6 29 0 + 8700 8.7 30 0 + 8800 8.8 30 0 + 8900 8.9 30 0 + 9000 9 31 0 + 9100 9.1 31 0 + 9200 9.2 31 0 + 9300 9.3 32 0 + 9400 9.4 32 0 + 9500 9.5 32 0 + 9600 9.6 33 0 + 9700 9.7 33 0 + 9800 9.8 33 0 + 9900 9.9 34 0 + 10000 10 34 0 +Loop time of 131.724 on 1 procs for 10000 steps with 1600 atoms + +Performance: 6559168.339 ns/day, 0.000 hours/ns, 75.916 timesteps/s, 121.466 katom-step/s +99.7% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 130.89 | 130.89 | 130.89 | 0.0 | 99.37 +Neigh | 0.02884 | 0.02884 | 0.02884 | 0.0 | 0.02 +Comm | 0.17863 | 0.17863 | 0.17863 | 0.0 | 0.14 +Output | 0.095497 | 0.095497 | 0.095497 | 0.0 | 0.07 +Modify | 0.42063 | 0.42063 | 0.42063 | 0.0 | 0.32 +Other | | 0.1069 | | | 0.08 + +Nlocal: 1600 ave 1600 max 1600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 993 ave 993 max 993 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 73236 ave 73236 max 73236 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 73236 +Ave neighs/atom = 45.7725 +Neighbor list builds = 34 +Dangerous builds = 0 +Total wall time: 0:02:11 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 new file mode 100644 index 0000000000..6cb58bc233 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 @@ -0,0 +1,253 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable Lf equal $R*3 +variable Lf equal 0.5*3 +variable Lb equal $R*4 +variable Lb equal 0.5*4 +variable wall_velocity equal 0.01 # micrometers/microsecond +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -2 ${Lb} 0 ${a} units box +region box block -2 2 -2 2 0 ${a} units box +region box block -2 2 -2 2 0 0.1 units box +create_box 4 box +Created orthogonal box = (-2 -2 0) to (2 2 0.1) + 2 by 2 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 1600 atoms + using lattice units in orthogonal box = (-2 -2 0) to (2 2 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +region upper_wall block INF INF +${Lf} INF INF INF units box +region upper_wall block INF INF +1.5 INF INF INF units box +set region upper_wall type 3 +Setting atom values ... + 200 settings made for type + +region lower_wall block INF INF INF -${Lf} INF INF units box +region lower_wall block INF INF INF -1.5 INF INF units box +set region lower_wall type 4 +Setting atom values ... + 240 settings made for type + +group fluid type 1 +1079 atoms in group fluid +group sphere type 2 +81 atoms in group sphere +group upper_wall type 3 +200 atoms in group upper_wall +group lower_wall type 4 +240 atoms in group lower_wall + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 1600 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms +fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box +fix 3 upper_wall meso/move linear +0.01 0 0 units box +fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box +fix 4 lower_wall meso/move linear -0.01 0 0 units box + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 15 15 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 7.23 | 7.23 | 7.23 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 10 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 11 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 13 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 14 0 + 4600 4.6 14 0 + 4700 4.7 15 0 + 4800 4.8 15 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 16 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 18 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 20 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 21 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 22 0 + 6700 6.7 22 0 + 6800 6.8 22 0 + 6900 6.9 23 0 + 7000 7 23 0 + 7100 7.1 23 0 + 7200 7.2 24 0 + 7300 7.3 24 0 + 7400 7.4 24 0 + 7500 7.5 25 0 + 7600 7.6 25 0 + 7700 7.7 25 0 + 7800 7.8 25 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 27 0 + 8300 8.3 27 0 + 8400 8.4 28 0 + 8500 8.5 28 0 + 8600 8.6 28 0 + 8700 8.7 29 0 + 8800 8.8 29 0 + 8900 8.9 29 0 + 9000 9 30 0 + 9100 9.1 30 0 + 9200 9.2 30 0 + 9300 9.3 31 0 + 9400 9.4 31 0 + 9500 9.5 31 0 + 9600 9.6 32 0 + 9700 9.7 32 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 33 0 +Loop time of 24.8261 on 4 procs for 10000 steps with 1600 atoms + +Performance: 34802055.618 ns/day, 0.000 hours/ns, 402.802 timesteps/s, 644.483 katom-step/s +99.1% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 21.84 | 22.879 | 23.944 | 21.4 | 92.16 +Neigh | 0.007446 | 0.0079435 | 0.0084435 | 0.6 | 0.03 +Comm | 0.5271 | 1.5894 | 2.6259 | 80.9 | 6.40 +Output | 0.034799 | 0.035302 | 0.036437 | 0.4 | 0.14 +Modify | 0.20079 | 0.21033 | 0.2202 | 1.7 | 0.85 +Other | | 0.1041 | | | 0.42 + +Nlocal: 400 ave 414 max 390 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Nghost: 555.5 ave 564 max 543 min +Histogram: 1 0 0 0 1 0 0 0 0 2 +Neighs: 18299.2 ave 18820 max 17906 min +Histogram: 1 1 0 0 0 0 1 0 0 1 + +Total # of neighbors = 73197 +Ave neighs/atom = 45.748125 +Neighbor list builds = 33 +Dangerous builds = 0 +Total wall time: 0:00:24 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps b/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps index 6ef36a0cf6..2e0e821480 100644 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps @@ -1,6 +1,6 @@ dimension 2 units micro -atom_style meso +atom_style sph variable R equal 0.5 # radius of sphere micrometers variable a equal $R/5 # lattice spacing micrometers @@ -27,12 +27,12 @@ group fluid type 1 group sphere type 2 mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} -fix 1 fluid meso +fix 1 fluid sph fix 2 sphere rigid/meso single fix 2d all enforce2d diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 deleted file mode 100644 index d44c0fd6f4..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 +++ /dev/null @@ -1,226 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable L equal $R*3 -variable L equal 0.5*3 -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -$L $L -$L $L 0 $a units box -region box block -1.5 $L -$L $L 0 $a units box -region box block -1.5 1.5 -$L $L 0 $a units box -region box block -1.5 1.5 -1.5 $L 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 0.1 units box -create_box 2 box -Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) - 1 by 1 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 900 atoms - Time spent = 0.0015769 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -group fluid type 1 -819 atoms in group fluid -group sphere type 2 -81 atoms in group sphere - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 900 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.137 | 6.137 | 6.137 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 6 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 7 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 10 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 11 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 12 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 13 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 14 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 17 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 18 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 19 0 - 6100 6.1 20 0 - 6200 6.2 20 0 - 6300 6.3 20 0 - 6400 6.4 21 0 - 6500 6.5 21 0 - 6600 6.6 21 0 - 6700 6.7 21 0 - 6800 6.8 22 0 - 6900 6.9 22 0 - 7000 7 22 0 - 7100 7.1 23 0 - 7200 7.2 23 0 - 7300 7.3 23 0 - 7400 7.4 24 0 - 7500 7.5 24 0 - 7600 7.6 24 0 - 7700 7.7 25 0 - 7800 7.8 25 0 - 7900 7.9 26 0 - 8000 8 26 0 - 8100 8.1 26 0 - 8200 8.2 26 0 - 8300 8.3 27 0 - 8400 8.4 27 0 - 8500 8.5 27 0 - 8600 8.6 28 0 - 8700 8.7 28 0 - 8800 8.8 28 0 - 8900 8.9 29 0 - 9000 9 29 0 - 9100 9.1 29 0 - 9200 9.2 30 0 - 9300 9.3 30 0 - 9400 9.4 30 0 - 9500 9.5 30 0 - 9600 9.6 31 0 - 9700 9.7 31 0 - 9800 9.8 32 0 - 9900 9.9 32 0 - 10000 10 32 0 -Loop time of 80.9456 on 1 procs for 10000 steps with 900 atoms - -Performance: 10673829.855 ns/day, 0.000 hours/ns, 123.540 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 | 80.306 | 80.306 | 80.306 | 0.0 | 99.21 -Neigh | 0.017418 | 0.017418 | 0.017418 | 0.0 | 0.02 -Comm | 0.16939 | 0.16939 | 0.16939 | 0.0 | 0.21 -Output | 0.070281 | 0.070281 | 0.070281 | 0.0 | 0.09 -Modify | 0.3154 | 0.3154 | 0.3154 | 0.0 | 0.39 -Other | | 0.067 | | | 0.08 - -Nlocal: 900 ave 900 max 900 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 762 ave 762 max 762 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 40697 ave 40697 max 40697 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 40697 -Ave neighs/atom = 45.2189 -Neighbor list builds = 32 -Dangerous builds = 0 -Total wall time: 0:01:20 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 deleted file mode 100644 index f904b78ab4..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 +++ /dev/null @@ -1,226 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable L equal $R*3 -variable L equal 0.5*3 -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -$L $L -$L $L 0 $a units box -region box block -1.5 $L -$L $L 0 $a units box -region box block -1.5 1.5 -$L $L 0 $a units box -region box block -1.5 1.5 -1.5 $L 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 0.1 units box -create_box 2 box -Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) - 2 by 2 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 900 atoms - Time spent = 0.0010246 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -group fluid type 1 -819 atoms in group fluid -group sphere type 2 -81 atoms in group sphere - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 900 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.087 | 6.087 | 6.087 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 5 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 6 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 7 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 8 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 9 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 13 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 16 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 18 0 - 5500 5.5 18 0 - 5600 5.6 19 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 20 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 21 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 22 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 23 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 24 0 - 7200 7.2 24 0 - 7300 7.3 24 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 25 0 - 7700 7.7 26 0 - 7800 7.8 26 0 - 7900 7.9 26 0 - 8000 8 27 0 - 8100 8.1 27 0 - 8200 8.2 27 0 - 8300 8.3 28 0 - 8400 8.4 28 0 - 8500 8.5 28 0 - 8600 8.6 28 0 - 8700 8.7 29 0 - 8800 8.8 29 0 - 8900 8.9 29 0 - 9000 9 30 0 - 9100 9.1 30 0 - 9200 9.2 31 0 - 9300 9.3 31 0 - 9400 9.4 31 0 - 9500 9.5 31 0 - 9600 9.6 32 0 - 9700 9.7 32 0 - 9800 9.8 32 0 - 9900 9.9 33 0 - 10000 10 33 0 -Loop time of 69.01 on 4 procs for 10000 steps with 900 atoms - -Performance: 12519931.275 ns/day, 0.000 hours/ns, 144.907 timesteps/s -48.7% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 56.528 | 57.936 | 58.729 | 11.0 | 83.95 -Neigh | 0.013157 | 0.013382 | 0.013551 | 0.1 | 0.02 -Comm | 8.9594 | 9.7555 | 11.113 | 26.7 | 14.14 -Output | 0.14644 | 0.15009 | 0.15809 | 1.2 | 0.22 -Modify | 0.72913 | 0.91574 | 1.0524 | 12.4 | 1.33 -Other | | 0.2389 | | | 0.35 - -Nlocal: 225 ave 229 max 223 min -Histogram: 1 2 0 0 0 0 0 0 0 1 -Nghost: 442 ave 444 max 439 min -Histogram: 1 0 0 0 1 0 0 0 0 2 -Neighs: 10188.8 ave 10437 max 9932 min -Histogram: 1 0 0 1 0 0 0 1 0 1 - -Total # of neighbors = 40755 -Ave neighs/atom = 45.2833 -Neighbor list builds = 33 -Dangerous builds = 0 -Total wall time: 0:01:09 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 new file mode 100644 index 0000000000..30bf43dcf6 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 @@ -0,0 +1,230 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable L equal $R*3 +variable L equal 0.5*3 +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -$L $L -$L $L 0 $a units box +region box block -1.5 $L -$L $L 0 $a units box +region box block -1.5 1.5 -$L $L 0 $a units box +region box block -1.5 1.5 -1.5 $L 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 0.1 units box +create_box 2 box +Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + 1 by 1 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 900 atoms + using lattice units in orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +group fluid type 1 +819 atoms in group fluid +group sphere type 2 +81 atoms in group sphere + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 900 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.512 | 6.512 | 6.512 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 6 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 7 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 10 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 11 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 12 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 13 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 17 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 18 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 19 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 19 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 20 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 21 0 + 6700 6.7 21 0 + 6800 6.8 22 0 + 6900 6.9 22 0 + 7000 7 22 0 + 7100 7.1 23 0 + 7200 7.2 23 0 + 7300 7.3 23 0 + 7400 7.4 24 0 + 7500 7.5 24 0 + 7600 7.6 24 0 + 7700 7.7 25 0 + 7800 7.8 25 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 26 0 + 8300 8.3 27 0 + 8400 8.4 27 0 + 8500 8.5 27 0 + 8600 8.6 28 0 + 8700 8.7 28 0 + 8800 8.8 28 0 + 8900 8.9 29 0 + 9000 9 29 0 + 9100 9.1 29 0 + 9200 9.2 30 0 + 9300 9.3 30 0 + 9400 9.4 30 0 + 9500 9.5 30 0 + 9600 9.6 31 0 + 9700 9.7 31 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 32 0 +Loop time of 78.0094 on 1 procs for 10000 steps with 900 atoms + +Performance: 11075589.479 ns/day, 0.000 hours/ns, 128.190 timesteps/s, 115.371 katom-step/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 77.441 | 77.441 | 77.441 | 0.0 | 99.27 +Neigh | 0.016471 | 0.016471 | 0.016471 | 0.0 | 0.02 +Comm | 0.14821 | 0.14821 | 0.14821 | 0.0 | 0.19 +Output | 0.062415 | 0.062415 | 0.062415 | 0.0 | 0.08 +Modify | 0.25323 | 0.25323 | 0.25323 | 0.0 | 0.32 +Other | | 0.0877 | | | 0.11 + +Nlocal: 900 ave 900 max 900 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 762 ave 762 max 762 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 40697 ave 40697 max 40697 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 40697 +Ave neighs/atom = 45.218889 +Neighbor list builds = 32 +Dangerous builds = 0 +Total wall time: 0:01:18 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 new file mode 100644 index 0000000000..03f5ed01bb --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 @@ -0,0 +1,230 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable L equal $R*3 +variable L equal 0.5*3 +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -$L $L -$L $L 0 $a units box +region box block -1.5 $L -$L $L 0 $a units box +region box block -1.5 1.5 -$L $L 0 $a units box +region box block -1.5 1.5 -1.5 $L 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 0.1 units box +create_box 2 box +Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + 2 by 2 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 900 atoms + using lattice units in orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +group fluid type 1 +819 atoms in group fluid +group sphere type 2 +81 atoms in group sphere + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 900 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.463 | 6.463 | 6.463 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 11 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 12 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 18 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 19 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 20 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 21 0 + 6700 6.7 22 0 + 6800 6.8 22 0 + 6900 6.9 22 0 + 7000 7 23 0 + 7100 7.1 23 0 + 7200 7.2 23 0 + 7300 7.3 24 0 + 7400 7.4 24 0 + 7500 7.5 24 0 + 7600 7.6 25 0 + 7700 7.7 25 0 + 7800 7.8 26 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 27 0 + 8300 8.3 27 0 + 8400 8.4 28 0 + 8500 8.5 28 0 + 8600 8.6 28 0 + 8700 8.7 29 0 + 8800 8.8 29 0 + 8900 8.9 29 0 + 9000 9 30 0 + 9100 9.1 30 0 + 9200 9.2 30 0 + 9300 9.3 30 0 + 9400 9.4 31 0 + 9500 9.5 31 0 + 9600 9.6 31 0 + 9700 9.7 32 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 33 0 +Loop time of 13.5306 on 4 procs for 10000 steps with 900 atoms + +Performance: 63855371.888 ns/day, 0.000 hours/ns, 739.067 timesteps/s, 665.160 katom-step/s +98.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 | 12.327 | 12.56 | 12.738 | 4.3 | 92.83 +Neigh | 0.0043391 | 0.0044297 | 0.0045381 | 0.1 | 0.03 +Comm | 0.53746 | 0.71463 | 0.94685 | 18.1 | 5.28 +Output | 0.021884 | 0.02228 | 0.023428 | 0.4 | 0.16 +Modify | 0.14457 | 0.14548 | 0.14643 | 0.2 | 1.08 +Other | | 0.08351 | | | 0.62 + +Nlocal: 225 ave 228 max 222 min +Histogram: 1 0 0 1 0 0 1 0 0 1 +Nghost: 438.25 ave 442 max 434 min +Histogram: 1 0 0 0 0 1 1 0 0 1 +Neighs: 10152.2 ave 10328 max 9853 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 40609 +Ave neighs/atom = 45.121111 +Neighbor list builds = 33 +Dangerous builds = 0 +Total wall time: 0:00:13 diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps b/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps index 0d06723f59..59359d4b38 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps @@ -1,6 +1,6 @@ dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -21,7 +21,7 @@ lattice sc $a create_atoms 1 box mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} @@ -34,7 +34,7 @@ variable vx_sq_check equal c_v_sq[1]*${mass}/${kB}/$T variable vy_sq_check equal c_v_sq[2]*${mass}/${kB}/$T variable vz_sq_check equal c_v_sq[3]*${mass}/${kB}/$T -fix 1 all meso +fix 1 all sph neighbor ${skin} bin timestep ${dt} diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 similarity index 58% rename from examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 rename to examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 index 06ffd699bc..2fa4771a74 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 @@ -1,7 +1,7 @@ -LAMMPS (24 Oct 2018) +LAMMPS (28 Mar 2023 - Development) dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -38,13 +38,15 @@ Lattice spacing in x,y,z = 0.1 0.1 0.1 create_atoms 1 box Created 8000 atoms - Time spent = 0.00285411 secs + using lattice units in orthogonal box = (-1 -1 -1) to (1 1 1) + create_atoms CPU = 0.002 seconds mass * ${mass} mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 8000 settings made for meso/rho +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 8000 settings made for sph/rho pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 @@ -71,7 +73,7 @@ variable vz_sq_check equal c_v_sq[3]*0.001/${kB}/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/300 -fix 1 all meso +fix 1 all sph neighbor ${skin} bin neighbor 0.04 bin @@ -82,8 +84,9 @@ thermo 10 thermo_style custom step time v_vx_sq_check v_vy_sq_check v_vz_sq_check run 200 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 10 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 0.44 ghost atom cutoff = 0.44 @@ -92,55 +95,55 @@ Neighbor list info ... (1) pair sdpd/taitwater/isothermal, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 13.54 | 13.54 | 13.54 Mbytes -Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check - 0 0 0 0 0 - 10 0.005 0.70973271 0.71495693 0.71910087 - 20 0.01 0.90418096 0.88845437 0.89659567 - 30 0.015 0.9590736 0.97880338 0.9619016 - 40 0.02 0.98533774 0.96057682 0.95600448 - 50 0.025 0.96433662 0.96650071 0.95509683 - 60 0.03 0.96598029 0.96373656 0.96734888 - 70 0.035 0.95433045 0.98004764 0.96255924 - 80 0.04 0.97872906 0.95987289 0.96623598 - 90 0.045 0.99913888 0.99255731 0.95616142 - 100 0.05 0.98872675 0.97141018 0.95338841 - 110 0.055 0.97794592 0.97389258 0.98473719 - 120 0.06 0.98389266 0.96716284 0.95504862 - 130 0.065 0.98572886 0.96680923 0.95599065 - 140 0.07 0.97602684 0.97580081 0.9886878 - 150 0.075 0.99172003 0.95027467 0.96028033 - 160 0.08 0.96793247 0.94590928 0.95644301 - 170 0.085 0.94167619 0.98048861 0.93439426 - 180 0.09 0.97277934 0.97383622 0.96900866 - 190 0.095 0.96647288 1.0027643 0.96230782 - 200 0.1 0.94864291 0.95902585 0.96398175 -Loop time of 60.1095 on 1 procs for 200 steps with 8000 atoms +Per MPI rank memory allocation (min/avg/max) = 14.29 | 14.29 | 14.29 Mbytes + Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check + 0 0 0 0 0 + 10 0.005 0.70973271 0.71495693 0.71910087 + 20 0.01 0.90418096 0.88845437 0.89659567 + 30 0.015 0.9590736 0.97880338 0.9619016 + 40 0.02 0.98533774 0.96057682 0.95600448 + 50 0.025 0.96433662 0.96650071 0.95509683 + 60 0.03 0.96598029 0.96373656 0.96734888 + 70 0.035 0.95433045 0.98004764 0.96255924 + 80 0.04 0.97872906 0.95987289 0.96623598 + 90 0.045 0.99913888 0.99255731 0.95616142 + 100 0.05 0.98872675 0.97141018 0.95338841 + 110 0.055 0.97794592 0.97389258 0.98473719 + 120 0.06 0.98389266 0.96716284 0.95504862 + 130 0.065 0.98572886 0.96680923 0.95599065 + 140 0.07 0.97602684 0.97580081 0.9886878 + 150 0.075 0.99172003 0.95027467 0.96028033 + 160 0.08 0.96793247 0.94590928 0.95644301 + 170 0.085 0.94167619 0.98048861 0.93439426 + 180 0.09 0.97277934 0.97383622 0.96900866 + 190 0.095 0.96647288 1.0027643 0.96230782 + 200 0.1 0.94864291 0.95902585 0.96398175 +Loop time of 55.7542 on 1 procs for 200 steps with 8000 atoms -Performance: 143737.595 ns/day, 0.000 hours/ns, 3.327 timesteps/s -99.7% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 154965.922 ns/day, 0.000 hours/ns, 3.587 timesteps/s, 28.697 katom-step/s +99.6% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 59.92 | 59.92 | 59.92 | 0.0 | 99.68 +Pair | 55.642 | 55.642 | 55.642 | 0.0 | 99.80 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.11154 | 0.11154 | 0.11154 | 0.0 | 0.19 -Output | 0.0063498 | 0.0063498 | 0.0063498 | 0.0 | 0.01 -Modify | 0.043546 | 0.043546 | 0.043546 | 0.0 | 0.07 -Other | | 0.02811 | | | 0.05 +Comm | 0.060977 | 0.060977 | 0.060977 | 0.0 | 0.11 +Output | 0.0066393 | 0.0066393 | 0.0066393 | 0.0 | 0.01 +Modify | 0.028354 | 0.028354 | 0.028354 | 0.0 | 0.05 +Other | | 0.01623 | | | 0.03 -Nlocal: 8000 ave 8000 max 8000 min +Nlocal: 8000 ave 8000 max 8000 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 16389 ave 16389 max 16389 min +Nghost: 16389 ave 16389 max 16389 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1.456e+06 ave 1.456e+06 max 1.456e+06 min +Neighs: 1.456e+06 ave 1.456e+06 max 1.456e+06 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 1456000 Ave neighs/atom = 182 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:01:00 +Total wall time: 0:00:56 diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 similarity index 58% rename from examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 rename to examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 index 88509f0fd1..e4f11d305e 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 @@ -1,7 +1,7 @@ -LAMMPS (24 Oct 2018) +LAMMPS (28 Mar 2023 - Development) dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -38,13 +38,15 @@ Lattice spacing in x,y,z = 0.1 0.1 0.1 create_atoms 1 box Created 8000 atoms - Time spent = 0.00252754 secs + using lattice units in orthogonal box = (-1 -1 -1) to (1 1 1) + create_atoms CPU = 0.001 seconds mass * ${mass} mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 8000 settings made for meso/rho +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 8000 settings made for sph/rho pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 @@ -71,7 +73,7 @@ variable vz_sq_check equal c_v_sq[3]*0.001/${kB}/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/300 -fix 1 all meso +fix 1 all sph neighbor ${skin} bin neighbor 0.04 bin @@ -82,8 +84,9 @@ thermo 10 thermo_style custom step time v_vx_sq_check v_vy_sq_check v_vz_sq_check run 200 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 10 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 0.44 ghost atom cutoff = 0.44 @@ -92,55 +95,55 @@ Neighbor list info ... (1) pair sdpd/taitwater/isothermal, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.795 | 5.795 | 5.795 Mbytes -Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check - 0 0 0 0 0 - 10 0.005 0.71224819 0.71470372 0.7008956 - 20 0.01 0.90627589 0.90683966 0.90116506 - 30 0.015 0.938505 0.95884272 0.93337542 - 40 0.02 0.94394649 0.93668038 0.96468004 - 50 0.025 0.97152309 0.97546161 0.95107762 - 60 0.03 0.94710871 0.95678322 0.97285504 - 70 0.035 0.96253148 0.95838642 0.95450883 - 80 0.04 0.97581495 0.95278681 0.95099478 - 90 0.045 0.96251614 0.9740684 0.96081505 - 100 0.05 0.94191275 0.97137523 0.94084858 - 110 0.055 0.953406 0.95739684 0.98574522 - 120 0.06 0.99001614 0.99608287 0.9839996 - 130 0.065 0.96575225 0.94309655 0.92847798 - 140 0.07 0.97642687 0.97458638 0.94696406 - 150 0.075 0.99316381 0.96876814 0.95440106 - 160 0.08 0.94589744 0.95264791 0.95495169 - 170 0.085 0.97599092 0.95336014 0.97687718 - 180 0.09 0.97214242 0.9726305 0.9726035 - 190 0.095 0.97577583 0.96523645 0.9756968 - 200 0.1 0.96386053 0.97268854 0.94582436 -Loop time of 32.5247 on 4 procs for 200 steps with 8000 atoms +Per MPI rank memory allocation (min/avg/max) = 6.172 | 6.172 | 6.172 Mbytes + Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check + 0 0 0 0 0 + 10 0.005 0.71224819 0.71470372 0.7008956 + 20 0.01 0.90627589 0.90683966 0.90116506 + 30 0.015 0.938505 0.95884272 0.93337542 + 40 0.02 0.94394649 0.93668038 0.96468004 + 50 0.025 0.97152309 0.97546161 0.95107762 + 60 0.03 0.94710871 0.95678322 0.97285504 + 70 0.035 0.96253148 0.95838642 0.95450883 + 80 0.04 0.97581495 0.95278681 0.95099478 + 90 0.045 0.96251614 0.9740684 0.96081505 + 100 0.05 0.94191275 0.97137523 0.94084858 + 110 0.055 0.953406 0.95739684 0.98574522 + 120 0.06 0.99001614 0.99608287 0.9839996 + 130 0.065 0.96575225 0.94309655 0.92847798 + 140 0.07 0.97642687 0.97458638 0.94696406 + 150 0.075 0.99316381 0.96876814 0.95440106 + 160 0.08 0.94589744 0.95264791 0.95495169 + 170 0.085 0.97599092 0.95336014 0.97687718 + 180 0.09 0.97214242 0.9726305 0.9726035 + 190 0.095 0.97577583 0.96523645 0.9756968 + 200 0.1 0.96386053 0.97268854 0.94582436 +Loop time of 9.59181 on 4 procs for 200 steps with 8000 atoms -Performance: 265644.515 ns/day, 0.000 hours/ns, 6.149 timesteps/s -73.9% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 900768.333 ns/day, 0.000 hours/ns, 20.851 timesteps/s, 166.809 katom-step/s +98.1% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 27.385 | 28.409 | 28.761 | 11.1 | 87.34 +Pair | 8.9729 | 9.2147 | 9.4383 | 5.5 | 96.07 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 3.582 | 3.9343 | 4.9531 | 29.7 | 12.10 -Output | 0.022267 | 0.026073 | 0.033141 | 2.7 | 0.08 -Modify | 0.031714 | 0.033134 | 0.034367 | 0.6 | 0.10 -Other | | 0.1226 | | | 0.38 +Comm | 0.13739 | 0.36068 | 0.60216 | 27.6 | 3.76 +Output | 0.0022724 | 0.002394 | 0.0026506 | 0.3 | 0.02 +Modify | 0.0068559 | 0.0069926 | 0.0070974 | 0.1 | 0.07 +Other | | 0.007004 | | | 0.07 -Nlocal: 2000 ave 2000 max 2000 min +Nlocal: 2000 ave 2000 max 2000 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 8469 ave 8469 max 8469 min +Nghost: 8469 ave 8469 max 8469 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 364000 ave 376628 max 351184 min +Neighs: 364000 ave 376628 max 351184 min Histogram: 1 0 1 0 0 0 0 1 0 1 Total # of neighbors = 1456000 Ave neighs/atom = 182 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:00:32 +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm b/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm new file mode 120000 index 0000000000..fe5cccfcd2 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm @@ -0,0 +1 @@ +../../../../potentials/COH.aip.water.2dm \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data b/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data new file mode 100644 index 0000000000..7e6d3925f0 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data @@ -0,0 +1,2040 @@ +LAMMPS data file via write_data, version 23 Jun 2022, timestep = 100000 + +936 atoms +3 atom types +96 bonds +1 bond types +48 angles +1 angle types + +0 46.92336 xlo xhi +0 44.331078317370086 ylo yhi +0 200 zlo zhi + +Atoms # full + +1 1 1 0 0 0 0 0 0 0 +2 1 1 0 0.71096 1.231418842149169 0 0 0 0 +3 1 1 0 2.13288 1.231418842149169 0 0 0 0 +4 1 1 0 2.84384 0 0 0 0 0 +5 1 1 0 0 2.462837684298338 0 0 0 0 +6 1 1 0 0.71096 3.694256526447507 0 0 0 0 +7 1 1 0 2.13288 3.694256526447507 0 0 0 0 +8 1 1 0 2.84384 2.462837684298338 0 0 0 0 +9 1 1 0 0 4.925675368596676 0 0 0 0 +10 1 1 0 0.71096 6.157094210745845 0 0 0 0 +11 1 1 0 2.13288 6.157094210745845 0 0 0 0 +12 1 1 0 2.84384 4.925675368596676 0 0 0 0 +13 1 1 0 0 7.388513052895014 0 0 0 0 +14 1 1 0 0.71096 8.619931895044184 0 0 0 0 +15 1 1 0 2.13288 8.619931895044184 0 0 0 0 +16 1 1 0 2.84384 7.388513052895014 0 0 0 0 +17 1 1 0 0 9.851350737193352 0 0 0 0 +20 1 1 0 2.84384 9.851350737193352 0 0 0 0 +73 1 1 0 4.26576 0 0 0 0 0 +74 1 1 0 4.97672 1.231418842149169 0 0 0 0 +77 1 1 0 4.26576 2.462837684298338 0 0 0 0 +78 1 1 0 4.97672 3.694256526447507 0 0 0 0 +81 1 1 0 4.26576 4.925675368596676 0 0 0 0 +82 1 1 0 4.97672 6.157094210745845 0 0 0 0 +85 1 1 0 4.26576 7.388513052895014 0 0 0 0 +86 1 1 0 4.97672 8.619931895044184 0 0 0 0 +89 1 1 0 4.26576 9.851350737193352 0 0 0 0 +18 1 1 0 0.71096 11.082769579342521 0 0 0 0 +19 1 1 0 2.13288 11.082769579342521 0 0 0 0 +21 1 1 0 0 12.31418842149169 0 0 0 0 +22 1 1 0 0.71096 13.545607263640859 0 0 0 0 +23 1 1 0 2.13288 13.545607263640859 0 0 0 0 +24 1 1 0 2.84384 12.31418842149169 0 0 0 0 +25 1 1 0 0 14.777026105790029 0 0 0 0 +26 1 1 0 0.71096 16.008444947939196 0 0 0 0 +27 1 1 0 2.13288 16.008444947939196 0 0 0 0 +28 1 1 0 2.84384 14.777026105790029 0 0 0 0 +29 1 1 0 0 17.239863790088364 0 0 0 0 +30 1 1 0 0.71096 18.471282632237532 0 0 0 0 +31 1 1 0 2.13288 18.471282632237532 0 0 0 0 +32 1 1 0 2.84384 17.239863790088364 0 0 0 0 +33 1 1 0 0 19.702701474386703 0 0 0 0 +34 1 1 0 0.71096 20.93412031653587 0 0 0 0 +35 1 1 0 2.13288 20.93412031653587 0 0 0 0 +36 1 1 0 2.84384 19.702701474386703 0 0 0 0 +90 1 1 0 4.97672 11.082769579342521 0 0 0 0 +93 1 1 0 4.26576 12.31418842149169 0 0 0 0 +94 1 1 0 4.97672 13.545607263640859 0 0 0 0 +97 1 1 0 4.26576 14.777026105790029 0 0 0 0 +98 1 1 0 4.97672 16.008444947939196 0 0 0 0 +101 1 1 0 4.26576 17.239863790088364 0 0 0 0 +102 1 1 0 4.97672 18.471282632237532 0 0 0 0 +105 1 1 0 4.26576 19.702701474386703 0 0 0 0 +106 1 1 0 4.97672 20.93412031653587 0 0 0 0 +37 1 1 0 0 22.165539158685043 0 0 0 0 +38 1 1 0 0.71096 23.39695800083421 0 0 0 0 +39 1 1 0 2.13288 23.39695800083421 0 0 0 0 +40 1 1 0 2.84384 22.165539158685043 0 0 0 0 +41 1 1 0 0 24.62837684298338 0 0 0 0 +42 1 1 0 0.71096 25.859795685132546 0 0 0 0 +43 1 1 0 2.13288 25.859795685132546 0 0 0 0 +44 1 1 0 2.84384 24.62837684298338 0 0 0 0 +45 1 1 0 0 27.091214527281718 0 0 0 0 +46 1 1 0 0.71096 28.322633369430886 0 0 0 0 +47 1 1 0 2.13288 28.322633369430886 0 0 0 0 +48 1 1 0 2.84384 27.091214527281718 0 0 0 0 +49 1 1 0 0 29.554052211580057 0 0 0 0 +50 1 1 0 0.71096 30.785471053729225 0 0 0 0 +51 1 1 0 2.13288 30.785471053729225 0 0 0 0 +52 1 1 0 2.84384 29.554052211580057 0 0 0 0 +53 1 1 0 0 32.01688989587839 0 0 0 0 +56 1 1 0 2.84384 32.01688989587839 0 0 0 0 +109 1 1 0 4.26576 22.165539158685043 0 0 0 0 +110 1 1 0 4.97672 23.39695800083421 0 0 0 0 +113 1 1 0 4.26576 24.62837684298338 0 0 0 0 +114 1 1 0 4.97672 25.859795685132546 0 0 0 0 +117 1 1 0 4.26576 27.091214527281718 0 0 0 0 +118 1 1 0 4.97672 28.322633369430886 0 0 0 0 +121 1 1 0 4.26576 29.554052211580057 0 0 0 0 +122 1 1 0 4.97672 30.785471053729225 0 0 0 0 +125 1 1 0 4.26576 32.01688989587839 0 0 0 0 +54 1 1 0 0.71096 33.24830873802756 0 0 0 0 +55 1 1 0 2.13288 33.24830873802756 0 0 0 0 +57 1 1 0 0 34.47972758017673 0 0 0 0 +58 1 1 0 0.71096 35.711146422325896 0 0 0 0 +59 1 1 0 2.13288 35.711146422325896 0 0 0 0 +60 1 1 0 2.84384 34.47972758017673 0 0 0 0 +61 1 1 0 0 36.94256526447507 0 0 0 0 +62 1 1 0 0.71096 38.17398410662424 0 0 0 0 +63 1 1 0 2.13288 38.17398410662424 0 0 0 0 +64 1 1 0 2.84384 36.94256526447507 0 0 0 0 +65 1 1 0 0 39.40540294877341 0 0 0 0 +66 1 1 0 0.71096 40.636821790922575 0 0 0 0 +67 1 1 0 2.13288 40.636821790922575 0 0 0 0 +68 1 1 0 2.84384 39.40540294877341 0 0 0 0 +69 1 1 0 0 41.86824063307174 0 0 0 0 +70 1 1 0 0.71096 43.09965947522091 0 0 0 0 +71 1 1 0 2.13288 43.09965947522091 0 0 0 0 +72 1 1 0 2.84384 41.86824063307174 0 0 0 0 +126 1 1 0 4.97672 33.24830873802756 0 0 0 0 +129 1 1 0 4.26576 34.47972758017673 0 0 0 0 +130 1 1 0 4.97672 35.711146422325896 0 0 0 0 +133 1 1 0 4.26576 36.94256526447507 0 0 0 0 +134 1 1 0 4.97672 38.17398410662424 0 0 0 0 +137 1 1 0 4.26576 39.40540294877341 0 0 0 0 +138 1 1 0 4.97672 40.636821790922575 0 0 0 0 +141 1 1 0 4.26576 41.86824063307174 0 0 0 0 +142 1 1 0 4.97672 43.09965947522091 0 0 0 0 +75 1 1 0 6.39864 1.231418842149169 0 0 0 0 +76 1 1 0 7.1096 0 0 0 0 0 +79 1 1 0 6.39864 3.694256526447507 0 0 0 0 +80 1 1 0 7.1096 2.462837684298338 0 0 0 0 +83 1 1 0 6.39864 6.157094210745845 0 0 0 0 +84 1 1 0 7.1096 4.925675368596676 0 0 0 0 +87 1 1 0 6.39864 8.619931895044184 0 0 0 0 +88 1 1 0 7.1096 7.388513052895014 0 0 0 0 +92 1 1 0 7.1096 9.851350737193352 0 0 0 0 +145 1 1 0 8.53152 0 0 0 0 0 +146 1 1 0 9.24248 1.231418842149169 0 0 0 0 +147 1 1 0 10.6644 1.231418842149169 0 0 0 0 +148 1 1 0 11.37536 0 0 0 0 0 +149 1 1 0 8.53152 2.462837684298338 0 0 0 0 +150 1 1 0 9.24248 3.694256526447507 0 0 0 0 +151 1 1 0 10.6644 3.694256526447507 0 0 0 0 +152 1 1 0 11.37536 2.462837684298338 0 0 0 0 +153 1 1 0 8.53152 4.925675368596676 0 0 0 0 +154 1 1 0 9.24248 6.157094210745845 0 0 0 0 +155 1 1 0 10.6644 6.157094210745845 0 0 0 0 +156 1 1 0 11.37536 4.925675368596676 0 0 0 0 +157 1 1 0 8.53152 7.388513052895014 0 0 0 0 +158 1 1 0 9.24248 8.619931895044184 0 0 0 0 +159 1 1 0 10.6644 8.619931895044184 0 0 0 0 +160 1 1 0 11.37536 7.388513052895014 0 0 0 0 +161 1 1 0 8.53152 9.851350737193352 0 0 0 0 +164 1 1 0 11.37536 9.851350737193352 0 0 0 0 +91 1 1 0 6.39864 11.082769579342521 0 0 0 0 +95 1 1 0 6.39864 13.545607263640859 0 0 0 0 +96 1 1 0 7.1096 12.31418842149169 0 0 0 0 +99 1 1 0 6.39864 16.008444947939196 0 0 0 0 +100 1 1 0 7.1096 14.777026105790029 0 0 0 0 +103 1 1 0 6.39864 18.471282632237532 0 0 0 0 +104 1 1 0 7.1096 17.239863790088364 0 0 0 0 +107 1 1 0 6.39864 20.93412031653587 0 0 0 0 +108 1 1 0 7.1096 19.702701474386703 0 0 0 0 +162 1 1 0 9.24248 11.082769579342521 0 0 0 0 +163 1 1 0 10.6644 11.082769579342521 0 0 0 0 +165 1 1 0 8.53152 12.31418842149169 0 0 0 0 +166 1 1 0 9.24248 13.545607263640859 0 0 0 0 +167 1 1 0 10.6644 13.545607263640859 0 0 0 0 +168 1 1 0 11.37536 12.31418842149169 0 0 0 0 +169 1 1 0 8.53152 14.777026105790029 0 0 0 0 +170 1 1 0 9.24248 16.008444947939196 0 0 0 0 +171 1 1 0 10.6644 16.008444947939196 0 0 0 0 +172 1 1 0 11.37536 14.777026105790029 0 0 0 0 +173 1 1 0 8.53152 17.239863790088364 0 0 0 0 +174 1 1 0 9.24248 18.471282632237532 0 0 0 0 +175 1 1 0 10.6644 18.471282632237532 0 0 0 0 +176 1 1 0 11.37536 17.239863790088364 0 0 0 0 +177 1 1 0 8.53152 19.702701474386703 0 0 0 0 +178 1 1 0 9.24248 20.93412031653587 0 0 0 0 +179 1 1 0 10.6644 20.93412031653587 0 0 0 0 +180 1 1 0 11.37536 19.702701474386703 0 0 0 0 +111 1 1 0 6.39864 23.39695800083421 0 0 0 0 +112 1 1 0 7.1096 22.165539158685043 0 0 0 0 +115 1 1 0 6.39864 25.859795685132546 0 0 0 0 +116 1 1 0 7.1096 24.62837684298338 0 0 0 0 +119 1 1 0 6.39864 28.322633369430886 0 0 0 0 +120 1 1 0 7.1096 27.091214527281718 0 0 0 0 +123 1 1 0 6.39864 30.785471053729225 0 0 0 0 +124 1 1 0 7.1096 29.554052211580057 0 0 0 0 +128 1 1 0 7.1096 32.01688989587839 0 0 0 0 +181 1 1 0 8.53152 22.165539158685043 0 0 0 0 +182 1 1 0 9.24248 23.39695800083421 0 0 0 0 +183 1 1 0 10.6644 23.39695800083421 0 0 0 0 +184 1 1 0 11.37536 22.165539158685043 0 0 0 0 +185 1 1 0 8.53152 24.62837684298338 0 0 0 0 +186 1 1 0 9.24248 25.859795685132546 0 0 0 0 +187 1 1 0 10.6644 25.859795685132546 0 0 0 0 +188 1 1 0 11.37536 24.62837684298338 0 0 0 0 +189 1 1 0 8.53152 27.091214527281718 0 0 0 0 +190 1 1 0 9.24248 28.322633369430886 0 0 0 0 +191 1 1 0 10.6644 28.322633369430886 0 0 0 0 +192 1 1 0 11.37536 27.091214527281718 0 0 0 0 +193 1 1 0 8.53152 29.554052211580057 0 0 0 0 +194 1 1 0 9.24248 30.785471053729225 0 0 0 0 +195 1 1 0 10.6644 30.785471053729225 0 0 0 0 +196 1 1 0 11.37536 29.554052211580057 0 0 0 0 +197 1 1 0 8.53152 32.01688989587839 0 0 0 0 +200 1 1 0 11.37536 32.01688989587839 0 0 0 0 +127 1 1 0 6.39864 33.24830873802756 0 0 0 0 +131 1 1 0 6.39864 35.711146422325896 0 0 0 0 +132 1 1 0 7.1096 34.47972758017673 0 0 0 0 +135 1 1 0 6.39864 38.17398410662424 0 0 0 0 +136 1 1 0 7.1096 36.94256526447507 0 0 0 0 +139 1 1 0 6.39864 40.636821790922575 0 0 0 0 +140 1 1 0 7.1096 39.40540294877341 0 0 0 0 +143 1 1 0 6.39864 43.09965947522091 0 0 0 0 +144 1 1 0 7.1096 41.86824063307174 0 0 0 0 +198 1 1 0 9.24248 33.24830873802756 0 0 0 0 +199 1 1 0 10.6644 33.24830873802756 0 0 0 0 +201 1 1 0 8.53152 34.47972758017673 0 0 0 0 +202 1 1 0 9.24248 35.711146422325896 0 0 0 0 +203 1 1 0 10.6644 35.711146422325896 0 0 0 0 +204 1 1 0 11.37536 34.47972758017673 0 0 0 0 +205 1 1 0 8.53152 36.94256526447507 0 0 0 0 +206 1 1 0 9.24248 38.17398410662424 0 0 0 0 +207 1 1 0 10.6644 38.17398410662424 0 0 0 0 +208 1 1 0 11.37536 36.94256526447507 0 0 0 0 +209 1 1 0 8.53152 39.40540294877341 0 0 0 0 +210 1 1 0 9.24248 40.636821790922575 0 0 0 0 +211 1 1 0 10.6644 40.636821790922575 0 0 0 0 +212 1 1 0 11.37536 39.40540294877341 0 0 0 0 +213 1 1 0 8.53152 41.86824063307174 0 0 0 0 +214 1 1 0 9.24248 43.09965947522091 0 0 0 0 +215 1 1 0 10.6644 43.09965947522091 0 0 0 0 +216 1 1 0 11.37536 41.86824063307174 0 0 0 0 +217 1 1 0 12.79728 0 0 0 0 0 +218 1 1 0 13.50824 1.231418842149169 0 0 0 0 +219 1 1 0 14.93016 1.231418842149169 0 0 0 0 +220 1 1 0 15.64112 0 0 0 0 0 +221 1 1 0 12.79728 2.462837684298338 0 0 0 0 +222 1 1 0 13.50824 3.694256526447507 0 0 0 0 +223 1 1 0 14.93016 3.694256526447507 0 0 0 0 +224 1 1 0 15.64112 2.462837684298338 0 0 0 0 +225 1 1 0 12.79728 4.925675368596676 0 0 0 0 +226 1 1 0 13.50824 6.157094210745845 0 0 0 0 +227 1 1 0 14.93016 6.157094210745845 0 0 0 0 +228 1 1 0 15.64112 4.925675368596676 0 0 0 0 +229 1 1 0 12.79728 7.388513052895014 0 0 0 0 +230 1 1 0 13.50824 8.619931895044184 0 0 0 0 +231 1 1 0 14.93016 8.619931895044184 0 0 0 0 +232 1 1 0 15.64112 7.388513052895014 0 0 0 0 +233 1 1 0 12.79728 9.851350737193352 0 0 0 0 +236 1 1 0 15.64112 9.851350737193352 0 0 0 0 +289 1 1 0 17.06304 0 0 0 0 0 +293 1 1 0 17.06304 2.462837684298338 0 0 0 0 +297 1 1 0 17.06304 4.925675368596676 0 0 0 0 +301 1 1 0 17.06304 7.388513052895014 0 0 0 0 +305 1 1 0 17.06304 9.851350737193352 0 0 0 0 +234 1 1 0 13.50824 11.082769579342521 0 0 0 0 +235 1 1 0 14.93016 11.082769579342521 0 0 0 0 +237 1 1 0 12.79728 12.31418842149169 0 0 0 0 +238 1 1 0 13.50824 13.545607263640859 0 0 0 0 +239 1 1 0 14.93016 13.545607263640859 0 0 0 0 +240 1 1 0 15.64112 12.31418842149169 0 0 0 0 +241 1 1 0 12.79728 14.777026105790029 0 0 0 0 +242 1 1 0 13.50824 16.008444947939196 0 0 0 0 +243 1 1 0 14.93016 16.008444947939196 0 0 0 0 +244 1 1 0 15.64112 14.777026105790029 0 0 0 0 +245 1 1 0 12.79728 17.239863790088364 0 0 0 0 +246 1 1 0 13.50824 18.471282632237532 0 0 0 0 +247 1 1 0 14.93016 18.471282632237532 0 0 0 0 +248 1 1 0 15.64112 17.239863790088364 0 0 0 0 +249 1 1 0 12.79728 19.702701474386703 0 0 0 0 +250 1 1 0 13.50824 20.93412031653587 0 0 0 0 +251 1 1 0 14.93016 20.93412031653587 0 0 0 0 +252 1 1 0 15.64112 19.702701474386703 0 0 0 0 +309 1 1 0 17.06304 12.31418842149169 0 0 0 0 +313 1 1 0 17.06304 14.777026105790029 0 0 0 0 +317 1 1 0 17.06304 17.239863790088364 0 0 0 0 +321 1 1 0 17.06304 19.702701474386703 0 0 0 0 +253 1 1 0 12.79728 22.165539158685043 0 0 0 0 +254 1 1 0 13.50824 23.39695800083421 0 0 0 0 +255 1 1 0 14.93016 23.39695800083421 0 0 0 0 +256 1 1 0 15.64112 22.165539158685043 0 0 0 0 +257 1 1 0 12.79728 24.62837684298338 0 0 0 0 +258 1 1 0 13.50824 25.859795685132546 0 0 0 0 +259 1 1 0 14.93016 25.859795685132546 0 0 0 0 +260 1 1 0 15.64112 24.62837684298338 0 0 0 0 +261 1 1 0 12.79728 27.091214527281718 0 0 0 0 +262 1 1 0 13.50824 28.322633369430886 0 0 0 0 +263 1 1 0 14.93016 28.322633369430886 0 0 0 0 +264 1 1 0 15.64112 27.091214527281718 0 0 0 0 +265 1 1 0 12.79728 29.554052211580057 0 0 0 0 +266 1 1 0 13.50824 30.785471053729225 0 0 0 0 +267 1 1 0 14.93016 30.785471053729225 0 0 0 0 +268 1 1 0 15.64112 29.554052211580057 0 0 0 0 +269 1 1 0 12.79728 32.01688989587839 0 0 0 0 +272 1 1 0 15.64112 32.01688989587839 0 0 0 0 +325 1 1 0 17.06304 22.165539158685043 0 0 0 0 +329 1 1 0 17.06304 24.62837684298338 0 0 0 0 +333 1 1 0 17.06304 27.091214527281718 0 0 0 0 +337 1 1 0 17.06304 29.554052211580057 0 0 0 0 +341 1 1 0 17.06304 32.01688989587839 0 0 0 0 +270 1 1 0 13.50824 33.24830873802756 0 0 0 0 +271 1 1 0 14.93016 33.24830873802756 0 0 0 0 +273 1 1 0 12.79728 34.47972758017673 0 0 0 0 +274 1 1 0 13.50824 35.711146422325896 0 0 0 0 +275 1 1 0 14.93016 35.711146422325896 0 0 0 0 +276 1 1 0 15.64112 34.47972758017673 0 0 0 0 +277 1 1 0 12.79728 36.94256526447507 0 0 0 0 +278 1 1 0 13.50824 38.17398410662424 0 0 0 0 +279 1 1 0 14.93016 38.17398410662424 0 0 0 0 +280 1 1 0 15.64112 36.94256526447507 0 0 0 0 +281 1 1 0 12.79728 39.40540294877341 0 0 0 0 +282 1 1 0 13.50824 40.636821790922575 0 0 0 0 +283 1 1 0 14.93016 40.636821790922575 0 0 0 0 +284 1 1 0 15.64112 39.40540294877341 0 0 0 0 +285 1 1 0 12.79728 41.86824063307174 0 0 0 0 +286 1 1 0 13.50824 43.09965947522091 0 0 0 0 +287 1 1 0 14.93016 43.09965947522091 0 0 0 0 +288 1 1 0 15.64112 41.86824063307174 0 0 0 0 +345 1 1 0 17.06304 34.47972758017673 0 0 0 0 +349 1 1 0 17.06304 36.94256526447507 0 0 0 0 +353 1 1 0 17.06304 39.40540294877341 0 0 0 0 +357 1 1 0 17.06304 41.86824063307174 0 0 0 0 +290 1 1 0 17.774 1.231418842149169 0 0 0 0 +291 1 1 0 19.19592 1.231418842149169 0 0 0 0 +292 1 1 0 19.90688 0 0 0 0 0 +294 1 1 0 17.774 3.694256526447507 0 0 0 0 +295 1 1 0 19.19592 3.694256526447507 0 0 0 0 +296 1 1 0 19.90688 2.462837684298338 0 0 0 0 +298 1 1 0 17.774 6.157094210745845 0 0 0 0 +299 1 1 0 19.19592 6.157094210745845 0 0 0 0 +300 1 1 0 19.90688 4.925675368596676 0 0 0 0 +302 1 1 0 17.774 8.619931895044184 0 0 0 0 +303 1 1 0 19.19592 8.619931895044184 0 0 0 0 +304 1 1 0 19.90688 7.388513052895014 0 0 0 0 +308 1 1 0 19.90688 9.851350737193352 0 0 0 0 +361 1 1 0 21.3288 0 0 0 0 0 +362 1 1 0 22.03976 1.231418842149169 0 0 0 0 +365 1 1 0 21.3288 2.462837684298338 0 0 0 0 +366 1 1 0 22.03976 3.694256526447507 0 0 0 0 +369 1 1 0 21.3288 4.925675368596676 0 0 0 0 +370 1 1 0 22.03976 6.157094210745845 0 0 0 0 +373 1 1 0 21.3288 7.388513052895014 0 0 0 0 +374 1 1 0 22.03976 8.619931895044184 0 0 0 0 +377 1 1 0 21.3288 9.851350737193352 0 0 0 0 +306 1 1 0 17.774 11.082769579342521 0 0 0 0 +307 1 1 0 19.19592 11.082769579342521 0 0 0 0 +310 1 1 0 17.774 13.545607263640859 0 0 0 0 +311 1 1 0 19.19592 13.545607263640859 0 0 0 0 +312 1 1 0 19.90688 12.31418842149169 0 0 0 0 +314 1 1 0 17.774 16.008444947939196 0 0 0 0 +315 1 1 0 19.19592 16.008444947939196 0 0 0 0 +316 1 1 0 19.90688 14.777026105790029 0 0 0 0 +318 1 1 0 17.774 18.471282632237532 0 0 0 0 +319 1 1 0 19.19592 18.471282632237532 0 0 0 0 +320 1 1 0 19.90688 17.239863790088364 0 0 0 0 +322 1 1 0 17.774 20.93412031653587 0 0 0 0 +323 1 1 0 19.19592 20.93412031653587 0 0 0 0 +324 1 1 0 19.90688 19.702701474386703 0 0 0 0 +378 1 1 0 22.03976 11.082769579342521 0 0 0 0 +381 1 1 0 21.3288 12.31418842149169 0 0 0 0 +382 1 1 0 22.03976 13.545607263640859 0 0 0 0 +385 1 1 0 21.3288 14.777026105790029 0 0 0 0 +386 1 1 0 22.03976 16.008444947939196 0 0 0 0 +389 1 1 0 21.3288 17.239863790088364 0 0 0 0 +390 1 1 0 22.03976 18.471282632237532 0 0 0 0 +393 1 1 0 21.3288 19.702701474386703 0 0 0 0 +394 1 1 0 22.03976 20.93412031653587 0 0 0 0 +326 1 1 0 17.774 23.39695800083421 0 0 0 0 +327 1 1 0 19.19592 23.39695800083421 0 0 0 0 +328 1 1 0 19.90688 22.165539158685043 0 0 0 0 +330 1 1 0 17.774 25.859795685132546 0 0 0 0 +331 1 1 0 19.19592 25.859795685132546 0 0 0 0 +332 1 1 0 19.90688 24.62837684298338 0 0 0 0 +334 1 1 0 17.774 28.322633369430886 0 0 0 0 +335 1 1 0 19.19592 28.322633369430886 0 0 0 0 +336 1 1 0 19.90688 27.091214527281718 0 0 0 0 +338 1 1 0 17.774 30.785471053729225 0 0 0 0 +339 1 1 0 19.19592 30.785471053729225 0 0 0 0 +340 1 1 0 19.90688 29.554052211580057 0 0 0 0 +344 1 1 0 19.90688 32.01688989587839 0 0 0 0 +397 1 1 0 21.3288 22.165539158685043 0 0 0 0 +398 1 1 0 22.03976 23.39695800083421 0 0 0 0 +401 1 1 0 21.3288 24.62837684298338 0 0 0 0 +402 1 1 0 22.03976 25.859795685132546 0 0 0 0 +405 1 1 0 21.3288 27.091214527281718 0 0 0 0 +406 1 1 0 22.03976 28.322633369430886 0 0 0 0 +409 1 1 0 21.3288 29.554052211580057 0 0 0 0 +410 1 1 0 22.03976 30.785471053729225 0 0 0 0 +413 1 1 0 21.3288 32.01688989587839 0 0 0 0 +342 1 1 0 17.774 33.24830873802756 0 0 0 0 +343 1 1 0 19.19592 33.24830873802756 0 0 0 0 +346 1 1 0 17.774 35.711146422325896 0 0 0 0 +347 1 1 0 19.19592 35.711146422325896 0 0 0 0 +348 1 1 0 19.90688 34.47972758017673 0 0 0 0 +350 1 1 0 17.774 38.17398410662424 0 0 0 0 +351 1 1 0 19.19592 38.17398410662424 0 0 0 0 +352 1 1 0 19.90688 36.94256526447507 0 0 0 0 +354 1 1 0 17.774 40.636821790922575 0 0 0 0 +355 1 1 0 19.19592 40.636821790922575 0 0 0 0 +356 1 1 0 19.90688 39.40540294877341 0 0 0 0 +358 1 1 0 17.774 43.09965947522091 0 0 0 0 +359 1 1 0 19.19592 43.09965947522091 0 0 0 0 +360 1 1 0 19.90688 41.86824063307174 0 0 0 0 +414 1 1 0 22.03976 33.24830873802756 0 0 0 0 +417 1 1 0 21.3288 34.47972758017673 0 0 0 0 +418 1 1 0 22.03976 35.711146422325896 0 0 0 0 +421 1 1 0 21.3288 36.94256526447507 0 0 0 0 +422 1 1 0 22.03976 38.17398410662424 0 0 0 0 +425 1 1 0 21.3288 39.40540294877341 0 0 0 0 +426 1 1 0 22.03976 40.636821790922575 0 0 0 0 +429 1 1 0 21.3288 41.86824063307174 0 0 0 0 +430 1 1 0 22.03976 43.09965947522091 0 0 0 0 +363 1 1 0 23.46168 1.231418842149169 0 0 0 0 +364 1 1 0 24.17264 0 0 0 0 0 +367 1 1 0 23.46168 3.694256526447507 0 0 0 0 +368 1 1 0 24.17264 2.462837684298338 0 0 0 0 +371 1 1 0 23.46168 6.157094210745845 0 0 0 0 +372 1 1 0 24.17264 4.925675368596676 0 0 0 0 +375 1 1 0 23.46168 8.619931895044184 0 0 0 0 +376 1 1 0 24.17264 7.388513052895014 0 0 0 0 +380 1 1 0 24.17264 9.851350737193352 0 0 0 0 +433 1 1 0 25.59456 0 0 0 0 0 +434 1 1 0 26.30552 1.231418842149169 0 0 0 0 +435 1 1 0 27.72744 1.231418842149169 0 0 0 0 +436 1 1 0 28.4384 0 0 0 0 0 +437 1 1 0 25.59456 2.462837684298338 0 0 0 0 +438 1 1 0 26.30552 3.694256526447507 0 0 0 0 +439 1 1 0 27.72744 3.694256526447507 0 0 0 0 +440 1 1 0 28.4384 2.462837684298338 0 0 0 0 +441 1 1 0 25.59456 4.925675368596676 0 0 0 0 +442 1 1 0 26.30552 6.157094210745845 0 0 0 0 +443 1 1 0 27.72744 6.157094210745845 0 0 0 0 +444 1 1 0 28.4384 4.925675368596676 0 0 0 0 +445 1 1 0 25.59456 7.388513052895014 0 0 0 0 +446 1 1 0 26.30552 8.619931895044184 0 0 0 0 +447 1 1 0 27.72744 8.619931895044184 0 0 0 0 +448 1 1 0 28.4384 7.388513052895014 0 0 0 0 +449 1 1 0 25.59456 9.851350737193352 0 0 0 0 +452 1 1 0 28.4384 9.851350737193352 0 0 0 0 +824 2 3 0.5564 27.869304504728962 5.441231954072771 7.1662725516060455 0 1 0 +882 2 3 0.5564 28.591049353698207 2.8104183869168513 5.199459350263634 0 1 0 +915 2 3 0.5564 28.292441133424674 2.1988836940092424 7.463258849755662 0 1 0 +839 2 3 0.5564 26.910290112042958 6.063448035194025 5.063585745298239 0 1 0 +880 2 2 -1.1128 28.406942326033935 2.7991510311135688 4.260199050138843 0 1 0 +897 2 3 0.5564 27.747536325556545 1.2206385238286348 3.5735630764050397 0 1 0 +881 2 3 0.5564 29.245437925664305 3.008615335710485 3.848759968343325 0 1 0 +840 2 3 0.5564 27.732306784723644 4.9179177154124885 4.512269230492448 0 1 0 +823 2 2 -1.1128 27.744982568298607 4.921082089542739 7.960138430480629 0 1 0 +825 2 3 0.5564 28.164684169862443 5.433634827582471 8.651059816127074 0 1 0 +838 2 2 -1.1128 27.618723311223718 5.461577610249769 5.291862125144689 0 1 0 +918 2 3 0.5564 29.02685745449238 0.37211643590853727 5.955025086554165 0 1 0 +895 2 2 -1.1128 27.54700508575224 0.3218588761159764 3.312383533998835 0 1 0 +913 2 2 -1.1128 28.964145363419156 1.767681453892013 6.93494944041131 0 1 0 +896 2 3 0.5564 26.73803217297322 0.39396829884754553 2.8058305738430946 0 1 0 +379 1 1 0 23.46168 11.082769579342521 0 0 0 0 +383 1 1 0 23.46168 13.545607263640859 0 0 0 0 +384 1 1 0 24.17264 12.31418842149169 0 0 0 0 +387 1 1 0 23.46168 16.008444947939196 0 0 0 0 +388 1 1 0 24.17264 14.777026105790029 0 0 0 0 +391 1 1 0 23.46168 18.471282632237532 0 0 0 0 +392 1 1 0 24.17264 17.239863790088364 0 0 0 0 +395 1 1 0 23.46168 20.93412031653587 0 0 0 0 +396 1 1 0 24.17264 19.702701474386703 0 0 0 0 +450 1 1 0 26.30552 11.082769579342521 0 0 0 0 +451 1 1 0 27.72744 11.082769579342521 0 0 0 0 +453 1 1 0 25.59456 12.31418842149169 0 0 0 0 +454 1 1 0 26.30552 13.545607263640859 0 0 0 0 +455 1 1 0 27.72744 13.545607263640859 0 0 0 0 +456 1 1 0 28.4384 12.31418842149169 0 0 0 0 +457 1 1 0 25.59456 14.777026105790029 0 0 0 0 +458 1 1 0 26.30552 16.008444947939196 0 0 0 0 +459 1 1 0 27.72744 16.008444947939196 0 0 0 0 +460 1 1 0 28.4384 14.777026105790029 0 0 0 0 +461 1 1 0 25.59456 17.239863790088364 0 0 0 0 +462 1 1 0 26.30552 18.471282632237532 0 0 0 0 +463 1 1 0 27.72744 18.471282632237532 0 0 0 0 +464 1 1 0 28.4384 17.239863790088364 0 0 0 0 +465 1 1 0 25.59456 19.702701474386703 0 0 0 0 +466 1 1 0 26.30552 20.93412031653587 0 0 0 0 +467 1 1 0 27.72744 20.93412031653587 0 0 0 0 +468 1 1 0 28.4384 19.702701474386703 0 0 0 0 +399 1 1 0 23.46168 23.39695800083421 0 0 0 0 +400 1 1 0 24.17264 22.165539158685043 0 0 0 0 +403 1 1 0 23.46168 25.859795685132546 0 0 0 0 +404 1 1 0 24.17264 24.62837684298338 0 0 0 0 +407 1 1 0 23.46168 28.322633369430886 0 0 0 0 +408 1 1 0 24.17264 27.091214527281718 0 0 0 0 +411 1 1 0 23.46168 30.785471053729225 0 0 0 0 +412 1 1 0 24.17264 29.554052211580057 0 0 0 0 +416 1 1 0 24.17264 32.01688989587839 0 0 0 0 +469 1 1 0 25.59456 22.165539158685043 0 0 0 0 +470 1 1 0 26.30552 23.39695800083421 0 0 0 0 +471 1 1 0 27.72744 23.39695800083421 0 0 0 0 +472 1 1 0 28.4384 22.165539158685043 0 0 0 0 +473 1 1 0 25.59456 24.62837684298338 0 0 0 0 +474 1 1 0 26.30552 25.859795685132546 0 0 0 0 +475 1 1 0 27.72744 25.859795685132546 0 0 0 0 +476 1 1 0 28.4384 24.62837684298338 0 0 0 0 +477 1 1 0 25.59456 27.091214527281718 0 0 0 0 +478 1 1 0 26.30552 28.322633369430886 0 0 0 0 +479 1 1 0 27.72744 28.322633369430886 0 0 0 0 +480 1 1 0 28.4384 27.091214527281718 0 0 0 0 +481 1 1 0 25.59456 29.554052211580057 0 0 0 0 +482 1 1 0 26.30552 30.785471053729225 0 0 0 0 +483 1 1 0 27.72744 30.785471053729225 0 0 0 0 +484 1 1 0 28.4384 29.554052211580057 0 0 0 0 +485 1 1 0 25.59456 32.01688989587839 0 0 0 0 +488 1 1 0 28.4384 32.01688989587839 0 0 0 0 +415 1 1 0 23.46168 33.24830873802756 0 0 0 0 +419 1 1 0 23.46168 35.711146422325896 0 0 0 0 +420 1 1 0 24.17264 34.47972758017673 0 0 0 0 +423 1 1 0 23.46168 38.17398410662424 0 0 0 0 +424 1 1 0 24.17264 36.94256526447507 0 0 0 0 +427 1 1 0 23.46168 40.636821790922575 0 0 0 0 +428 1 1 0 24.17264 39.40540294877341 0 0 0 0 +431 1 1 0 23.46168 43.09965947522091 0 0 0 0 +432 1 1 0 24.17264 41.86824063307174 0 0 0 0 +486 1 1 0 26.30552 33.24830873802756 0 0 0 0 +487 1 1 0 27.72744 33.24830873802756 0 0 0 0 +489 1 1 0 25.59456 34.47972758017673 0 0 0 0 +490 1 1 0 26.30552 35.711146422325896 0 0 0 0 +491 1 1 0 27.72744 35.711146422325896 0 0 0 0 +492 1 1 0 28.4384 34.47972758017673 0 0 0 0 +493 1 1 0 25.59456 36.94256526447507 0 0 0 0 +494 1 1 0 26.30552 38.17398410662424 0 0 0 0 +495 1 1 0 27.72744 38.17398410662424 0 0 0 0 +496 1 1 0 28.4384 36.94256526447507 0 0 0 0 +497 1 1 0 25.59456 39.40540294877341 0 0 0 0 +498 1 1 0 26.30552 40.636821790922575 0 0 0 0 +499 1 1 0 27.72744 40.636821790922575 0 0 0 0 +500 1 1 0 28.4384 39.40540294877341 0 0 0 0 +501 1 1 0 25.59456 41.86824063307174 0 0 0 0 +502 1 1 0 26.30552 43.09965947522091 0 0 0 0 +503 1 1 0 27.72744 43.09965947522091 0 0 0 0 +504 1 1 0 28.4384 41.86824063307174 0 0 0 0 +916 2 2 -1.1128 29.08618298573557 43.94947838758336 5.367978087245454 0 0 0 +917 2 3 0.5564 28.386514599822995 44.08700021343198 4.729397955617813 0 0 0 +505 1 1 0 29.86032 0 0 0 0 0 +506 1 1 0 30.57128 1.231418842149169 0 0 0 0 +507 1 1 0 31.9932 1.231418842149169 0 0 0 0 +508 1 1 0 32.70416 0 0 0 0 0 +509 1 1 0 29.86032 2.462837684298338 0 0 0 0 +510 1 1 0 30.57128 3.694256526447507 0 0 0 0 +511 1 1 0 31.9932 3.694256526447507 0 0 0 0 +512 1 1 0 32.70416 2.462837684298338 0 0 0 0 +513 1 1 0 29.86032 4.925675368596676 0 0 0 0 +514 1 1 0 30.57128 6.157094210745845 0 0 0 0 +515 1 1 0 31.9932 6.157094210745845 0 0 0 0 +516 1 1 0 32.70416 4.925675368596676 0 0 0 0 +517 1 1 0 29.86032 7.388513052895014 0 0 0 0 +518 1 1 0 30.57128 8.619931895044184 0 0 0 0 +519 1 1 0 31.9932 8.619931895044184 0 0 0 0 +520 1 1 0 32.70416 7.388513052895014 0 0 0 0 +521 1 1 0 29.86032 9.851350737193352 0 0 0 0 +524 1 1 0 32.70416 9.851350737193352 0 0 0 0 +577 1 1 0 34.12608 0 0 0 0 0 +578 1 1 0 34.83704 1.231418842149169 0 0 0 0 +581 1 1 0 34.12608 2.462837684298338 0 0 0 0 +582 1 1 0 34.83704 3.694256526447507 0 0 0 0 +585 1 1 0 34.12608 4.925675368596676 0 0 0 0 +586 1 1 0 34.83704 6.157094210745845 0 0 0 0 +589 1 1 0 34.12608 7.388513052895014 0 0 0 0 +590 1 1 0 34.83704 8.619931895044184 0 0 0 0 +593 1 1 0 34.12608 9.851350737193352 0 0 0 0 +817 2 2 -1.1128 32.95909328018726 1.6637108808053531 5.668801991409098 0 1 0 +934 2 2 -1.1128 33.03662922860542 5.539750355496759 3.4106598806856026 0 1 0 +844 2 2 -1.1128 32.621956673723574 8.462510491174692 3.097685137766835 0 1 0 +865 2 2 -1.1128 33.39821533005053 4.27658110246568 8.57211051291085 0 1 0 +926 2 3 0.5564 34.92704311330822 0.3845425638438278 3.265292528280904 0 1 0 +936 2 3 0.5564 33.75132011550044 5.390752767402144 2.7915877722683704 0 1 0 +845 2 3 0.5564 32.95333393700144 7.6062659773288255 3.3683635070864155 0 1 0 +819 2 3 0.5564 32.7762889404034 1.1154582070700432 4.905758051766679 0 1 0 +884 2 3 0.5564 34.37559715270682 2.4504450164493186 4.161687719751862 0 1 0 +928 2 2 -1.1128 31.427550994207557 2.4943780016602988 7.958560374626963 0 1 0 +832 2 2 -1.1128 30.792128585762608 3.236529264630232 3.148554951507026 0 1 0 +866 2 3 0.5564 33.498279431301086 5.15245480897742 8.94502756132422 0 1 0 +879 2 3 0.5564 31.732225644992504 0.6458474538482556 8.445047264076692 0 1 0 +929 2 3 0.5564 31.77966866913706 2.4458814443480152 7.069800530214144 0 1 0 +935 2 3 0.5564 33.378544384335676 5.232733920405251 4.250343211939568 0 1 0 +909 2 3 0.5564 34.652364031673926 9.711776039203794 3.0913066271420564 0 1 0 +846 2 3 0.5564 31.81206671515871 8.574696009442315 3.595405469907686 0 1 0 +867 2 3 0.5564 34.29090448110653 3.9354082288573955 8.517893415156758 0 1 0 +914 2 3 0.5564 29.77283350609241 1.883495478021958 7.433793196056744 0 1 0 +818 2 3 0.5564 33.45847517590033 1.097384085601532 6.25712553579729 0 1 0 +793 2 2 -1.1128 31.42830690864691 0.30749748676379024 3.451602894838017 0 1 0 +833 2 3 0.5564 31.524189385665945 3.8525231665567263 3.17806031753671 0 1 0 +834 2 3 0.5564 31.198864521440843 2.3888322887806708 2.969088763806106 0 1 0 +930 2 3 0.5564 31.832512681924495 3.2758254964154077 8.334829251422462 0 1 0 +883 2 2 -1.1128 35.06386221461597 2.1652239249670107 3.56071142612891 0 1 0 +794 2 3 0.5564 31.07805011932854 0.1628051877054162 2.572616093573198 0 1 0 +795 2 3 0.5564 30.711778331953756 0.06543858818245951 4.038311517945166 0 1 0 +522 1 1 0 30.57128 11.082769579342521 0 0 0 0 +523 1 1 0 31.9932 11.082769579342521 0 0 0 0 +525 1 1 0 29.86032 12.31418842149169 0 0 0 0 +526 1 1 0 30.57128 13.545607263640859 0 0 0 0 +527 1 1 0 31.9932 13.545607263640859 0 0 0 0 +528 1 1 0 32.70416 12.31418842149169 0 0 0 0 +529 1 1 0 29.86032 14.777026105790029 0 0 0 0 +530 1 1 0 30.57128 16.008444947939196 0 0 0 0 +531 1 1 0 31.9932 16.008444947939196 0 0 0 0 +532 1 1 0 32.70416 14.777026105790029 0 0 0 0 +533 1 1 0 29.86032 17.239863790088364 0 0 0 0 +534 1 1 0 30.57128 18.471282632237532 0 0 0 0 +535 1 1 0 31.9932 18.471282632237532 0 0 0 0 +536 1 1 0 32.70416 17.239863790088364 0 0 0 0 +537 1 1 0 29.86032 19.702701474386703 0 0 0 0 +538 1 1 0 30.57128 20.93412031653587 0 0 0 0 +539 1 1 0 31.9932 20.93412031653587 0 0 0 0 +540 1 1 0 32.70416 19.702701474386703 0 0 0 0 +594 1 1 0 34.83704 11.082769579342521 0 0 0 0 +597 1 1 0 34.12608 12.31418842149169 0 0 0 0 +598 1 1 0 34.83704 13.545607263640859 0 0 0 0 +601 1 1 0 34.12608 14.777026105790029 0 0 0 0 +602 1 1 0 34.83704 16.008444947939196 0 0 0 0 +605 1 1 0 34.12608 17.239863790088364 0 0 0 0 +606 1 1 0 34.83704 18.471282632237532 0 0 0 0 +609 1 1 0 34.12608 19.702701474386703 0 0 0 0 +610 1 1 0 34.83704 20.93412031653587 0 0 0 0 +541 1 1 0 29.86032 22.165539158685043 0 0 0 0 +542 1 1 0 30.57128 23.39695800083421 0 0 0 0 +543 1 1 0 31.9932 23.39695800083421 0 0 0 0 +544 1 1 0 32.70416 22.165539158685043 0 0 0 0 +545 1 1 0 29.86032 24.62837684298338 0 0 0 0 +546 1 1 0 30.57128 25.859795685132546 0 0 0 0 +547 1 1 0 31.9932 25.859795685132546 0 0 0 0 +548 1 1 0 32.70416 24.62837684298338 0 0 0 0 +549 1 1 0 29.86032 27.091214527281718 0 0 0 0 +550 1 1 0 30.57128 28.322633369430886 0 0 0 0 +551 1 1 0 31.9932 28.322633369430886 0 0 0 0 +552 1 1 0 32.70416 27.091214527281718 0 0 0 0 +553 1 1 0 29.86032 29.554052211580057 0 0 0 0 +554 1 1 0 30.57128 30.785471053729225 0 0 0 0 +555 1 1 0 31.9932 30.785471053729225 0 0 0 0 +556 1 1 0 32.70416 29.554052211580057 0 0 0 0 +557 1 1 0 29.86032 32.01688989587839 0 0 0 0 +560 1 1 0 32.70416 32.01688989587839 0 0 0 0 +613 1 1 0 34.12608 22.165539158685043 0 0 0 0 +614 1 1 0 34.83704 23.39695800083421 0 0 0 0 +617 1 1 0 34.12608 24.62837684298338 0 0 0 0 +618 1 1 0 34.83704 25.859795685132546 0 0 0 0 +621 1 1 0 34.12608 27.091214527281718 0 0 0 0 +622 1 1 0 34.83704 28.322633369430886 0 0 0 0 +625 1 1 0 34.12608 29.554052211580057 0 0 0 0 +626 1 1 0 34.83704 30.785471053729225 0 0 0 0 +629 1 1 0 34.12608 32.01688989587839 0 0 0 0 +558 1 1 0 30.57128 33.24830873802756 0 0 0 0 +559 1 1 0 31.9932 33.24830873802756 0 0 0 0 +561 1 1 0 29.86032 34.47972758017673 0 0 0 0 +562 1 1 0 30.57128 35.711146422325896 0 0 0 0 +563 1 1 0 31.9932 35.711146422325896 0 0 0 0 +564 1 1 0 32.70416 34.47972758017673 0 0 0 0 +565 1 1 0 29.86032 36.94256526447507 0 0 0 0 +566 1 1 0 30.57128 38.17398410662424 0 0 0 0 +567 1 1 0 31.9932 38.17398410662424 0 0 0 0 +568 1 1 0 32.70416 36.94256526447507 0 0 0 0 +569 1 1 0 29.86032 39.40540294877341 0 0 0 0 +570 1 1 0 30.57128 40.636821790922575 0 0 0 0 +571 1 1 0 31.9932 40.636821790922575 0 0 0 0 +572 1 1 0 32.70416 39.40540294877341 0 0 0 0 +573 1 1 0 29.86032 41.86824063307174 0 0 0 0 +574 1 1 0 30.57128 43.09965947522091 0 0 0 0 +575 1 1 0 31.9932 43.09965947522091 0 0 0 0 +576 1 1 0 32.70416 41.86824063307174 0 0 0 0 +630 1 1 0 34.83704 33.24830873802756 0 0 0 0 +633 1 1 0 34.12608 34.47972758017673 0 0 0 0 +634 1 1 0 34.83704 35.711146422325896 0 0 0 0 +637 1 1 0 34.12608 36.94256526447507 0 0 0 0 +638 1 1 0 34.83704 38.17398410662424 0 0 0 0 +641 1 1 0 34.12608 39.40540294877341 0 0 0 0 +642 1 1 0 34.83704 40.636821790922575 0 0 0 0 +645 1 1 0 34.12608 41.86824063307174 0 0 0 0 +646 1 1 0 34.83704 43.09965947522091 0 0 0 0 +857 2 3 0.5564 31.280093348563454 40.92413736707893 6.6129915041108855 0 0 0 +856 2 2 -1.1128 31.40625202155322 40.21708321945418 7.245756851263454 0 0 0 +892 2 2 -1.1128 31.44124789790012 42.595258440016934 5.939207128004798 0 0 0 +893 2 3 0.5564 31.51332483392942 42.86716514991827 6.854141078427132 0 0 0 +886 2 2 -1.1128 34.01903467331608 42.21640858508662 5.249166944042416 0 0 0 +828 2 3 0.5564 32.936087243922984 39.01715292261755 6.258330984602254 0 0 0 +887 2 3 0.5564 33.06416149038681 42.23692223473913 5.31266208454256 0 0 0 +826 2 2 -1.1128 33.39528676861921 38.50985593645892 5.588989616608882 0 0 0 +827 2 3 0.5564 32.73225698170465 37.911697838992474 5.244270601582248 0 0 0 +894 2 3 0.5564 30.602363734473947 42.95262718865609 5.648014222802151 0 0 0 +925 2 2 -1.1128 34.84802945499661 43.76986891444704 3.140612646843307 0 0 0 +858 2 3 0.5564 30.675738345874993 40.309216087673825 7.857389270234698 0 0 0 +878 2 3 0.5564 32.99974881977633 44.200178456643876 8.15878411943684 0 0 0 +812 2 3 0.5564 34.62910581051034 43.605123868773425 6.411277828859756 0 0 0 +927 2 3 0.5564 34.27329532640793 43.48151669199635 3.849673061844464 0 0 0 +888 2 3 0.5564 34.21818732626533 41.3445338672516 4.907982839354571 0 0 0 +877 2 2 -1.1128 32.10811143071273 44.09784681673461 8.491565398531655 0 0 0 +835 2 2 -1.1128 35.185759286779124 40.039097016824876 3.8999166884707246 0 0 0 +811 2 2 -1.1128 34.72988962100261 44.30600404203223 7.05535990375944 0 0 0 +837 2 3 0.5564 34.873780058275806 39.29804634363621 4.419289163091052 0 0 0 +579 1 1 0 36.25896 1.231418842149169 0 0 0 0 +580 1 1 0 36.96992 0 0 0 0 0 +583 1 1 0 36.25896 3.694256526447507 0 0 0 0 +584 1 1 0 36.96992 2.462837684298338 0 0 0 0 +587 1 1 0 36.25896 6.157094210745845 0 0 0 0 +588 1 1 0 36.96992 4.925675368596676 0 0 0 0 +591 1 1 0 36.25896 8.619931895044184 0 0 0 0 +592 1 1 0 36.96992 7.388513052895014 0 0 0 0 +596 1 1 0 36.96992 9.851350737193352 0 0 0 0 +649 1 1 0 38.39184 0 0 0 0 0 +650 1 1 0 39.1028 1.231418842149169 0 0 0 0 +651 1 1 0 40.52472 1.231418842149169 0 0 0 0 +653 1 1 0 38.39184 2.462837684298338 0 0 0 0 +654 1 1 0 39.1028 3.694256526447507 0 0 0 0 +655 1 1 0 40.52472 3.694256526447507 0 0 0 0 +657 1 1 0 38.39184 4.925675368596676 0 0 0 0 +658 1 1 0 39.1028 6.157094210745845 0 0 0 0 +659 1 1 0 40.52472 6.157094210745845 0 0 0 0 +661 1 1 0 38.39184 7.388513052895014 0 0 0 0 +662 1 1 0 39.1028 8.619931895044184 0 0 0 0 +663 1 1 0 40.52472 8.619931895044184 0 0 0 0 +665 1 1 0 38.39184 9.851350737193352 0 0 0 0 +864 2 3 0.5564 38.72559977454883 6.453140217896254 3.9654022350817373 0 1 0 +885 2 3 0.5564 35.86457499683829 2.187926621046695 4.084712133041518 0 1 0 +891 2 3 0.5564 36.49290196320123 4.5825554857830815 2.340280303271688 0 1 0 +905 2 3 0.5564 35.6539726734068 6.533533581961909 4.2226103514317215 0 1 0 +847 2 2 -1.1128 38.31073636731568 9.297637163461909 3.018631746447206 0 1 0 +807 2 3 0.5564 39.93839438218238 3.380787594401584 8.070189977397536 0 1 0 +842 2 3 0.5564 40.4439801215969 3.4539357982168974 5.874913654515922 0 1 0 +806 2 3 0.5564 39.53388614087088 1.9224662216249124 8.030602383511098 0 1 0 +841 2 2 -1.1128 40.346631074078815 3.161275558289171 4.968764399811248 0 1 0 +848 2 3 0.5564 37.378243475312125 9.509492777618444 2.9761304825701878 0 1 0 +805 2 2 -1.1128 39.1879363509718 2.799773990143194 8.194559951043354 0 1 0 +862 2 2 -1.1128 39.527254402566676 6.871055409294266 3.6508699018474053 0 1 0 +808 2 2 -1.1128 40.9813125028353 6.491622655244695 6.1252186603712815 0 1 0 +863 2 3 0.5564 39.2982209112595 7.796620838566813 3.566577577839523 0 1 0 +906 2 3 0.5564 35.63016556188961 6.980217848903836 5.668916912294608 0 1 0 +803 2 3 0.5564 37.21046144155504 3.3547056748419672 8.44685444624274 0 1 0 +820 2 2 -1.1128 40.238058884519425 8.892908109209923 7.228256282347458 0 1 0 +813 2 3 0.5564 35.66411242895095 0.1828007460118728 7.039625445693748 0 1 0 +830 2 3 0.5564 37.461900361164744 5.761054225296827 7.339683551589981 0 1 0 +809 2 3 0.5564 40.143388183992 6.666539751684856 5.6968272273146985 0 1 0 +849 2 3 0.5564 38.545146461582334 9.064870760768706 2.1202418370825424 0 1 0 +814 2 2 -1.1128 40.748134171936435 0.7389880780512781 3.3949349561238815 0 1 0 +816 2 3 0.5564 40.34138668782936 1.5417691543993164 3.7210197692903493 0 1 0 +933 2 3 0.5564 38.42845468599284 3.199245505203782 4.980786350179616 0 1 0 +932 2 3 0.5564 37.36968971559904 3.309266240641299 6.057265875709786 0 1 0 +802 2 2 -1.1128 36.25679030038503 3.29601481677218 8.38941777770298 0 1 0 +931 2 2 -1.1128 37.542384613917065 2.9133905650069245 5.203046413341369 0 1 0 +907 2 2 -1.1128 35.578884551020806 9.573590646940167 3.2880229990945917 0 1 0 +831 2 3 0.5564 36.268287811817636 4.832138094401851 7.27407174097549 0 1 0 +804 2 3 0.5564 36.035479013673445 2.501960846901915 8.875969191698895 0 1 0 +904 2 2 -1.1128 35.40021179318659 7.265609687237741 4.784662067802107 0 1 0 +829 2 2 -1.1128 36.67463142628169 5.575159558617119 6.8279361567305 0 1 0 +890 2 3 0.5564 35.51445085753465 3.6096863189422184 2.96322151266684 0 1 0 +919 2 2 -1.1128 40.013239321978745 0.15668706717705305 7.440776242049551 0 1 0 +908 2 3 0.5564 35.58368296090604 8.875183376627756 3.9425735956748125 0 1 0 +800 2 3 0.5564 37.74677816296982 0.734680968209546 5.402507033516551 0 1 0 +859 2 2 -1.1128 40.622879392981964 10.272720036648469 4.720042613666213 0 1 0 +861 2 3 0.5564 39.78296055209543 10.382230179324548 4.274198380882334 0 1 0 +889 2 2 -1.1128 35.68276124895589 4.5449882413929235 2.8487022953494807 0 1 0 +860 2 3 0.5564 40.42792864795578 9.700111278266009 5.461896012943214 0 1 0 +822 2 3 0.5564 40.522133068490525 8.019471778966093 6.958729128356608 0 1 0 +821 2 3 0.5564 40.47731496825091 8.948235047845442 8.153419981025246 0 1 0 +595 1 1 0 36.25896 11.082769579342521 0 0 0 0 +599 1 1 0 36.25896 13.545607263640859 0 0 0 0 +600 1 1 0 36.96992 12.31418842149169 0 0 0 0 +603 1 1 0 36.25896 16.008444947939196 0 0 0 0 +604 1 1 0 36.96992 14.777026105790029 0 0 0 0 +607 1 1 0 36.25896 18.471282632237532 0 0 0 0 +608 1 1 0 36.96992 17.239863790088364 0 0 0 0 +611 1 1 0 36.25896 20.93412031653587 0 0 0 0 +612 1 1 0 36.96992 19.702701474386703 0 0 0 0 +666 1 1 0 39.1028 11.082769579342521 0 0 0 0 +667 1 1 0 40.52472 11.082769579342521 0 0 0 0 +669 1 1 0 38.39184 12.31418842149169 0 0 0 0 +670 1 1 0 39.1028 13.545607263640859 0 0 0 0 +671 1 1 0 40.52472 13.545607263640859 0 0 0 0 +673 1 1 0 38.39184 14.777026105790029 0 0 0 0 +674 1 1 0 39.1028 16.008444947939196 0 0 0 0 +675 1 1 0 40.52472 16.008444947939196 0 0 0 0 +677 1 1 0 38.39184 17.239863790088364 0 0 0 0 +678 1 1 0 39.1028 18.471282632237532 0 0 0 0 +679 1 1 0 40.52472 18.471282632237532 0 0 0 0 +681 1 1 0 38.39184 19.702701474386703 0 0 0 0 +682 1 1 0 39.1028 20.93412031653587 0 0 0 0 +683 1 1 0 40.52472 20.93412031653587 0 0 0 0 +615 1 1 0 36.25896 23.39695800083421 0 0 0 0 +616 1 1 0 36.96992 22.165539158685043 0 0 0 0 +619 1 1 0 36.25896 25.859795685132546 0 0 0 0 +620 1 1 0 36.96992 24.62837684298338 0 0 0 0 +623 1 1 0 36.25896 28.322633369430886 0 0 0 0 +624 1 1 0 36.96992 27.091214527281718 0 0 0 0 +627 1 1 0 36.25896 30.785471053729225 0 0 0 0 +628 1 1 0 36.96992 29.554052211580057 0 0 0 0 +632 1 1 0 36.96992 32.01688989587839 0 0 0 0 +685 1 1 0 38.39184 22.165539158685043 0 0 0 0 +686 1 1 0 39.1028 23.39695800083421 0 0 0 0 +687 1 1 0 40.52472 23.39695800083421 0 0 0 0 +689 1 1 0 38.39184 24.62837684298338 0 0 0 0 +690 1 1 0 39.1028 25.859795685132546 0 0 0 0 +691 1 1 0 40.52472 25.859795685132546 0 0 0 0 +693 1 1 0 38.39184 27.091214527281718 0 0 0 0 +694 1 1 0 39.1028 28.322633369430886 0 0 0 0 +695 1 1 0 40.52472 28.322633369430886 0 0 0 0 +697 1 1 0 38.39184 29.554052211580057 0 0 0 0 +698 1 1 0 39.1028 30.785471053729225 0 0 0 0 +699 1 1 0 40.52472 30.785471053729225 0 0 0 0 +701 1 1 0 38.39184 32.01688989587839 0 0 0 0 +631 1 1 0 36.25896 33.24830873802756 0 0 0 0 +635 1 1 0 36.25896 35.711146422325896 0 0 0 0 +636 1 1 0 36.96992 34.47972758017673 0 0 0 0 +639 1 1 0 36.25896 38.17398410662424 0 0 0 0 +640 1 1 0 36.96992 36.94256526447507 0 0 0 0 +643 1 1 0 36.25896 40.636821790922575 0 0 0 0 +644 1 1 0 36.96992 39.40540294877341 0 0 0 0 +647 1 1 0 36.25896 43.09965947522091 0 0 0 0 +648 1 1 0 36.96992 41.86824063307174 0 0 0 0 +702 1 1 0 39.1028 33.24830873802756 0 0 0 0 +703 1 1 0 40.52472 33.24830873802756 0 0 0 0 +705 1 1 0 38.39184 34.47972758017673 0 0 0 0 +706 1 1 0 39.1028 35.711146422325896 0 0 0 0 +707 1 1 0 40.52472 35.711146422325896 0 0 0 0 +709 1 1 0 38.39184 36.94256526447507 0 0 0 0 +710 1 1 0 39.1028 38.17398410662424 0 0 0 0 +711 1 1 0 40.52472 38.17398410662424 0 0 0 0 +713 1 1 0 38.39184 39.40540294877341 0 0 0 0 +714 1 1 0 39.1028 40.636821790922575 0 0 0 0 +715 1 1 0 40.52472 40.636821790922575 0 0 0 0 +717 1 1 0 38.39184 41.86824063307174 0 0 0 0 +718 1 1 0 39.1028 43.09965947522091 0 0 0 0 +719 1 1 0 40.52472 43.09965947522091 0 0 0 0 +801 2 3 0.5564 37.548308436970686 43.56537533039196 5.365704432988823 0 0 0 +852 2 3 0.5564 38.88919502047367 42.042424135970684 3.6087789454249384 0 0 0 +876 2 3 0.5564 36.695468476045846 41.81307318973102 4.654847654027673 0 0 0 +851 2 3 0.5564 39.88056712847529 43.079060421379005 3.124565190962247 0 0 0 +836 2 3 0.5564 35.55710562397264 39.6409654643291 3.11262603757073 0 0 0 +874 2 2 -1.1128 37.156592548770114 42.42602324299549 4.082231251420106 0 0 0 +875 2 3 0.5564 36.4628015962606 42.8541504174728 3.580640511788261 0 0 0 +850 2 2 -1.1128 39.74740412124872 42.13377480969944 3.1948153248505924 0 0 0 +920 2 3 0.5564 40.541519697736526 43.81546496276574 7.010468244614621 0 0 0 +921 2 3 0.5564 39.11034070400223 44.265151888276336 7.21395020009192 0 0 0 +799 2 2 -1.1128 37.54782393045426 44.314597322511524 5.9614390867350435 0 0 0 +652 1 1 0 41.23568 0 0 0 0 0 +656 1 1 0 41.23568 2.462837684298338 0 0 0 0 +660 1 1 0 41.23568 4.925675368596676 0 0 0 0 +664 1 1 0 41.23568 7.388513052895014 0 0 0 0 +668 1 1 0 41.23568 9.851350737193352 0 0 0 0 +721 1 1 0 42.6576 0 0 0 0 0 +722 1 1 0 43.36856 1.231418842149169 0 0 0 0 +723 1 1 0 44.79048 1.231418842149169 0 0 0 0 +724 1 1 0 45.50144 0 0 0 0 0 +725 1 1 0 42.6576 2.462837684298338 0 0 0 0 +726 1 1 0 43.36856 3.694256526447507 0 0 0 0 +727 1 1 0 44.79048 3.694256526447507 0 0 0 0 +728 1 1 0 45.50144 2.462837684298338 0 0 0 0 +729 1 1 0 42.6576 4.925675368596676 0 0 0 0 +730 1 1 0 43.36856 6.157094210745845 0 0 0 0 +731 1 1 0 44.79048 6.157094210745845 0 0 0 0 +732 1 1 0 45.50144 4.925675368596676 0 0 0 0 +733 1 1 0 42.6576 7.388513052895014 0 0 0 0 +734 1 1 0 43.36856 8.619931895044184 0 0 0 0 +735 1 1 0 44.79048 8.619931895044184 0 0 0 0 +736 1 1 0 45.50144 7.388513052895014 0 0 0 0 +737 1 1 0 42.6576 9.851350737193352 0 0 0 0 +740 1 1 0 45.50144 9.851350737193352 0 0 0 0 +855 2 3 0.5564 42.60570890502672 6.754108104519662 3.2778996089299444 0 1 0 +853 2 2 -1.1128 42.099480757637274 5.9504482420758835 3.3966273472818673 0 1 0 +924 2 3 0.5564 42.55717296882286 9.17260477834803 2.5938337966266043 0 1 0 +796 2 2 -1.1128 42.77023484300884 3.2473201847921502 3.212925112248156 0 1 0 +902 2 3 0.5564 42.12839423169956 3.7289140838154062 7.1537282390574495 0 1 0 +903 2 3 0.5564 41.53585251071065 5.1118011663682905 7.322300070785221 0 1 0 +898 2 2 -1.1128 45.445001196506084 2.452551396966245 3.028403472579563 0 1 0 +797 2 3 0.5564 42.58443206962962 4.186306057729107 3.2089115332453373 0 1 0 +798 2 3 0.5564 43.71048122279908 3.189455512069421 3.38269391940839 0 1 0 +810 2 3 0.5564 41.63040595115056 6.5777864583716426 5.427015401612798 0 1 0 +854 2 3 0.5564 41.20236665318539 6.25112336337136 3.5415926908824034 0 1 0 +923 2 3 0.5564 42.32247135813611 9.521352146245636 4.048203548805301 0 1 0 +922 2 2 -1.1128 42.80519254575484 8.918478791891543 3.4827315727519106 0 1 0 +900 2 3 0.5564 45.15285956979833 1.5485234956341212 3.145105564354613 0 1 0 +899 2 3 0.5564 46.07339231136837 2.4105339689072443 2.3075759749099993 0 1 0 +901 2 2 -1.1128 41.44718299707816 4.208196261290198 7.625398774411962 0 1 0 +815 2 3 0.5564 41.32793113560261 1.0321378043039096 2.6919903566852 0 1 0 +843 2 3 0.5564 41.07940607864339 3.567038821973523 4.505483562010162 0 1 0 +672 1 1 0 41.23568 12.31418842149169 0 0 0 0 +676 1 1 0 41.23568 14.777026105790029 0 0 0 0 +680 1 1 0 41.23568 17.239863790088364 0 0 0 0 +684 1 1 0 41.23568 19.702701474386703 0 0 0 0 +738 1 1 0 43.36856 11.082769579342521 0 0 0 0 +739 1 1 0 44.79048 11.082769579342521 0 0 0 0 +741 1 1 0 42.6576 12.31418842149169 0 0 0 0 +742 1 1 0 43.36856 13.545607263640859 0 0 0 0 +743 1 1 0 44.79048 13.545607263640859 0 0 0 0 +744 1 1 0 45.50144 12.31418842149169 0 0 0 0 +745 1 1 0 42.6576 14.777026105790029 0 0 0 0 +746 1 1 0 43.36856 16.008444947939196 0 0 0 0 +747 1 1 0 44.79048 16.008444947939196 0 0 0 0 +748 1 1 0 45.50144 14.777026105790029 0 0 0 0 +749 1 1 0 42.6576 17.239863790088364 0 0 0 0 +750 1 1 0 43.36856 18.471282632237532 0 0 0 0 +751 1 1 0 44.79048 18.471282632237532 0 0 0 0 +752 1 1 0 45.50144 17.239863790088364 0 0 0 0 +753 1 1 0 42.6576 19.702701474386703 0 0 0 0 +754 1 1 0 43.36856 20.93412031653587 0 0 0 0 +755 1 1 0 44.79048 20.93412031653587 0 0 0 0 +756 1 1 0 45.50144 19.702701474386703 0 0 0 0 +688 1 1 0 41.23568 22.165539158685043 0 0 0 0 +692 1 1 0 41.23568 24.62837684298338 0 0 0 0 +696 1 1 0 41.23568 27.091214527281718 0 0 0 0 +700 1 1 0 41.23568 29.554052211580057 0 0 0 0 +704 1 1 0 41.23568 32.01688989587839 0 0 0 0 +757 1 1 0 42.6576 22.165539158685043 0 0 0 0 +758 1 1 0 43.36856 23.39695800083421 0 0 0 0 +759 1 1 0 44.79048 23.39695800083421 0 0 0 0 +760 1 1 0 45.50144 22.165539158685043 0 0 0 0 +761 1 1 0 42.6576 24.62837684298338 0 0 0 0 +762 1 1 0 43.36856 25.859795685132546 0 0 0 0 +763 1 1 0 44.79048 25.859795685132546 0 0 0 0 +764 1 1 0 45.50144 24.62837684298338 0 0 0 0 +765 1 1 0 42.6576 27.091214527281718 0 0 0 0 +766 1 1 0 43.36856 28.322633369430886 0 0 0 0 +767 1 1 0 44.79048 28.322633369430886 0 0 0 0 +768 1 1 0 45.50144 27.091214527281718 0 0 0 0 +769 1 1 0 42.6576 29.554052211580057 0 0 0 0 +770 1 1 0 43.36856 30.785471053729225 0 0 0 0 +771 1 1 0 44.79048 30.785471053729225 0 0 0 0 +772 1 1 0 45.50144 29.554052211580057 0 0 0 0 +773 1 1 0 42.6576 32.01688989587839 0 0 0 0 +776 1 1 0 45.50144 32.01688989587839 0 0 0 0 +708 1 1 0 41.23568 34.47972758017673 0 0 0 0 +712 1 1 0 41.23568 36.94256526447507 0 0 0 0 +716 1 1 0 41.23568 39.40540294877341 0 0 0 0 +720 1 1 0 41.23568 41.86824063307174 0 0 0 0 +774 1 1 0 43.36856 33.24830873802756 0 0 0 0 +775 1 1 0 44.79048 33.24830873802756 0 0 0 0 +777 1 1 0 42.6576 34.47972758017673 0 0 0 0 +778 1 1 0 43.36856 35.711146422325896 0 0 0 0 +779 1 1 0 44.79048 35.711146422325896 0 0 0 0 +780 1 1 0 45.50144 34.47972758017673 0 0 0 0 +781 1 1 0 42.6576 36.94256526447507 0 0 0 0 +782 1 1 0 43.36856 38.17398410662424 0 0 0 0 +783 1 1 0 44.79048 38.17398410662424 0 0 0 0 +784 1 1 0 45.50144 36.94256526447507 0 0 0 0 +785 1 1 0 42.6576 39.40540294877341 0 0 0 0 +786 1 1 0 43.36856 40.636821790922575 0 0 0 0 +787 1 1 0 44.79048 40.636821790922575 0 0 0 0 +788 1 1 0 45.50144 39.40540294877341 0 0 0 0 +789 1 1 0 42.6576 41.86824063307174 0 0 0 0 +790 1 1 0 43.36856 43.09965947522091 0 0 0 0 +791 1 1 0 44.79048 43.09965947522091 0 0 0 0 +792 1 1 0 45.50144 41.86824063307174 0 0 0 0 +871 2 2 -1.1128 42.43621342090696 41.361777660606826 3.5286311215230155 0 0 0 +910 2 2 -1.1128 44.00261269418429 44.009231456650014 3.7548439135777425 0 0 0 +873 2 3 0.5564 42.81116163142683 40.8806399438352 2.7909638607684895 0 0 0 +912 2 3 0.5564 44.01512081357764 43.199784996149646 3.244083663427368 0 0 0 +872 2 3 0.5564 41.50534987825062 41.436128256982094 3.318397554899502 0 0 0 +869 2 3 0.5564 41.92696097428322 42.44540495044042 4.918533220471727 0 0 0 +868 2 2 -1.1128 41.602312218152235 43.15319449082845 5.475195560073079 0 0 0 +870 2 3 0.5564 41.17840173459901 43.7603473856229 4.8686487491511015 0 0 0 +911 2 3 0.5564 43.2397024819597 43.9207537163753 4.326134358669964 0 0 0 + +Velocities + +1 0 0 0 +2 0 0 0 +3 0 0 0 +4 0 0 0 +5 0 0 0 +6 0 0 0 +7 0 0 0 +8 0 0 0 +9 0 0 0 +10 0 0 0 +11 0 0 0 +12 0 0 0 +13 0 0 0 +14 0 0 0 +15 0 0 0 +16 0 0 0 +17 0 0 0 +20 0 0 0 +73 0 0 0 +74 0 0 0 +77 0 0 0 +78 0 0 0 +81 0 0 0 +82 0 0 0 +85 0 0 0 +86 0 0 0 +89 0 0 0 +18 0 0 0 +19 0 0 0 +21 0 0 0 +22 0 0 0 +23 0 0 0 +24 0 0 0 +25 0 0 0 +26 0 0 0 +27 0 0 0 +28 0 0 0 +29 0 0 0 +30 0 0 0 +31 0 0 0 +32 0 0 0 +33 0 0 0 +34 0 0 0 +35 0 0 0 +36 0 0 0 +90 0 0 0 +93 0 0 0 +94 0 0 0 +97 0 0 0 +98 0 0 0 +101 0 0 0 +102 0 0 0 +105 0 0 0 +106 0 0 0 +37 0 0 0 +38 0 0 0 +39 0 0 0 +40 0 0 0 +41 0 0 0 +42 0 0 0 +43 0 0 0 +44 0 0 0 +45 0 0 0 +46 0 0 0 +47 0 0 0 +48 0 0 0 +49 0 0 0 +50 0 0 0 +51 0 0 0 +52 0 0 0 +53 0 0 0 +56 0 0 0 +109 0 0 0 +110 0 0 0 +113 0 0 0 +114 0 0 0 +117 0 0 0 +118 0 0 0 +121 0 0 0 +122 0 0 0 +125 0 0 0 +54 0 0 0 +55 0 0 0 +57 0 0 0 +58 0 0 0 +59 0 0 0 +60 0 0 0 +61 0 0 0 +62 0 0 0 +63 0 0 0 +64 0 0 0 +65 0 0 0 +66 0 0 0 +67 0 0 0 +68 0 0 0 +69 0 0 0 +70 0 0 0 +71 0 0 0 +72 0 0 0 +126 0 0 0 +129 0 0 0 +130 0 0 0 +133 0 0 0 +134 0 0 0 +137 0 0 0 +138 0 0 0 +141 0 0 0 +142 0 0 0 +75 0 0 0 +76 0 0 0 +79 0 0 0 +80 0 0 0 +83 0 0 0 +84 0 0 0 +87 0 0 0 +88 0 0 0 +92 0 0 0 +145 0 0 0 +146 0 0 0 +147 0 0 0 +148 0 0 0 +149 0 0 0 +150 0 0 0 +151 0 0 0 +152 0 0 0 +153 0 0 0 +154 0 0 0 +155 0 0 0 +156 0 0 0 +157 0 0 0 +158 0 0 0 +159 0 0 0 +160 0 0 0 +161 0 0 0 +164 0 0 0 +91 0 0 0 +95 0 0 0 +96 0 0 0 +99 0 0 0 +100 0 0 0 +103 0 0 0 +104 0 0 0 +107 0 0 0 +108 0 0 0 +162 0 0 0 +163 0 0 0 +165 0 0 0 +166 0 0 0 +167 0 0 0 +168 0 0 0 +169 0 0 0 +170 0 0 0 +171 0 0 0 +172 0 0 0 +173 0 0 0 +174 0 0 0 +175 0 0 0 +176 0 0 0 +177 0 0 0 +178 0 0 0 +179 0 0 0 +180 0 0 0 +111 0 0 0 +112 0 0 0 +115 0 0 0 +116 0 0 0 +119 0 0 0 +120 0 0 0 +123 0 0 0 +124 0 0 0 +128 0 0 0 +181 0 0 0 +182 0 0 0 +183 0 0 0 +184 0 0 0 +185 0 0 0 +186 0 0 0 +187 0 0 0 +188 0 0 0 +189 0 0 0 +190 0 0 0 +191 0 0 0 +192 0 0 0 +193 0 0 0 +194 0 0 0 +195 0 0 0 +196 0 0 0 +197 0 0 0 +200 0 0 0 +127 0 0 0 +131 0 0 0 +132 0 0 0 +135 0 0 0 +136 0 0 0 +139 0 0 0 +140 0 0 0 +143 0 0 0 +144 0 0 0 +198 0 0 0 +199 0 0 0 +201 0 0 0 +202 0 0 0 +203 0 0 0 +204 0 0 0 +205 0 0 0 +206 0 0 0 +207 0 0 0 +208 0 0 0 +209 0 0 0 +210 0 0 0 +211 0 0 0 +212 0 0 0 +213 0 0 0 +214 0 0 0 +215 0 0 0 +216 0 0 0 +217 0 0 0 +218 0 0 0 +219 0 0 0 +220 0 0 0 +221 0 0 0 +222 0 0 0 +223 0 0 0 +224 0 0 0 +225 0 0 0 +226 0 0 0 +227 0 0 0 +228 0 0 0 +229 0 0 0 +230 0 0 0 +231 0 0 0 +232 0 0 0 +233 0 0 0 +236 0 0 0 +289 0 0 0 +293 0 0 0 +297 0 0 0 +301 0 0 0 +305 0 0 0 +234 0 0 0 +235 0 0 0 +237 0 0 0 +238 0 0 0 +239 0 0 0 +240 0 0 0 +241 0 0 0 +242 0 0 0 +243 0 0 0 +244 0 0 0 +245 0 0 0 +246 0 0 0 +247 0 0 0 +248 0 0 0 +249 0 0 0 +250 0 0 0 +251 0 0 0 +252 0 0 0 +309 0 0 0 +313 0 0 0 +317 0 0 0 +321 0 0 0 +253 0 0 0 +254 0 0 0 +255 0 0 0 +256 0 0 0 +257 0 0 0 +258 0 0 0 +259 0 0 0 +260 0 0 0 +261 0 0 0 +262 0 0 0 +263 0 0 0 +264 0 0 0 +265 0 0 0 +266 0 0 0 +267 0 0 0 +268 0 0 0 +269 0 0 0 +272 0 0 0 +325 0 0 0 +329 0 0 0 +333 0 0 0 +337 0 0 0 +341 0 0 0 +270 0 0 0 +271 0 0 0 +273 0 0 0 +274 0 0 0 +275 0 0 0 +276 0 0 0 +277 0 0 0 +278 0 0 0 +279 0 0 0 +280 0 0 0 +281 0 0 0 +282 0 0 0 +283 0 0 0 +284 0 0 0 +285 0 0 0 +286 0 0 0 +287 0 0 0 +288 0 0 0 +345 0 0 0 +349 0 0 0 +353 0 0 0 +357 0 0 0 +290 0 0 0 +291 0 0 0 +292 0 0 0 +294 0 0 0 +295 0 0 0 +296 0 0 0 +298 0 0 0 +299 0 0 0 +300 0 0 0 +302 0 0 0 +303 0 0 0 +304 0 0 0 +308 0 0 0 +361 0 0 0 +362 0 0 0 +365 0 0 0 +366 0 0 0 +369 0 0 0 +370 0 0 0 +373 0 0 0 +374 0 0 0 +377 0 0 0 +306 0 0 0 +307 0 0 0 +310 0 0 0 +311 0 0 0 +312 0 0 0 +314 0 0 0 +315 0 0 0 +316 0 0 0 +318 0 0 0 +319 0 0 0 +320 0 0 0 +322 0 0 0 +323 0 0 0 +324 0 0 0 +378 0 0 0 +381 0 0 0 +382 0 0 0 +385 0 0 0 +386 0 0 0 +389 0 0 0 +390 0 0 0 +393 0 0 0 +394 0 0 0 +326 0 0 0 +327 0 0 0 +328 0 0 0 +330 0 0 0 +331 0 0 0 +332 0 0 0 +334 0 0 0 +335 0 0 0 +336 0 0 0 +338 0 0 0 +339 0 0 0 +340 0 0 0 +344 0 0 0 +397 0 0 0 +398 0 0 0 +401 0 0 0 +402 0 0 0 +405 0 0 0 +406 0 0 0 +409 0 0 0 +410 0 0 0 +413 0 0 0 +342 0 0 0 +343 0 0 0 +346 0 0 0 +347 0 0 0 +348 0 0 0 +350 0 0 0 +351 0 0 0 +352 0 0 0 +354 0 0 0 +355 0 0 0 +356 0 0 0 +358 0 0 0 +359 0 0 0 +360 0 0 0 +414 0 0 0 +417 0 0 0 +418 0 0 0 +421 0 0 0 +422 0 0 0 +425 0 0 0 +426 0 0 0 +429 0 0 0 +430 0 0 0 +363 0 0 0 +364 0 0 0 +367 0 0 0 +368 0 0 0 +371 0 0 0 +372 0 0 0 +375 0 0 0 +376 0 0 0 +380 0 0 0 +433 0 0 0 +434 0 0 0 +435 0 0 0 +436 0 0 0 +437 0 0 0 +438 0 0 0 +439 0 0 0 +440 0 0 0 +441 0 0 0 +442 0 0 0 +443 0 0 0 +444 0 0 0 +445 0 0 0 +446 0 0 0 +447 0 0 0 +448 0 0 0 +449 0 0 0 +452 0 0 0 +824 23.28678663838591 -19.695178733121715 -4.712860628654516 +882 -7.0610581976405244 16.44204311186104 -4.175586130223243 +915 5.458359862786789 12.338077912032869 3.646984172142374 +839 20.392115541402525 21.839207526251702 -29.285410530315588 +880 -1.6972489953530285 5.884325737897911 -5.109687018230828 +897 -0.5612899831289091 6.907522350424367 -17.06603259626599 +881 -3.29469084908246 18.230178486719424 -2.0874433657999796 +840 0.3491624797675958 -9.4770564186721 5.993889540912456 +823 -2.4113508906287486 0.7060826232690176 4.591531586272169 +825 -9.503739029582237 10.088287372649603 1.9260324522526424 +838 -4.206308232163817 2.7689815350821445 -3.2345774478153677 +918 5.963097489077942 -5.811799881204121 -1.1246744751170932 +895 -3.6065546286281265 3.360807936038344 -2.5135837850671177 +913 -3.9429603880542876 -3.803003714965937 4.88513733901858 +896 7.160890299407335 0.32762830929124437 -20.137386051219497 +379 0 0 0 +383 0 0 0 +384 0 0 0 +387 0 0 0 +388 0 0 0 +391 0 0 0 +392 0 0 0 +395 0 0 0 +396 0 0 0 +450 0 0 0 +451 0 0 0 +453 0 0 0 +454 0 0 0 +455 0 0 0 +456 0 0 0 +457 0 0 0 +458 0 0 0 +459 0 0 0 +460 0 0 0 +461 0 0 0 +462 0 0 0 +463 0 0 0 +464 0 0 0 +465 0 0 0 +466 0 0 0 +467 0 0 0 +468 0 0 0 +399 0 0 0 +400 0 0 0 +403 0 0 0 +404 0 0 0 +407 0 0 0 +408 0 0 0 +411 0 0 0 +412 0 0 0 +416 0 0 0 +469 0 0 0 +470 0 0 0 +471 0 0 0 +472 0 0 0 +473 0 0 0 +474 0 0 0 +475 0 0 0 +476 0 0 0 +477 0 0 0 +478 0 0 0 +479 0 0 0 +480 0 0 0 +481 0 0 0 +482 0 0 0 +483 0 0 0 +484 0 0 0 +485 0 0 0 +488 0 0 0 +415 0 0 0 +419 0 0 0 +420 0 0 0 +423 0 0 0 +424 0 0 0 +427 0 0 0 +428 0 0 0 +431 0 0 0 +432 0 0 0 +486 0 0 0 +487 0 0 0 +489 0 0 0 +490 0 0 0 +491 0 0 0 +492 0 0 0 +493 0 0 0 +494 0 0 0 +495 0 0 0 +496 0 0 0 +497 0 0 0 +498 0 0 0 +499 0 0 0 +500 0 0 0 +501 0 0 0 +502 0 0 0 +503 0 0 0 +504 0 0 0 +916 2.1969507203442245 -1.4352986791463374 -7.127919603909629 +917 11.826235663356204 14.279824537641929 -14.280083496635585 +505 0 0 0 +506 0 0 0 +507 0 0 0 +508 0 0 0 +509 0 0 0 +510 0 0 0 +511 0 0 0 +512 0 0 0 +513 0 0 0 +514 0 0 0 +515 0 0 0 +516 0 0 0 +517 0 0 0 +518 0 0 0 +519 0 0 0 +520 0 0 0 +521 0 0 0 +524 0 0 0 +577 0 0 0 +578 0 0 0 +581 0 0 0 +582 0 0 0 +585 0 0 0 +586 0 0 0 +589 0 0 0 +590 0 0 0 +593 0 0 0 +817 1.6133973243890818 0.09544910649802017 -2.82837163408008 +934 -0.7137103646976727 -3.722196372187516 0.848848803609948 +844 -1.412310995403245 2.5213507567859863 -4.599202803630543 +865 8.862935798755592 -1.7466754230232333 -1.6569510007225825 +926 -4.119692818575567 8.294228711700969 -32.74811918647688 +936 -15.928953261034998 -9.92364110983116 -15.23435729552565 +845 -7.482059146842958 -2.336334839582908 -12.584395592557943 +819 19.704188351794787 13.480076284531094 -16.836845023051307 +884 -5.8411676590434105 -3.4674785948480853 3.373261182910667 +928 -0.47949465869401636 4.8766140418593915 -1.7082902202551018 +832 3.7664949439970346 -7.725237251790142 2.249127795467372 +866 8.574128387623029 11.87092357709237 -33.55660077300949 +879 2.397970035203643 -1.0067012033099316 -24.55246411236801 +929 3.276394804624606 -17.02257780299615 0.9984492433600977 +935 20.101385093495328 5.113530565709303 -4.402939514605331 +909 -4.28073098421694 -15.637815198236153 -13.025293876950634 +846 -12.564589941629468 -6.4025051268954645 -20.75775453419462 +867 8.983700225517605 -3.390103398382499 10.693415861649115 +914 -2.2270563485919563 -24.131906542363726 6.875944405629472 +818 0.2383020958130696 -5.676983900196928 -7.219651526329348 +793 5.148041806008255 2.984645492151128 3.4961269673039586 +833 -0.6438138903502075 -2.2828874172817644 -2.0720922776886743 +834 10.612584098261342 -7.3667177513881885 16.15587930450157 +930 6.00984818290816 8.246158764929453 -15.698501664737071 +883 -3.3507225248985764 -0.5583884018684485 4.849649083643576 +794 3.908344161677918 -24.184551279453736 8.492626116154728 +795 8.894549364978065 12.946246804004156 12.17949248871838 +522 0 0 0 +523 0 0 0 +525 0 0 0 +526 0 0 0 +527 0 0 0 +528 0 0 0 +529 0 0 0 +530 0 0 0 +531 0 0 0 +532 0 0 0 +533 0 0 0 +534 0 0 0 +535 0 0 0 +536 0 0 0 +537 0 0 0 +538 0 0 0 +539 0 0 0 +540 0 0 0 +594 0 0 0 +597 0 0 0 +598 0 0 0 +601 0 0 0 +602 0 0 0 +605 0 0 0 +606 0 0 0 +609 0 0 0 +610 0 0 0 +541 0 0 0 +542 0 0 0 +543 0 0 0 +544 0 0 0 +545 0 0 0 +546 0 0 0 +547 0 0 0 +548 0 0 0 +549 0 0 0 +550 0 0 0 +551 0 0 0 +552 0 0 0 +553 0 0 0 +554 0 0 0 +555 0 0 0 +556 0 0 0 +557 0 0 0 +560 0 0 0 +613 0 0 0 +614 0 0 0 +617 0 0 0 +618 0 0 0 +621 0 0 0 +622 0 0 0 +625 0 0 0 +626 0 0 0 +629 0 0 0 +558 0 0 0 +559 0 0 0 +561 0 0 0 +562 0 0 0 +563 0 0 0 +564 0 0 0 +565 0 0 0 +566 0 0 0 +567 0 0 0 +568 0 0 0 +569 0 0 0 +570 0 0 0 +571 0 0 0 +572 0 0 0 +573 0 0 0 +574 0 0 0 +575 0 0 0 +576 0 0 0 +630 0 0 0 +633 0 0 0 +634 0 0 0 +637 0 0 0 +638 0 0 0 +641 0 0 0 +642 0 0 0 +645 0 0 0 +646 0 0 0 +857 0.014723103701010352 19.617056339014884 16.55424143708416 +856 -0.643223754474494 5.776893808258414 1.1873537786475037 +892 -3.075450592140558 0.21721350023132013 -1.4569947460087087 +893 -16.397277523345814 -3.4380854612300413 0.6965615832113001 +886 -0.2961775166926003 1.3204871191677252 -6.423441607226728 +828 -5.723804354158924 -2.2689365841904983 2.5260940343682323 +887 0.8430831533311819 -13.339077650133666 15.172508195501921 +826 -4.448639032696121 -0.8915914080568843 2.3567943259561948 +827 1.718412324889533 -14.893863590144628 14.797129976414348 +894 -6.427973685028659 -12.558615271775233 -7.485451456789206 +925 8.402235075352133 3.407952177949016 -3.5053149045150525 +858 -6.427819874217524 -13.261042052865486 -2.844099672535822 +878 4.549175257644374 -9.190685290399665 7.233790964076811 +812 1.6130765364411193 6.523491914724538 -2.1666788533706773 +927 5.411595894339899 18.95778556645519 0.4163503598847362 +888 6.673800249844219 -4.147769988251276 11.562868346675096 +877 0.7642590168406848 -0.42640846170725205 -0.24362676533615443 +835 4.762512418319816 4.257619894363519 -2.633248633741173 +811 2.94897877928045 1.1358222911198308 3.501491126078737 +837 -25.574582055486644 8.173269863077355 -15.333432600063208 +579 0 0 0 +580 0 0 0 +583 0 0 0 +584 0 0 0 +587 0 0 0 +588 0 0 0 +591 0 0 0 +592 0 0 0 +596 0 0 0 +649 0 0 0 +650 0 0 0 +651 0 0 0 +653 0 0 0 +654 0 0 0 +655 0 0 0 +657 0 0 0 +658 0 0 0 +659 0 0 0 +661 0 0 0 +662 0 0 0 +663 0 0 0 +665 0 0 0 +864 18.10875991489158 -1.221818047957972 14.493518869719745 +885 -3.50759902491298 9.459430974379575 4.647666016780896 +891 1.2937876234992576 -13.218582770473045 1.8043374968280674 +905 -4.091578474774505 3.159726887798095 -1.8642051540811495 +847 13.821135507553436 3.78277650099749 -0.8935962180188131 +807 -2.855822557363695 -1.3802914256701821 1.3207757685673218 +842 -3.5610017924774 20.399114965452245 -9.059382158173541 +806 -4.05498634870798 -0.7854363713825808 -8.046995507898338 +841 2.77935600657832 0.33087027354111276 -3.276950737363777 +848 14.223073217510889 7.872740511148931 10.887767283489458 +805 -1.6775622324299977 -2.2096661714145456 4.5967537734138295 +862 5.242654019377736 5.918079707262924 -8.884230198450263 +808 -3.696957383720496 1.0048882207315841 -0.5768482173888145 +863 -1.8703493217333826 5.862886335539861 9.68692462574889 +906 18.26182603645302 7.175694562498453 -2.7522051758285015 +803 3.2862566934744275 -9.793076664879903 3.0089122195092575 +820 -6.318316424453873 -6.3876103453941235 -3.8277653578536937 +813 2.860647424855888 1.4990458438578118 3.0590515326924304 +830 17.528802909679435 -19.339237046941598 -20.741951943235076 +809 -1.7667991174728181 2.556579099847797 -3.7133211964009396 +849 -1.1901850692743416 -8.440379804790025 -1.6424701640814479 +814 1.1332861799827034 0.6093309476680691 1.6239157816953607 +816 8.576684394424559 3.76294659470765 3.1067139692854044 +933 3.343313506115779 -12.788319535305213 0.4254781025251201 +932 1.2123994730269427 3.3154650357069606 -3.334409286644367 +802 3.413872469336105 -1.1546266031788768 -7.788063759324826 +931 -1.4494894135693275 -0.007254181008071915 -2.3332218927708426 +907 -5.153001723767468 0.1363135393043927 2.075664750863472 +831 -10.004566446956199 14.6294729429816 -0.9646159688100753 +804 -7.991671584288851 -7.475452917857694 -23.323610756314213 +904 -7.100120239541285 -0.3942667752088697 1.4081501423590068 +829 1.9015007439507077 5.283166213121213 -5.6785558614538445 +890 -19.32307212346698 3.2014322404638675 -4.971981839089952 +919 -2.338652775866846 -1.6192256874434943 3.5872094229145635 +908 -4.506448801038724 7.6944348035494805 10.147202763194022 +800 0.525815621025557 0.8800480170316483 -0.20140766169559945 +859 -3.7638632187225913 -1.3301900297863984 -1.6857540996503018 +861 -1.300800867558945 -21.968770646198 -11.380968378191717 +889 -0.13291154686447318 0.408222226270759 0.5188896950022159 +860 2.8418653167563583 -10.860696318995991 -7.274081987407397 +822 18.555841947164804 1.3488795446530215 -2.57263197376979 +821 2.5914509962410404 6.1128885622856535 -6.891713022600967 +595 0 0 0 +599 0 0 0 +600 0 0 0 +603 0 0 0 +604 0 0 0 +607 0 0 0 +608 0 0 0 +611 0 0 0 +612 0 0 0 +666 0 0 0 +667 0 0 0 +669 0 0 0 +670 0 0 0 +671 0 0 0 +673 0 0 0 +674 0 0 0 +675 0 0 0 +677 0 0 0 +678 0 0 0 +679 0 0 0 +681 0 0 0 +682 0 0 0 +683 0 0 0 +615 0 0 0 +616 0 0 0 +619 0 0 0 +620 0 0 0 +623 0 0 0 +624 0 0 0 +627 0 0 0 +628 0 0 0 +632 0 0 0 +685 0 0 0 +686 0 0 0 +687 0 0 0 +689 0 0 0 +690 0 0 0 +691 0 0 0 +693 0 0 0 +694 0 0 0 +695 0 0 0 +697 0 0 0 +698 0 0 0 +699 0 0 0 +701 0 0 0 +631 0 0 0 +635 0 0 0 +636 0 0 0 +639 0 0 0 +640 0 0 0 +643 0 0 0 +644 0 0 0 +647 0 0 0 +648 0 0 0 +702 0 0 0 +703 0 0 0 +705 0 0 0 +706 0 0 0 +707 0 0 0 +709 0 0 0 +710 0 0 0 +711 0 0 0 +713 0 0 0 +714 0 0 0 +715 0 0 0 +717 0 0 0 +718 0 0 0 +719 0 0 0 +801 6.3791360737229175 -0.06294951897585185 6.275276534287049 +852 9.533204722301026 3.635358487275625 11.325241984676676 +876 -7.5288457960325195 10.343955685749071 9.174112903806698 +851 11.324630200416946 -5.3841269941632195 -4.331280522070834 +836 -18.948267184095485 3.059583577066092 -13.205211938026421 +874 0.11331962980175045 -2.6443097750575877 1.3904229166613291 +875 5.578453451251161 -1.707571521972893 -5.365721983984957 +850 3.508833846356138 -4.177464350024476 -2.929550119627118 +920 9.735651740617827 11.172654877683243 -1.520392490494708 +921 2.634342633192178 -7.473941525247307 -10.3819677968746 +799 2.480261876941381 2.6479286070540775 2.8757710276609134 +652 0 0 0 +656 0 0 0 +660 0 0 0 +664 0 0 0 +668 0 0 0 +721 0 0 0 +722 0 0 0 +723 0 0 0 +724 0 0 0 +725 0 0 0 +726 0 0 0 +727 0 0 0 +728 0 0 0 +729 0 0 0 +730 0 0 0 +731 0 0 0 +732 0 0 0 +733 0 0 0 +734 0 0 0 +735 0 0 0 +736 0 0 0 +737 0 0 0 +740 0 0 0 +855 -4.983418977664709 7.316762475632069 -4.804677515261691 +853 -0.9889242911612474 4.9363545378208835 -3.893215427287619 +924 24.809030366392236 12.938030894027968 -7.929148423342626 +796 -2.042486989230798 -1.6716889696169193 4.818040886059996 +902 -12.24631912078176 -9.296091792191639 -5.933828252367176 +903 14.861767381200762 0.646302630400826 8.128909247439392 +898 -2.268970865642067 0.19593504253976693 -1.7002095325194038 +797 13.389488449540423 1.304501878497851 -5.024765837418713 +798 -4.04938216085792 -15.534814466192707 11.193556197029825 +810 -3.4873315530660745 -26.291881956134898 -3.7360180315706857 +854 -0.050097723565420214 1.1979024312153128 9.895624196355202 +923 -20.553020845996645 -9.899327350049255 -9.819708647345967 +922 4.523293437546675 5.218998274954441 -4.49072202518129 +900 7.633861074709448 -2.2307704025903523 4.296521673635092 +899 -19.369173009793435 5.968253817215517 -16.94178229768782 +901 3.1298945853524573 1.0199579971809891 5.836464708883643 +815 12.880886365907195 -2.18582234580474 10.172206114924288 +843 3.8805061810272847 -6.900108272859447 -7.842804013717792 +672 0 0 0 +676 0 0 0 +680 0 0 0 +684 0 0 0 +738 0 0 0 +739 0 0 0 +741 0 0 0 +742 0 0 0 +743 0 0 0 +744 0 0 0 +745 0 0 0 +746 0 0 0 +747 0 0 0 +748 0 0 0 +749 0 0 0 +750 0 0 0 +751 0 0 0 +752 0 0 0 +753 0 0 0 +754 0 0 0 +755 0 0 0 +756 0 0 0 +688 0 0 0 +692 0 0 0 +696 0 0 0 +700 0 0 0 +704 0 0 0 +757 0 0 0 +758 0 0 0 +759 0 0 0 +760 0 0 0 +761 0 0 0 +762 0 0 0 +763 0 0 0 +764 0 0 0 +765 0 0 0 +766 0 0 0 +767 0 0 0 +768 0 0 0 +769 0 0 0 +770 0 0 0 +771 0 0 0 +772 0 0 0 +773 0 0 0 +776 0 0 0 +708 0 0 0 +712 0 0 0 +716 0 0 0 +720 0 0 0 +774 0 0 0 +775 0 0 0 +777 0 0 0 +778 0 0 0 +779 0 0 0 +780 0 0 0 +781 0 0 0 +782 0 0 0 +783 0 0 0 +784 0 0 0 +785 0 0 0 +786 0 0 0 +787 0 0 0 +788 0 0 0 +789 0 0 0 +790 0 0 0 +791 0 0 0 +792 0 0 0 +871 3.8388411617482983 2.1415774247586086 2.2282258014613365 +910 7.602860298670014 2.6393823107390926 0.5414737324680828 +873 20.507332409943604 5.51145846781714 8.496326839610182 +912 -3.629349712693535 23.337951853868613 -32.58198418026529 +872 4.080216979227207 -18.995820981792978 -6.328839221258122 +869 25.409329042660474 4.159096283589856 8.003159128696433 +868 -6.119380276761435 0.9901059131840709 -6.330598686020231 +870 -10.78856535095556 -17.561195466544348 -21.63165476286472 +911 14.291030359419361 -16.1359695519986 6.557863766321599 + +Bonds + +1 1 880 881 +2 1 880 882 +3 1 823 824 +4 1 823 825 +5 1 838 839 +6 1 838 840 +7 1 895 896 +8 1 895 897 +9 1 913 914 +10 1 913 915 +11 1 916 917 +12 1 916 918 +13 1 817 818 +14 1 817 819 +15 1 934 935 +16 1 934 936 +17 1 844 845 +18 1 844 846 +19 1 865 866 +20 1 865 867 +21 1 928 929 +22 1 928 930 +23 1 832 833 +24 1 832 834 +25 1 793 794 +26 1 793 795 +27 1 883 884 +28 1 883 885 +29 1 856 857 +30 1 856 858 +31 1 892 893 +32 1 892 894 +33 1 886 887 +34 1 886 888 +35 1 826 827 +36 1 826 828 +37 1 925 926 +38 1 925 927 +39 1 877 878 +40 1 877 879 +41 1 835 836 +42 1 835 837 +43 1 811 812 +44 1 811 813 +45 1 847 848 +46 1 847 849 +47 1 841 842 +48 1 841 843 +49 1 805 806 +50 1 805 807 +51 1 862 863 +52 1 862 864 +53 1 808 809 +54 1 808 810 +55 1 820 821 +56 1 820 822 +57 1 814 815 +58 1 814 816 +59 1 802 803 +60 1 802 804 +61 1 931 932 +62 1 931 933 +63 1 907 908 +64 1 907 909 +65 1 904 905 +66 1 904 906 +67 1 829 830 +68 1 829 831 +69 1 919 920 +70 1 919 921 +71 1 859 860 +72 1 859 861 +73 1 889 890 +74 1 889 891 +75 1 874 875 +76 1 874 876 +77 1 850 851 +78 1 850 852 +79 1 799 800 +80 1 799 801 +81 1 853 854 +82 1 853 855 +83 1 796 797 +84 1 796 798 +85 1 898 899 +86 1 898 900 +87 1 922 923 +88 1 922 924 +89 1 901 902 +90 1 901 903 +91 1 871 872 +92 1 871 873 +93 1 910 911 +94 1 910 912 +95 1 868 869 +96 1 868 870 + +Angles + +1 1 881 880 882 +2 1 824 823 825 +3 1 839 838 840 +4 1 896 895 897 +5 1 914 913 915 +6 1 917 916 918 +7 1 818 817 819 +8 1 935 934 936 +9 1 845 844 846 +10 1 866 865 867 +11 1 929 928 930 +12 1 833 832 834 +13 1 794 793 795 +14 1 884 883 885 +15 1 857 856 858 +16 1 893 892 894 +17 1 887 886 888 +18 1 827 826 828 +19 1 926 925 927 +20 1 878 877 879 +21 1 836 835 837 +22 1 812 811 813 +23 1 848 847 849 +24 1 842 841 843 +25 1 806 805 807 +26 1 863 862 864 +27 1 809 808 810 +28 1 821 820 822 +29 1 815 814 816 +30 1 803 802 804 +31 1 932 931 933 +32 1 908 907 909 +33 1 905 904 906 +34 1 830 829 831 +35 1 920 919 921 +36 1 860 859 861 +37 1 890 889 891 +38 1 875 874 876 +39 1 851 850 852 +40 1 800 799 801 +41 1 854 853 855 +42 1 797 796 798 +43 1 899 898 900 +44 1 923 922 924 +45 1 902 901 903 +46 1 872 871 873 +47 1 911 910 912 +48 1 869 868 870 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water new file mode 100644 index 0000000000..9f8e717a7e --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water @@ -0,0 +1,51 @@ +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +group water molecule 2 +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt new file mode 100644 index 0000000000..8494bfcb3e --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt @@ -0,0 +1,51 @@ +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +group water molecule 2 +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 new file mode 100644 index 0000000000..c8268c72f6 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 @@ -0,0 +1,239 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water 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 and D. Mandelli and 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 and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and 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, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 84320 48000 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 32.9 | 32.9 | 32.9 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494868 -20.796993 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.486271 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502844 -20.993704 3.49086 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495287 -20.828353 3.3330658 188.48002 -1.8429075 271.42862 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491435 -20.443044 2.9516084 188.7589 -1.8566335 240.36459 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24516e-05 48 + 600 -17.505684 -20.608457 3.1027731 188.72078 -1.9560796 252.67471 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50422e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496703 -21.072663 3.5759596 188.2777 -1.9833956 291.20871 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15262e-06 96 +Angle: 1 104.52 7.02157e-05 48 + 800 -17.478623 -20.819504 3.3408809 188.37868 -1.9112996 272.06505 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14138e-07 96 +Angle: 1 104.52 6.98742e-05 48 + 900 -17.48086 -20.728495 3.2476349 188.59022 -1.8922102 264.47155 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00586e-06 96 +Angle: 1 104.52 0.000111712 48 + 1000 -17.498465 -20.331545 2.8330804 188.87473 -1.812177 230.71225 +Loop time of 20.3334 on 1 procs for 1000 steps with 936 atoms + +Performance: 4.249 ns/day, 5.648 hours/ns, 49.180 timesteps/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 16.179 | 16.179 | 16.179 | 0.0 | 79.57 +Bond | 0.00021103 | 0.00021103 | 0.00021103 | 0.0 | 0.00 +Kspace | 3.3118 | 3.3118 | 3.3118 | 0.0 | 16.29 +Neigh | 0.79017 | 0.79017 | 0.79017 | 0.0 | 3.89 +Comm | 0.026379 | 0.026379 | 0.026379 | 0.0 | 0.13 +Output | 0.00046496 | 0.00046496 | 0.00046496 | 0.0 | 0.00 +Modify | 0.017013 | 0.017013 | 0.017013 | 0.0 | 0.08 +Other | | 0.008835 | | | 0.04 + +Nlocal: 936 ave 936 max 936 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 5242 ave 5242 max 5242 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: 431382 ave 431382 max 431382 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:20 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 new file mode 100644 index 0000000000..ab28c96657 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 @@ -0,0 +1,239 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.017 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water 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 and D. Mandelli and 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 and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and 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, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 30685 12480 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 25.22 | 25.25 | 25.29 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494869 -20.796995 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.48627 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502843 -20.993703 3.4908599 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495285 -20.82835 3.333065 188.48003 -1.8429074 271.42856 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443043 2.9516075 188.7589 -1.8566335 240.36452 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24517e-05 48 + 600 -17.505683 -20.608456 3.1027734 188.72078 -1.9560795 252.67474 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50425e-07 96 +Angle: 1 104.52 5.62422e-05 48 + 700 -17.496706 -21.072664 3.575958 188.2777 -1.9833951 291.20858 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15256e-06 96 +Angle: 1 104.52 7.02177e-05 48 + 800 -17.478628 -20.819507 3.340879 188.37868 -1.9113009 272.06489 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14163e-07 96 +Angle: 1 104.52 6.98849e-05 48 + 900 -17.480865 -20.728504 3.2476386 188.5902 -1.8922108 264.47185 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00568e-06 96 +Angle: 1 104.52 0.000111707 48 + 1000 -17.498474 -20.331607 2.833133 188.87466 -1.8121689 230.71654 +Loop time of 9.05361 on 4 procs for 1000 steps with 936 atoms + +Performance: 9.543 ns/day, 2.515 hours/ns, 110.453 timesteps/s +99.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.462 | 4.2266 | 7.1075 | 89.3 | 46.68 +Bond | 0.00018424 | 0.00019878 | 0.00022125 | 0.0 | 0.00 +Kspace | 1.4698 | 4.338 | 6.1001 | 87.8 | 47.91 +Neigh | 0.39462 | 0.39489 | 0.39518 | 0.0 | 4.36 +Comm | 0.043753 | 0.055826 | 0.062746 | 3.1 | 0.62 +Output | 0.00048755 | 0.00053971 | 0.00062785 | 0.0 | 0.01 +Modify | 0.027255 | 0.028664 | 0.030278 | 0.7 | 0.32 +Other | | 0.008904 | | | 0.10 + +Nlocal: 234 ave 302 max 198 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 2876.5 ave 3122 max 2632 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 107846 ave 150684 max 82181 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 new file mode 100644 index 0000000000..c795e85d56 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 @@ -0,0 +1,256 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water 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 and D. Mandelli and 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 and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and 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, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +- ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137 +@inproceedings{gao2021lmff + author = {Gao, Ping and Duan, Xiaohui and Others}, + title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors}, + year = {2021}, + isbn = {9781450384421}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/3458817.3476137}, + doi = {10.1145/3458817.3476137}, + booktitle = {Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis}, + articleno = {42}, + numpages = {14}, + location = {St. Louis, Missouri}, + series = {SC'21}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 84320 48000 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm/opt, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 25.27 | 25.27 | 25.27 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494868 -20.796993 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.486271 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502844 -20.993704 3.49086 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495287 -20.828353 3.3330658 188.48002 -1.8429075 271.42862 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443044 2.9516084 188.7589 -1.8566335 240.36459 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24516e-05 48 + 600 -17.505684 -20.608457 3.1027731 188.72078 -1.9560796 252.67471 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50422e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496701 -21.07266 3.5759595 188.2777 -1.9833956 291.20871 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15262e-06 96 +Angle: 1 104.52 7.02158e-05 48 + 800 -17.478623 -20.819504 3.340881 188.37868 -1.9112996 272.06506 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14138e-07 96 +Angle: 1 104.52 6.98742e-05 48 + 900 -17.480864 -20.728498 3.2476343 188.59022 -1.8922102 264.4715 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00586e-06 96 +Angle: 1 104.52 0.000111711 48 + 1000 -17.498466 -20.331547 2.8330808 188.87473 -1.8121768 230.71228 +Loop time of 8.11929 on 1 procs for 1000 steps with 936 atoms + +Performance: 10.641 ns/day, 2.255 hours/ns, 123.163 timesteps/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 4.6849 | 4.6849 | 4.6849 | 0.0 | 57.70 +Bond | 0.00017678 | 0.00017678 | 0.00017678 | 0.0 | 0.00 +Kspace | 3.2098 | 3.2098 | 3.2098 | 0.0 | 39.53 +Neigh | 0.17546 | 0.17546 | 0.17546 | 0.0 | 2.16 +Comm | 0.024693 | 0.024693 | 0.024693 | 0.0 | 0.30 +Output | 0.00037798 | 0.00037798 | 0.00037798 | 0.0 | 0.00 +Modify | 0.015853 | 0.015853 | 0.015853 | 0.0 | 0.20 +Other | | 0.007983 | | | 0.10 + +Nlocal: 936 ave 936 max 936 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 5242 ave 5242 max 5242 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: 431382 ave 431382 max 431382 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:08 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 new file mode 100644 index 0000000000..f885c5708d --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 @@ -0,0 +1,256 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.014 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water 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 and D. Mandelli and 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 and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and 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, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +- ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137 +@inproceedings{gao2021lmff + author = {Gao, Ping and Duan, Xiaohui and Others}, + title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors}, + year = {2021}, + isbn = {9781450384421}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/3458817.3476137}, + doi = {10.1145/3458817.3476137}, + booktitle = {Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis}, + articleno = {42}, + numpages = {14}, + location = {St. Louis, Missouri}, + series = {SC'21}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 30685 12480 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm/opt, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 21.4 | 21.44 | 21.48 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494869 -20.796995 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.48627 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502843 -20.993703 3.4908599 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495285 -20.82835 3.333065 188.48003 -1.8429074 271.42856 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443043 2.9516075 188.7589 -1.8566335 240.36452 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24517e-05 48 + 600 -17.505682 -20.608456 3.1027734 188.72078 -1.9560795 252.67474 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50425e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496706 -21.072664 3.575958 188.2777 -1.9833951 291.20858 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15256e-06 96 +Angle: 1 104.52 7.02177e-05 48 + 800 -17.478628 -20.819507 3.340879 188.37868 -1.9113009 272.0649 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14163e-07 96 +Angle: 1 104.52 6.98849e-05 48 + 900 -17.480868 -20.728506 3.2476383 188.5902 -1.8922108 264.47182 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00568e-06 96 +Angle: 1 104.52 0.000111707 48 + 1000 -17.498472 -20.331605 2.8331335 188.87466 -1.8121689 230.71657 +Loop time of 4.24862 on 4 procs for 1000 steps with 936 atoms + +Performance: 20.336 ns/day, 1.180 hours/ns, 235.370 timesteps/s +99.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.25749 | 1.1806 | 2.6872 | 89.0 | 27.79 +Bond | 0.00018656 | 0.00020786 | 0.00025377 | 0.0 | 0.00 +Kspace | 1.4259 | 2.9204 | 3.8414 | 56.3 | 68.74 +Neigh | 0.057504 | 0.057852 | 0.05818 | 0.1 | 1.36 +Comm | 0.041952 | 0.053593 | 0.05876 | 3.0 | 1.26 +Output | 0.0004296 | 0.00046809 | 0.00055317 | 0.0 | 0.01 +Modify | 0.026204 | 0.027251 | 0.028382 | 0.6 | 0.64 +Other | | 0.008209 | | | 0.19 + +Nlocal: 234 ave 302 max 198 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 2876.5 ave 3122 max 2632 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 107846 ave 150684 max 82181 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:04 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 new file mode 100644 index 0000000000..3dc2944ed9 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.338208372875723 -8.724519590498623 -8.445612139491281 0 -1 1 +82 1 -7.5133824622188925 -6.978636164411631 -10.191775661279799 0 0 0 +57 1 -6.093878587859262 -9.276313581141936 -7.744358551066254 1 0 0 +8 1 -7.188384493977925 -11.000743174865285 -10.566868392413127 0 1 1 +49 1 -0.45896030511450936 -8.721648062141405 -7.76988436909876 0 1 0 +54 1 4.36019737005205 -9.840722628422576 -9.652200105153977 0 -1 1 +114 1 3.904944042667676 -8.560258519206736 -6.227256449483399 -1 0 1 +128 1 1.537670815459421 11.367557646509137 -7.44113189883349 0 0 -2 +102 1 2.6467980910798623 -6.300231690446356 -10.839747469959917 1 -1 -1 +157 1 6.599214138053117 -6.278630725537236 -7.389049268829837 -1 0 1 +20 1 8.160418209241914 -11.236890922228888 -9.90427297873004 0 1 0 +147 1 10.464052914243185 -5.834517788008704 -9.403782126876184 -1 2 0 +169 1 9.355540563360105 -8.982132042608429 -6.861385656669775 0 1 1 +123 1 -6.908328795781873 -3.2942152122483694 -10.871702946953768 -1 0 -1 +130 1 -6.59789640513614 -2.559000332768779 -7.109058819418416 -1 1 0 +140 1 -9.12121182032633 -1.3228381271313019 -9.248705124201138 -1 1 0 +153 1 -4.57209419001429 -5.197951679459013 -8.806559015841044 0 1 0 +129 1 -0.17714454435176596 -5.056145756511569 -8.582370909018262 0 1 1 +148 1 -3.197585507102101 -2.0540921199407465 -9.77932871778502 0 0 0 +119 1 -3.51954842440485 -3.8478081846346726 10.678236929073831 0 -1 -1 +174 1 3.1384595215939513 -1.9078182147633918 -10.748237231758047 -1 1 -1 +134 1 -0.0032185119392025285 -0.36841629060197645 -8.631895429784365 -1 0 2 +189 1 2.892780086534627 -1.3587472579142499 -6.410113256095116 0 0 2 +28 1 6.224912481821424 -1.100900418829165 -9.316948573538184 0 0 -1 +1 1 7.533342646866252 -2.8858379557892953 -6.5588822497649195 1 -1 0 +24 1 10.891564390761006 -2.1693511431878143 -8.14872153065027 0 -1 1 +176 1 10.35065200687287 -3.6683271215630047 -4.32699396695263 0 0 0 +182 1 -10.764131367809398 0.5730937842904389 -5.180063181396292 0 1 -1 +137 1 -8.194528746006949 3.76661130396705 -8.596433076900993 -1 1 0 +89 1 -5.793296966734716 0.9591211322466908 -8.532912969707475 0 0 -1 +88 1 -3.2415549382910047 2.6063473128515433 -11.019658141847422 0 1 -1 +160 1 -0.17978720428819353 5.335367005111222 -5.961111228150678 0 0 1 +125 1 -3.2595127311899836 3.541669787125592 -7.094678802230409 0 1 0 +167 1 2.6101389699783257 2.7016950511217104 -7.510579719545417 0 1 0 +107 1 2.478905108002845 1.3710464608203452 -11.241338409619438 -1 1 1 +45 1 -0.2728444271939366 3.4472072045614333 -9.803824961885091 0 1 0 +95 1 7.005885045149228 1.8641755193621776 -11.033503201926393 0 2 -1 +111 1 11.28085723924775 1.3577973865073396 -8.404143782130012 0 1 1 +37 1 7.50412447792306 1.5806311975228182 -7.696866725729485 1 0 2 +53 1 9.464056637143884 5.181490576538966 -10.160960273108417 -1 -1 1 +122 1 -8.61454149114821 11.46923394337289 -7.097906043887797 2 -1 -1 +126 1 -8.658911027419105 9.160142379367757 -10.196432851978876 0 0 -1 +72 1 -11.223582472260205 7.275428216701358 10.836645274139237 2 0 0 +144 1 -3.0387339366126 -9.918200912273784 -9.896452956043586 0 1 1 +135 1 0.03771056281680529 7.830565362407303 -8.390686664231268 1 0 0 +183 1 2.8786138768293665 5.221499246050073 -10.100270572243783 0 0 0 +155 1 3.821499942128122 9.224610559399695 -9.359914290522674 0 0 0 +21 1 6.6299071097705 6.818271712520994 -8.197268594363944 1 0 0 +66 1 9.53812274637967 7.559409537149467 -6.194715694404919 -2 -1 0 +22 1 11.107750453110658 10.72621054512756 -6.232964722376559 -1 0 0 +42 1 9.127119842763733 9.280850325093446 -10.249747757735628 -1 1 0 +77 1 -6.840159982144716 -10.92057206639582 -3.876267638432264 1 -1 1 +47 1 -8.742923464684916 -8.023408201112765 -5.403173093100989 1 2 1 +18 1 -10.63751608820882 -11.30186343558728 -3.9206887105699195 1 0 -1 +46 1 11.298180499183054 -7.685155723666886 -4.06604680107494 1 0 -2 +14 1 -9.566429851257723 -7.447961115721825 -2.010931774940218 -1 0 2 +178 1 -4.527419254322211 -8.045910047035035 -4.819501104832851 2 1 0 +48 1 -3.2147691406929866 -10.888877164915472 -6.377437598460709 1 1 -1 +55 1 -0.9601171939836206 -6.238495322587188 -4.2762406549238605 -1 0 -1 +12 1 -1.8964494825899862 -9.405283267682947 -2.3799601015584315 -1 0 2 +15 1 6.020890846962015 -8.178330582079944 0.7240728610757863 -1 0 -1 +64 1 2.731938348082501 -10.543443272156145 -1.741916704711699 1 1 0 +44 1 8.065377899358 -6.2776681789760715 -3.599447303926354 -1 0 1 +188 1 10.02823971588665 -8.47709879900416 -0.7307124355000334 -1 0 0 +200 1 -9.394872508283228 -3.330386381489715 -5.1567351351767705 -1 0 0 +198 1 -7.21209897973175 -1.1704302343832897 -2.203950414480204 0 0 1 +76 1 -9.986350100477846 -3.0116982250661763 -1.5200938888623745 1 0 0 +194 1 -6.746550374491012 -4.972813556867408 -2.5010542319113824 0 1 -1 +68 1 -2.5395355119165752 -3.5084431511046077 -6.11089008487593 0 1 1 +96 1 -3.383034995518244 -3.996115182399876 -2.1114098179404905 -1 2 0 +91 1 3.023350222125586 -6.242259457656427 -2.3794062527217115 1 -1 -1 +154 1 -0.21966769644821582 -2.9431607814775376 -3.0023832902544516 -1 2 0 +19 1 3.1658091018639274 -2.0642468786997554 -2.307083850490244 0 1 -1 +120 1 6.655220459905831 -2.268055028492757 -2.8431810436972036 1 1 1 +138 1 9.657284951715521 -4.552145938528714 -0.6562837148986382 -1 1 -1 +9 1 7.577787647310252 -2.027383158459481 0.591256647470022 0 0 1 +150 1 -9.975709520806461 2.045189761629004 -1.3967042898865678 1 -1 1 +38 1 -5.780821497271447 4.724336446491739 -4.727424802574532 1 0 2 +172 1 -9.690365647641709 4.0528825638271995 -4.90299752668659 0 0 2 +29 1 -7.905836311144201 7.618140007848844 2.0916587803060374 1 -1 -1 +87 1 -3.2429786758343386 -0.9446923499804107 -3.602689802943157 0 -1 1 +93 1 -6.311310050813026 0.9463486890063564 -4.844328963553153 0 -1 1 +195 1 1.0294591756555889 0.17190072131794665 -3.729109843284945 1 -1 3 +149 1 -2.2517532526979984 2.837758606759653 -2.568308902690684 1 0 0 +25 1 4.622058806898725 1.1966098061131745 -0.5762266975161516 -1 0 1 +35 1 2.770724754796497 3.7811224145924633 -3.6900492736017867 1 -1 0 +116 1 5.985384722273807 5.820793889080573 -5.01963853113883 0 1 0 +5 1 5.710509981071034 1.5091333740272113 -4.1779355439452 0 -1 -1 +112 1 4.909280213802248 5.451229842365678 -0.23301351689583433 -1 0 0 +152 1 11.352756404691903 -0.5457110274170986 -1.851635893722021 -2 -1 0 +132 1 8.574718024729343 1.7846682488107686 -1.3135653711870618 0 0 0 +173 1 8.985071256603522 3.7974294357041134 -5.507410143502991 0 0 1 +73 1 -9.997675226742189 8.034933990134746 -6.6211967592334595 0 -2 1 +161 1 -11.552860384837217 7.057039822309078 -3.567109853559714 2 0 2 +78 1 -1.8080552760100446 10.151101687740656 -1.7466859905812946 1 -2 1 +11 1 4.503908677727956 -11.845112920212848 -5.000489634351112 0 2 1 +84 1 2.4816138724708487 7.425072174245171 -5.250945864454475 1 0 0 +90 1 6.134640615065156 9.297869169242624 -0.8361676575747339 0 -1 1 +36 1 1.9591052897014976 7.715785297331987 -1.741598961638701 2 -1 0 +98 1 8.55440808947692 7.573996243117245 -2.894381804652479 -1 0 0 +56 1 7.300059241947594 10.446841724098018 -6.708609001665156 -1 0 1 +109 1 9.185972290533323 11.319457447612841 -0.9199703749554402 -1 1 1 +115 1 -7.290737513756202 -8.128422064576581 2.840900089769448 1 0 0 +124 1 -11.095494798277388 -8.787146009506092 4.06143463064398 1 0 -2 +121 1 -8.269324094623837 -10.076632693187037 6.580117501920071 0 1 -1 +80 1 -4.964400090273426 -7.254460179243866 -0.2516287260948715 0 0 1 +101 1 -4.352556925935133 -8.093642941491481 4.9061967743324075 1 3 1 +4 1 1.6615068736969008 10.065280091130505 4.658196599859135 -1 -1 -1 +81 1 7.340287496174785 -8.542929146635126 6.681008128047246 -1 1 1 +6 1 8.92830710513934 -10.595453002991315 2.772878983207939 1 1 0 +166 1 -8.702005772998799 -5.0252019350878925 4.355591496028076 0 2 0 +40 1 -7.050509790391359 -4.52399648752538 1.2979104738341645 1 1 0 +127 1 -5.6981160982548635 -2.4804262914214696 3.963876974872145 0 -1 0 +104 1 -0.43889931205929145 -0.6786512342031208 -0.26982380817326046 -1 0 -1 +151 1 0.38632233704260427 -6.436575550724694 0.28827602607540115 0 1 2 +60 1 -2.3388191412291297 -2.1909895686965264 5.332358036316238 0 1 0 +168 1 3.905092056046815 -3.342842649601014 0.743162620375255 -1 1 -1 +51 1 0.30821594516237355 -3.3431888641351466 2.97421468380087 0 0 -1 +97 1 2.0959982908166124 -0.09218688876005032 2.2065126859574242 0 -1 -1 +103 1 4.032770557637615 -1.033589048853706 6.026643139338357 -1 2 0 +163 1 -10.67096111340156 -2.753792851497721 2.2777487994238297 0 -1 0 +175 1 5.732332747304902 -3.395357434547403 3.9793999602240824 -1 1 0 +158 1 8.900731939704714 -6.465614302153284 2.882524782105495 -1 0 -1 +85 1 10.256991086371421 -0.03399764580791596 5.19749850902792 1 0 1 +63 1 -8.206071489694988 -0.20777550918309284 1.1337283531787357 -1 0 1 +133 1 -10.53669133454302 2.413445898515217 3.6779422317228634 1 1 0 +67 1 -6.580427997228583 3.5308019506173483 3.249950052857889 1 0 0 +83 1 -3.837130760373457 0.5948829995405305 2.7555803207629808 0 -2 1 +162 1 0.5628056325507875 0.015590885064073646 6.104541108047491 0 0 0 +170 1 -2.741308504695489 4.278253215456882 6.467354505657028 -1 1 -2 +181 1 -5.298818879016533 0.6747551441657151 5.729306597544269 -1 1 -1 +71 1 1.6643578976841618 4.095917673198805 -0.5219437486813767 0 -1 -1 +31 1 1.0515428688465895 4.152933403466363 6.1671972298548825 0 -2 0 +139 1 3.7848906674638663 3.6854393920193473 3.29399693806094 -1 2 0 +3 1 10.981379981294642 1.2656622142958476 0.9353988521574017 0 -1 1 +108 1 6.1052451115408175 0.8636547219490183 3.620998736363435 1 1 0 +16 1 8.972094495168673 3.5728016103606848 4.03251575890399 0 -2 1 +110 1 -11.360244143589199 5.991417852211969 3.108858276372061 0 0 -2 +50 1 -7.001523002421964 11.111129854490866 4.085896982012491 0 0 0 +191 1 -8.535734954334753 7.01291974923636 5.601813919122847 1 -1 0 +187 1 -10.711068400768836 11.24759510548256 5.108018843428019 1 1 0 +180 1 -1.0115990012221623 6.198904069067613 -1.8166876549028856 1 -1 2 +30 1 -0.6366171189365808 8.860606610617594 1.2441466899617097 1 -2 -1 +2 1 -1.8186886713768473 5.401678057284073 2.675711617904522 1 -2 -1 +17 1 -2.0021887273825953 8.358120841698845 5.289337562756078 -2 0 -1 +7 1 4.074924702840786 8.78812906409422 1.7171879913627848 -1 0 1 +164 1 1.8692613585489788 6.285969009685708 2.179749632062295 -1 0 0 +69 1 4.63280772470042 6.917030747154868 5.0992927825629835 0 -2 -1 +61 1 10.180483484726627 5.102933813094147 -0.6143013682078827 -1 -2 0 +34 1 7.6753980260971115 9.289346236573914 2.385702988209246 0 0 -1 +43 1 7.122060213065371 6.027541758611427 2.434097564627603 -1 -2 1 +177 1 8.528259310530697 7.357497844279905 5.573095645895759 -1 1 -1 +179 1 11.765063377112929 -11.216117555594387 -10.520782276852188 -1 3 2 +65 1 -9.939292746165652 -8.35547457034324 11.370610161953358 0 -1 -1 +27 1 -10.951259960706151 -11.676718912293088 8.46919851147203 1 1 1 +58 1 -9.681801591871107 -6.867288275839336 8.155377252027327 -1 0 -1 +32 1 -6.131008336203429 -5.3807894145123 6.404139996945254 2 1 -2 +26 1 -5.277766259873033 -8.47443173172751 9.34226968131783 1 0 0 +142 1 -2.2300264866152233 -6.734520703453221 8.54527447884555 2 1 0 +100 1 -1.5334511532264656 -10.941538235330839 6.762850724892153 1 2 0 +184 1 7.375517404090732 -7.455937963783537 -11.443563002056962 0 1 2 +105 1 1.3322147240971494 -7.892907018083993 3.959755431262508 0 0 -1 +75 1 4.579073338589469 -6.332281766890766 5.401380400098642 0 -1 0 +99 1 1.6872589572610692 -11.008904691990601 10.790406649632594 0 0 0 +193 1 2.165378393000026 -6.907577487565213 9.269079214220964 1 1 -1 +33 1 4.415243573456659 -11.651415043860048 7.196586725345009 0 -1 0 +79 1 8.562132664810616 11.60776935837499 5.9765813232044 -1 0 0 +92 1 9.7882797687825 -9.546408677583251 11.099049944831634 0 2 -1 +165 1 -9.230629586630256 -3.286419219229394 7.361693942438226 0 0 0 +199 1 -6.865681519441191 -4.960200472270827 9.951650907912764 0 -1 1 +70 1 -5.465385410624981 -2.359017759235627 7.824489075549977 0 1 1 +146 1 -1.4128831058942808 -0.5651321764460739 11.276244400666037 2 1 1 +106 1 -1.359759429785522 -2.5612049312124596 8.66030082151058 0 0 -1 +52 1 0.6275246163307096 -3.6626685091764974 11.394079726568394 0 0 0 +86 1 5.385048800206313 -4.521509414521681 8.656605720260643 -1 0 1 +197 1 1.5960773668099044 -4.632851183052137 7.050260712413685 -1 0 -1 +185 1 2.0988154112902677 -0.6155858372057779 10.039741652805866 -2 1 -2 +190 1 7.402096413387279 -0.25029457328283883 9.918579248632192 0 0 -1 +145 1 7.12421994994077 -3.662416626939269 -11.744325877649178 -1 -2 0 +131 1 11.18002293743892 -5.284301350499634 6.202872301153104 1 0 0 +156 1 -5.458324556633278 -0.38542205585237 11.508150106421377 0 -1 -1 +10 1 -9.11455987814511 -0.7284053525098189 4.7937364242043685 0 0 2 +196 1 -9.334790977795333 0.22026194254469544 8.665774918646903 1 2 1 +143 1 -7.202065049712928 3.0671354576980563 8.711576683539384 1 0 0 +13 1 -11.827431931265373 3.351396387549464 6.969024410690874 -1 -1 1 +59 1 -3.4888315694577976 1.7945900827414363 9.37212343512276 1 -1 1 +186 1 0.1399856131518682 2.5706426278242667 9.701168522174706 1 1 0 +136 1 3.4415384834588973 2.185354911818653 7.959200431003509 0 -1 -3 +192 1 10.528638878678947 2.482587032106114 9.852249456508758 1 1 1 +113 1 7.169273245351864 2.240386648237891 6.81806834338785 -1 -1 -1 +62 1 3.8919207853480167 6.881948160439718 8.99101225575 1 0 0 +74 1 -8.178685418297237 9.818884262184877 8.930172678325137 1 -1 0 +118 1 -11.577334387980462 8.493934752303879 6.984011067983683 0 1 0 +117 1 -5.265098295144998 11.327347075770236 7.5602122003602945 -1 -1 0 +23 1 -5.150793196726769 5.778029085599102 11.296630874448987 0 0 -2 +171 1 -4.323653153250317 7.139179037030907 7.775653914779269 0 2 -2 +94 1 0.595594702317225 9.593135599654605 9.048522029833913 -1 0 0 +41 1 5.495056487999116 11.528824616719037 11.673423310901565 0 0 -1 +141 1 9.858324590689726 5.708495049079261 9.011577695177973 1 -1 -1 +159 1 9.655575431519994 9.766549249024301 9.761747234830672 0 -1 0 + +Velocities + +39 3.843901085922765 -0.7556840039136884 3.588481686862416 +82 -6.7131250110640295 0.1978517371310493 3.794615543737683 +57 -3.8444246166822666 -0.12509187511770853 -0.15016726331630528 +8 2.510198026755905 3.9393955076781997 2.1890256483333417 +49 2.3436002495676416 -3.937791517692209 -0.8678317852601907 +54 0.6032383013072746 3.3962808798459587 -4.353772407339659 +114 1.733121125021854 -5.515987819958336 5.5418081738213125 +128 0.6238341583124627 -4.373836957545107 -1.8358939583013871 +102 3.7217703111263405 -2.1130321869806172 0.3604425898099683 +157 -3.060805678543839 -4.541031970793705 2.0247670855961024 +20 0.19495210236206537 0.7445218389780817 -4.9481403197240175 +147 1.300002576089047 0.4456991718445389 -0.49416915478347523 +169 -0.4362191685321444 -3.947171092840025 -1.656461237016801 +123 -4.189637911629164 -3.3929868871757067 0.6670412748458154 +130 0.6134420085318386 2.2669355259081905 -3.459678248548238 +140 -3.017718530938869 2.2011145660870097 -0.08987220236519784 +153 1.8522800493758318 0.8156876148506785 -9.385509457300062 +129 4.422122082904887 0.7131966606636173 0.3531709089212848 +148 0.6611682907987628 -0.38909659051429185 -0.4773785971811748 +119 -1.669105812009433 -0.37002694554897725 -3.3024540150626986 +174 -6.672226703796612 4.247321732812844 1.6315053674536977 +134 -3.0608984486057835 -2.4129204610506294 -2.734745807674302 +189 -2.302704208974844 3.481037259019509 -2.794714120652709 +28 -2.75682827680027 -3.050875489215879 -4.227117245181596 +1 -2.1560141369701795 4.052819594846101 5.448339653382999 +24 -2.386079256841039 -2.8280668145030563 4.35837241466938 +176 -1.4372688768932664 -6.6415313837559875 4.129983376772735 +182 -0.4720828255607976 3.662207995039096 2.519318256725504 +137 3.2869116185302323 3.2307568609578143 -1.9509349541264633 +89 0.9583454014186878 -1.6238254590624648 1.3557912965537908 +88 1.7694593220184982 -1.036030143090322 1.9233033494166958 +160 1.008621423016506 -6.119196433851812 5.640861548269096 +125 1.8734575131064475 -1.5413231325971886 -1.3731468026454559 +167 0.5552538334188052 4.600624550198432 0.10361430748931168 +107 -3.2399064229680294 -1.8236363657903167 0.5755237816639006 +45 -0.8909937912895557 3.652128037032182 0.47945125158298724 +95 -3.55734648018246 -1.7071938037895589 -0.49307606319505376 +111 -0.5877274590969576 -1.0815552570296887 1.2264280053757328 +37 -0.4940015083502718 2.120546197357239 -6.129979680695427 +53 -0.2896516389711194 0.42515885739039166 -1.8677025658203998 +122 0.967791765282903 1.7401195129115046 1.9118554789129 +126 -2.954209751448974 2.164651827051895 2.3297982456925053 +72 3.173369384034092 -3.8176084785054245 -2.272242460318536 +144 7.811875555936 4.819434744326224 0.3359991553117815 +135 0.1395889289809734 1.0258297209323288 -3.8437628564556956 +183 3.6133240015570744 -0.6507150055387017 -3.110230107415811 +155 -1.81416144798709 -3.5659788058079758 -2.041490164886604 +21 0.6092276970785621 -4.133031653047547 -1.1692481377542574 +66 -1.2540845964267104 -3.824259504042551 3.29729030480536 +22 2.5446763351186448 -0.6513499783353496 -2.0932016159863465 +42 5.82871794909335 1.6743919751666467 0.7126718280768334 +77 -0.4040118365141223 -3.2290750702108357 1.818231240430787 +47 0.028653058178313952 -2.27141290239272 0.7388413469098802 +18 -0.3605358292652272 -2.51632133097868 -2.2152302223559324 +46 -4.956822430210972 1.7347845441659948 -0.8052402055568453 +14 1.0447813005670052 1.7950897980192044 -5.120385937069129 +178 2.8613069610645323 -1.221832900100255 4.786474400939546 +48 -1.0101057057064093 -4.108390928419403 -3.626668446988165 +55 3.380329095570148 1.9767809972549477 -0.7468971412257048 +12 0.5796037236485843 -2.968894009109519 -1.109629405353503 +15 -1.0805423425753338 -0.6224135466634316 2.517980927489596 +64 2.772129192684522 2.307682180641892 1.326944641441264 +44 -2.8172327982334355 1.083586023278567 -1.8763865737567058 +188 -3.437261818925725 1.5454398749025489 -0.16540078855271825 +200 -4.575258061249265 4.788641216932844 -0.4020526553149053 +198 2.0555443873273083 -3.895983368588817 1.158820403753976 +76 -0.43680328576927907 -2.690054938184871 -3.1926091395345697 +194 -4.927518640766644 -2.7958765254010074 2.346084579105554 +68 3.8869230882195995 -4.532127531608888 -3.709193335672372 +96 0.5541428371102486 2.469654795647139 1.3292842757665846 +91 -0.732047074282118 -2.6885559423815857 -2.1949168022734056 +154 -2.5136766428597386 3.590700279102351 -0.059374328708080126 +19 -6.161653279730477 -2.8765306398549155 2.4409492942004887 +120 3.4942280062726017 -3.9836089343560284 -3.098191865520773 +138 -1.392154916395345 -2.6054126458670575 -0.5249503554366697 +9 -1.4056559546036238 -7.532778826245055 -1.3371688664267456 +150 0.5460808983742688 1.1289965684546914 0.03903574349628039 +38 7.617629027425106 5.411105913171608 -2.660628272394109 +172 1.971077098016012 -2.934759849810778 -2.6385133345793075 +29 -0.8567705552974654 6.938534740571189 1.1877415743187205 +87 -2.465817251368031 -0.5425773738872799 -0.8367656554342691 +93 -3.238874163573574 -1.2524540618123574 0.7858441913773856 +195 0.6658739747764354 -1.3905513374439 -4.4817269197268415 +149 4.447455849494194 -3.5745477247727786 -0.5281496993793596 +25 3.022648709593685 0.43914951689799137 -0.6775610151451638 +35 1.3277674074899293 0.9468507964705938 -3.026965993493294 +116 3.907132307739244 1.560341819486881 -2.1186616218198884 +5 -3.10241641974574 6.10623002683338 -0.012215259748321432 +112 -2.863798374154691 0.5948426813836486 0.35177484162268213 +152 1.5766503044655036 -0.41730163186181074 1.996501964828515 +132 -2.0634425438904502 -6.992874517268254 -0.2451331836568511 +173 0.12455810167557121 0.14574198963840712 2.9966160518510416 +73 -0.10493988646970537 0.013265555839272553 -3.9096646776491677 +161 -0.7682600042762859 1.8026603641653332 -2.7660568636516665 +78 -4.598805320864625 -0.6966368634003359 -2.729429984123398 +11 -0.9758381654162251 0.5227854122925947 0.3448945101494703 +84 2.841479136799234 0.22602223675017963 -1.9286282882334902 +90 -1.170230656537341 -0.6922100007103397 1.00880686523509 +36 -1.555842370975647 0.5631255749042902 -1.1019837065378786 +98 2.0124676556916246 0.6570695281160257 5.910973495167498 +56 -0.022897610961461763 5.352337474059436 -7.2334429828662445 +109 -0.08981766099555996 -2.306157996649536 -0.3829489041252826 +115 -0.9773922652842171 -1.500230307176322 -3.510085314469408 +124 -1.1435154328225432 2.1646855444941977 -2.677614067537958 +121 -0.6489305438370466 -5.377205725667324 6.410392354489873 +80 -2.184720009719291 -4.6495239027996265 -0.404219915911962 +101 -1.8277373470288034 -0.16307514644975357 -4.871062878988115 +4 5.273572229084702 -6.329640548895822 -0.10537322064888095 +81 -3.237096839577087 -1.2899510482475711 -0.501749653216555 +6 -2.850185972190969 -0.9855865922331829 1.2879726986158606 +166 -0.71207408822265 -1.941276610007301 -0.46670672944069197 +40 2.5501094465369287 -4.1121537776062285 -3.7730629800493616 +127 0.9391826983400688 -0.23609028118969985 -0.8428319005564415 +104 -2.889702758235898 2.6026465825944647 1.733501739951787 +151 1.0239383010373613 4.20250515830853 -2.5188428027750676 +60 0.8768242700054026 -1.4452870366932915 4.607166615214986 +168 2.6499467008683806 0.15351519699868008 -2.4173199831848433 +51 -2.7001470663696083 2.298050292705142 -1.8727439352999022 +97 4.077411493370136 -0.49363711607361804 2.618893169202227 +103 -0.7976469434966291 -2.8296239792549494 -3.1085019733170576 +163 1.4239083858918546 -1.7152330037559187 -3.7262201886107413 +175 2.28608354457103 -5.013082617544787 1.9463144730607622 +158 2.364724804444635 -1.417965451640216 3.3110988056960116 +85 2.634049111053192 2.030183273599258 -1.1156959044778305 +63 -2.5594596368644584 6.5807348164634165 1.2216612365119401 +133 0.11496856368877509 -1.3029278864933922 0.3137832360475215 +67 3.2847742901460815 -3.509493405431694 2.207008202574443 +83 2.570557721108847 -0.3717669874940476 0.19918880069367745 +162 3.0399699011039054 1.3116112714661063 2.674382531726811 +170 -1.38109599459742 3.3822351643604485 2.3645182440787846 +181 -3.229104480841883 0.4809626947427979 -1.0038042842684436 +71 3.9132675825937917 1.4930647145750953 -2.169388439547446 +31 0.2080392077753374 -0.7175240437209078 5.244126748535574 +139 -3.2722113265821164 2.403646928095839 4.89007181946881 +3 0.23844888496446556 -1.2064671761077215 -3.765272552252597 +108 1.9533881124972572 2.2407632376201616 2.7809203919337717 +16 -2.546655497698339 -2.9475172512416052 5.679217575496501 +110 -2.0619258300646304 -2.5135908125338595 -1.9634278842507895 +50 2.7297022478135924 -1.7023753942716038 0.9305543045166054 +191 -5.08419299322051 0.0712033790584315 4.019663294315123 +187 -1.1602692653736124 0.6592040176624594 -0.9276587772961099 +180 3.9270482120535912 0.7337070019018614 -6.1521791130682715 +30 2.146405625539158 -4.470711382216746 2.4389136902743624 +2 -2.164694698633498 -3.946038803617009 -6.932908852758065 +17 -5.0136316664846525 -4.910395378878622 0.2531438520391362 +7 6.405139093241594 -0.029320522419797518 -2.4556700372713656 +164 -4.71978957162196 0.7565882723845814 -7.804804192177828 +69 0.585325244096323 -4.172549570259053 1.421305529899283 +61 -1.2969434367599055 0.21371727493194503 -5.996553017036012 +34 0.836211095631979 4.842199148306591 -0.264740483545493 +43 4.973431404758735 -3.0161637272673114 0.6585207320279483 +177 1.9972180553856484 2.8405653312769714 3.7936113983454574 +179 -1.8016662165736297 0.17922718595288942 1.675961420609039 +65 -0.3262344061357664 4.502937830108041 -1.6925046570602365 +27 3.2148912674329595 -4.265923914349978 0.20837858074619325 +58 -2.5148141053183966 -3.410776250506333 -4.126435252324821 +32 -3.9688004644027894 -4.975859333985981 -0.31037975343014773 +26 -1.8868624613436276 -0.6784023280861808 -6.9019978159434325 +142 -2.2655622806415803 5.065238482808602 -0.5612653461135326 +100 -3.1689440110918863 3.611829368506524 -5.535634657025687 +184 1.155071447769214 1.3970696009831187 5.21877428678114 +105 -1.0527289600189955 -0.359868396602688 -4.314898952688254 +75 1.1126434309490583 7.161365583137096 -6.8797286508213995 +99 -2.2511573267704605 4.325930022921806 -4.536664094156967 +193 -1.8538759123569282 -0.3771359852226918 1.3265167612281819 +33 4.043103770190031 -2.463191434468879 0.2825585567463736 +79 0.8247934215179962 -0.8593180918731026 1.8075425908507756 +92 -1.9872298962564725 4.526116206000229 5.875185828559399 +165 -0.9325271408003691 1.9234746099504088 0.09139445808177141 +199 -2.4466143796538278 -3.5392337118481905 0.07336564176962056 +70 1.6955535004916 2.7542669443749292 -2.844202030673744 +146 -2.7188074197448584 1.8546678027188679 3.404472056065058 +106 1.6207845192963544 1.2164210998710923 7.1450165172108 +52 6.210256198054289 -2.1514980948844977 -3.0246733234381606 +86 -4.166581136807711 -0.379450814784322 -2.11423926273923 +197 -2.0944322960049 2.1097024434581955 -1.5699756741420037 +185 0.496431323422778 -0.673746468047717 1.6256733179580487 +190 3.5894390751435754 -0.5232916689073732 -2.5898259464521436 +145 -5.060692392767518 -3.604348262830216 8.963086293155014 +131 -1.7493649096325448 1.9215551392824017 -5.654561521157757 +156 3.0486560090093078 0.7623397112130897 -0.6623326467666147 +10 -0.3025813929631971 3.8012367067722552 1.7944918683195408 +196 0.20779509519657535 1.1724947587327104 -3.2497684331092898 +143 0.1615216816901657 0.541965759645283 -0.3699391852573772 +13 0.3416281793998905 2.006587618812918 -4.356326172952984 +59 1.6542517855144645 1.9404536050042447 2.6385288647359855 +186 -3.4589984191612237 4.344929883747252 -2.4261876990284055 +136 -1.052237178030063 1.7981079687785935 1.5452947189881334 +192 -1.8283033036376375 -2.1460456664281984 0.4532252919540826 +113 -0.07210257811201395 0.4448121853700756 0.4002442722770919 +62 0.07671657245048122 3.988794018720988 -1.5215067553007326 +74 -6.261763851450271 6.841230877971418 0.19948931371832682 +118 -4.55843930988713 0.7045880922983706 -1.5541929923380147 +117 -1.7138030815767766 -2.2218466460669197 -2.4862510267677966 +23 3.4139900995951797 -1.2153416151189098 1.5870813641624815 +171 2.9673700826094715 -2.730113253007238 -0.013674771129509489 +94 -1.559158449433541 -4.089352807642382 -4.9936243516296415 +41 0.05830786336808787 1.0332428056957692 -1.4731928753411638 +141 2.0403501209228514 0.38114816689047215 0.2637593201666092 +159 -2.276370624127765 -5.5130320242721425 -2.201507053272948 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 new file mode 100644 index 0000000000..d48c9e654f --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.348412656724513 -8.709686235988883 -8.4270990310572 0 -1 1 +57 1 -6.076254771403757 -9.286388884881402 -7.702702502017148 1 0 0 +82 1 -7.550388144071918 -7.009510153923324 -10.103430125234938 0 0 0 +65 1 -10.007477542149314 -8.426774632489874 11.409858756818739 0 -1 -1 +8 1 -7.164995520412905 -11.038468804393306 -10.58636480246276 0 1 1 +49 1 -0.45959797061569213 -8.711842576893478 -7.759689256680434 0 1 0 +54 1 4.335836096446666 -9.860468354448713 -9.596810041931791 0 -1 1 +102 1 2.5723817340883883 -6.321599469181216 -10.836018784654463 1 -1 -1 +114 1 3.9633708583907534 -8.59122246718616 -6.211421303718058 -1 0 1 +128 1 1.6111319524977374 11.42178725036819 -7.424763349756333 0 0 -2 +157 1 6.676723241532642 -6.249807038476984 -7.434858543313773 -1 0 1 +20 1 8.180031746693997 -11.224906976375225 -9.914700910890055 0 1 0 +147 1 10.552595438745763 -5.846535200951102 -9.39377855844701 -1 2 0 +169 1 9.349136090221942 -8.979140149397233 -6.8265579785125965 0 1 1 +123 1 -6.855446583817184 -3.2640394531559696 -10.949254791001273 -1 0 -1 +130 1 -6.535059536526429 -2.567484128692307 -7.041716414515715 -1 1 0 +140 1 -9.06855871809178 -1.3542845787289544 -9.224892837601802 -1 1 0 +153 1 -4.569518029474378 -5.203914109037015 -8.781875667281184 0 1 0 +129 1 -0.2299073567614939 -5.077417463604178 -8.55580527821163 0 1 1 +148 1 -3.144987560803104 -2.0908434236033218 -9.879429686918634 0 0 0 +119 1 -3.5411143846194992 -3.8360561641889532 10.696563632316428 0 -1 -1 +134 1 -0.04545170129816967 -0.3594090384455699 -8.557611667254108 -1 0 2 +174 1 3.1061081743214345 -1.9799957752444968 -10.724581364205001 -1 1 -1 +189 1 2.8769937819916396 -1.3674240720053161 -6.389788220787231 0 0 2 +28 1 6.237115641177313 -1.1545998190288946 -9.272228860156012 0 0 -1 +1 1 7.549394959535029 -2.854734791893552 -6.538590887699934 1 -1 0 +24 1 10.883729099000904 -2.1271876989337706 -8.117545982704844 0 -1 1 +176 1 10.267930709995003 -3.6438442151633126 -4.343476582694092 0 0 0 +182 1 -10.786266284256198 0.5593263120798149 -5.188887623332871 0 1 -1 +137 1 -8.253864841052525 3.7298295620111226 -8.568533527553154 -1 1 0 +89 1 -5.794201120520342 0.9380076791670935 -8.557102414588634 0 0 -1 +88 1 -3.290466618666769 2.666597373561615 -10.965754432660972 0 1 -1 +160 1 -0.18201736379451042 5.440877252854083 -6.045408976448922 0 0 1 +125 1 -3.2721098231201498 3.482326329512073 -7.20800643325733 0 1 0 +167 1 2.6838478408055124 2.662941774470184 -7.446400398896404 0 1 0 +107 1 2.461769881852174 1.4723823486650787 -11.23948224456525 -1 1 1 +45 1 -0.32643148409171074 3.4132158246810462 -9.890588978502432 0 1 0 +95 1 7.12050576869771 1.8830305880227627 -11.021337217501824 0 2 -1 +111 1 11.302810293745958 1.3519264206984616 -8.432303785348612 0 1 1 +37 1 7.499987535787309 1.5957548452787924 -7.727720303674275 1 0 2 +53 1 9.440512427968931 5.294797843867766 -10.137582763727357 -1 -1 1 +122 1 -8.602536179448315 11.512272015578171 -7.106756749836173 2 -1 -1 +126 1 -8.684507097426447 9.102724910576027 -10.228076159133025 0 0 -1 +72 1 -11.212168106684132 7.24750708554837 10.879317278944692 2 0 0 +144 1 -3.026583839716779 -9.884067057114146 -9.895519067990667 0 1 1 +135 1 -0.0021296445465068814 7.861337183488864 -8.408004375424728 1 0 0 +183 1 2.8552963287326403 5.197557014594176 -10.04944592034365 0 0 0 +155 1 3.763607040992876 9.197661654352766 -9.383705258407385 0 0 0 +21 1 6.743085276662367 6.819489412060577 -8.245771575257553 1 0 0 +66 1 9.52403312105875 7.459476022143324 -6.138585785756646 -2 -1 0 +42 1 9.12856561120073 9.359598065403702 -10.255808680046007 -1 1 0 +22 1 11.084937277836246 10.7346270298744 -6.189336343510782 -1 0 0 +47 1 -8.79851480543095 -8.030651717047036 -5.3995272670275725 1 2 1 +77 1 -6.824604399212273 -10.927075660857042 -3.894519486445894 1 -1 1 +18 1 -10.638894292838417 -11.301447222259686 -3.92180055862298 1 0 -1 +46 1 11.290286356240586 -7.674430365874162 -4.055829279128204 1 0 -2 +14 1 -9.506577112536185 -7.441780453176744 -2.0080876276818103 -1 0 2 +178 1 -4.543756730558393 -8.097143654115143 -4.784790404681888 2 1 0 +48 1 -3.2444312260629573 -10.940861821243079 -6.354255167480908 1 1 -1 +55 1 -0.9464860706310958 -6.285996525353373 -4.30908825600282 -1 0 -1 +12 1 -1.856123326430506 -9.517447392023085 -2.3435724928975645 -1 0 2 +15 1 6.077305695814157 -8.166300444221115 0.7448836933119019 -1 0 -1 +64 1 2.7452944971646858 -10.558129575009149 -1.730050297615053 1 1 0 +44 1 8.116024736633927 -6.297043957734161 -3.618119081228304 -1 0 1 +188 1 9.990490631214506 -8.453825757862562 -0.7847723993749525 -1 0 0 +200 1 -9.371399961242005 -3.371895968187197 -5.193597997968697 -1 0 0 +198 1 -7.163187216472317 -1.1934858004192783 -2.2622400054633864 0 0 1 +76 1 -9.919958613706985 -3.040871792288106 -1.4149931903428534 1 0 0 +194 1 -6.743945843921815 -5.005230021567819 -2.613393963742155 0 1 -1 +68 1 -2.5671189668335317 -3.434435519320573 -6.1465461411366 0 1 1 +96 1 -3.430661147431614 -4.018545052073527 -2.021400662533695 -1 2 0 +91 1 2.9683873682514026 -6.254217834947031 -2.3589109971891737 1 -1 -1 +154 1 -0.2218228203315391 -2.902150057925404 -2.9725706529414366 -1 2 0 +19 1 3.2665435171804194 -1.9817522239515633 -2.3096363660640975 0 1 -1 +120 1 6.609146288179666 -2.2318382061287565 -2.808377349441308 1 1 1 +138 1 9.631227201052864 -4.547744518411388 -0.6709487904267171 -1 1 -1 +9 1 7.596887391638223 -2.0237588049028696 0.6051605861836649 0 0 1 +150 1 -10.044973671786467 2.0147581633676452 -1.3897952482345524 1 -1 1 +38 1 -5.7978106400822895 4.770632320137689 -4.758054319452569 1 0 2 +172 1 -9.658785222083136 4.026164557116778 -4.942402258050777 0 0 2 +152 1 11.431334273176418 -0.4623515239881826 -1.925450909701469 -2 -1 0 +29 1 -7.909238416570071 7.61624491229837 2.2042493522591258 1 -1 -1 +87 1 -3.3103551172038665 -0.94337019011639 -3.5930404382745955 0 -1 1 +93 1 -6.2863195662557 0.9404795536165196 -4.898675396085437 0 -1 1 +195 1 1.0245553543549981 0.20159488775043144 -3.679042462676364 1 -1 3 +149 1 -2.269526344184385 2.8074136653426387 -2.5814855370744945 1 0 0 +25 1 4.649154714287583 1.2394738761102164 -0.6186508337325307 -1 0 1 +35 1 2.8516234465534787 3.745844200453856 -3.7667964552544286 1 -1 0 +5 1 5.795606814798939 1.5285888723891716 -4.179888075744685 0 -1 -1 +116 1 6.001522247841404 5.755884373452364 -5.02433183427119 0 1 0 +112 1 4.844016623012077 5.465934695953432 -0.25432767294668557 -1 0 0 +132 1 8.53939720077536 1.8213558063438606 -1.3830903771567364 0 0 0 +173 1 9.062655610340409 3.8664027467280935 -5.47150892329001 0 0 1 +73 1 -9.979257287380412 7.98839910326609 -6.702836934882303 0 -2 1 +161 1 -11.50425364162053 7.022415057658153 -3.488322518144713 2 0 2 +78 1 -1.7469625877850241 10.184158454427994 -1.7648096425042503 1 -2 1 +11 1 4.444644958846757 11.851997915189173 -4.933412264679578 0 1 1 +84 1 2.459047681073617 7.373812748831801 -5.213139361825189 1 0 0 +90 1 6.1482860548874925 9.307626902509035 -0.9026751698054234 0 -1 1 +36 1 1.9695381713294537 7.78336838361963 -1.7729647147442544 2 -1 0 +98 1 8.527874795717773 7.612035599231426 -2.9325216125652 -1 0 0 +56 1 7.282783408448612 10.400831236794666 -6.728973679619628 -1 0 1 +109 1 9.156728968120607 11.308407539099598 -0.9040861597803378 -1 1 1 +115 1 -7.309621980156194 -8.117595813105002 2.8126740615279595 1 0 0 +124 1 -11.142069858043358 -8.82667541719755 4.10932707265772 1 0 -2 +121 1 -8.21003433895173 -10.089956822420406 6.660752548831763 0 1 -1 +80 1 -4.909425537698309 -7.256236799158399 -0.2747148144591023 0 0 1 +101 1 -4.312342956814611 -8.070113074572049 4.879741561255617 1 3 1 +4 1 1.5494925162428856 10.03102296069128 4.602107842780676 -1 -1 -1 +81 1 7.27113702294054 -8.472013640467047 6.625505444757195 -1 1 1 +6 1 8.885736885591768 -10.557271403060728 2.7878338185404203 1 1 0 +166 1 -8.69650192512206 -5.07362796560642 4.236148217669305 0 2 0 +40 1 -6.987849762900474 -4.511534637942379 1.3175075163680883 1 1 0 +127 1 -5.689629608203652 -2.3907227510814337 3.9463589292537864 0 -1 0 +104 1 -0.4397363632556015 -0.6165598923688651 -0.3313279093278112 -1 0 -1 +151 1 0.4300685018079994 -6.441488457556783 0.38045612640805615 0 1 2 +60 1 -2.3217820522915846 -2.1704723730197557 5.333166404467865 0 1 0 +168 1 3.9149834819211655 -3.3791911515481985 0.7567189672094479 -1 1 -1 +51 1 0.398133835057336 -3.3931578730294385 3.016370538231655 0 0 -1 +97 1 2.1573351041413034 -0.0855884286300217 2.2286851783702524 0 -1 -1 +103 1 3.9664988893980713 -1.064731427067052 6.037166605284854 -1 2 0 +163 1 -10.709566329240587 -2.7332402144894417 2.2660820588417665 0 -1 0 +175 1 5.762755562271241 -3.3856559659466114 4.002375112428048 -1 1 0 +158 1 8.862173003831924 -6.538751027751994 2.8769202677556542 -1 0 -1 +85 1 10.229250850148503 -0.01502947727190853 5.300096059690905 1 0 1 +63 1 -8.263417127255543 -0.18022873161562153 1.17510825734459 -1 0 1 +133 1 -10.480766232506394 2.392923584409271 3.720879727063737 1 1 0 +67 1 -6.544234163722191 3.501038541004621 3.191437971422375 1 0 0 +83 1 -3.849802400718045 0.6646468573486004 2.7446055069817703 0 -2 1 +162 1 0.6098193007635196 -0.05324811248282152 6.154363200071202 0 0 0 +170 1 -2.6786368359767714 4.255168732248176 6.435570102352074 -1 1 -2 +181 1 -5.252793067773865 0.7761154003139943 5.79909696611136 -1 1 -1 +71 1 1.6452911952303246 4.06622820161267 -0.5166203216146883 0 -1 -1 +31 1 1.0738987741436463 4.15303788757344 6.141061091921109 0 -2 0 +139 1 3.8104659718300624 3.693576878280304 3.384062081506274 -1 2 0 +3 1 10.9858871588246 1.2545617976234098 0.8570931258327192 0 -1 1 +108 1 6.174388178357244 0.8538858651722911 3.6472942727893374 1 1 0 +16 1 8.97282237909764 3.5943899325206274 4.02632096928566 0 -2 1 +110 1 -11.336507152318017 5.947474598331584 3.14037651741927 0 0 -2 +50 1 -7.046202899905131 11.083294806174674 4.036430331092051 0 0 0 +191 1 -8.508890702823583 6.994301261898876 5.5988324620755945 1 -1 0 +187 1 -10.749519222803974 11.280267500561628 5.071750333310352 1 1 0 +180 1 -1.0032349913124285 6.140237973021502 -1.7436540397788036 1 -1 2 +2 1 -1.7946548786825645 5.404613901091388 2.68002365908378 1 -2 -1 +30 1 -0.6282593143948212 8.881746166196663 1.2420280890418454 1 -2 -1 +17 1 -1.9971151666590217 8.252473054961822 5.30244560397972 -2 0 -1 +7 1 4.0488432159812255 8.81693522673231 1.6114995620401231 -1 0 1 +164 1 1.873438403508949 6.222826359057496 2.2533705281578316 -1 0 0 +69 1 4.6051775335846745 6.921132428828564 5.128620799236167 0 -2 -1 +61 1 10.268176907196304 5.08172043450454 -0.642274843845057 -1 -2 0 +34 1 7.601946368008498 9.256904252690223 2.406585955238384 0 0 -1 +43 1 7.165450199452092 6.0290506218302085 2.4419163969738023 -1 -2 1 +177 1 8.561622776612461 7.244917835893727 5.602147565752702 -1 1 -1 +179 1 11.750057623239174 -11.228395927014766 -10.487778908482419 -1 3 2 +27 1 -10.974224751020245 -11.635298968202441 8.509409995684443 1 1 1 +58 1 -9.692847117546727 -6.99702076150861 8.089242933510139 -1 0 -1 +32 1 -6.165044846878473 -5.3531372054847 6.419358142287187 2 1 -2 +26 1 -5.15775210282499 -8.509724647787523 9.35521475378418 1 0 0 +142 1 -2.2394120995772013 -6.757001235575803 8.53817557952535 2 1 0 +100 1 -1.562747759528225 -10.930435349230905 6.862796976881519 1 2 0 +184 1 7.329483236732028 -7.477553906204161 -11.457403276020457 0 1 2 +105 1 1.3124523565691075 -7.852976862538032 4.005035595809602 0 0 -1 +75 1 4.597924698307231 -6.283694211187047 5.476806400599068 0 -1 0 +99 1 1.716773073271929 -10.998458790026556 10.715096401091909 0 0 0 +193 1 2.1325154242736666 -6.931854968739277 9.419307764840358 1 1 -1 +33 1 4.48712925680286 -11.671378658171115 7.267170381111049 0 -1 0 +79 1 8.573107089496888 11.611228502272368 5.983087465760138 -1 0 0 +92 1 9.81601068917706 -9.527916362770739 11.159627680682005 0 2 -1 +165 1 -9.2113400341349 -3.219195257680457 7.288219778779848 0 0 0 +199 1 -6.931272020823427 -5.000130571946396 9.88597891452116 0 -1 1 +70 1 -5.507541862888313 -2.393142934597723 7.807143673901248 0 1 1 +146 1 -1.4771503758916822 -0.5410305896302106 11.279923136114263 2 1 1 +106 1 -1.3651808664767915 -2.54616781259121 8.590647351661577 0 0 -1 +52 1 0.6779843498698166 -3.7311606456725768 11.453754175953545 0 0 0 +86 1 5.4031998049641565 -4.549788149287394 8.596350093940629 -1 0 1 +197 1 1.573548668834416 -4.687213943022477 7.1278633337641 -1 0 -1 +185 1 2.1532991864501554 -0.6046775517606129 10.000779301772766 -2 1 -2 +190 1 7.401787297285096 -0.2505978640044338 9.870584022136198 0 0 -1 +145 1 7.111702440333872 -3.6540730490844453 -11.814469255040187 -1 -2 0 +131 1 11.130905707249603 -5.281990426153451 6.209567942496238 1 0 0 +156 1 -5.482768650143603 -0.4312680407464029 11.466238929392272 0 -1 -1 +10 1 -9.053182404201642 -0.711645217691651 4.8230146575990815 0 0 2 +196 1 -9.337441409320208 0.1609718702750058 8.663781619737854 1 2 1 +143 1 -7.17068301465806 3.0756929715249197 8.74321294778271 1 0 0 +13 1 -11.784452395762827 3.289072175663378 7.001527553636599 -1 -1 1 +59 1 -3.4378714190696336 1.7721863061771366 9.36771463550879 1 -1 1 +186 1 0.1662370132365254 2.5243181917810595 9.709168312215267 1 1 0 +136 1 3.4094152339708126 2.153729603693705 8.008621315534214 0 -1 -3 +192 1 10.489678729236587 2.4935818679754185 9.842929691077494 1 1 1 +113 1 7.1536296108923345 2.1797090477435894 6.8304033834765505 -1 -1 -1 +62 1 3.9169396613561496 6.861682724751661 8.976027690230366 1 0 0 +74 1 -8.118378807759774 9.793902614888827 8.932362315849124 1 -1 0 +118 1 -11.58583737453999 8.536873240765573 7.014861349235567 0 1 0 +117 1 -5.277108589074334 11.352800033973235 7.597327201748058 -1 -1 0 +23 1 -5.157626384085098 5.75340956696832 11.215724105856438 0 0 -2 +171 1 -4.306475221375887 7.1666374724202555 7.827635610104089 0 2 -2 +94 1 0.5173001347371304 9.700900025717369 9.033047100941438 -1 0 0 +41 1 5.490142462338115 11.510392579949611 11.613725539319557 0 0 -1 +141 1 9.87566572043054 5.774221219191659 9.0665289512053 1 -1 -1 +159 1 9.686865955901812 9.753371327924555 9.75057962979839 0 -1 0 + +Velocities + +39 -1.9399818993193945 -6.2245952285602995 3.5338548174142916 +57 1.5287860491005811 -2.72214429330134 2.2456706435699694 +82 4.011405667244886 1.5297461738282854 -0.00848199347765205 +65 -8.99687886174914 -3.5904944014362874 -0.24257004026483364 +8 1.3456043077490425 -2.128460026427474 0.5438548397418695 +49 3.9804563992312922 -6.033137289721198 -2.4992971438276896 +54 -0.8797092038138496 -4.4441361344158485 -1.158307352101043 +102 -1.6073661483672754 -6.3013772766305705 -0.8971841583061024 +114 4.952776653242985 1.9508143607180544 -4.637659613505405 +128 -1.269058654850369 2.9109256516813193 0.4053666332013952 +157 -1.0484348115580815 1.3302695757858152 -2.3230656835483483 +20 1.6286859684439459 0.8384182438479687 3.337320080806048 +147 1.7009416069818912 -1.6078420463299883 0.41513271531119245 +169 4.488200687237288 -6.490934602483694 0.13987631822178037 +123 -2.8913963004993426 7.445402407235762 -0.2708525381058624 +130 -1.3405859620177862 1.4399831113332697 0.048073865645907876 +140 5.071347652434061 -0.6702612789643095 4.605780995472893 +153 -3.7972143859475698 -0.514917067426214 -4.9181301157390225 +129 -0.524987732421045 -3.209340969084892 2.932495986872108 +148 -5.447057077277419 -1.4060679681657386 -5.483184347880067 +119 -2.5629223421862375 1.3882127095818109 2.83591016397441 +134 -1.3621064953428361 4.288456433365155 -1.6190478694645496 +174 1.7758446648889914 4.86331991854285 1.1265592480566544 +189 -2.1997618638118066 -5.481413979755256 -1.086026577758521 +28 0.47277982211285713 -2.417172577737755 -1.932990476216946 +1 0.6703800334847378 0.767366418061703 0.19201532965448842 +24 0.04297238333671294 5.144308305848863 0.078997482901074 +176 0.4965479246937361 -0.13321844730810892 -0.13420426694661658 +182 -0.03943631525057928 -0.4576897656157408 5.202139202652978 +137 3.3038160138315282 -2.8142339694373977 5.5902387847740025 +89 -0.7210799083306686 1.5890809944259632 -0.7203455040724582 +88 1.0693506358892855 0.004219772825099388 -0.34637529725335453 +160 2.818428049318086 3.2244292228167537 -4.494216600884747 +125 0.42818621594139183 3.1889923789665167 -0.2889418149701054 +167 -1.634028108672504 2.274964875925839 -2.5010575325085713 +107 -2.275260397982265 0.40965124117591156 3.7368455922538386 +45 -0.7001662440449031 1.119455401379465 0.23148546097076927 +95 5.262372995855103 -2.4350400461030928 4.204427583146448 +111 -2.8606969082837232 -2.7980553847036016 -5.595977877258418 +37 -2.2899225677006445 -0.8948602257995134 -0.4803200724258121 +53 3.002131309420766 2.6120771462261168 -0.9952903525863226 +122 0.8674217257039606 -7.734997952666523 0.833404061351757 +126 -1.1420613062006533 -4.550118096866477 -4.2790463933780245 +72 -1.8516741228057083 5.947761028964626 1.6102399224289305 +144 -1.1917460086100382 5.214371411898472 2.577241700331775 +135 -0.6560595442322588 -5.810339924107932 -4.318267593309593 +183 -10.386809746296331 1.1897898885572993 3.451816626760367 +155 -5.162635743080924 -0.24765733386766664 -0.9110712844247615 +21 -4.2563878171076155 -3.402344841498928 -6.759865341543254 +66 3.892260841699981 -3.872668437572034 -0.3337143786545691 +42 0.4166666127989469 6.100606589949791 -1.4397576055696024 +22 0.3608663266598049 -0.6522614903150212 1.896193166731318 +47 -5.327073086748509 -3.490472671050769 -0.07383525372930849 +77 -0.978728222397191 3.4020107799172736 1.0077489411757843 +18 -0.4650542307772494 2.9718359172432747 1.4633800163719572 +46 -3.027050149464662 4.17167624743228 -1.827230734431756 +14 -0.09677720578549692 -2.7193038262530447 1.7914199983541117 +178 3.696002315695369 1.6876713658009856 -4.672832052845037 +48 3.983692149992739 -1.1833239408832328 -4.299433489091069 +55 1.4078039475385906 2.056934505867413 3.7406982539078393 +12 -6.525348764219679 3.3122244911450394 2.6197769407714624 +15 -3.3141834562011994 0.5054069138851847 -2.97725365266652 +64 -7.771910612976191 -4.581106933347833 -0.41638292972909086 +44 1.6412238745050067 -1.8908109366759165 -0.06612343065785803 +188 -3.5844091539515395 1.8268122826497 -0.2374993089904055 +200 7.894813073634868 0.057995156825788374 -2.5771892403060033 +198 2.1286980919165597 1.0207578884216715 -2.002608806720997 +76 -4.082585877193767 -3.634723448931757 0.6497689857802457 +194 -5.141422516595061 -5.385767090831518 4.1044833771883145 +68 -1.3677719930905985 1.0604606148180302 -1.7254671966550923 +96 -2.592687583785919 -0.5546395167068001 0.38605262002135754 +91 -4.294011884932044 -4.480411411848511 4.543287343202344 +154 1.815487275814105 -0.07008532516876564 -4.441392134697374 +19 -0.24976249513756998 1.579721447829149 -1.7421975373515703 +120 1.804118819372854 0.520165481785893 -0.866356354838586 +138 0.7160603181741005 -3.5316114730742316 2.8815518324723897 +9 -4.1756988875943195 2.0672991466342374 -0.8825046873416664 +150 1.815083623557248 2.773051884794719 1.9746918971798604 +38 -1.502458122060807 2.504120522003904 3.5630087040476006 +172 2.925371783317832 -4.008067088721308 2.95272814084428 +152 -4.6300230395213555 -1.2429914909034638 -3.848634119515747 +29 2.326120452340355 2.730479927388889 -4.850062460498464 +87 -3.7757652246448092 -2.144244861787354 1.0169754355289107 +93 -2.0873983214067384 0.5358760575940038 -0.23325341995082138 +195 -1.4168233936677792 2.3959259540484603 -2.0506018284590537 +149 2.2841089396850274 0.26447423100144896 -0.8987301521306412 +25 2.8990369033774663 3.4475964151025584 0.06622887609588958 +35 -3.439056984685437 3.8288190767067634 0.5330155111995796 +5 1.1832213107046619 -0.3877998693431248 -1.369194610956917 +116 -2.0849829431786198 -1.7654561629509715 0.6633937705540919 +112 -0.5822227923488573 0.3013831835536517 -4.31387983328802 +132 -4.968232076425547 -0.6461873308157724 3.153818258163696 +173 -2.606365772909947 -3.929167709306097 -2.1504295970222675 +73 1.5595598163445097 -0.6161933298135185 6.6258235518245785 +161 5.1614226588847085 4.911303681383577 3.193451794720913 +78 2.399770604666089 -1.7368694007148553 3.13840955491289 +11 -0.1723279344217883 3.2117525787482495 -5.003125430736541 +84 -3.0246026160032238 -0.10349126829912314 -2.244471367403812 +90 2.2752472907587027 0.5192129247104318 1.739661062051631 +36 3.3131943405122586 -4.945706489020841 0.7304326039438429 +98 2.222390966846857 2.076728811998776 2.745752031197498 +56 3.2308827790046997 2.20226369176158 -0.16256864643069302 +109 -5.432919034165497 -0.6507653252627013 -2.288197504123378 +115 3.2470353212929526 -7.326498442980268 2.0848162375252226 +124 3.23326108206676 -1.3727946801269606 -2.040624527813595 +121 4.263689866797482 2.7161360736926117 -0.9353436003014414 +80 -3.183923910858363 -1.409115057483441 0.20655585479413852 +101 1.8647413072811272 -5.138741167769708 1.449442652238715 +4 -4.059920467104848 2.021712460074869 4.0296908872357 +81 -1.4496413113665318 0.22275997734715647 1.0204012050853233 +6 -2.5319674910604797 2.921972066778776 -0.5937144564354684 +166 -1.7032554189048639 0.4271452228969883 -3.929596648952609 +40 -3.2997667945300786 1.7569019147151133 0.9556994202850172 +127 -4.094479436855724 1.004173845399162 -0.957686162248562 +104 5.839775077994146 0.5614942472461542 1.3388300846640222 +151 0.03681474392662332 4.158212179208171 3.087410074045597 +60 -0.5753595098363337 -1.944185172990125 -8.542198180005448 +168 1.356831683366837 -2.3643099268420564 3.337777267437989 +51 0.594767745409305 2.5443394223058013 -0.5744844027146594 +97 -1.4592614460552826 -2.9896997140291077 4.468909988652328 +103 -1.7464552873436274 -2.725030040682925 -4.682984068370838 +163 -1.6811327453491027 1.203374785043913 -2.52756154734346 +175 -2.36073693749339 -3.2083472883959288 -2.522379591971816 +158 2.0901462213047384 -0.8790568223757592 2.862349710125339 +85 1.6955544698562546 1.329401432748634 1.339424168209504 +63 -0.9387866016534254 -4.101481886236126 2.5768942521591023 +133 -3.3950934863801323 -1.1853227351766746 -0.8938618367927571 +67 -4.93636647331341 -5.808321017441839 -1.5826220082758682 +83 -4.348910184667013 0.5721399223517865 -0.7197270365001088 +162 1.9809720767805532 -3.8356819219002203 -1.5209517397218844 +170 -4.1339290337428345 5.621618700525048 -1.5836709740423311 +181 1.1838126543084162 -1.2107904166348504 5.997389392830687 +71 -3.6322706258882382 0.4573448065249036 -3.4819929402094774 +31 1.5672965345476493 -2.5171072174405418 -5.016079150444441 +139 2.347944365043533 5.087068349207903 -1.4373175728413294 +3 -0.6897541703497496 -5.2109972760726215 -3.1967261285849102 +108 2.1632029794076 -2.3278780023196486 -2.2165896316468543 +16 0.5518752214748219 1.7443113317844785 -0.3914314868799459 +110 0.6545696772446776 -2.3972319991341955 4.869786319607602 +50 3.4589447101316337 -3.631848006300771 3.113137145447494 +191 -1.2968299225913498 0.4433703369757638 -1.5568387599668925 +187 1.9322905031758904 1.7630376183510783 -1.713007037692872 +180 6.8380544057940424 1.3883512491464782 2.155270210489675 +2 -0.9447291546303294 -0.0513923732527517 -3.0672808505869886 +30 1.6158645533289293 3.1155851081317145 -2.1710811001472363 +17 -1.543787339459575 3.1374805002054007 -4.413979305864849 +7 4.040936876599553 1.9639386370487468 3.3637852508743804 +164 1.4392327984967968 -0.8254697339648331 -0.33613984139186426 +69 4.683013019846548 -1.4001774602376138 2.7483283024733463 +61 4.859801586904617 0.3945575299928299 -0.36030106753723035 +34 2.144274218554215 0.30058665232035375 1.6815154302941946 +43 -2.262284846661947 -1.933549681130589 -1.7228919249476684 +177 -0.04379017544723046 -3.0489629385721146 0.8031465712034731 +179 0.1618165357299699 -0.15566873489305255 -1.156913000807537 +27 2.280685460437968 0.25990101487970774 2.9095092475822724 +58 -0.6292223334449243 -1.0309616093739953 -3.156937935356546 +32 -0.011281818866179849 -0.9102886141888968 3.1492471714773824 +26 0.3704942133027209 -1.9855236287495084 -1.1813125622083982 +142 -1.0547774115337973 9.781673444693524 -0.5474605098370294 +100 -2.466739505935093 -2.401234723424822 -0.9166143227115303 +184 0.998183931841219 0.5555844351868584 -0.24866844568146534 +105 -0.9091746414938665 -0.6852682268807229 -0.5049408850325867 +75 -1.2458876998256998 -3.70960636595479 -1.979594195572476 +99 4.943544682867021 -2.8438984768476887 -2.114165836507449 +193 1.6648153391738203 1.9396654116178769 -2.563892949279256 +33 -1.6878161438450656 0.40927910646954185 0.5582734801758544 +79 -3.538909021595642 3.805204310016289 2.7765516255860625 +92 -2.394452859130453 -1.9459314788883335 -4.8163793839903395 +165 5.545976326258468 -1.4902648191681507 -2.852217343260048 +199 6.057154285340822 -2.785333961235231 -3.9368802597200943 +70 4.428171740986177 -4.8728670167946255 3.9631873121213563 +146 3.789706894596731 -0.4960046634434 2.7214958472715947 +106 -0.23074985036276763 -8.713636612175375 4.005748004431039 +52 -0.7237533363087905 4.119548929665377 -2.8963629157006965 +86 -0.7790443173139772 8.632440811261022 1.3650149071424797 +197 1.0158635207501077 -0.6540677867631334 -1.9286092656946883 +185 0.14103906323580015 -1.9230099439242179 -2.9613897973588497 +190 -6.016428738140042 -1.2480913921594763 3.6835279433237065 +145 2.079579027486713 7.671127892348986 -1.2249224435341195 +131 -0.32590310182334836 -2.4757135143210527 -1.108006743304219 +156 1.5441602101522276 -4.3012365664752 2.152192470473115 +10 -1.9251615561320725 7.7941703098856605 1.152489777841718 +196 -2.5417164626144206 -2.322970333327737 6.382288207464665 +143 1.1146704068320736 2.2068798409995507 4.003296941736723 +13 0.2218873541633033 2.002339450538451 -3.9278426768807844 +59 -1.1249725039613747 -1.38236183692768 0.6273981188606278 +186 0.17954184943335427 -2.3932954696372053 -0.7313011465358523 +136 -0.6086309213506338 3.5713339511273894 -3.8080329205654193 +192 -2.4502215368224705 -4.545932925209442 -1.62934516857554 +113 -3.3214500416678074 4.555014566016373 7.353766374710929 +62 -4.358088896189819 -5.982496403026446 2.5501878477362316 +74 -0.5539329584507672 2.794170243271062 -2.161412931865338 +118 -1.979611801168517 3.0336891371182197 1.2515672466968413 +117 -2.6346443065380387 -6.52420382221947 -2.3221165776786097 +23 6.421824321311546 1.7253174765287 -9.160076509970361 +171 2.1156964930224973 3.568443790163169 -3.4488134770961105 +94 2.1701428589622624 4.886850980047828 3.260178593455835 +41 6.033712104492915 2.2785562972718627 -1.4849735175385876 +141 1.4706522295431979 -1.8195923066965298 0.019053288005804775 +159 -4.554564437682667 0.05936456417819991 -1.932073129933284 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 new file mode 100644 index 0000000000..ca36561e7a --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.394704135733114 -8.775565826160808 -8.397941096758792 0 -1 1 +57 1 -6.0931281896189695 -9.344348749599556 -7.681818125657076 1 0 0 +82 1 -7.510250310452092 -7.015516388660279 -10.07082880494168 0 0 0 +47 1 -8.77559664157391 -8.051556457641034 -5.414795391990417 1 2 1 +8 1 -7.186535453159322 -11.036850971616609 -10.567777816088821 0 1 1 +49 1 -0.39620530191825165 -8.622783800666731 -7.678166749572666 0 1 0 +184 1 7.393521813917142 -7.373039726272342 -11.446331826056564 0 1 2 +54 1 4.350458272629415 -9.857224313433228 -9.653286924521744 0 -1 1 +114 1 3.8685603455186985 -8.598956542283156 -6.307174409208557 -1 0 1 +128 1 1.5947628847115236 11.435941489344966 -7.415359628481937 0 0 -2 +102 1 2.581923114006006 -6.377657392511939 -10.762619336954629 1 -1 -1 +157 1 6.660414728640671 -6.277919775804619 -7.429265669038422 -1 0 1 +20 1 8.111607396483045 -11.231970200759829 -9.923403990974927 0 1 0 +147 1 10.627447337694411 -5.758860591417452 -9.410039814850826 -1 2 0 +169 1 9.360516562348877 -8.959647419481891 -6.858134439225374 0 1 1 +123 1 -6.81574278381186 -3.257465879140419 -10.90227212401971 -1 0 -1 +182 1 -10.83184823295899 0.6211210726593173 -5.225302920513499 0 1 -1 +130 1 -6.48675645240678 -2.4960330140097717 -7.149887944428669 -1 1 0 +140 1 -9.06689925915267 -1.3404094442689392 -9.265230651366284 -1 1 0 +153 1 -4.596115154274846 -5.2269288210583476 -8.762725686367764 0 1 0 +129 1 -0.18023204267520931 -5.069487595679249 -8.563855383994511 0 1 1 +148 1 -3.129776386379185 -2.132302209017619 -9.812957672584432 0 0 0 +68 1 -2.5326692981381176 -3.433323674590902 -6.08354364753642 0 1 1 +119 1 -3.563878018222407 -3.8548716132518166 10.583657201237452 0 -1 -1 +174 1 3.1103832548223167 -1.970524067942005 -10.720839500990373 -1 1 -1 +134 1 -0.0533798609747933 -0.3943397369034881 -8.568909963478589 -1 0 2 +189 1 2.8780134490012608 -1.3406833227009611 -6.386852522463116 0 0 2 +28 1 6.229563951867086 -1.1530156323854972 -9.327046250788925 0 0 -1 +1 1 7.525938759972945 -2.8198310481116913 -6.5604190503711814 1 -1 0 +24 1 10.94065283830757 -2.1209886921600436 -8.153560298060441 0 -1 1 +89 1 -5.78369558828959 0.914992281244533 -8.554571507812774 0 0 -1 +137 1 -8.18813666088715 3.7027977864495334 -8.645965827566897 -1 1 0 +88 1 -3.2799196205792844 2.576742862817614 -11.027465080959736 0 1 -1 +160 1 -0.2557418723462786 5.44151330793023 -5.976638045093324 0 0 1 +125 1 -3.2953557120100467 3.5116994482831103 -7.1553118740511215 0 1 0 +167 1 2.6725243652102173 2.638087495697569 -7.466301426847419 0 1 0 +107 1 2.5245946528561056 1.4391466346789628 -11.24156229950114 -1 1 1 +45 1 -0.29130191021650537 3.390022307884845 -9.780519849519312 0 1 0 +95 1 7.067732497970006 1.8275651232311958 -11.06782765028197 0 2 -1 +111 1 11.286054617943643 1.4415120259015062 -8.377487796984207 0 1 1 +37 1 7.567677172981714 1.512274859816151 -7.66702414977977 1 0 2 +53 1 9.41684489904846 5.317555173980882 -10.149115122842298 -1 -1 1 +122 1 -8.696560905496263 11.52907921791907 -7.072120720309414 2 -1 -1 +126 1 -8.701961655974642 9.131336810565264 -10.209192118557077 0 0 -1 +72 1 -11.181614439635823 7.328242947804642 10.873052780217858 2 0 0 +144 1 -3.063630044241759 -9.888584626042347 -9.88620302733954 0 1 1 +135 1 -0.011770197460421628 7.809248750526247 -8.433472830923051 1 0 0 +183 1 2.868185059788288 5.159526867067117 -10.074475497261854 0 0 0 +155 1 3.7046375990422384 9.18029420434672 -9.355401725486303 0 0 0 +21 1 6.6545915304717695 6.763201059850044 -8.264144019598284 1 0 0 +66 1 9.504750400993288 7.515486524178964 -6.171582593350192 -2 -1 0 +22 1 11.084351988266622 10.76412261505721 -6.106373064516015 -1 0 0 +42 1 9.142378798766934 9.296638377937079 -10.23790547780751 -1 1 0 +77 1 -6.875408369074396 -10.905367618463075 -3.8927601705390593 1 -1 1 +18 1 -10.586419483635158 -11.318597225412478 -3.865523315987396 1 0 -1 +46 1 11.248362092754824 -7.711534097612761 -3.9950725578324935 1 0 -2 +14 1 -9.503351845338017 -7.486629728113749 -2.029636008930268 -1 0 2 +178 1 -4.577490558383545 -8.077630279121967 -4.852591089043882 2 1 0 +48 1 -3.2127534742600403 -10.982725180284804 -6.34369805529311 1 1 -1 +55 1 -0.9448027936788463 -6.214616210957371 -4.309013304243614 -1 0 -1 +12 1 -1.8077376902517912 -9.51331251139922 -2.294135008818479 -1 0 2 +15 1 6.0707891099498035 -8.158735340051752 0.7389132882736256 -1 0 -1 +64 1 2.744794419170617 -10.568743032836894 -1.6560300803721786 1 1 0 +44 1 8.059994426810258 -6.349491556263628 -3.6188994660194567 -1 0 1 +188 1 10.007211181841205 -8.471311544163584 -0.7301030264655086 -1 0 0 +200 1 -9.361429934020506 -3.325582783501604 -5.251291205351098 -1 0 0 +198 1 -7.206783651218934 -1.1768543952383812 -2.2878728904921033 0 0 1 +76 1 -9.957900853453992 -2.990392708748729 -1.4836790089375538 1 0 0 +194 1 -6.720915931526202 -5.0514840317136205 -2.6178060083265535 0 1 -1 +96 1 -3.442998842345119 -4.030752937282784 -2.1099501345166054 -1 2 0 +104 1 -0.4344464897733502 -0.6370527730950448 -0.3065766310174318 -1 0 -1 +91 1 3.028414651691776 -6.371562707358944 -2.3012007885342207 1 -1 -1 +154 1 -0.18450456920986724 -2.8959245063427446 -2.9727341046372144 -1 2 0 +19 1 3.3110202139376677 -2.0069344123928587 -2.3036519362171575 0 1 -1 +176 1 10.315295502792623 -3.712962672865248 -4.262743726209571 0 0 0 +120 1 6.599910778171431 -2.290014983742207 -2.708516274908039 1 1 1 +138 1 9.70090444039391 -4.510671194156078 -0.7586380570561282 -1 1 -1 +9 1 7.581463530555666 -2.0591591013924426 0.5576192070111965 0 0 1 +150 1 -9.916366847902271 1.9274446583917424 -1.3280546499490278 1 -1 1 +38 1 -5.810864806174543 4.79569434382538 -4.7432663890343605 1 0 2 +172 1 -9.649044476681059 4.000883539130775 -4.9787866594630685 0 0 2 +87 1 -3.293106763914671 -0.9728697280200684 -3.5717383721780784 0 -1 1 +93 1 -6.290260113883048 1.000513447709075 -4.873943848533926 0 -1 1 +195 1 0.9143548729177553 0.18149461265281985 -3.719891858874817 1 -1 3 +149 1 -2.3007300445292564 2.7637958268752776 -2.589523265551314 1 0 0 +25 1 4.621842262318463 1.3043820546828728 -0.6225207492747167 -1 0 1 +35 1 2.847846769015831 3.7484794005209174 -3.7317005078406185 1 -1 0 +5 1 5.76859301522971 1.4821693744986142 -4.192625078793096 0 -1 -1 +116 1 5.980108401532309 5.771931805152196 -4.952107221267599 0 1 0 +112 1 4.9004069037624305 5.449030478588363 -0.25381811981375635 -1 0 0 +152 1 11.427575396440815 -0.5215078327180223 -1.9270850902641319 -2 -1 0 +132 1 8.550991064218966 1.8728424902700131 -1.3413841671493485 0 0 0 +173 1 8.98824885831321 3.8266779448060135 -5.54469830676447 0 0 1 +73 1 -9.970827412932536 8.006037772956901 -6.707069562638264 0 -2 1 +29 1 -7.851850658958549 7.656691482687513 2.2522623824361467 1 -1 -1 +161 1 -11.447924236091708 7.060851422709438 -3.5858559166646984 2 0 2 +78 1 -1.7537678607411138 10.085056705494843 -1.7540835643783588 1 -2 1 +11 1 4.471756401488951 11.779896969440827 -4.946674669424063 0 1 1 +84 1 2.43612195340992 7.404092397911457 -5.290554303714214 1 0 0 +90 1 6.2047805444381146 9.344776673352051 -0.9025295949725489 0 -1 1 +36 1 1.9413202066882462 7.760257880084115 -1.7928253633196454 2 -1 0 +98 1 8.489759189718113 7.59448375625753 -2.9903904190005255 -1 0 0 +56 1 7.283347233840352 10.49272575590101 -6.717344837699539 -1 0 1 +109 1 9.256731562506227 11.306927316729052 -0.9017849515922478 -1 1 1 +115 1 -7.271375340356332 -8.164250984794014 2.885007836656445 1 0 0 +124 1 -11.095529268087242 -8.923461918340646 4.126541576799873 1 0 -2 +121 1 -8.243366755262961 -10.114098944495577 6.642910506934619 0 1 -1 +80 1 -4.970941376701066 -7.256796443574398 -0.2694927115936565 0 0 1 +151 1 0.35720010482862147 -6.473326344145772 0.3145914251441795 0 1 2 +4 1 1.490868001691105 10.008505441456391 4.6538607757363515 -1 -1 -1 +6 1 9.00182583692019 -10.573496261667716 2.7405792887239087 1 1 0 +166 1 -8.709149836110669 -5.121301291304988 4.221356992297617 0 2 0 +40 1 -6.986302058442625 -4.546619094873101 1.2165687777692458 1 1 0 +127 1 -5.703890672733537 -2.4808733861641947 3.9258140668162143 0 -1 0 +60 1 -2.3900969955392997 -2.1240248283806444 5.301270425252238 0 1 0 +168 1 3.975110510651529 -3.4413029165097235 0.7867580630241555 -1 1 -1 +51 1 0.36128571956442473 -3.39012855469405 2.9987895355425387 0 0 -1 +97 1 2.1619059504545017 -0.14370659092792337 2.253550136735452 0 -1 -1 +103 1 4.021656515073349 -0.9827338117732367 6.042568640726292 -1 2 0 +163 1 -10.59690034092717 -2.73669268553396 2.3250010477277816 0 -1 0 +175 1 5.789631011184049 -3.417672117461432 3.9954654049476215 -1 1 0 +158 1 8.907482269205014 -6.491283319059688 2.9624073267859536 -1 0 -1 +85 1 10.197413661591135 -0.012917762754849087 5.257965818060175 1 0 1 +63 1 -8.188715623008076 -0.18029853692280418 1.160315648952679 -1 0 1 +133 1 -10.49518128239182 2.3754251515033395 3.670523930057962 1 1 0 +67 1 -6.57681506296786 3.490338685255813 3.2777499682226248 1 0 0 +83 1 -3.8395282904771557 0.6878472661538524 2.789698047147944 0 -2 1 +181 1 -5.242185082676098 0.757446996867543 5.798435988392239 -1 1 -1 +162 1 0.5730435311953745 0.02538554697642809 6.131446692962922 0 0 0 +71 1 1.5861291557437986 4.031923436354859 -0.5668685974116876 0 -1 -1 +31 1 1.1084648099889496 4.166735507593387 6.199029350547128 0 -2 0 +139 1 3.8934885611865404 3.644680090821751 3.3699758952172827 -1 2 0 +3 1 11.031167120250961 1.2297818113295769 0.8240448962619134 0 -1 1 +108 1 6.151774132335838 0.9127260755469919 3.630865862972541 1 1 0 +16 1 8.948393568215273 3.5697656211117277 4.019424538349256 0 -2 1 +110 1 -11.360902504880006 5.931262380786016 3.1386340545012104 0 0 -2 +50 1 -7.03855700568745 11.1587737863648 4.038018652970141 0 0 0 +191 1 -8.539592833531575 6.98957805034221 5.576163396973422 1 -1 0 +187 1 -10.749591400235348 11.27674482179097 5.078753839959464 1 1 0 +180 1 -1.0497509784332344 6.113751500784257 -1.8125940782158025 1 -1 2 +2 1 -1.7901048404834796 5.395364205758469 2.706946913090345 1 -2 -1 +30 1 -0.609763114135145 8.866708941315338 1.2567907242718874 1 -2 -1 +7 1 4.024360795442131 8.792731325824677 1.6316831819568236 -1 0 1 +164 1 1.9253904296798758 6.2539753963352425 2.2732172727821673 -1 0 0 +69 1 4.589943704480154 6.860175335740237 5.107742575629615 0 -2 -1 +61 1 10.211708813407666 5.048929362482134 -0.6556133826774401 -1 -2 0 +34 1 7.618123086186067 9.260791062852595 2.410253158978456 0 0 -1 +43 1 7.187831963553112 6.047643259558733 2.377231426556367 -1 -2 1 +177 1 8.53679514766192 7.2855280107021585 5.618179930120522 -1 1 -1 +65 1 -10.025744517789033 -8.43398132011017 11.42484399314975 0 -1 -1 +27 1 -10.94664003963282 -11.66367183635281 8.50586002909509 1 1 1 +58 1 -9.736423247717525 -6.9374057905213675 8.120131077653108 -1 0 -1 +26 1 -5.214988898132063 -8.488979255655 9.322140672840906 1 0 0 +142 1 -2.2289627568453696 -6.732212289220556 8.533930418433167 2 1 0 +101 1 -4.332868168974628 -8.046497536008985 4.908195000324994 1 3 1 +100 1 -1.5781140115056829 -10.89378955359733 6.845196027213777 1 2 0 +105 1 1.348709072973532 -7.840212526420486 3.935309569976617 0 0 -1 +75 1 4.538409842632715 -6.347596431637598 5.462073088539682 0 -1 0 +99 1 1.681804464017192 -11.02047184883833 10.743929007254543 0 0 0 +193 1 2.131527690130696 -6.895966349546285 9.427352746134135 1 1 -1 +33 1 4.441375653691135 -11.736850231117081 7.202677955581144 0 -1 0 +81 1 7.255373647519644 -8.53916396071646 6.739789624034124 -1 1 1 +92 1 9.790634573312333 -9.44185811686149 11.159147618448468 0 2 -1 +131 1 11.167512844489337 -5.2910720883824744 6.1780456625725 1 0 0 +32 1 -6.188065315477864 -5.388148534056967 6.4630859734577015 2 1 -2 +165 1 -9.199411318810375 -3.239575676768024 7.39142666230393 0 0 0 +199 1 -6.937479844200535 -4.998516463158538 9.811426478379644 0 -1 1 +70 1 -5.484149755229003 -2.3316100376807256 7.82342156113301 0 1 1 +146 1 -1.4782561675061032 -0.5332293079309558 11.298322053799005 2 1 1 +106 1 -1.299565649633866 -2.547377817344993 8.672457149378053 0 0 -1 +86 1 5.4346476876843255 -4.567525864857576 8.586496749161867 -1 0 1 +52 1 0.6258963928325112 -3.6737913184680213 11.408468473681546 0 0 0 +197 1 1.6655903827098761 -4.690360650696893 7.1487356646988935 -1 0 -1 +185 1 2.1215529597432052 -0.6042753779764993 10.00914541981377 -2 1 -2 +145 1 7.122063254971888 -3.6848122349525525 -11.806135592932787 -1 -2 0 +156 1 -5.464187808325629 -0.39192954326422935 11.38371879051662 0 -1 -1 +10 1 -9.035521158465771 -0.7757159430461369 4.809652747733452 0 0 2 +196 1 -9.335669158910619 0.22813232884729473 8.66176404595545 1 2 1 +143 1 -7.124352690053236 3.030922198080938 8.687337455424057 1 0 0 +13 1 -11.772101478818819 3.2748279418542197 6.990058907086091 -1 -1 1 +170 1 -2.6686912671072918 4.2637019013785284 6.493175161410804 -1 1 -2 +59 1 -3.414884055242947 1.7144589247064204 9.304818354414252 1 -1 1 +190 1 7.431647314963107 -0.2323681547056703 9.930387554553988 0 0 -1 +186 1 0.12403907626679356 2.5751847736553266 9.610847507588266 1 1 0 +136 1 3.4038632456152635 2.1695685652264665 7.948376142475482 0 -1 -3 +62 1 3.9322597596563718 6.930006246409542 8.985009369790514 1 0 0 +192 1 10.419594684028056 2.5035467156582776 9.806945423286493 1 1 1 +113 1 7.193391146269118 2.2362428283193516 6.875806515902987 -1 -1 -1 +179 1 11.834426610265067 -11.194697762969987 -10.475928756799647 -1 3 2 +74 1 -8.13998220698503 9.794354756748188 9.006589181804868 1 -1 0 +118 1 -11.66384578850255 8.468830152015009 7.042404750007243 0 1 0 +117 1 -5.315240522733173 11.32072783429444 7.576721087819581 -1 -1 0 +23 1 -5.138619088737474 5.725030905668137 11.239725943022542 0 0 -2 +171 1 -4.330917401708549 7.140228396638214 7.942565065680071 0 2 -2 +17 1 -2.03596415813805 8.313925455397243 5.2823718467129375 -2 0 -1 +94 1 0.5232518791432845 9.687616975679045 9.044820921363916 -1 0 0 +79 1 8.56918534055184 11.565534359174451 5.948120961320791 -1 0 0 +41 1 5.45739715811315 11.541960137674769 11.642369134799488 0 0 -1 +141 1 9.892948341443592 5.76405276568962 9.068370836458591 1 -1 -1 +159 1 9.60684214528172 9.743113663992652 9.758679903521092 0 -1 0 + +Velocities + +39 -2.179321628468343 1.1511761233721014 -0.5234785181560597 +57 -6.53120961304823 2.2544161501487334 -1.2373865721091248 +82 -1.0543302569480935 -1.2919030991113425 -2.688794866729753 +47 1.4420685217894869 -0.5747049377538087 0.6848122481945966 +8 2.36242269061923 3.5603470370323436 1.4936669774368116 +49 -0.6083156247744255 -1.170955618423765 -3.8346753413107364 +184 3.2429732085760055 -3.3821697881066015 -7.235911314720436 +54 -3.6115695852161833 0.0106170916100512 5.665158101271987 +114 6.929262289695876 4.643270489304085 -2.432510904848287 +128 3.7837119455630903 -0.5425190416852157 -0.9248832742343969 +102 -5.730330621950312 2.5925672733788283 -4.330025077474401 +157 -0.16543207126613158 -3.935307993847579 1.876153422628358 +20 -2.5674917416750285 7.261116339316168 -0.2822364811608604 +147 3.957269802164221 -0.44334252499690296 1.8428688293334772 +169 -0.43761432062493966 -2.7004091328373003 -1.9616354437812995 +123 0.4419336641195504 1.661879969268821 -0.34576656499174563 +182 -2.755633666515818 2.89026397900542 -3.3064689855078004 +130 0.4228585869964945 -2.6339270059626747 2.3472759619296717 +140 -2.5258615952943133 4.5464360654810925 -2.960299517136603 +153 2.614799199811544 -6.997005129983971 -0.4675266931999429 +129 -1.0794701392816852 -0.7999027589273617 -1.3594765973927763 +148 -2.5441459127388772 -5.738540142837333 1.2458734580393733 +68 -0.8806574381084391 3.664356747058979 4.498638804868755 +119 1.348535842985886 -1.9096618944303452 1.6705192446304495 +174 0.23536625265167066 3.432430764653958 -0.9841797613553105 +134 0.26301203065712264 2.9239481371691687 4.198089422305616 +189 -5.106229336056745 1.3598593078850199 -5.0921887654096665 +28 -0.5789581538284776 4.678352716038949 1.6083556088979694 +1 4.3168451733041335 -0.8087879863432109 -1.1510010508143134 +24 4.684129190758672 0.5864820180144825 1.3599272674223446 +89 1.2931815025110984 -1.7192563446283065 -3.2675358462468287 +137 -2.489381057507014 1.3936843668930472 -3.4953181455890334 +88 5.564916491075967 0.8520321811715912 -4.447122865446203 +160 -0.07033878109043368 2.2522705799844327 1.9030072089658323 +125 -1.5185131407725638 0.6804743431846004 -2.389477187487043 +167 -3.6035218377687275 -1.9787464624356907 1.2495634883162925 +107 -4.50061384293538 -4.128984940089246 -1.940600692273992 +45 -2.0130680589133294 1.0097638511181886 -1.9327875523898734 +95 -1.8894050626509937 -4.373548537324043 0.32709687823368594 +111 -4.9090211058158335 -4.89034728498546 -4.4838347069372535 +37 -0.7827825654937912 0.2606671310038102 1.2648209822548744 +53 -3.3248176554427693 -1.934526339006954 -2.2700456945424197 +122 2.3544797713703187 -0.1174286295452037 -1.1080357975092663 +126 -1.8232106805443349 -4.42954489421542 3.9468260248902474 +72 -0.3083487798866145 7.089424978098924 -4.065977117594069 +144 -3.209546353795563 2.7953912155418355 -1.9419952653204642 +135 2.825460830342647 -1.3242735854960683 -1.061464548303972 +183 -0.6219322132099675 4.350176294595897 -3.2016653855084876 +155 -4.16183730251878 -4.394917007094668 3.143265712814128 +21 1.042679461197399 -3.76474130433989 3.307467644481217 +66 -0.5660353999856405 -0.9094642274226821 -0.5314610131608182 +22 -1.709804393279522 2.6955272721787336 6.847933865416769 +42 1.5723865718421481 1.2482884329237185 2.4822430118654624 +77 1.0256281250413677 0.6998122284735013 2.9532003047278765 +18 -3.421972744387341 -0.5274519950694775 -4.133682641337289 +46 2.168436016686143 1.0804778012063694 -4.320033516090909 +14 -4.0164283054824255 0.49834440962343196 -0.8290451948901274 +178 -1.7412819488092 2.798973205265782 -0.479900827844132 +48 -0.555572193190021 -2.2271111327857946 -5.48753500392571 +55 -0.2945098160209474 -2.3597197684570634 -1.323571695006608 +12 2.648780275608345 -5.627798255886156 3.878499085658468 +15 5.08064047237585 10.983886551374368 -3.8614562219189974 +64 4.528407739688303 3.5669581487847277 -1.59783436247384 +44 0.6179240842533569 4.733042665051045 3.2581525303469463 +188 -7.148050937863482 -0.9829624495370496 -0.8418403492142479 +200 -2.1181786226695647 -0.7796260516164706 -2.0505857854477805 +198 -0.41864716042364125 2.296081055566785 0.29109905683884685 +76 3.589037248934578 3.9784201870774147 -0.18396191505765547 +194 3.2793423730519953 -0.6090514771278666 -3.4934826993710537 +96 -1.781539941975932 -4.363514711154816 4.864062078072237 +104 1.408163209882818 -2.2024070797001714 1.13197301326935 +91 0.7549842936282545 -1.8949946215618456 -1.0202618871629823 +154 -3.58496442590166 0.6965660533263317 -1.9948941159972786 +19 1.1538547086598117 4.352147462832853 0.5698931598819479 +176 6.6158635134989 -2.4436529370166666 -7.921148144074609 +120 1.9770896033272432 5.325440429480748 0.4321682589452387 +138 -2.434142355712014 -4.211844174503549 3.7463686848024356 +9 -7.9556317081134775 1.3611081846148716 1.1973651519179334 +150 7.132627873294173 -1.1589700932996243 -0.3531633921451265 +38 -2.373885424533282 -1.6670776794732187 7.126244784839699 +172 -4.190332426742245 1.4971407429268737 -2.1038522992559976 +87 3.8705371644824407 0.6946282376038537 -0.5718475935933448 +93 1.3514689577122314 2.2886635029067657 1.1457291529838165 +195 0.8294761589431854 6.809445622982572 -4.490681006002271 +149 4.665694837020095 -3.8971221183097815 -7.000247317496072 +25 -1.4227504585025186 2.666757793916314 -4.2485642256584795 +35 2.0433487025942068 2.1539055294115 -2.682708261193331 +5 -3.648704562720594 -0.39330823945136234 0.15528838477335327 +116 2.764952659364006 3.2308857608345534 -0.538944143891585 +112 1.7976356559372615 -1.540357698562047 -2.170928793825917 +152 -2.4572877205036923 -1.6206485240807629 -4.85936004694647 +132 4.802107956404735 -0.11013197470116909 0.6674735986355181 +173 -0.7045077946396323 0.6277364102624156 1.4282110726540087 +73 -3.4535983591604964 -1.3273163733693092 3.631166806617851 +29 -5.742750315320132 4.210335165654985 -3.183862358662845 +161 0.7207671082657183 -2.639249856838032 1.2031913703667394 +78 1.9802499580941673 3.892356471093276 -6.0300544674355 +11 0.3710597317170738 3.014897507875772 7.0674999285689495 +84 0.06314153271125988 -4.938702818012672 2.3405049696166014 +90 -3.021721770486999 0.5895782968475963 -0.883462541486843 +36 0.6115261475891951 3.326758596635819 5.305093464697983 +98 -3.289247327924386 -0.7716659861479829 -0.8061979190797803 +56 -2.484208615656381 -0.7583806019455193 2.000293738990754 +109 4.065544877208817 -0.31468790514138334 0.3860037578404895 +115 -1.5583103456503846 -4.034490286401138 0.5420000897756707 +124 2.716664944254732 1.195693130251065 -1.0534283229167152 +121 8.492299287405391 -0.8573607139000322 2.0906896396885357 +80 -4.269726737071596 1.290253084422534 1.3756246647776993 +151 0.17922239204385892 -5.243344038190157 -1.7214465623209987 +4 -1.5287457726003018 4.545253326761756 0.4075652200807629 +6 -5.5555965267113505 5.196757149002673 -2.131768740002899 +166 3.8192709965319924 8.287983828276944 -1.2203929922517287 +40 3.450300769917062 1.3679263003539135 -5.713912913407013 +127 -1.8550057408599427 0.2529213554001156 4.292787610095508 +60 -0.4570467791684108 2.1995625338737512 0.38684023826685754 +168 -1.1461639744415708 -3.7753008221986715 -0.7069362633693567 +51 4.246427854086795 2.2660286121479016 -0.17525536000106454 +97 -0.45920058079801923 2.3672214881822935 2.918793131685986 +103 2.8457407886760415 5.079818233132883 -1.6831372889932052 +163 6.588786306029201 2.961102097923318 0.12898108224833468 +175 -0.7784000842847736 0.05239163186710383 4.783927411692968 +158 1.324975092911766 5.716483065795907 -2.766582829578808 +85 1.126575470046233 1.8878210873276244 -0.3160540074040886 +63 0.26385610607819265 -1.0518690744177137 4.681584068045189 +133 -0.8004471826186864 6.474544076922776 1.4133211461125943 +67 3.6157553514613374 3.5767340310447207 0.22045279936244222 +83 -1.0062072078141164 -6.493845317833074 -5.600689394569981 +181 -1.9698774782124704 -2.4967875449198838 -1.482046688397622 +162 -2.904567214261779 4.609525946829769 -4.773883794319192 +71 4.704149679704777 3.1523586525426124 4.57547323305684 +31 -1.5901553457672002 -3.05689507101266 2.2039810687618497 +139 -2.695407001366337 2.151237461783768 -2.283708689815052 +3 -0.46766817551787454 -3.140857693103965 0.4361924390516714 +108 0.1913617703423478 -2.71581239158428 0.6724779385423365 +16 -0.5574602967458635 2.869089341747036 3.246617986586125 +110 -3.2935781644783413 -4.906537822882089 2.429950659174858 +50 1.3517081278566716 0.7979565345760338 -0.4185472621695281 +191 -6.186669509381163 1.5069910278978673 -3.122140179713244 +187 0.8559064953620825 0.3957056787517148 0.9088293844669495 +180 0.221714052316844 3.344232199120801 0.5800459730217239 +2 2.3994296631460794 -2.8375195813060388 -1.0887178593496891 +30 1.2210690766888224 3.5899619104376446 0.08151741673684687 +7 2.7726111769463913 0.687615055956059 0.37410979119832144 +164 -1.1931898641891907 -1.3539824930215878 -3.3405462160564703 +69 1.9731979197688503 -3.2571194324245205 1.6749831681024951 +61 3.1823016504442476 -3.0315743307115213 0.8747268024881065 +34 0.42940760329491323 -0.8546757769020348 0.7046464666351262 +43 -1.2834304624987016 -0.32585553857664296 0.40311374457538895 +177 -4.156106157869977 -1.1691085227558309 4.764406539360629 +65 0.7459698348800096 2.6999150256104985 -3.5548113977053744 +27 1.2331887682296838 -1.694381902758542 0.04304965560826135 +58 -6.154057979578904 -0.19938148972279413 -3.4163165607386854 +26 2.910747146350628 -2.990465499480819 -1.5258142005591657 +142 -2.6857404309480515 -0.4742647340730133 0.8619212003727141 +101 0.8564696967146533 -2.0546263222545185 5.004696469365843 +100 1.7773361390238631 3.5466656645190247 -4.741841979587642 +105 5.236015515046745 -7.745834640119119 -2.0944663177984997 +75 3.19034440896343 4.856191854526413 0.20239301909347396 +99 0.7372059827598996 0.8218000327204846 1.1962914445625328 +193 -5.54751039136509 -0.8984829893317632 -0.09804506747660646 +33 -0.9015609488918586 2.8634014710755875 -0.5142897564939601 +81 -4.226349362632615 0.4990338142221863 -3.177351469506789 +92 4.852938979419456 -0.5312580038435196 0.4444574326006344 +131 -6.780942865007681 0.2505331120455996 2.984671966978939 +32 2.043323184339133 -2.0915365663642502 0.3570674081797969 +165 1.772621337461088 5.624086428613788 -2.1958779155861525 +199 -4.655961690467214 -1.5582587292151853 -1.0372922469851396 +70 2.1009520029345854 -3.4367267457669444 0.3489118952393979 +146 1.1094627356046975 -3.7052416904893786 3.1151669468585044 +106 0.9244635796842038 -0.8697076449017062 -1.1271268628891515 +86 -2.4614440724404063 -1.1443915951868173 3.0472327038543923 +52 2.206997554373295 0.48895638167295574 7.813903343751546 +197 -4.43947099244034 0.3827402537789232 -6.114284477117655 +185 1.8450115502667273 -3.367103363338241 -2.7646657581326055 +145 -4.495233666659511 1.3255674480674051 -1.5848168476287035 +156 -1.1061826790673608 3.490100920043544 1.7425058587963753 +10 0.10888349121518726 -2.3346954910750384 0.3634642612209191 +196 -1.237862986215301 2.306399540514406 -5.426709024577362 +143 1.387043305733553 -2.3787136376519027 -0.20756141146550633 +13 2.2357687358768974 1.685714857075964 2.2457142840004356 +170 5.1889099023089535 2.9826822454922652 1.0755609101553643 +59 -1.712405925615148 -2.553137012160255 0.03926835373766702 +190 -1.7274645985224364 -0.0964601276780217 -0.8892867639051387 +186 -0.5051041743099376 2.0346977046537615 2.086897795173162 +136 1.6635288094047165 0.5254443611211371 1.8199836517530088 +62 0.7708640981248649 0.12152082573932288 1.7717141492471689 +192 -1.0422128532558474 -4.04447955732469 -1.926662726630305 +113 -4.472429838979146 -6.765621050808509 -3.003588999898843 +179 -1.7067254128417755 -7.980317775082368 -0.9140818138687279 +74 3.515578700667397 -5.09057685611017 -2.4373465493326076 +118 -3.836950473028625 -4.398228703366778 -0.9008313748045251 +117 1.2669363304661976 0.4817377004658103 -1.5641060379969072 +23 -3.023411190495862 0.4127754096885368 0.24116380806370397 +171 0.782437003849918 2.278657242176388 -1.477387925776958 +17 0.8979396881179555 -2.2139965953711083 -0.9661842759619532 +94 -2.2083649456241576 -0.3520697824173402 6.939477089019811 +79 -5.097477099334401 -1.1053765447054356 -0.5927717885602897 +41 2.717742851180541 -0.8197068618726784 -1.1670313842646072 +141 1.3223712852080913 -1.1251601779570968 2.4100632027817 +159 -3.979797713933269 1.5260607907829866 1.4624579807682239 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 new file mode 100644 index 0000000000..7fcb4a8bac --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.354249178970125 -8.813051919915168 -8.382969093379817 0 -1 1 +57 1 -6.095139656027609 -9.359263918713493 -7.698842353606457 1 0 0 +82 1 -7.493664607592135 -7.0059769885785474 -10.165574967227153 0 0 0 +8 1 -7.207830943811267 -11.030802786228156 -10.545758277848378 0 1 1 +49 1 -0.3707760358866739 -8.703874147846175 -7.734231800660862 0 1 0 +54 1 4.371171010756674 -9.822286390366472 -9.608608173022526 0 -1 1 +114 1 3.857478702816806 -8.583003039261015 -6.26115845444949 -1 0 1 +128 1 1.580452299690882 11.414121196534609 -7.383200117467098 0 0 -2 +102 1 2.6350731915864145 -6.397417482172074 -10.801961817246344 1 -1 -1 +157 1 6.611187455803048 -6.205022609136458 -7.392834911294685 -1 0 1 +20 1 8.102933091687992 -11.214330088075124 -9.936524774492973 0 1 0 +147 1 10.596045290286296 -5.759130098910738 -9.380762680610847 -1 2 0 +169 1 9.366630474689176 -8.921006522319503 -6.843673029579733 0 1 1 +123 1 -6.859009660270495 -3.2379537512590297 -10.864178266429683 -1 0 -1 +130 1 -6.577322046738903 -2.5106835965921164 -7.224326100490352 -1 1 0 +140 1 -9.107723436323155 -1.3229863757258506 -9.244986454221655 -1 1 0 +153 1 -4.548656766959874 -5.17967134910819 -8.787434718939945 0 1 0 +129 1 -0.17808656259561137 -5.023072792674526 -8.617493408883192 0 1 1 +148 1 -3.2601725736553027 -2.033844854035978 -9.777384129731104 0 0 0 +119 1 -3.5689822234610595 -3.8505044768944927 10.627709646886371 0 -1 -1 +174 1 3.140197534695247 -1.913882100151838 -10.76389374977719 -1 1 -1 +134 1 0.048608226174046365 -0.39555664243276595 -8.555122102444741 -1 0 2 +189 1 2.8889478385298655 -1.3768037709890826 -6.4534432907832056 0 0 2 +28 1 6.251824687614619 -1.150087307901578 -9.266876365488919 0 0 -1 +1 1 7.556173300837827 -2.8495110668506705 -6.5781416096142475 1 -1 0 +24 1 10.885498404916829 -2.163413929107282 -8.181530231530648 0 -1 1 +176 1 10.317143708012939 -3.6994503272775026 -4.285905348037859 0 0 0 +182 1 -10.866713794399553 0.5835390862478285 -5.190897922574198 0 1 -1 +137 1 -8.197336531384668 3.7710266805092836 -8.628333311872499 -1 1 0 +89 1 -5.830740775393367 0.9227024639457406 -8.56962226272939 0 0 -1 +88 1 -3.2174671278447153 2.596119117918313 -11.010039397757382 0 1 -1 +160 1 -0.16353319092958282 5.356569592952759 -6.027400461354258 0 0 1 +125 1 -3.2660565494911986 3.5402608994580014 -7.139474945270797 0 1 0 +107 1 2.5004686193441863 1.4213418016161157 -11.264390107008213 -1 1 1 +167 1 2.6306438675911963 2.7047021139073024 -7.49322777752869 0 1 0 +45 1 -0.26576210897417507 3.3660903959893673 -9.858663372020018 0 1 0 +95 1 7.02981932063029 1.8215081284089933 -11.08913793230704 0 2 -1 +111 1 11.249280516767561 1.4119125550850526 -8.355555586118154 0 1 1 +37 1 7.519477058425284 1.5490589443573544 -7.629176894794767 1 0 2 +53 1 9.42047942911636 5.244187392085703 -10.133263719784543 -1 -1 1 +122 1 -8.63992654505136 11.450404981587694 -7.075458716341785 2 -1 -1 +126 1 -8.723342916981192 9.13102883296233 -10.17466547482745 0 0 -1 +72 1 -11.206699277582317 7.297248005363309 10.79372604446887 2 0 0 +144 1 -3.0607758424636864 -9.877816322452732 -9.947243110943289 0 1 1 +135 1 -0.051808796348424835 7.83802622288054 -8.426793042584595 1 0 0 +183 1 2.8265474855254293 5.2650728973076095 -10.056888138059385 0 0 0 +155 1 3.7333346013160673 9.271985029918303 -9.380687277523048 0 0 0 +21 1 6.713007344355741 6.806136281598503 -8.223321187919673 1 0 0 +66 1 9.521874492322397 7.474069880889854 -6.18586873962963 -2 -1 0 +22 1 11.050170157856584 10.74761987425433 -6.194431008418831 -1 0 0 +42 1 9.124991617085433 9.313926068749339 -10.259091612355418 -1 1 0 +77 1 -6.847598261663958 -10.941109014822928 -3.892206492676891 1 -1 1 +47 1 -8.72137736883077 -8.020553455249186 -5.411695457067339 1 2 1 +46 1 11.333911554840483 -7.659682887184623 -4.080815689532784 1 0 -2 +18 1 -10.646224114047842 -11.295142102189118 -3.8769976756703564 1 0 -1 +14 1 -9.605745944890806 -7.401374860679573 -1.982921039201294 -1 0 2 +178 1 -4.564495057067056 -8.050510749495825 -4.8659978849512635 2 1 0 +48 1 -3.165816579392377 -10.956276319999837 -6.319173483966388 1 1 -1 +55 1 -0.9801312338979216 -6.257580408615657 -4.2669674058977485 -1 0 -1 +12 1 -1.844858616965503 -9.490670669998687 -2.2961766563429364 -1 0 2 +15 1 6.049786455655653 -8.189634166823847 0.7790760301881896 -1 0 -1 +64 1 2.7732180154018238 -10.586600242266561 -1.7220526985868578 1 1 0 +44 1 7.987685169786731 -6.317537693048875 -3.624602682973471 -1 0 1 +188 1 9.985693632064716 -8.552544016815117 -0.7260907476837022 -1 0 0 +200 1 -9.468913996814749 -3.332006112139499 -5.219156914346259 -1 0 0 +198 1 -7.176651640198091 -1.1963525306783946 -2.253714347543795 0 0 1 +76 1 -9.922127224407973 -2.9538091484944595 -1.5482866071777552 1 0 0 +194 1 -6.755129554954018 -4.9982944036574395 -2.6156955876752477 0 1 -1 +68 1 -2.4837259122195063 -3.490803572414407 -6.114089975980331 0 1 1 +96 1 -3.411864655652117 -4.073235933810771 -2.067669105620388 -1 2 0 +91 1 3.0280594613502636 -6.3376596415711255 -2.326898295867128 1 -1 -1 +154 1 -0.19811764587289105 -2.9629996027018635 -2.9145103486688195 -1 2 0 +19 1 3.201765959673939 -2.0909064907714274 -2.3150720129859153 0 1 -1 +120 1 6.666250093808799 -2.2381082538053363 -2.826357084420522 1 1 1 +138 1 9.709412364194842 -4.510669257803851 -0.7371785941816178 -1 1 -1 +9 1 7.576584804759921 -2.0173260225381977 0.5837619474494389 0 0 1 +150 1 -9.925148350003655 2.008414757334357 -1.3585989335940631 1 -1 1 +38 1 -5.774540065294694 4.703952130507923 -4.709776738882269 1 0 2 +172 1 -9.650643801070206 4.065753015545833 -4.8890536457268325 0 0 2 +152 1 11.354703841174967 -0.5574832611945055 -1.878354960063874 -2 -1 0 +29 1 -7.8756923654824735 7.618259977195223 2.1884603240114373 1 -1 -1 +87 1 -3.3182201208100697 -0.9619504843434044 -3.571516039019219 0 -1 1 +93 1 -6.22447967806385 0.9237017015404234 -4.899961705314269 0 -1 1 +195 1 0.9557760919893532 0.18190089307880442 -3.7530657563825116 1 -1 3 +149 1 -2.258211757279497 2.7869892960968605 -2.6067337721972543 1 0 0 +25 1 4.582659783463335 1.197304704789868 -0.6333382889463834 -1 0 1 +35 1 2.8340362437473665 3.775198295599683 -3.7220216498098746 1 -1 0 +5 1 5.712702262390174 1.525516395213053 -4.231454437885219 0 -1 -1 +116 1 5.993880302160488 5.819609728686341 -4.981314501727478 0 1 0 +112 1 4.993891288991353 5.44294004315121 -0.20000094912971011 -1 0 0 +132 1 8.553215140035688 1.848923908331039 -1.3929852223418029 0 0 0 +173 1 9.058614097754903 3.793989570565648 -5.529277027531151 0 0 1 +73 1 -9.97609370360327 8.001052498887105 -6.678871508542809 0 -2 1 +161 1 -11.443764897577033 7.1235053711641685 -3.5412879782897306 2 0 2 +78 1 -1.7946589875472476 10.140074782001498 -1.7188309657767924 1 -2 1 +11 1 4.48445505597226 -11.863465860429208 -4.995823112103199 0 2 1 +84 1 2.463379766571318 7.427030445050496 -5.251636426023569 1 0 0 +90 1 6.171978058160043 9.299313343642424 -0.9265676065333643 0 -1 1 +36 1 1.9133463519046003 7.719511929183511 -1.7420567765226709 2 -1 0 +56 1 7.255050752153057 10.433125182056429 -6.693622072998551 -1 0 1 +109 1 9.138840387988623 11.32849279657362 -0.9075432219499753 -1 1 1 +98 1 8.493633429672352 7.664253543281429 -2.9150549381854445 -1 0 0 +115 1 -7.310435599643078 -8.126317136056372 2.852881189844054 1 0 0 +124 1 -11.031652111608674 -8.829616358814924 4.11892916031843 1 0 -2 +121 1 -8.24719811507558 -10.102559907485395 6.644774570363861 0 1 -1 +80 1 -4.990158022745006 -7.228416620009519 -0.23616829431627906 0 0 1 +101 1 -4.425835217027135 -8.041862792922046 4.912842377205241 1 3 1 +4 1 1.6093443070111064 10.036215537003722 4.649624528139505 -1 -1 -1 +6 1 8.957102959942503 -10.648514255179037 2.7520244907338807 1 1 0 +81 1 7.208459443972924 -8.512507364143946 6.7186127098675 -1 1 1 +166 1 -8.735612761804596 -5.051940162290023 4.287135452158321 0 2 0 +40 1 -7.0154409632766175 -4.6058645552640805 1.2332349553758588 1 1 0 +127 1 -5.628166701486109 -2.4571683554307384 3.9074191001707503 0 -1 0 +104 1 -0.4346324933964958 -0.6513905925349095 -0.2958543835790408 -1 0 -1 +151 1 0.3877075536664327 -6.4007225085014845 0.24945488280004469 0 1 2 +60 1 -2.369840965541917 -2.0961144039265633 5.2852382593681435 0 1 0 +168 1 3.911007973828095 -3.389123300929967 0.7576129789066393 -1 1 -1 +51 1 0.3292384996563097 -3.420112775820937 2.935489834742583 0 0 -1 +97 1 2.1485649172664862 -0.10439592636417316 2.279403065792625 0 -1 -1 +103 1 4.042877904485135 -1.0208892892284567 6.118986931410435 -1 2 0 +163 1 -10.685207062128164 -2.805182722090798 2.2992408280776737 0 -1 0 +175 1 5.777080728790477 -3.428422767297768 3.9500489905592655 -1 1 0 +158 1 8.901770795533949 -6.449835056793116 2.8925949474189174 -1 0 -1 +85 1 10.225188926473791 0.0017773278841735195 5.209115671649155 1 0 1 +63 1 -8.213348572388885 -0.1729333455438991 1.128439638194422 -1 0 1 +133 1 -10.560391258433501 2.3871994933981604 3.6217764405881163 1 1 0 +67 1 -6.58893267726452 3.5537178434565275 3.2475644463629347 1 0 0 +83 1 -3.8515887631140515 0.6260605243857498 2.809794279660778 0 -2 1 +162 1 0.5353669870800427 0.011171969691910696 6.140615526988775 0 0 0 +170 1 -2.6982076482868784 4.239239002024167 6.5023488926564 -1 1 -2 +181 1 -5.269736706670749 0.6633143508889567 5.80856876438175 -1 1 -1 +71 1 1.6280398876142836 3.9922472717626896 -0.5550063690378906 0 -1 -1 +31 1 1.1405250667226041 4.200703300864838 6.2167435118694465 0 -2 0 +139 1 3.842562548009269 3.6547622321511497 3.2913955399115533 -1 2 0 +3 1 10.98202973743475 1.2548431833407037 0.9250033618641567 0 -1 1 +108 1 6.094576089388102 0.9247979169923504 3.624011344184912 1 1 0 +16 1 8.94421023892344 3.592040529277952 3.968834804835023 0 -2 1 +110 1 -11.386726712959288 6.012786074810452 3.1335330551037686 0 0 -2 +50 1 -7.019873322974002 11.162655244151733 4.132863440221239 0 0 0 +191 1 -8.58859990391919 7.042920679843704 5.549588183323656 1 -1 0 +187 1 -10.694945657883851 11.280545373237025 5.089277301544773 1 1 0 +180 1 -0.9832322177090624 6.17374336331137 -1.7810168677844587 1 -1 2 +30 1 -0.5786545001726999 8.92644611919124 1.2001444343316763 1 -2 -1 +2 1 -1.7987623083026563 5.385135175592104 2.641095387043805 1 -2 -1 +17 1 -1.9803131781320147 8.340104277288379 5.2339610584552005 -2 0 -1 +7 1 4.056078571838132 8.755054555667046 1.7129552906297647 -1 0 1 +164 1 1.8606879960472185 6.264401812470137 2.238048307949188 -1 0 0 +69 1 4.582260343749063 6.901308432226479 5.16724455389889 0 -2 -1 +61 1 10.203999344055715 5.098875037493535 -0.6552273031803888 -1 -2 0 +34 1 7.6452062423181015 9.296589241677342 2.4017008610787727 0 0 -1 +43 1 7.186240451053859 6.044802069738282 2.458597580290494 -1 -2 1 +177 1 8.52522272174418 7.310838340899178 5.550705478002598 -1 1 -1 +179 1 11.738401405730409 -11.171052154041227 -10.46073671167246 -1 3 2 +65 1 -9.923794257190753 -8.360277300667597 11.397343948439744 0 -1 -1 +27 1 -10.96202039046517 -11.679459496759502 8.461761452894827 1 1 1 +58 1 -9.782820449181592 -6.900116722543098 8.161461366886957 -1 0 -1 +32 1 -6.176757614808324 -5.427580338396943 6.37353314773015 2 1 -2 +26 1 -5.244950495195521 -8.48903289150118 9.276610316099598 1 0 0 +142 1 -2.2192381371286913 -6.710860567512032 8.5692633945157 2 1 0 +100 1 -1.5829434980745454 -10.919909502588283 6.783259906533759 1 2 0 +184 1 7.415704119987677 -7.40752254135457 -11.394836902247562 0 1 2 +105 1 1.324436294552863 -7.868824845245506 3.928981783067961 0 0 -1 +75 1 4.559950916659301 -6.316720857110099 5.422215632967026 0 -1 0 +99 1 1.6556187341181972 -11.042676696296036 10.823511254079808 0 0 0 +193 1 2.1147403084852634 -6.885083505075134 9.409447220216105 1 1 -1 +33 1 4.45464187128425 -11.736247949088288 7.271061852952995 0 -1 0 +79 1 8.565919655629239 11.638486198403275 5.960760377855752 -1 0 0 +92 1 9.769060714231218 -9.492631803351557 11.102372610406375 0 2 -1 +165 1 -9.212711733999253 -3.259454828813142 7.377981593005203 0 0 0 +199 1 -6.873376106851867 -4.9933518932685566 9.87422952115871 0 -1 1 +70 1 -5.445601633222862 -2.349920544152827 7.807205278865663 0 1 1 +146 1 -1.4368974006040247 -0.5526263308116413 11.329045170425331 2 1 1 +106 1 -1.320489681644758 -2.525949605897458 8.649126125808394 0 0 -1 +52 1 0.6432865601156172 -3.653577986848175 11.390625659771409 0 0 0 +86 1 5.463936380191402 -4.545155299286932 8.600558169678536 -1 0 1 +197 1 1.6297777023246702 -4.6288437196490895 7.127308915254101 -1 0 -1 +185 1 2.117376701545396 -0.6740584604995838 9.981858778655166 -2 1 -2 +190 1 7.391326441541653 -0.2420688149799064 9.912167028101104 0 0 -1 +145 1 7.1433612487852685 -3.600502105720082 -11.787138473864353 -1 -2 0 +131 1 11.237287581981867 -5.265986055819216 6.2884198947288406 1 0 0 +156 1 -5.499196268975016 -0.3842368684419455 11.47923685297254 0 -1 -1 +10 1 -9.091750969544233 -0.8101391784724588 4.798103517685853 0 0 2 +196 1 -9.331229431870144 0.22379652065858124 8.694495890506026 1 2 1 +143 1 -7.138465404537655 3.0174764853722347 8.68001066247089 1 0 0 +13 1 -11.76499693524697 3.321385859999623 6.936314787144568 -1 -1 1 +59 1 -3.4402166179497833 1.730296081472357 9.358944812035546 1 -1 1 +186 1 0.1617283142132493 2.5970365582430226 9.662083422391825 1 1 0 +136 1 3.4199513038280873 2.163828872826315 7.95543255977617 0 -1 -3 +62 1 3.963989117283031 6.890950850270743 8.983560199060738 1 0 0 +192 1 10.513433172209162 2.5350934882928264 9.78265608934408 1 1 1 +113 1 7.161285582100181 2.2124289355489886 6.79272048842973 -1 -1 -1 +74 1 -8.169335431227 9.77557136132564 9.00057456275031 1 -1 0 +118 1 -11.608821137521177 8.521503367814617 7.013321378357836 0 1 0 +117 1 -5.327579617349453 11.314505774662308 7.558097527322893 -1 -1 0 +23 1 -5.129126916477775 5.721102420605024 11.278247239081892 0 0 -2 +171 1 -4.352281149020513 7.112600115001591 7.871167109278595 0 2 -2 +94 1 0.5998107735037941 9.708724091432982 9.014903980367055 -1 0 0 +41 1 5.4449659738536695 11.522021070488632 11.662868284303414 0 0 -1 +141 1 9.872190892571076 5.7761026505659245 8.948318084922565 1 -1 -1 +159 1 9.641274357072867 9.726441601090215 9.76145240542319 0 -1 0 + +Velocities + +39 2.577793097354695 -3.3983788380629387 0.9311775479132861 +57 0.044350439903272976 -2.756321060337954 -1.0428315092461067 +82 -2.504296787676701 -3.6468474399030493 0.2541672097953289 +8 3.6367927137204146 -0.708503612114486 -3.734398328076926 +49 1.8873851156019454 -1.4752561333771483 0.44317628658177016 +54 2.0609459874818237 -3.7591063995516816 6.295629243534251 +114 5.3525465279303015 -3.959388563871946 6.9201302420483755 +128 1.2908060914043953 -2.111376197467554 -0.48873831716967264 +102 -4.571293842871747 8.300052861760934 -2.8260260042769847 +157 0.6864784580965262 2.3741938996988416 3.197851910441299 +20 4.652994650182517 -2.368616661754701 -3.6239824640674376 +147 2.3112278761829046 2.7926157746726785 0.3841905616879638 +169 3.8809056176148298 -3.783797831749185 1.5132762830383186 +123 1.2907138384495385 4.5605260997379515 6.265572889261794 +130 2.3899251274818005 0.27666961403153456 4.415473432866114 +140 1.0077403345435272 3.331618501750946 3.823686801783437 +153 -4.158360194263056 -0.05792314282326738 -0.09170129980331274 +129 -2.0924141264102167 -2.229463311149641 5.774701380963026 +148 4.419535691773222 -2.221801500903651 -1.322900377568077 +119 3.3013302732178436 1.0440417527080033 2.8019660816699443 +174 1.8865107534171663 4.984254074383621 -4.4680569390231515 +134 -3.051462360151183 0.13872483873263985 0.8334720216492622 +189 -1.575075881871396 1.8217362685289014 -2.0444979947436 +28 3.421168174684726 -5.498073809092277 -0.04014458535812704 +1 1.9883484696931384 -5.62737172391044 -0.6897496957906657 +24 -1.2667871307922316 4.30277534955836 -0.9434339008200991 +176 5.33889839399068 -0.7261935889242956 -1.0648636501642632 +182 -1.3434249574772492 -1.2612974855392476 -0.8264254407007674 +137 1.9669241314073078 1.4304166951432975 -0.7941330665668798 +89 3.0037245881229415 0.2485958612228784 0.43340084246330035 +88 -4.773290068397481 -4.145612735120506 2.9587651882723076 +160 3.2238819912540246 1.454427974780249 -0.8931785023147302 +125 -2.027584749577839 0.2846539404784728 -1.9747515011844237 +107 -0.4309962618034694 -3.6977689727188716 -1.9008509957370174 +167 1.1593622921328293 -1.8699221821464713 -0.35243227029296986 +45 3.8023301775972866 1.4226356824680009 0.7412574800338123 +95 -6.444883722807761 -0.36547146467399716 -2.3313614045704956 +111 2.654717565255864 1.4059595144409067 -0.8812624422906502 +37 2.6344865612342447 3.1241557322031097 0.21727945365726709 +53 -1.162490586497141 -1.8114743286402544 -3.3819238034771355 +122 -0.39245032082132514 6.341371204609977 0.15639083036810653 +126 -1.605697227924968 4.594486921923675 2.22444280178021 +72 5.553154164868334 -1.6002168773168566 2.986954509825138 +144 1.3403843285320132 -1.7279031413546053 1.3999311572505995 +135 2.534876793407053 -3.9801581090182863 3.1492981080983657 +183 -4.679242103632781 2.993032322724656 -1.3277928954591556 +155 2.478325342602548 0.096505570078343 0.23454435113676975 +21 -3.5229231861916004 -3.9816529561376006 0.026639755919907415 +66 -4.078355783351698 -0.12178976416838905 3.6922808103625115 +22 -3.6395126219587364 -6.832262596301959 1.5951115669463118 +42 -4.403508549300507 -1.075423056570003 -0.591849033607009 +77 -3.529890611915624 -4.75010415058562 1.6925557776838493 +47 -2.1850961781212535 0.29268584139732723 -6.145825548126078 +46 4.627258609793938 -0.35735610275796525 -4.228603145133978 +18 3.73167019444449 -0.1412650186120299 1.8269713694609548 +14 4.255528637119755 -1.6399584278487664 -2.3670010206718466 +178 -5.547816263652345 -3.2716811779531016 0.3760629173372536 +48 4.425750039051989 -1.6380895084775802 3.0834785539819825 +55 0.9664608309050373 -3.9279561872107216 3.738153737041613 +12 -0.41819517254673283 0.9367025298427245 1.548662259471958 +15 -1.5561256264944465 -1.7138464717908113 -5.214325558070718 +64 -4.340047339400262 -2.22675786620723 -1.8953705605237372 +44 1.1388904606478099 1.1952052434483869 -4.7138321817777165 +188 -0.6813174034115439 -5.349606335139992 -0.5494798369887832 +200 4.5313662932423755 -1.509632335926491 -0.7143667001741889 +198 -0.147474124917653 -4.398760900940008 -1.3829542092135303 +76 3.499335281047853 4.321577651994544 1.8422196851357424 +194 0.40702093571028386 2.536045454224767 -0.25948941675872716 +68 1.095513798887539 6.302453994563069 -0.032465133466722085 +96 -0.8025115532160563 4.133456324521671 -0.3987555142125939 +91 -1.0924701330602116 -4.134760716625712 -2.5476966892452007 +154 -0.6420195815805342 0.5441210237991451 -2.4764714848254394 +19 -6.45757006657402 -1.8917738383254377 -2.2385612755611657 +120 -2.333329676155747 -2.6263663088962446 -0.31608193981125454 +138 -4.2274347886527295 -5.149547905719161 0.18051226809116783 +9 1.9482438581325014 1.836033317169747 4.767132863545005 +150 1.9981648567087547 6.350098740087899 -2.8565846607881165 +38 0.7805411976234249 3.2336875919271204 -5.491325260091564 +172 -1.6067207370017498 -4.025457011374177 3.328473783113818 +152 1.2783569248468387 1.1836235305806408 -2.8398807957375904 +29 0.012522208655832867 -2.202968899510487 1.2653923818179775 +87 2.4301555960867915 -0.3844922649780862 2.3653616101850643 +93 -0.8167645337546143 7.0869554155527865 -0.992159930343214 +195 1.386850643478473 -2.1138124263507945 -2.6343099572277926 +149 -1.9222490388239173 -2.9269314999007365 1.9288615526733388 +25 -3.59971099165819 -1.6866464810245103 1.7143969426226588 +35 1.1068675504822845 2.9570865620910163 1.5489285873628789 +5 -0.06525583154753622 4.64663174535613 0.0051166703840210825 +116 -2.156521693342489 -1.106530196750272 -0.7392284182460408 +112 0.8256766355184204 -3.3427544054629896 2.364051175484082 +132 2.1070952059277808 -0.7636208241660348 -2.901239577070981 +173 0.9555468923097092 0.9205686685241707 -3.199573856104545 +73 1.5067078955449293 -1.4433124895723743 -1.0680684282081363 +161 2.1775187990003184 -2.0432036406877887 -2.502427749527437 +78 0.4277549814794872 0.923985061568942 -4.462582084674592 +11 -0.7883572752861073 -3.298996571191427 5.184829507433079 +84 -0.3908120720288031 0.8981771084266208 2.781123174827333 +90 0.1806374932457661 1.6703751943299625 2.7208543462130645 +36 -1.267739998375956 2.1167954160312523 -2.3987528368253503 +56 0.42755132352919767 0.3105230600944311 -0.03753157138922093 +109 1.9130458422765049 -2.4592218292820647 -3.7955776970359176 +98 2.224412680285525 2.8105570053709483 -6.007751163289515 +115 -2.8264888701698423 -6.77384783439804 -4.5128631453140455 +124 1.0115631212847158 2.197697811017366 -1.4884565302411554 +121 1.819952585372025 2.133685315101777 -0.48009196690211353 +80 3.6825834395072827 2.9369744584874624 0.7772431106319383 +101 3.8152106585296663 -0.7504695117106335 -1.3678083578602058 +4 1.1543968705285124 3.6108919626584783 1.279726012491966 +6 -2.734554328800396 0.45690265044985007 1.7653493310436426 +81 2.173385375162031 -1.545557384488483 -2.635973810143899 +166 -1.239464711076861 1.3504238003340796 -0.49024226288977 +40 1.7898346069542372 -0.4474778752941201 3.4790111502788887 +127 1.6296109635966738 0.6612604860538578 5.807821273928263 +104 -4.901664479006097 1.1052244598202794 3.4465808005881824 +151 -3.983151444075344 -3.2501191110732113 -1.2526584841338049 +60 -1.922006700361108 -0.7785585059363819 -4.390434339117124 +168 -2.788478664171041 3.923738577427861 2.49523972250301 +51 -1.6149322848467969 -3.4296394320723262 4.226459281197094 +97 -1.226730421851149 -2.392775221203476 5.070036120535187 +103 -2.9962982871055357 -2.90339448475708 -1.1348192929647936 +163 0.3128021577268095 -4.112121184421586 2.47129388197539 +175 -4.72131850682648 -1.6008946774115904 -3.6054426092000593 +158 -5.274680729271083 -0.4457302148856164 4.174272671309751 +85 2.9757034033315444 -0.5103121033627565 1.99919210117291 +63 1.600933165736236 1.4604641421860185 5.197681341346513 +133 0.3650834395918216 4.123541846312257 2.1615515366543354 +67 2.0607792864448453 2.3124375339420076 0.21959246817514527 +83 -6.156022387564482 -1.1548915743184078 -0.4948872456362283 +162 -2.1450070724040025 3.9286059442169066 2.007885747151935 +170 1.8166139807691821 -1.95234066921456 -1.8559861240898843 +181 -1.587457433365127 -3.2094890956838205 2.212401241994942 +71 1.7829689662908779 -3.6713609566551657 1.3773962271622693 +31 3.918178411733008 -0.5772484115851036 0.16726508680219976 +139 -4.560722486125075 -0.5471630166750243 5.863010868871481 +3 -3.9686726349917825 3.6173076990026054 2.5273959166862507 +108 0.3042801304200664 4.847444330423647 -0.35518169829313484 +16 -2.4685650045584717 5.98056595230015 0.9384145704518219 +110 -0.6129548866614436 1.8199747299312752 -0.6050782543434758 +50 -1.8884152067915962 -1.4877561250799833 -3.9811275374353494 +191 1.500896458072849 -1.9099553342822155 -5.024921011162899 +187 -2.013243274912701 -0.8604266013822317 -1.038480536601888 +180 1.4966822969502809 2.2104050426784707 3.732721924128324 +30 -2.3551911487538373 -1.0313809690434763 -1.4871503115129143 +2 2.4972367326603697 -1.5125466361921762 1.0762650051734106 +17 0.43112912988867413 -1.9548201848493156 -0.43017998184207773 +7 6.622180146484479 4.7673609572662725 0.19425898871224434 +164 2.301415823751322 0.4827221772498991 4.559127095693677 +69 -3.4364505629674733 -1.1594038113628669 -1.2078137888752072 +61 1.7869953777023173 0.9935547623401149 0.14745693195171444 +34 -0.027807484985171937 -3.1354780466577754 -1.036977576868685 +43 -1.3037743820903311 -5.61028065095172 -4.306710886889687 +177 2.1781720801097206 -1.516912077043328 -2.054689845757315 +179 0.4934049365569875 -4.8639422788504625 -6.225153590664796 +65 2.6970228261721383 0.19294320506195817 6.683323231860031 +27 -1.6731814501881797 0.7519385590564082 3.2183027406212203 +58 -0.7774753429967389 -0.6669437971456971 3.5183225900940927 +32 -5.389835933890947 -0.4954507654154201 0.4594525916972694 +26 0.7382474998065096 -3.102724138188651 -2.185686698723454 +142 -1.944479379421283 -1.2761486898263725 0.72348529709274 +100 -2.739025692998968 -2.6245009262596986 3.182008026346906 +184 1.4210317521782347 3.1395926369797884 5.319543188841913 +105 -1.2308708716614136 -1.2494207925918743 -3.3415190888725443 +75 -1.8835854547991517 -1.3807763884880995 3.052239941977269 +99 2.3501462152911015 -0.09098282020287418 -2.963130739502538 +193 3.2483282921859455 -6.045063326765766 -1.2297831607518321 +33 -1.5552221515820004 2.623852853566988 -0.3953508079233695 +79 2.0518370606822334 1.899510113710928 2.0859744201323727 +92 1.5026700715390955 0.9352029472761221 -5.528904283783295 +165 -2.240438523644089 -0.6103912799862421 0.40653914875448993 +199 -1.2653571662196268 3.710626862073433 1.4730516528440072 +70 1.655492430853343 0.17760859693009826 -1.650919734678463 +146 -1.4225048482747793 2.74232833480091 -3.413198079564811 +106 -1.093901348299414 0.20953760114868714 -0.7298112830112282 +52 6.647000075136453 -0.30141024565553315 1.2035752428962934 +86 0.6741589587443484 4.365068713763016 3.5677961016049315 +197 -0.666824417721529 0.7257967702216201 6.272517109849018 +185 -1.1845876194928404 2.1001111189632264 2.457366035714506 +190 -1.6517508143986053 2.271851696760304 3.7976228734124575 +145 -0.6660913411508007 -2.1887913545610314 1.427073342591097 +131 3.4923356345857024 1.8910870819349503 0.22757964871813297 +156 1.3901143776938099 -0.5912367128957199 -1.945898273856384 +10 -3.3254266550003906 2.363446512042732 -2.8505669909097167 +196 1.9772342503358795 2.9791453967072834 5.0702556945320305 +143 1.3619198656944898 -4.070780999483669 0.554762511858757 +13 -3.6607073229889986 -6.103961980753075 3.3895476442791126 +59 1.3424546798513801 -0.012418821554116527 -1.0607350515292961 +186 -0.19147109350375446 -0.14042042908600805 -5.06183250631794 +136 10.318783006250738 -0.33198398090799297 -3.1695432610471372 +62 -0.9320061937291512 -8.919718141167188 -1.0031472261072583 +192 -6.036717500669019 -0.4626110813075395 -5.283002697165421 +113 -1.9312339562598033 1.2868323831429733 -0.27836767602350954 +74 0.289298974376203 4.639184114550362 -1.3074893268836063 +118 2.3186362762712704 0.014757210175651903 -1.9096714905556824 +117 2.917320124569121 -0.927139463682407 -2.038093079844118 +23 3.445296199640721 -2.484450168397722 6.150025302403371 +171 -1.3488599922862394 -0.40015537573335275 5.541824987776105 +94 2.7016234671889183 -4.500360725821148 -0.3771036206116729 +41 0.040051409073174504 1.3144504850460685 -2.628956804481983 +141 0.8101589418958534 -0.40901282998394567 2.3777914588666906 +159 -2.168905163137191 -3.9077440516609387 3.1238186982134213 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/in.lmp b/examples/PACKAGES/pimd/langevin_metal_units/in.lmp new file mode 100644 index 0000000000..124063df99 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/in.lmp @@ -0,0 +1,28 @@ +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ new file mode 100644 index 0000000000..fa22106766 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ @@ -0,0 +1,2 @@ +LAMMPS (28 Mar 2023) +Running on 4 partitions of processors diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 new file mode 100644 index 0000000000..00787df8ba --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 0 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt01 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 01 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 0 -7.3046601 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -164.47373 + 100 149.95804 3.8573359 0 -7.7921375 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 -101.30374 + 200 245.00113 6.3021074 0 -8.2639651 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 112.22426 + 300 300.57486 7.7316177 0 -8.2986331 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 814.45889 + 400 368.08438 9.4681493 0 -8.4800193 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1202.0398 + 500 419.32066 10.786088 0 -8.640773 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 952.59748 + 600 385.4127 9.9138817 0 -8.4356035 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 676.62913 + 700 360.14242 9.2638601 0 -8.2900275 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 456.91446 + 800 346.92167 8.923786 0 -8.0694169 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 454.60123 + 900 364.39442 9.3732334 0 -8.0415668 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 499.75868 + 1000 390.77042 10.051697 0 -8.1948009 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 572.98799 +Loop time of 0.248186 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.126 ns/day, 0.069 hours/ns, 4029.238 timesteps/s, 805.848 katom-step/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 | 0.14541 | 0.14541 | 0.14541 | 0.0 | 58.59 +Neigh | 0.00099082 | 0.00099082 | 0.00099082 | 0.0 | 0.40 +Comm | 0.0039966 | 0.0039966 | 0.0039966 | 0.0 | 1.61 +Output | 0.00016346 | 0.00016346 | 0.00016346 | 0.0 | 0.07 +Modify | 0.096205 | 0.096205 | 0.096205 | 0.0 | 38.76 +Other | | 0.001425 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1342 ave 1342 max 1342 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10325 ave 10325 max 10325 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10325 +Ave neighs/atom = 51.625 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 new file mode 100644 index 0000000000..83821cafb7 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 1 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt02 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 02 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 11.920908 -7.3063682 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -167.65544 + 100 483.61933 12.440028 11.405863 -7.7749671 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 606.14668 + 200 452.03836 11.627678 11.47094 -8.2534927 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 583.5476 + 300 470.25997 12.096389 11.739306 -8.3750153 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1152.6851 + 400 459.46597 11.818737 12.502421 -8.5240576 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1381.0251 + 500 442.73121 11.388273 11.19396 -8.6488583 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 1000.6119 + 600 493.47034 12.693424 11.91335 -8.4625706 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 904.52944 + 700 470.04548 12.090871 10.348757 -8.278182 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 715.22796 + 800 458.04928 11.782296 11.152029 -8.0926613 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 678.21261 + 900 468.60547 12.05383 10.937315 -8.0319335 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 735.24377 + 1000 427.44192 10.99499 11.916587 -8.2229199 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 637.98311 +Loop time of 0.248186 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.126 ns/day, 0.069 hours/ns, 4029.238 timesteps/s, 805.848 katom-step/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14654 | 0.14654 | 0.14654 | 0.0 | 59.04 +Neigh | 0.00099986 | 0.00099986 | 0.00099986 | 0.0 | 0.40 +Comm | 0.0041628 | 0.0041628 | 0.0041628 | 0.0 | 1.68 +Output | 0.00018019 | 0.00018019 | 0.00018019 | 0.0 | 0.07 +Modify | 0.094878 | 0.094878 | 0.094878 | 0.0 | 38.23 +Other | | 0.001424 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10328 ave 10328 max 10328 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10328 +Ave neighs/atom = 51.64 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 new file mode 100644 index 0000000000..fd8dd409ae --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 2 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt03 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 03 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 10.862314 -7.320388 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -175.34503 + 100 455.18121 11.708521 11.48472 -7.8033686 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 526.41632 + 200 460.81997 11.853566 10.817157 -8.2276485 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 615.80924 + 300 481.48652 12.385166 10.035423 -8.3866916 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1169.2917 + 400 487.3584 12.536208 11.766522 -8.3643382 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1574.1427 + 500 446.36019 11.48162 12.144202 -8.680266 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 979.68395 + 600 500.3783 12.871115 11.075008 -8.47833 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 912.39361 + 700 435.40634 11.199857 10.923558 -8.3090105 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 617.20857 + 800 446.82793 11.493652 11.599712 -8.0900498 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 652.13243 + 900 448.28506 11.531133 12.130739 -8.0810557 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 674.68073 + 1000 440.94913 11.342433 10.765654 -8.1419484 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 730.67128 +Loop time of 0.248185 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.128 ns/day, 0.069 hours/ns, 4029.259 timesteps/s, 805.852 katom-step/s +97.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 | 0.14702 | 0.14702 | 0.14702 | 0.0 | 59.24 +Neigh | 0.0010003 | 0.0010003 | 0.0010003 | 0.0 | 0.40 +Comm | 0.0039821 | 0.0039821 | 0.0039821 | 0.0 | 1.60 +Output | 0.00023527 | 0.00023527 | 0.00023527 | 0.0 | 0.09 +Modify | 0.094519 | 0.094519 | 0.094519 | 0.0 | 38.08 +Other | | 0.001427 | | | 0.58 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10313 ave 10313 max 10313 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10313 +Ave neighs/atom = 51.565 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 new file mode 100644 index 0000000000..423ebb7d63 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 3 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt04 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 04 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 10.794425 -7.3457072 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -191.02389 + 100 426.01705 10.958338 12.206372 -7.8040582 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 464.39271 + 200 414.52703 10.662783 11.934129 -8.2331312 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 502.87052 + 300 424.85622 10.928478 11.681713 -8.357621 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1058.1162 + 400 485.80103 12.496148 12.255827 -8.3658975 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1570.2486 + 500 462.99006 11.909386 11.187609 -8.6934698 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 1014.2134 + 600 465.24407 11.967366 11.168375 -8.4422887 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 864.12413 + 700 426.16111 10.962044 11.000011 -8.2855512 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 614.76939 + 800 454.53159 11.691811 10.834606 -8.0654281 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 684.85907 + 900 441.72064 11.362278 10.4492 -8.0786302 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 659.68525 + 1000 429.90929 11.058457 11.851933 -8.1578394 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 698.73278 +Loop time of 0.248175 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.141 ns/day, 0.069 hours/ns, 4029.409 timesteps/s, 805.882 katom-step/s +98.1% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14919 | 0.14919 | 0.14919 | 0.0 | 60.12 +Neigh | 0.00099112 | 0.00099112 | 0.00099112 | 0.0 | 0.40 +Comm | 0.0040992 | 0.0040992 | 0.0040992 | 0.0 | 1.65 +Output | 0.0001723 | 0.0001723 | 0.0001723 | 0.0 | 0.07 +Modify | 0.092299 | 0.092299 | 0.092299 | 0.0 | 37.19 +Other | | 0.00142 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10332 ave 10332 max 10332 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10332 +Ave neighs/atom = 51.66 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/run.sh b/examples/PACKAGES/pimd/langevin_metal_units/run.sh new file mode 100644 index 0000000000..2580ef1a41 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/run.sh @@ -0,0 +1 @@ +mpirun -np 4 $LMP -in in.lmp -p 4x1 -log log -screen screen diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 new file mode 100644 index 0000000000..e3d6b816a3 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 @@ -0,0 +1,219 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 2000 + +200 atoms +1 atom types + +-3.4945130603740377 3.4945130603740377 xlo xhi +-3.4945130603740377 3.4945130603740377 ylo yhi +-3.4945130603740377 3.4945130603740377 zlo zhi + +Masses + +1 1 + +Pair Coeffs # lj/cut + +1 1 1 + +Atoms # atomic + +108 1 -2.7795690566068996 -2.0367677788080942 3.4238258338844894 2 1 -1 +102 1 -2.609481280743025 -1.8912619121268304 -2.399753092988466 1 -1 -1 +141 1 -3.140749645549514 -2.8903241627869427 -2.7071762462261537 2 0 0 +49 1 -2.3658136681990007 -3.088812044820056 3.4760124445890623 0 1 -1 +88 1 -1.6158710173914035 -2.3369020600614756 3.233517474511907 0 1 -1 +192 1 -1.2960228223928079 -3.237522585981233 -3.1506262911155765 1 1 2 +113 1 -0.5058112539671865 -2.175265580488635 -2.895948573481031 -1 0 0 +147 1 -0.22721902013037146 -3.2095321965856187 -2.5444416457809185 0 1 0 +55 1 0.6250447384071113 -2.6446349401275255 -2.959767417439857 -1 0 -1 +63 1 1.6783992808137906 -3.22203513406057 -3.1652676844989256 -1 1 1 +95 1 1.3579478870419064 -2.684729254303277 -2.052496056604152 0 2 -1 +105 1 1.4496281787006915 -1.9673030959679096 -3.332658945278261 0 0 0 +84 1 2.4045875426768606 -1.8297724699275564 -2.7874627893944544 0 0 0 +65 1 -2.68682939849047 -0.8114540186440395 -3.126687818057689 0 -1 0 +112 1 -1.7203801180145006 -0.8038481618523634 -2.0163240721427838 0 0 0 +174 1 -1.4968933339977661 -1.3290620346554367 -3.064010040861048 -1 0 -1 +189 1 -0.6249709402997541 -1.252931712435372 -1.9882716349469658 0 0 2 +9 1 -0.23886293275872486 -1.0612344376875333 -3.025432389188406 0 0 1 +146 1 -0.9802936024515303 -0.3953988402073487 -2.8364522494017708 2 1 2 +171 1 0.39730078560778914 -1.7846492070113664 -2.443607407553737 0 2 -1 +140 1 0.5573788374911133 -0.5990036144148324 -2.402963062521378 -1 0 0 +152 1 3.4379847727225346 -1.3055938268830742 -2.4905074589410936 -2 -1 0 +11 1 3.1992117767992068 -1.191883736793153 -3.4723419170834338 -1 2 1 +69 1 2.6376153053668867 -0.2845436411244765 -2.788279844473203 0 -2 0 +173 1 -1.967038944001471 0.06098718735032446 -2.58940519609616 1 0 1 +190 1 -2.8711350478349926 0.9129034739862979 -3.477848194666021 0 0 0 +164 1 -2.8409776961511124 1.1599509265598786 -2.2464830240939375 0 0 1 +161 1 -1.6469671018177567 0.9360204597700993 -3.3491365145788827 1 0 2 +74 1 -0.028453987680887038 0.3739399392930446 -2.9891764409930484 1 -1 1 +162 1 -0.9152119867762214 1.8538003710645874 -2.0787458665529313 0 0 1 +165 1 0.20472499231506947 0.41157279287578097 -1.7804952487691292 0 0 0 +28 1 0.9556568956317052 0.9070586383550882 -3.051580171737043 0 -1 -1 +107 1 0.27101548210140264 1.6697625775553313 3.256398876364515 -1 1 0 +53 1 -2.2768986954542476 1.9520208666344268 -2.905899876141582 -1 -1 1 +60 1 -2.3748565234893153 3.1415519659534046 -2.6903226937570888 1 1 0 +172 1 -1.3831407623603917 2.6439383680022495 -2.988114399273657 0 0 2 +35 1 -1.9040946957475922 2.4850230251463294 -1.8238074088896814 1 -1 0 +90 1 -0.6407155002729499 2.891205873820353 -2.184576201275668 0 -1 1 +183 1 -0.7452468270399182 1.6958511415691964 -3.2646018242495516 1 0 0 +46 1 -0.22701759376730096 2.672935498985858 -3.2296828094464414 1 -1 -1 +26 1 0.3607641531328818 1.9915770180932266 -2.4322620664253045 0 -1 1 +41 1 0.6373758855225722 3.1576967379383136 -2.2076729513672273 0 0 1 +62 1 1.2599715479139464 2.4637352645229535 -2.996655642771261 0 0 1 +114 1 0.7095094175128512 3.3529225376529834 -3.446569928809617 0 -1 1 +29 1 -3.4441516076858747 3.186682881361427 -3.164290558791177 1 -1 0 +120 1 -2.7699397214807666 -3.0679149510930377 -1.4586405778286127 2 1 1 +166 1 -2.9639598123456348 -1.8230569851379879 -1.1336421298957986 0 1 0 +19 1 -2.219481001384856 -2.718720936926987 -0.17152653954078959 1 1 -1 +143 1 -3.3367462911096637 -2.646710289319255 -0.08639804580378332 1 1 0 +14 1 -0.8080539703460301 -3.3138674801902015 -1.5513416052298858 -1 0 1 +17 1 -1.2519028473371163 -1.9834151764617522 -0.4751925051419198 -2 0 0 +7 1 -0.6422036076119758 -2.1822637849150257 -1.309964136714573 -1 0 1 +76 1 0.002896678458885543 -2.2620445897063184 -0.2330303144789453 0 0 0 +25 1 0.3195487317939559 -2.5915964162672633 -1.6847661018972104 -1 0 1 +122 1 0.9437732996524034 -3.076308154774796 -1.0301951566376644 1 0 -1 +188 1 1.3149323047475332 -2.0202232851439175 -0.9332517483120624 -1 0 0 +196 1 2.4252816482051065 -2.9991133261256717 -0.2915609413585816 0 2 1 +154 1 1.617010887740887 -2.199305270305938 0.15712874770371849 -1 2 0 +64 1 2.934967635633404 -1.92620475221537 -0.7077313528493354 0 1 0 +79 1 -2.8111804533557017 -0.5176533778232942 -2.0486672107634094 0 1 0 +80 1 -2.079807139196039 -1.2506968999173758 -0.6878784167189951 0 0 1 +12 1 -2.996784469690298 -1.494057160171672 -0.09378065633433766 0 0 1 +87 1 -1.4786937501974577 -0.24572242955022147 -1.0411298155891553 0 -1 1 +118 1 -1.5219571471797697 -0.6469152337096267 0.07790607124041445 0 1 0 +106 1 1.1039107347748043 -0.9982945968846851 -1.4358613477546331 -1 0 0 +6 1 0.2994229743009 -1.5755502164022743 -1.1025451212735877 2 0 0 +98 1 0.14422647245316755 -0.4562748967814887 -1.1288823927075846 -1 0 0 +36 1 1.117403260546369 -0.6258611972204157 -0.45746732579129296 1 -1 0 +133 1 0.859517194013173 -1.4579095853876511 0.2223121798831755 1 1 1 +1 1 1.9750704226304612 -1.2226584851722493 -0.5050391499153623 0 -1 0 +91 1 2.930212504963826 -0.8900603772487206 0.31326990070574257 0 -1 -1 +135 1 -1.8704119131145511 1.4151617424236407 -2.0299493395071555 1 0 0 +145 1 -2.5978280185456044 0.23771261564216897 -0.6973478660383656 0 -2 -1 +194 1 -0.802106175542123 1.5380363524561962 -1.0014646333327863 0 1 -1 +177 1 -0.4209642163497379 1.4081511815239465 0.048786606404428355 0 1 -1 +56 1 0.1655081354187105 0.488612868229853 -0.6685586469118172 0 0 1 +137 1 1.0403444543974962 0.29392106264506496 -1.157047853549803 -1 1 -1 +3 1 1.426791637331859 1.1994824011018168 -0.7391487398561316 0 -1 1 +125 1 0.6384933993980926 1.4087406696008793 -0.04513978672724809 0 1 0 +85 1 3.492386221258323 -0.022918569575539983 -0.18415289757087 1 0 1 +37 1 1.9446560065460998 0.32690249887078415 -1.557848909197346 1 0 1 +157 1 2.2693311785439514 1.4234672203444076 -1.3950756204319474 -1 -1 1 +81 1 2.2043144165939133 0.7734976358785483 -0.1443989261496442 -1 0 1 +193 1 -2.800913203549158 3.3913795040038752 -0.3002902442199323 1 0 0 +127 1 -1.832485514575906 -3.475177695698571 -1.0143919033965547 0 0 0 +104 1 -0.9864189902172598 -3.128510029811542 -0.3946109581791233 0 0 -1 +72 1 -1.091863924309645 2.651695772194485 -1.1525574140711645 1 -1 0 +99 1 -1.376188772302252 2.1367308970905112 -0.22414000562735564 0 -1 0 +24 1 1.0798151658945965 1.8088284522753606 -1.611839691529319 1 -1 0 +42 1 3.3099578488331143 2.7636832208891664 -0.11775790598994411 -1 1 -1 +38 1 -2.6469918571054945 -2.446265188540552 0.8006326688775777 1 0 1 +86 1 -3.3982593364606077 -1.9911707046121028 1.4129412590921573 -1 0 0 +116 1 -3.3782151164102614 3.3939134790192074 0.6418244028431277 1 0 0 +144 1 -2.152212571536467 -2.8119708535854224 1.6778364082976118 0 1 0 +179 1 -0.8263021362457004 -1.7214596406733806 0.6812305480127513 -1 3 1 +151 1 -1.5217298498042864 -2.5933593936403763 0.7963122225368328 0 1 2 +130 1 -0.41366866285633624 -2.851509016203123 0.6773665297002652 -1 1 0 +149 1 -0.8196954968551895 -2.4620140380344058 1.6681749543249536 1 1 0 +123 1 0.42149982032625755 -2.3318080821151144 1.1400194349387576 -1 1 -1 +142 1 1.7676090653529768 -2.7694388971884765 1.0411093428968425 1 1 0 +43 1 1.2651581412723922 -1.7350310325188918 1.2119129817343088 -1 -1 1 +156 1 2.796603060966876 -1.975811297437484 0.5269881248554414 0 -1 0 +30 1 -2.572197786362113 -0.5211520888332514 0.06478473226429171 1 -1 0 +200 1 -2.796037525463158 -1.2242406753887405 0.9147806710233006 -1 0 0 +75 1 -3.264195451754593 -0.2758623474229462 0.8501703715118789 1 -1 0 +199 1 -1.8606891200301348 -0.81109530705794 1.234068196576104 1 -1 1 +119 1 -1.8952925629684365 -1.6742391291961565 0.3056526633582653 0 -1 0 +153 1 -0.6179778569135823 -0.6812551828045249 0.8822634033092613 1 1 0 +31 1 0.1434804396367878 -0.5352374975985325 0.00065681711961239 0 -1 0 +8 1 0.9896949675708329 -0.5825805499366115 0.8390036708294969 0 0 0 +198 1 0.20957042666083733 -1.2300305579788615 1.1505092305231928 0 0 1 +22 1 0.11282413745771128 -0.029722367543426716 1.1299864513218787 -1 0 -1 +195 1 2.9662277270739343 -0.9097471611972223 1.378968815531931 1 0 2 +32 1 1.9176581701385829 -1.0963885598161285 0.612637989357651 1 0 -1 +139 1 2.2034635745403706 -0.09403988556633318 0.8645554281632429 -1 2 0 +77 1 1.7035877859699526 -0.8133688575022073 1.6318409740615665 0 -1 1 +111 1 -3.223221512681343 0.8515794477136406 0.5304444380887284 1 1 1 +138 1 -2.102339643808083 0.3205080511040257 0.6397061187151873 0 1 -1 +103 1 -2.8441279458234914 0.5800051690180812 1.512417106043963 -1 1 0 +184 1 -2.4512811422970944 1.4407376078485292 1.024840909070544 0 0 1 +73 1 -1.2083083753201984 0.16913042396249212 1.31830897028215 0 -2 0 +89 1 -0.622943103836138 0.15695545887374523 0.03344907944561345 0 0 -1 +93 1 -0.6871612783719626 1.4782545941619265 1.7130745398216136 0 -1 0 +94 1 -1.209899480419889 1.1419050120740204 0.768566708093127 0 0 0 +181 1 0.8338139283938067 0.2955625473112081 0.1708175991674893 -1 1 -1 +129 1 1.1355758059362249 0.3630461551808931 1.290797674214222 -1 0 0 +182 1 0.08831527814343061 0.9709201913937692 0.9217855950625892 0 1 -1 +158 1 1.4062820374169525 1.1517166598840343 0.6269036353613398 0 0 0 +100 1 2.8360458941172935 1.5280995172170748 0.62642849190607 0 1 0 +59 1 3.120666407088228 0.49773318717092796 1.2390797462592613 0 -1 1 +40 1 2.1784673001300465 0.9493086808156442 1.37690657576216 0 0 0 +110 1 3.092811420136352 1.457598231264991 1.8333488137634408 0 0 -2 +71 1 -2.704068160468349 3.198799130983575 1.5420861670955985 0 -1 -1 +187 1 -3.3809787804159894 2.339193447924602 0.9253127201661663 1 1 0 +58 1 -1.8161128905276918 3.295453805825648 0.4419286058239596 0 -1 0 +39 1 -1.9288855291902436 2.399541640622866 1.1856795461879515 0 -2 0 +115 1 -1.3188418056778684 -3.426962627878111 1.3071043811339145 1 1 0 +109 1 0.7422148102651713 1.9772692916114134 0.8946623229549697 -1 1 0 +48 1 1.212990075236676 2.7637861839630933 1.668138216427735 0 0 -1 +44 1 1.8875283020177747 2.01954806585405 0.15097670327664356 -1 -1 1 +16 1 2.5088486436667465 3.2867062332187165 0.5352876678637931 0 -2 1 +150 1 2.339993315563226 2.225227215494749 1.201791196292386 0 -1 1 +101 1 -2.7232595674410254 -2.5310321070553594 2.520173028347837 1 3 1 +121 1 -0.1371595891679715 -2.734037361783574 3.2547541081110136 -1 1 -1 +131 1 -1.616105025949218 -1.97873290984862 2.2250110182725185 1 0 0 +50 1 -0.9774458776093428 -3.080336575399165 2.647294574069851 0 1 0 +78 1 -0.6388640381972747 -1.8358994538797384 3.0793625374288474 1 -1 1 +126 1 0.2617829860592282 -3.185635897887874 2.046978007125428 0 1 -1 +185 1 0.3910180046792306 -1.7476201774885758 3.460179487049301 -2 1 -1 +27 1 0.9216706073777299 -2.620009754961919 2.980059759810019 0 0 1 +5 1 0.14805884420723833 -2.060999311749248 2.194803632818035 0 -1 -1 +10 1 1.3885697256222325 -2.5811721069430047 1.960299612344295 0 0 1 +68 1 1.2305537223759786 3.452417391198064 2.5060768204562396 0 0 1 +92 1 3.2579931163558924 -3.0623298587917547 1.8252693484803535 0 2 -1 +178 1 2.26419751848874 -1.7585846281228215 1.7123805014943867 1 1 0 +96 1 2.599921016729558 -2.6427367710738228 3.4145177684858803 -2 2 -1 +57 1 3.2402592062064213 -1.9899576048001384 2.7907002699370937 1 0 0 +155 1 2.209613988042176 -1.7162524781709796 2.7271827572979834 0 0 -1 +168 1 3.477326382335708 -3.4068959852573992 2.821891114170504 -1 1 -2 +175 1 -3.1260125076640937 -0.1261845495956751 3.231607373653429 0 0 0 +117 1 -2.5082381499858095 -1.6201356456498082 1.916360867966056 0 0 0 +4 1 -3.1142920073981517 -0.7023062901592412 1.8555906719306698 0 0 -1 +51 1 -1.9626772134484154 -1.4010881760394245 3.033958867461655 0 0 -1 +148 1 -3.011516485433896 -1.1469037793442038 2.7610753028279933 0 0 0 +197 1 -2.0048159662329326 -0.6749211621392989 2.344679442661877 0 -1 -1 +70 1 -1.8654941392471802 -0.3319695813423535 3.329224742630753 0 1 1 +23 1 -1.0720302561208543 -0.8796307974060223 2.9652586368172633 0 0 -2 +134 1 -0.9769774773292339 -1.023866537972646 1.8133872200496586 -1 0 0 +66 1 0.0812156007450339 -1.0967406204476347 2.677696992399577 -1 -1 -1 +33 1 -0.42833987516917704 0.2127920276630183 3.0504271041557827 0 -1 -1 +18 1 0.8738459806171345 -0.7301638515378504 3.451151027750579 0 -1 -2 +167 1 1.1687036142366616 -1.4517802174625138 2.5014340704062015 0 1 -1 +136 1 1.795137560517328 -0.5623222017058748 2.761148573575212 0 -1 -2 +176 1 0.8667263057428289 -0.39855552371320657 2.157386135628261 0 0 0 +132 1 2.7791570748849397 -0.1854473725861777 3.06331164881256 0 0 -1 +163 1 2.861161516036147 -0.9653887253660198 2.3742914745631665 -1 -1 0 +159 1 -1.638440405488927 1.040992844593558 1.6945368306541542 0 0 0 +34 1 -2.319980614869211 0.615010700172925 2.607891496520952 1 0 -1 +67 1 -1.8758084270870021 1.7856292006021222 2.9794597615239873 1 0 0 +82 1 3.450078342208421 0.43347862445962865 2.3965330453749276 -1 -1 -1 +20 1 -0.3345634991984191 0.4474749361055883 2.021125197093307 1 0 -1 +160 1 -1.337826167757788 0.19507650189296638 2.4559469377176044 0 0 0 +191 1 -0.9433598322448645 1.0765639185970945 2.7978676989244713 1 -1 0 +97 1 1.4995074975439164 1.4827775589636611 2.8582397165142885 0 -1 -1 +83 1 0.7440931705195399 0.28485269404070884 2.8824261695219513 0 -2 0 +186 1 0.4501325900005473 1.1817617584793225 2.171005382838285 1 1 0 +21 1 1.5799209373811796 0.5165927484280916 2.197344395644513 1 0 -1 +170 1 1.781383760665039 0.4589516263468447 3.2606047972968697 -1 1 -1 +15 1 2.5264882009659457 -0.10271458568953422 1.9429509270634897 -1 0 -1 +54 1 2.4907565610148112 1.0443458588262453 2.659572052524602 0 -1 -1 +45 1 -2.3851170089162586 2.7278135027281576 3.2923683043438063 1 0 -1 +47 1 -2.417816843075144 1.911767591397239 2.070179319067279 0 1 0 +52 1 -3.4931268842957652 2.50155605132379 2.127865658713496 0 -1 0 +180 1 -1.9509177290095516 3.309670529089689 2.349688492929276 1 -1 1 +13 1 -0.12240867021598209 3.2141258686958913 2.833411182871058 -1 -1 1 +2 1 -1.340442106022601 2.2849149851767008 2.069093746173476 1 -2 -1 +124 1 -0.41265942682553436 2.1334074442091007 2.592421577863454 1 -1 -1 +61 1 0.7799049336891462 2.500510040165389 2.633457440959517 -1 -2 0 +128 1 2.8514020342376654 2.399755896897204 3.251183881976271 0 0 -2 +169 1 2.1185477137097575 2.27540363851787 2.3296903855745934 0 0 0 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 new file mode 100644 index 0000000000..aab14fd30f --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 @@ -0,0 +1,219 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 8000 + +200 atoms +1 atom types + +-3.4945130603740377 3.4945130603740377 xlo xhi +-3.4945130603740377 3.4945130603740377 ylo yhi +-3.4945130603740377 3.4945130603740377 zlo zhi + +Masses + +1 1 + +Pair Coeffs # lj/cut + +1 1 1 + +Atoms # atomic + +141 1 -1.763209980389579 -2.6156484242195064 -2.931843780833984 2 0 0 +152 1 -1.5928871542954757 3.3501884422702433 -1.8656866405706811 -1 -2 0 +49 1 -2.7539752553137182 -3.2181862303090325 -3.2982185001231508 0 1 0 +113 1 -0.7003027892165357 -2.1799819378730754 -2.999588953057854 -1 0 0 +147 1 -0.9066147762335637 -3.0721536393085946 -3.451497569202878 0 1 0 +25 1 -0.8348129272923334 -3.2010555139777104 -2.4342714727995403 -1 0 1 +7 1 -1.155032969500839 -2.109409697780318 -2.01960214884411 -1 0 1 +122 1 -0.11210230788570166 -2.6275713274626975 -1.900506384406081 1 0 -1 +55 1 0.23346664931542635 -2.573966195106371 -3.0437128589517024 -1 0 -1 +95 1 0.716981854784511 -1.7560064219465084 -1.6999612600924723 0 2 -1 +105 1 1.1248014998718883 -1.7403082354703703 -3.356758018801178 0 0 0 +84 1 2.225043764737794 -2.1031554472806464 -3.42558560520243 0 0 0 +65 1 -2.8977942390562763 -2.1977837904725823 -3.370623324950664 0 -1 0 +175 1 -3.151432241251456 -0.37515180280237564 3.4437485581764316 0 0 0 +173 1 -2.3157350741156972 -0.12943144237356516 -2.753320161369244 1 0 1 +174 1 -1.4393153013859372 -1.4595317956467175 -2.895392195630071 -1 0 -1 +189 1 -0.9035292808774392 -0.8049470303120404 -2.0013910310988474 0 0 2 +171 1 -0.09043747063992294 -1.5712222691835853 -2.3464524824680155 0 2 -1 +9 1 -0.38933479997274456 -0.745737254721562 -3.0928316849953847 0 0 1 +37 1 0.8181444837942082 -0.7091668788083872 -2.594933610756206 1 0 1 +170 1 1.3754078695474516 -0.09950193181623739 -3.3522400330808644 -1 1 0 +69 1 1.8294621328196188 -1.0504767914076205 -2.8686605757666803 0 -2 0 +11 1 3.053917621871791 -1.2494689141836135 -3.2389748560412586 -1 2 1 +132 1 2.7977059570311695 -0.2496088420677755 -3.341775035063612 0 0 0 +190 1 3.4919178496580034 0.673724849434539 3.4160908466980175 -1 0 -1 +146 1 -0.6231884714133011 0.14913282842463038 -2.641949381637644 2 1 2 +135 1 -1.5674517925968012 0.6290709302591437 -2.3856462153486317 1 0 0 +183 1 -0.49431360672463004 1.4890871743231773 -2.7350680810605428 1 0 0 +74 1 0.37022638217671316 0.08409992531451556 -3.033741105582725 1 -1 1 +26 1 0.4574609043057575 1.0299917975368564 -2.3172978982485737 0 -1 1 +28 1 1.1181699312197082 1.1244486490934802 -3.1866832135712855 0 -1 -1 +29 1 -2.5977690868714194 2.5288932865762908 -3.4450145823917615 1 -1 0 +60 1 -1.7983398047844672 3.3151201773371946 -2.9557747417019304 1 1 0 +35 1 -2.341675516391612 2.5752707942079995 -2.1932303039293837 1 -1 0 +172 1 -1.5906394201515217 2.0015866768978423 -2.97713376733703 0 0 2 +90 1 -0.9570316941978154 2.7341944347748575 -2.39704430602322 0 -1 1 +41 1 0.17097469683906785 3.422589740764926 -2.7250117611585174 0 0 1 +102 1 -2.1834144246935057 -1.9708341062049972 -1.651792998752301 1 -1 -1 +19 1 -2.799899482947646 -2.4762586983196475 -0.30170497621753223 1 1 -1 +193 1 -1.8524344777477728 -2.9040612754975954 -0.9352876177978476 1 1 0 +76 1 -0.14754768813509733 -2.534237145454477 -0.5903298333231304 0 0 0 +104 1 -1.4292162927828058 -1.8887180032986757 -0.7510048521253992 0 0 -1 +14 1 -0.7531800111600084 -3.202737076324235 -1.3992046647831564 -1 0 1 +188 1 1.0895178734825146 -2.3416281855941414 0.09937021752979631 -1 0 0 +157 1 1.53648073670157 -2.278353849103656 -0.9969007844888839 -1 -1 1 +64 1 3.2685116460755688 -1.7040641958682559 -0.168149877537844 0 1 0 +196 1 3.243226770875574 -2.735431073745969 -0.24543333692900807 0 2 1 +120 1 -2.7480834527815015 -1.2726347498238166 -0.7010605053509458 2 1 1 +166 1 -2.5409778907446827 -0.09698240322803402 -1.3435121782531134 0 1 0 +30 1 -2.536346720442665 -0.46539641115594493 0.008770351469747525 1 -1 0 +80 1 -1.716490207148261 -0.7528793181105096 -0.6170398381312646 0 0 1 +17 1 -0.8652064576231921 -1.1974714632304932 -0.15888843807113082 -2 0 0 +98 1 -0.5496242692202938 -0.5939149881300675 -0.9303624863402448 -1 0 0 +6 1 -0.45332547354146785 -1.6738816451677578 -1.1232699958219994 2 0 0 +140 1 0.09381666738090248 -0.533597973200848 -1.8865070415277823 -1 0 0 +106 1 0.5488648307350995 -1.2535162508826685 -0.8256886196074045 -1 0 0 +36 1 0.7889198394938511 -0.3476398702185327 -0.04547023889787161 1 -1 0 +24 1 1.3300945978662577 -0.35153772413771023 -0.9700284287655409 1 -1 0 +81 1 2.0630098337462903 -0.9138666208698583 -0.13962068859670462 -1 0 1 +91 1 -3.4535066291698033 -0.4796384079540839 -0.5221884185889151 1 -1 -1 +164 1 -1.8003776637651108 1.3095354466285742 -0.9389018844249196 0 0 1 +87 1 -1.8547858498275616 0.3065099544053662 -0.4980768850921695 0 -1 1 +145 1 -3.090772587596814 0.5837989607708169 -0.6251810283740868 0 -2 -1 +111 1 -2.534664983415859 1.34688446772606 0.11460128889340086 1 1 1 +79 1 -1.380899470765548 0.24370827853097413 -1.4854169578503262 0 1 0 +162 1 -1.1815902722068103 1.6597770188121743 -1.9852434376303232 0 0 1 +112 1 -0.32558743037491716 0.7106169572157139 -1.615285962267308 0 0 0 +56 1 -0.8283072702254036 0.4564624534306639 -0.5700689028075459 0 0 1 +182 1 0.04863074266364189 0.7978824700683131 -0.008284573593351257 0 1 -1 +177 1 -0.6481696376748467 1.7650890642565358 -0.05338043165294714 0 1 -1 +137 1 0.32639925685778487 -0.05353328668133155 -0.9586895874383917 -1 1 -1 +165 1 0.9387159980444888 0.2522291776639033 -1.8478441123660552 0 0 0 +3 1 1.0844300875316264 0.6025889724525081 -0.4582563908829376 0 -1 1 +194 1 0.8662415299163716 1.2219273986337442 -1.3857941220556813 0 1 -1 +158 1 2.0486184184859972 0.9634063040985638 -0.3354215045861158 0 0 0 +42 1 -1.5693584560601268 2.9075068816274467 -0.8387140667909673 0 1 -1 +99 1 -1.6113116181616747 2.147179220461499 0.1775215873578245 0 -1 0 +72 1 -0.6293873725016741 2.630010118252137 -0.9564776518035689 1 -1 0 +38 1 -2.8640470065198236 -2.2435586739017785 1.3910743129711478 1 0 1 +143 1 -3.0743396057883414 -3.212849746838124 0.5259359570888149 1 1 0 +58 1 -1.9981958681612715 -3.1822656548185346 0.09920225142503952 0 0 0 +144 1 -2.279979967578157 -3.0851896187054515 1.4084093697981352 0 1 0 +151 1 -2.0216078245666655 -2.2216580360079643 0.7457122321748793 0 1 2 +130 1 -0.17493166269242383 -2.4315359476317373 0.444080856211588 -1 1 0 +149 1 -1.3750250274960272 -1.974930490228725 1.5829454078902832 1 1 0 +115 1 -1.2118995350185076 -2.9035919135907267 0.8179968023020373 1 1 0 +126 1 -0.25733050703242866 -2.3407760209116555 1.6674720764378244 0 1 -1 +123 1 0.5187414713973443 -1.8755931680751559 1.2290889493691715 -1 1 -1 +92 1 3.2842270894719214 -2.336991573654636 0.7621232582722934 0 2 -1 +142 1 2.8537576665436712 -3.369110508718591 0.5560526759827451 1 1 0 +1 1 2.08557845839204 -2.010493903326111 0.46603456602394955 0 -1 0 +12 1 -2.813558556370972 -1.5225310581093578 0.39881007051362743 0 0 1 +200 1 -2.620780645842095 -0.6334500549042138 1.1697962611458572 -1 0 0 +117 1 -2.3409262065663707 -1.4262844598718953 1.577896400637549 0 0 0 +199 1 -1.6721028915736709 -0.3937836671461621 1.764496832035196 1 -1 1 +119 1 -1.3702172421751233 -0.982726844411586 0.8109159599445125 0 -1 0 +118 1 -1.22523977151256 0.049111500972962366 0.34422431168243056 0 1 0 +179 1 -0.48400468992080004 -1.5634732075160336 0.9724005879568145 -1 3 1 +153 1 -0.7754078116015299 -0.12746028844271876 1.3139844087365358 1 1 0 +31 1 -0.21960550339589976 -0.3692535839546128 0.27760883173133294 0 -1 0 +154 1 1.1892001894282327 -1.234463776085168 0.4980011557336487 -1 2 0 +198 1 0.208959161472621 -0.7925251742172552 1.1981697813594612 0 0 1 +133 1 0.2021894978277857 -1.321629803385425 0.21342138424976495 1 1 1 +8 1 1.290866486655316 -0.32315323656178685 1.238429676489808 0 0 0 +43 1 1.4755875560077207 -1.5038423322367462 1.5696783276393578 -1 -1 1 +178 1 2.5595353005590473 -1.8548623704973153 1.5265130435507075 1 1 0 +156 1 3.10009336795942 -1.1347768292920712 0.7103971454931245 0 -1 0 +195 1 3.0488535895478486 -0.3819070637556806 1.6994009663148437 1 0 2 +32 1 2.1785721999000907 -0.8868183892594861 1.0608219538420214 1 0 -1 +75 1 -3.330023312049968 -0.13053199225722137 0.5772143324801579 1 -1 0 +138 1 -2.126928513622699 0.2705982397065681 0.9031685365715656 0 1 -1 +103 1 -2.5233875332738447 1.119832203926971 1.7143082124863906 -1 1 0 +89 1 -1.5625051595744621 1.0842527403417836 0.48114251556352683 0 0 -1 +73 1 -1.3841491529474708 0.7735632155517752 1.4917172788469495 0 -2 0 +93 1 -0.8459409435273203 1.6986071717879083 1.233579181789839 0 -1 0 +22 1 0.23130054165086983 0.3973595019638049 1.136265889331469 -1 0 -1 +181 1 1.6715679048902568 0.38189497066002065 0.5813616713777726 -1 1 -1 +125 1 0.7657348058398646 1.4638634812356126 0.3595929949039634 0 1 0 +129 1 1.187621376432971 0.7432781269466477 1.4756104377419834 -1 0 0 +186 1 0.12119836338531766 1.4258158866314226 1.7139997055217806 1 1 0 +44 1 3.246466614044557 0.935266979887072 0.09504504915790167 -1 -1 1 +139 1 2.294764083473655 0.2623628592978102 1.523064327633417 -1 2 0 +85 1 2.6715078057197426 -0.13923978779568133 0.48921080221894214 1 0 1 +100 1 2.179445623029225 1.1813699866412055 0.929258254331208 0 1 0 +59 1 3.199013987449739 0.7056213255691308 1.3011789902622373 0 -1 1 +184 1 -3.3541957825280964 1.6540170153788636 1.314525393258615 0 0 1 +116 1 -2.5607854807212633 2.8662954762956563 0.2561876654735037 1 0 0 +94 1 -2.209938696472392 1.817908573668992 0.9714554983444477 0 0 0 +16 1 3.462148790854558 2.750688132987863 1.1678814516580918 0 -2 1 +127 1 -0.6724215018270191 2.910608435174655 0.1393721830184081 0 -1 0 +39 1 -1.4963936644183389 2.8490269023893804 1.0397387839630663 0 -2 0 +109 1 1.2282064333649392 2.002097356660932 1.219647219360347 -1 1 0 +13 1 -0.038761589919005045 2.283368111259498 0.6285508805046305 -1 -1 1 +68 1 1.8122507294414043 2.919628635322565 1.388388027502655 0 0 1 +187 1 2.839543107439997 1.9712312705165291 0.44701965347775696 0 1 0 +150 1 2.6350933896773805 2.228885886643039 1.6430472643318494 0 -1 1 +101 1 -2.9845915106276357 -2.643240276070094 2.6131611879137338 1 3 1 +180 1 -2.4664624391703636 3.2461534604898077 2.2991216200041777 1 -1 1 +131 1 -2.1198879143055582 -2.5254800707290985 2.2468458013290475 1 0 0 +88 1 -1.8261664412558902 -3.2761989619835945 3.0217607589697706 0 1 -1 +51 1 -1.7527244407627123 -2.1114193587023125 3.178648460302574 0 0 -1 +121 1 -0.8632847382707834 -2.364486787477818 2.5298242427842235 -1 1 -1 +50 1 -1.3127850841438964 -3.332989957578539 1.7903541140988317 0 1 0 +63 1 1.6040989853168577 -2.8917377487223326 2.9749125296584396 -1 1 0 +27 1 0.22872838010698016 -2.994984028716655 2.6653598205127595 0 0 1 +10 1 0.9362147196804173 -2.581105523755157 1.9878669654444103 0 0 1 +185 1 0.06742724446398485 -1.8726052150227481 3.179787889614259 -2 1 -1 +62 1 0.9381874848569671 3.2183812476038773 2.122950032967029 0 0 0 +108 1 3.2075816395574557 -2.6473251670969744 3.3899630726255054 1 1 -1 +168 1 -3.4886505297786643 -3.024902771510678 1.648075348189236 0 1 -2 +96 1 2.193516168781477 -3.220451114036294 2.031971070369377 -2 2 -1 +57 1 2.897670474066688 -1.7869273194590956 2.7802854592878443 1 0 0 +155 1 2.0203257801003764 -2.093908363815807 2.3651374010253265 0 0 -1 +70 1 -2.289198729241698 -1.0693505000499786 3.3341581014665116 0 1 1 +86 1 3.4317154036170927 -1.33629793948954 1.5868690985104916 -2 0 0 +4 1 -2.642034929204445 -0.5735696636076526 2.24988074624273 0 0 -1 +148 1 -2.7958435550832177 -1.6271830272245196 2.4651167378398258 0 0 0 +197 1 -1.6297637248397103 -1.2496732630952756 2.4653302717640746 0 -1 -1 +23 1 -1.4165843839294037 -0.23332219410733462 -3.3887252652014874 0 0 -1 +78 1 -0.8539129642965406 -1.4368914881460948 3.1097976169270467 1 -1 1 +134 1 -0.7681520363929484 -1.1354013495310054 1.8538106613640677 -1 0 0 +66 1 -0.23373724912576396 -0.5882558302750734 2.5656269999794135 -1 -1 -1 +160 1 -1.1132775718863501 0.16126595419727965 2.3994619853672896 0 0 0 +18 1 0.6168554097448792 -0.8675105647197154 3.3233443940314107 0 -1 -2 +5 1 0.21124689546372627 -1.527936340282886 2.128421015823146 0 -1 -1 +167 1 1.157996163161525 -1.3890474926504965 2.5930120556899743 0 1 -1 +176 1 0.7227757787132028 -0.4265054817409199 2.130677354553178 0 0 0 +77 1 2.0007502274099562 -0.6930768409753575 2.0562080526704536 0 -1 1 +136 1 2.059758900185651 -1.052357318680519 3.1194387358517117 0 -1 -2 +163 1 3.3650479388293877 -0.7812523229666395 2.7231341802578797 -1 -1 0 +53 1 -2.3141819292399695 1.20855609162257 -3.127003289906138 -1 -1 1 +34 1 -2.2520285035649175 0.34377072469492165 3.2433897655354262 1 0 -1 +82 1 -3.1361148993392707 0.2917712829104399 2.508598507937298 0 -1 -1 +47 1 -2.903472142580087 1.2996380231419302 2.6614912616951822 0 1 0 +159 1 -1.8421866316781088 1.3742261871908503 2.7832166426856038 0 0 0 +161 1 -1.2319440636738626 0.9387211724622819 -3.4892930122068617 1 0 2 +33 1 -0.4449542140900899 0.2769280403688486 3.289217283277774 0 -1 -1 +191 1 -0.8687075277531521 1.281273999295463 2.3493691514045447 1 -1 0 +20 1 -0.12835229617409075 0.4001437971686418 2.091186274425671 1 0 -1 +21 1 1.5590447736292827 0.23116165627532026 2.4331182207698356 1 0 -1 +83 1 0.6019872094726322 0.17868421219256525 2.965010196172179 0 -2 0 +107 1 -0.09314344901480053 1.8386195873289717 2.9198165047206524 -1 1 0 +97 1 0.9500008570521725 1.1147256892756756 2.5445482565685626 0 -1 -1 +15 1 2.6866827472081427 0.05611542822496954 2.621280841687164 -1 0 -1 +40 1 2.0535009935702107 1.3482348414084473 2.153119101811638 0 0 0 +110 1 3.037377950690711 1.1454318013031137 2.4602998295324308 0 0 -2 +54 1 2.1368310833242825 0.6989281938007096 3.190545712320829 0 -1 -1 +71 1 -2.6906257490825327 2.3188264822083675 1.851572369390678 0 -1 -1 +45 1 -1.8822606439217724 2.5464355632785174 2.887157746831732 1 0 -1 +2 1 -1.527738763941238 2.1784215473644295 1.8498426738676617 1 -2 -1 +67 1 -1.014923597719753 2.0522310481028465 3.091487536680741 1 0 0 +192 1 -0.8672155474955553 3.087168735274927 2.6165250257240618 1 0 1 +124 1 -0.37769468839105996 2.5506571887551175 1.8053870882842125 1 -1 -1 +46 1 -0.2092884053324724 2.562694157698328 -3.2372195292692605 1 -1 -1 +114 1 -0.2001222858286487 -3.429888000295159 1.8301280696628333 0 0 0 +61 1 0.5140644440329998 2.208326878392573 2.2153556959139413 -1 -2 0 +169 1 1.5629071468921552 2.2983930760888316 2.2366483189031316 0 0 0 +128 1 -3.438885935852406 3.376929578988928 3.002455750479755 1 0 -2 +52 1 -3.4549495641597217 2.178628786705743 2.923210719991474 0 -1 0 +48 1 2.502392696348409 2.9340155922847346 2.5991521468190113 0 0 -1 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp b/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp new file mode 100644 index 0000000000..80bfbe4956 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp @@ -0,0 +1,26 @@ +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ new file mode 100644 index 0000000000..4ed421dddb --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ @@ -0,0 +1,2 @@ +LAMMPS (28 Mar 2023) +Running on 2 partitions of processors diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 new file mode 100644 index 0000000000..d219e20845 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 @@ -0,0 +1,97 @@ +LAMMPS (28 Mar 2023) +Processor partition = 0 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} +read_data data.lj01 +Reading data file ... + orthogonal box = (-3.4945131 -3.4945131 -3.4945131) to (3.4945131 3.4945131 3.4945131) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + read_data CPU = 0.001 seconds + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L 01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99775496e-01 2.11886210e-02 + 1 1.31777963e+02 3.79426112e-03 9.42540858e-01 3.34090903e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 3.1015 + ghost atom cutoff = 3.1015 + binsize = 1.55075, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.117 | 3.117 | 3.117 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] Volume Press + 0 0 0 0 -875.67022 841866.06 -843041.14 253.30998 382.47517 -1646.2945 -1.9663356 -0.82731217 341.38937 -1.3810467 + 100 14.815998 4422.5753 0 -534.91485 5336.9805 -409.03828 7790.9787 306.80845 -0.79877176 13.250868 8.3263811 341.38937 12.561531 + 200 13.762526 4108.114 0 -535.07896 4177.1707 63.548813 -8225.489 308.68383 0.1240984 12.723365 8.0800159 341.38937 12.1757 + 300 12.566448 3751.0847 0 -493.13907 3999.3337 -31.433066 8675.7059 309.21599 -0.061382631 14.105486 8.6052841 341.38937 12.245009 + 400 11.843976 3535.4267 0 -515.14836 3784.077 -23.971605 -81.467506 309.02093 -0.046811856 13.638064 8.2470184 341.38937 11.61585 + 500 11.100239 3313.4214 0 -521.49831 3555.6926 -56.076799 648.94757 309.45936 -0.10950702 12.805213 7.7261445 341.38937 10.991018 + 600 9.9616183 2973.5431 0 -462.72888 3219.061 41.992567 3171.6576 309.48724 0.082003271 13.759365 8.0375919 341.38937 11.071546 + 700 9.3388468 2787.6458 0 -501.33865 2901.4483 81.033913 2000.5159 309.02619 0.15824338 12.744135 7.4580508 341.38937 10.129991 + 800 8.9069211 2658.716 0 -523.1858 2864.6773 -29.435005 2329.1521 308.67617 -0.057480808 11.604242 6.8135454 341.38937 9.3513467 + 900 8.5046965 2538.6519 0 -543.75602 2597.5491 50.752591 601.47078 308.62547 0.099109884 10.497389 6.2142574 341.38937 8.6389792 + 1000 8.0725601 2409.6592 0 -571.72872 2533.47 -23.431499 -1267.4683 308.58765 -0.045757135 9.421094 5.5928021 341.38937 7.8375753 +Loop time of 0.201181 on 1 procs for 1000 steps with 200 atoms + +Performance: 192854.150 tau/day, 4970.640 timesteps/s, 994.128 katom-step/s +98.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 | 0.11949 | 0.11949 | 0.11949 | 0.0 | 59.39 +Neigh | 0.011868 | 0.011868 | 0.011868 | 0.0 | 5.90 +Comm | 0.0041169 | 0.0041169 | 0.0041169 | 0.0 | 2.05 +Output | 0.00011916 | 0.00011916 | 0.00011916 | 0.0 | 0.06 +Modify | 0.064249 | 0.064249 | 0.064249 | 0.0 | 31.94 +Other | | 0.00134 | | | 0.67 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1117 ave 1117 max 1117 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7492 ave 7492 max 7492 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7492 +Ave neighs/atom = 37.46 +Neighbor list builds = 55 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 new file mode 100644 index 0000000000..0804a3488a --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 @@ -0,0 +1,97 @@ +LAMMPS (28 Mar 2023) +Processor partition = 1 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} +read_data data.lj02 +Reading data file ... + orthogonal box = (-3.4945131 -3.4945131 -3.4945131) to (3.4945131 3.4945131 3.4945131) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + read_data CPU = 0.001 seconds + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L 02 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99775496e-01 2.11886210e-02 + 1 1.31777963e+02 3.79426112e-03 9.42540858e-01 3.34090903e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 3.1015 + ghost atom cutoff = 3.1015 + binsize = 1.55075, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.117 | 3.117 | 3.117 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] Volume Press + 0 0 0 843646.47 -904.74343 841866.06 -843041.14 253.30998 382.47517 -1646.2945 -1.9663356 -0.82731217 341.38937 -0.58528882 + 100 3.1994696 955.04167 1014.3663 -520.08788 5336.9805 -409.03828 7790.9787 306.80845 -0.79877176 13.250868 8.3263811 341.38937 5.9400539 + 200 2.0518234 612.46927 541.77919 -550.11284 4177.1707 63.548813 -8225.489 308.68383 0.1240984 12.723365 8.0800159 341.38937 5.1568532 + 300 2.0005565 597.16612 636.76107 -492.53916 3999.3337 -31.433066 8675.7059 309.21599 -0.061382631 14.105486 8.6052841 341.38937 6.1061183 + 400 2.1301774 635.85796 629.2996 -501.35894 3784.077 -23.971605 -81.467506 309.02093 -0.046811856 13.638064 8.2470184 341.38937 6.0950651 + 500 2.1090509 629.55171 661.4048 -527.18699 3555.6926 -56.076799 648.94757 309.45936 -0.10950702 12.805213 7.7261445 341.38937 5.6641225 + 600 2.1073653 629.04855 563.33543 -484.13719 3219.061 41.992567 3171.6576 309.48724 0.082003271 13.759365 8.0375919 341.38937 6.2053973 + 700 1.9719777 588.63535 524.29409 -497.78822 2901.4483 81.033913 2000.5159 309.02619 0.15824338 12.744135 7.4580508 341.38937 5.9107525 + 800 2.0469949 611.02799 634.76301 -516.64387 2864.6773 -29.435005 2329.1521 308.67617 -0.057480808 11.604242 6.8135454 341.38937 5.445481 + 900 1.9587942 584.70008 554.57541 -536.62232 2597.5491 50.752591 601.47078 308.62547 0.099109884 10.497389 6.2142574 341.38937 4.9080572 + 1000 2.0978185 626.19882 628.7595 -559.41879 2533.47 -23.431499 -1267.4683 308.58765 -0.045757135 9.421094 5.5928021 341.38937 4.5477372 +Loop time of 0.20118 on 1 procs for 1000 steps with 200 atoms + +Performance: 192855.450 tau/day, 4970.674 timesteps/s, 994.135 katom-step/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 | 0.12009 | 0.12009 | 0.12009 | 0.0 | 59.69 +Neigh | 0.012807 | 0.012807 | 0.012807 | 0.0 | 6.37 +Comm | 0.0040331 | 0.0040331 | 0.0040331 | 0.0 | 2.00 +Output | 0.00012271 | 0.00012271 | 0.00012271 | 0.0 | 0.06 +Modify | 0.062764 | 0.062764 | 0.062764 | 0.0 | 31.20 +Other | | 0.001361 | | | 0.68 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1117 ave 1117 max 1117 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7460 ave 7460 max 7460 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7460 +Ave neighs/atom = 37.3 +Neighbor list builds = 57 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/run.sh b/examples/PACKAGES/pimd/langevin_reduced_units/run.sh new file mode 100644 index 0000000000..adc7f4b955 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/run.sh @@ -0,0 +1 @@ +mpirun -np 2 $LMP -in in.lmp -p 2x1 -log log -screen screen diff --git a/examples/QUANTUM/LATTE/latte_mdi.py b/examples/QUANTUM/LATTE/latte_mdi.py index 0170feee1f..ba1a83120a 100644 --- a/examples/QUANTUM/LATTE/latte_mdi.py +++ b/examples/QUANTUM/LATTE/latte_mdi.py @@ -153,7 +153,7 @@ def mdi_engine(other_options): # engine --> driver - mdi.MDI_Register_Command("@DEFAULT","LATTICE_FORCES") mdi.MDI_Register_Command("@DEFAULT"," driver - mdi.MDI_Register_Command("@DEFAULT","LATTICE_FORCES") #mdi.MDI_Register_Command("@DEFAULT"," driver - mdi.MDI_Register_Command("@DEFAULT",">>>> hey!") + #elems = self.as_tensor(data.elems).type(torch.int64).reshape(1, data.ntotal) + + """ + elems = self.as_tensor(data.elems).type(torch.int64) + 1 + #z_vals = self.species_set[elems+1] + pair_i = self.as_tensor(data.pair_i).type(torch.int64) + pair_j = self.as_tensor(data.pair_j).type(torch.int64) + rij = self.as_tensor(data.rij).type(torch.float64).requires_grad_(True) + nlocal = self.as_tensor(data.nlistatoms) + """ + + rij = data.rij + + #(total_energy, fij) = self.network(rij, None, None, None, nlocal, elems, pair_i, pair_j, "cpu", dtype=torch.float64, mode="lammps") + + test = self.model(rij) + + #data.update_pair_forces(fij) + #data.energy = total_energy.item() + + pass + +def setup_LAMMPS(energy): + """ + + :param energy: energy node for lammps interface + :return: graph for computing from lammps MLIAP unified inputs. + """ + + model = TheModelClass(*args, **kwargs) + + save_state_dict = torch.load("Ta_Pytorch.pt") + model.load_state_dict(save_state_dict["model_state_dict"]) + + + #model.load_state_dict(torch.load(PATH)) + model.eval() + + #model.eval() + return model \ No newline at end of file diff --git a/examples/reaxff/HNS/in.reaxc.hns b/examples/reaxff/HNS/in.reaxc.hns index 775a389eca..5b83698917 100644 --- a/examples/reaxff/HNS/in.reaxc.hns +++ b/examples/reaxff/HNS/in.reaxc.hns @@ -37,4 +37,4 @@ velocity all create 300.0 41279 loop geom fix 1 all nve fix 2 all qeq/reax 1 0.0 10.0 1e-6 reax/c -run 100 +run $t diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index cb7adfd34b..28e40bca44 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -20,7 +20,7 @@ ! University of Missouri, 2012-2020 ! ! Contributing authors: -! - Axel Kohlmeyer , Temple University, 2020-2022 +! - Axel Kohlmeyer , Temple University, 2020-2023 ! - Karl D. Hammond , University of Missouri, 2022 ! ! The Fortran module tries to follow the API of the C library interface @@ -44,11 +44,12 @@ MODULE LIBLAMMPS ! Data type constants for extracting data from global, atom, compute, and fix ! ! Must be kept in sync with the equivalent declarations in - ! src/library.h, python/lammps/constants.py, tools/swig/lammps.i, + ! src/library.h, src/lmptype.h, python/lammps/constants.py, tools/swig/lammps.i, ! and examples/COUPLE/plugin/liblammpsplugin.h ! ! These are NOT part of the API (the part the user sees) INTEGER(c_int), PARAMETER :: & + LAMMPS_NONE = -1, & ! no data type assigned (yet) LAMMPS_INT = 0, & ! 32-bit integer (or array) LAMMPS_INT_2D = 1, & ! two-dimensional 32-bit integer array LAMMPS_DOUBLE = 2, & ! 64-bit double (or array) @@ -87,10 +88,15 @@ MODULE LIBLAMMPS INTEGER(c_int) :: scalar, vector, array END TYPE lammps_type + TYPE lammps_dtype + INTEGER(c_int) :: i32, i64, r64, str + END TYPE lammps_dtype + TYPE lammps TYPE(c_ptr) :: handle = c_null_ptr TYPE(lammps_style) :: style TYPE(lammps_type) :: type + TYPE(lammps_dtype) :: dtype CONTAINS PROCEDURE :: close => lmp_close PROCEDURE :: error => lmp_error @@ -100,6 +106,7 @@ MODULE LIBLAMMPS PROCEDURE :: commands_string => lmp_commands_string PROCEDURE :: get_natoms => lmp_get_natoms PROCEDURE :: get_thermo => lmp_get_thermo + PROCEDURE :: last_thermo => lmp_last_thermo PROCEDURE :: extract_box => lmp_extract_box PROCEDURE :: reset_box => lmp_reset_box PROCEDURE :: memory_usage => lmp_memory_usage @@ -243,7 +250,7 @@ MODULE LIBLAMMPS END TYPE lammps_data_baseclass ! Derived type for receiving LAMMPS data (in lieu of the ability to type cast - ! pointers). Used for extract_compute, extract_atom + ! pointers). Used for extract_compute, extract_atom, last_thermo TYPE, EXTENDS(lammps_data_baseclass) :: lammps_data INTEGER(c_int), POINTER :: i32 => NULL() INTEGER(c_int), DIMENSION(:), POINTER :: i32_vec => NULL() @@ -439,6 +446,15 @@ MODULE LIBLAMMPS TYPE(c_ptr), INTENT(IN), VALUE :: name END FUNCTION lammps_get_thermo + FUNCTION lammps_last_thermo(handle,what,index) BIND(C) + IMPORT :: c_ptr, c_int + IMPLICIT NONE + TYPE(c_ptr) :: lammps_last_thermo + TYPE(c_ptr), INTENT(IN), VALUE :: handle + TYPE(c_ptr), INTENT(IN), VALUE :: what + INTEGER(c_int), INTENT(IN), VALUE :: index + END FUNCTION lammps_last_thermo + SUBROUTINE lammps_extract_box(handle,boxlo,boxhi,xy,yz,xz,pflags, & boxflag) BIND(C) IMPORT :: c_ptr, c_double, c_int @@ -995,6 +1011,10 @@ CONTAINS lmp_open%type%scalar = LMP_TYPE_SCALAR lmp_open%type%vector = LMP_TYPE_VECTOR lmp_open%type%array = LMP_TYPE_ARRAY + lmp_open%dtype%i32 = LAMMPS_INT + lmp_open%dtype%i64 = LAMMPS_INT64 + lmp_open%dtype%r64 = LAMMPS_DOUBLE + lmp_open%dtype%str = LAMMPS_STRING ! Assign constants for bigint and tagint for use elsewhere SIZE_TAGINT = lmp_extract_setting(lmp_open, 'tagint') @@ -1103,6 +1123,67 @@ CONTAINS CALL lammps_free(Cname) END FUNCTION lmp_get_thermo + ! equivalent function to lammps_last_thermo + FUNCTION lmp_last_thermo(self,what,index) RESULT(thermo_data) + CLASS(lammps), INTENT(IN), TARGET :: self + CHARACTER(LEN=*), INTENT(IN) :: what + INTEGER :: index + INTEGER(c_int) :: idx + TYPE(lammps_data) :: thermo_data, type_data + INTEGER(c_int) :: datatype + TYPE(c_ptr) :: Cname, Cptr + + idx = index - 1 + ! set data type for known cases + SELECT CASE (what) + CASE ('step') + IF (SIZE_BIGINT == 4_c_int) THEN + datatype = LAMMPS_INT + ELSE + datatype = LAMMPS_INT64 + END IF + CASE ('num') + datatype = LAMMPS_INT + CASE ('type') + datatype = LAMMPS_INT + CASE ('keyword') + datatype = LAMMPS_STRING + CASE ('data') + Cname = f2c_string('type') + Cptr = lammps_last_thermo(self%handle,Cname,idx) + type_data%lammps_instance => self + type_data%datatype = DATA_INT + CALL C_F_POINTER(Cptr, type_data%i32) + datatype = type_data%i32 + CALL lammps_free(Cname) + CASE DEFAULT + datatype = -1 + END SELECT + + Cname = f2c_string(what) + Cptr = lammps_last_thermo(self%handle,Cname,idx) + CALL lammps_free(Cname) + + thermo_data%lammps_instance => self + SELECT CASE (datatype) + CASE (LAMMPS_INT) + thermo_data%datatype = DATA_INT + CALL C_F_POINTER(Cptr, thermo_data%i32) + CASE (LAMMPS_INT64) + thermo_data%datatype = DATA_INT64 + CALL C_F_POINTER(Cptr, thermo_data%i64) + CASE (LAMMPS_DOUBLE) + thermo_data%datatype = DATA_DOUBLE + CALL C_F_POINTER(Cptr, thermo_data%r64) + CASE (LAMMPS_STRING) + thermo_data%datatype = DATA_STRING + thermo_data%str = c2f_string(Cptr) + CASE DEFAULT + CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, & + 'Unknown pointer type in last_thermo') + END SELECT + END FUNCTION lmp_last_thermo + ! equivalent subroutine to lammps_extract_box SUBROUTINE lmp_extract_box(self, boxlo, boxhi, xy, yz, xz, pflags, boxflag) CLASS(lammps), INTENT(IN) :: self diff --git a/lib/gpu/lal_amoeba.cu b/lib/gpu/lal_amoeba.cu index 82a42cff6c..e7c313301e 100644 --- a/lib/gpu/lal_amoeba.cu +++ b/lib/gpu/lal_amoeba.cu @@ -585,7 +585,12 @@ __kernel void k_amoeba_multipole(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[6]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; @@ -802,7 +807,12 @@ __kernel void k_amoeba_udirect2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4], bcn[3]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -976,7 +986,12 @@ __kernel void k_amoeba_umutual2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -992,7 +1007,8 @@ __kernel void k_amoeba_umutual2b(const __global numtyp4 *restrict x_, numtyp damp = pdi * coeff[jtype].x; // pdamp[jtype] if (damp != (numtyp)0.0) { numtyp pgamma = MIN(pti,coeff[jtype].y); // thole[jtype] - damp = pgamma * ucl_powr(r/damp,(numtyp)3.0); + numtyp rdamp = r/damp; + damp = pgamma * rdamp*rdamp*rdamp; if (damp < (numtyp)50.0) { numtyp expdamp = ucl_exp(-damp); scale3 = (numtyp)1.0 - expdamp; @@ -1230,7 +1246,12 @@ __kernel void k_amoeba_polar(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[5]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; diff --git a/lib/gpu/lal_answer.cpp b/lib/gpu/lal_answer.cpp index 1911be8431..fc8e2cfe7a 100644 --- a/lib/gpu/lal_answer.cpp +++ b/lib/gpu/lal_answer.cpp @@ -260,10 +260,10 @@ double AnswerT::energy_virial(double *eatom, double **vatom, ecoul+=ecv; if (_ef_atom) { if (_ilist==nullptr) { - for (int i=0; i<_ev_stride; i++) - eatom[i]+=engv[i]; - for (int i=_ev_stride; iadd_extra_data(); + if (_max_tep_size>_max_fieldp_size) { + _max_fieldp_size = _max_tep_size; + _fieldp.resize(_max_fieldp_size*6); + } + *fieldp_ptr=_fieldp.host.begin(); // specify the correct cutoff and alpha values diff --git a/lib/gpu/lal_base_amoeba.h b/lib/gpu/lal_base_amoeba.h index 0eaaafeb1e..f415b30334 100644 --- a/lib/gpu/lal_base_amoeba.h +++ b/lib/gpu/lal_base_amoeba.h @@ -203,7 +203,7 @@ class BaseAmoeba { virtual void update_fieldp(void **fieldp_ptr) { *fieldp_ptr=_fieldp.host.begin(); // _fieldp store both arrays, one after another - _fieldp.update_host(_max_fieldp_size*8,false); + _fieldp.update_host(_max_fieldp_size*6,false); } /// setup a plan for FFT, where size is the number of elements diff --git a/lib/gpu/lal_hippo.cpp b/lib/gpu/lal_hippo.cpp index 24ffae8de2..8d6ad5dfb2 100644 --- a/lib/gpu/lal_hippo.cpp +++ b/lib/gpu/lal_hippo.cpp @@ -211,7 +211,7 @@ void HippoT::compute_repulsion(const int /*ago*/, const int inum_full, if (inum_full>this->_max_tep_size) { this->_max_tep_size=static_cast(static_cast(inum_full)*1.10); - this->_tep.resize(this->_max_tep_size*4); + this->_tep.resize(this->_max_tep_size*3); } *tep_ptr=this->_tep.host.begin(); @@ -226,7 +226,7 @@ void HippoT::compute_repulsion(const int /*ago*/, const int inum_full, repulsion(this->_eflag,this->_vflag); // copy tep from device to host - this->_tep.update_host(this->_max_tep_size*4,false); + this->_tep.update_host(this->_max_tep_size*3,false); } // --------------------------------------------------------------------------- @@ -366,7 +366,7 @@ void HippoT::compute_multipole_real(const int /*ago*/, const int inum_full, if (inum_full>this->_max_tep_size) { this->_max_tep_size=static_cast(static_cast(inum_full)*1.10); - this->_tep.resize(this->_max_tep_size*4); + this->_tep.resize(this->_max_tep_size*3); } *tep_ptr=this->_tep.host.begin(); @@ -376,7 +376,7 @@ void HippoT::compute_multipole_real(const int /*ago*/, const int inum_full, multipole_real(this->_eflag,this->_vflag); // copy tep from device to host - this->_tep.update_host(this->_max_tep_size*4,false); + this->_tep.update_host(this->_max_tep_size*3,false); } // --------------------------------------------------------------------------- @@ -434,6 +434,10 @@ void HippoT::compute_udirect2b(int * /*host_amtype*/, int * /*host_amgroup*/, do this->cast_extra_data(nullptr, nullptr, nullptr, host_uind, host_uinp, host_pval); this->atom->add_extra_data(); + if (this->_max_tep_size>this->_max_fieldp_size) { + this->_max_fieldp_size = this->_max_tep_size; + this->_fieldp.resize(this->_max_fieldp_size*6); + } *fieldp_ptr=this->_fieldp.host.begin(); this->_off2_polar = off2_polar; @@ -442,7 +446,7 @@ void HippoT::compute_udirect2b(int * /*host_amtype*/, int * /*host_amgroup*/, do // copy field and fieldp from device to host (_fieldp store both arrays, one after another) - this->_fieldp.update_host(this->_max_fieldp_size*8,false); + this->_fieldp.update_host(this->_max_fieldp_size*6,false); } // --------------------------------------------------------------------------- @@ -580,7 +584,7 @@ void HippoT::compute_polar_real(int * /*host_amtype*/, int * /*host_amgroup*/, d this->device->add_ans_object(this->ans); // copy tep from device to host - this->_tep.update_host(this->_max_tep_size*4,false); + this->_tep.update_host(this->_max_tep_size*3,false); } // --------------------------------------------------------------------------- diff --git a/lib/gpu/lal_hippo.cu b/lib/gpu/lal_hippo.cu index 0a0f4f02be..7de7bd594f 100644 --- a/lib/gpu/lal_hippo.cu +++ b/lib/gpu/lal_hippo.cu @@ -845,7 +845,7 @@ __kernel void k_hippo_dispersion(const __global numtyp4 *restrict x_, numtyp scale = factor_disp * damp*damp; scale = scale - (numtyp)1.0; numtyp e = -ci * ck * (expa+scale) / r6; - numtyp rterm = -ucl_powr(ralpha2,(numtyp)3.0) * expterm / r; + numtyp rterm = -ralpha2*ralpha2*ralpha2 * expterm / r; numtyp de = (numtyp)-6.0*e/r2 - ci*ck*rterm/r7 - (numtyp)2.0*ci*ck*factor_disp*damp*ddamp/r7; energy+= e; @@ -1072,7 +1072,12 @@ __kernel void k_hippo_multipole(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[6]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; @@ -1319,7 +1324,12 @@ __kernel void k_hippo_udirect2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -1477,7 +1487,12 @@ __kernel void k_hippo_umutual2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -1702,7 +1717,12 @@ __kernel void k_hippo_polar(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[5]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; diff --git a/lib/kim/README b/lib/kim/README index 3cba4a4597..b4cba92fb5 100644 --- a/lib/kim/README +++ b/lib/kim/README @@ -1,6 +1,6 @@ This directory contains build settings for the KIM API library which is -required to use the KIM package and its kim_init, kim_interactions, kim_query, -and pair_kim commands in a LAMMPS input script. +required to use the KIM package and its kim init, kim interactions and kim query +commands in a LAMMPS input script. Information about the KIM project can be found at https://openkim.org. The KIM project is lead by Ellad Tadmor and Ryan Elliott (U Minn). @@ -13,7 +13,7 @@ do the same thing by typing "python Install.py" from within this directory, or you can do it manually by following the instructions below. -Use of the kim_query command requires that the CURL library (libcurl) +Use of the kim query command requires that the CURL library (libcurl) development package and its configuration query tool, curl-config, are installed. The provided Makefile.lammps is set up to automatically detect this. @@ -29,7 +29,7 @@ $ printf "${PWD}/installed-kim-api-X-X.Y.Z" > ./kim-prefix.txt 2. Download and unpack the kim-api $ wget http://s3.openkim.org/kim-api/kim-api-X.Y.Z.txz -$ tar zxvf kim-api-X.Y.Z.txz +$ tar xvf kim-api-X.Y.Z.txz # configure the kim-api $ cd kim-api-X.Y.Z @@ -50,7 +50,7 @@ $ rm -rf kim-api-X.Y.Z.txz 5. To add items do the following (replace the kim item name with your desired value) -$ source ${PWD}/kim-api-X.Y.Z/bin/kim-api-activate +$ source ${PWD}/installed-kim-api-X.Y.Z/bin/kim-api-activate $ kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_324507536345_002 @@ -59,7 +59,7 @@ $ kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_3 When these steps are complete you can build LAMMPS with the KIM package installed: -$ cd lammpos/src +$ cd lammps/src $ make yes-kim $ make g++ (or whatever target you wish) diff --git a/lib/kokkos/CHANGELOG.md b/lib/kokkos/CHANGELOG.md index bdbc75604b..34df76a0fd 100644 --- a/lib/kokkos/CHANGELOG.md +++ b/lib/kokkos/CHANGELOG.md @@ -1,4 +1,25 @@ -# Change Log +# CHANGELOG + +## [3.7.02](https://github.com/kokkos/kokkos/tree/3.7.02) (2023-05-17) +[Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.01...3.7.02) + +### Backends and Archs Enhancements: +#### CUDA +- Add Hopper support and update nvcc_wrapper to work with CUDA-12 [\#5693](https://github.com/kokkos/kokkos/pull/5693) +### General Enhancements: +- sprintf -> snprintf [\#5787](https://github.com/kokkos/kokkos/pull/5787) +### Build System: +- Add error message when not using `hipcc` and when `CMAKE_CXX_STANDARD` is not set [\#5945](https://github.com/kokkos/kokkos/pull/5945) +### Bug Fixes: +- Fix Scratch allocation alignment issues [\#5692](https://github.com/kokkos/kokkos/pull/5692) +- Fix Intel Classic Compiler ICE [\#5710](https://github.com/kokkos/kokkos/pull/5710) +- Don't install std algorithm headers multiple times [\#5711](https://github.com/kokkos/kokkos/pull/5711) +- Fix static init order issue in InitalizationSettings [\#5721](https://github.com/kokkos/kokkos/pull/5721) +- Fix src/dst Properties in deep_copy(DynamicView,View) [\#5732](https://github.com/kokkos/kokkos/pull/5732) +- Fix build on Fedora Rawhide [\#5782](https://github.com/kokkos/kokkos/pull/5782) +- Finalize HIP lock arrays [\#5694](https://github.com/kokkos/kokkos/pull/5694) +- Fix CUDA lock arrays for current Desul [\#5812](https://github.com/kokkos/kokkos/pull/5812) +- Set the correct device/context in InterOp tests [\#5701](https://github.com/kokkos/kokkos/pull/5701) ## [3.7.01](https://github.com/kokkos/kokkos/tree/3.7.01) (2022-12-01) [Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.00...3.7.01) diff --git a/lib/kokkos/CMakeLists.txt b/lib/kokkos/CMakeLists.txt index 7b78f29d73..404aad8065 100644 --- a/lib/kokkos/CMakeLists.txt +++ b/lib/kokkos/CMakeLists.txt @@ -129,7 +129,7 @@ ENDIF() set(Kokkos_VERSION_MAJOR 3) set(Kokkos_VERSION_MINOR 7) -set(Kokkos_VERSION_PATCH 01) +set(Kokkos_VERSION_PATCH 02) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") diff --git a/lib/kokkos/Makefile.kokkos b/lib/kokkos/Makefile.kokkos index b873fd1e06..adcee303ba 100644 --- a/lib/kokkos/Makefile.kokkos +++ b/lib/kokkos/Makefile.kokkos @@ -12,7 +12,7 @@ endif KOKKOS_VERSION_MAJOR = 3 KOKKOS_VERSION_MINOR = 7 -KOKKOS_VERSION_PATCH = 01 +KOKKOS_VERSION_PATCH = 02 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial @@ -1376,6 +1376,7 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0) ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") + tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_SetupBackend.hpp") endif ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") diff --git a/lib/kokkos/algorithms/src/CMakeLists.txt b/lib/kokkos/algorithms/src/CMakeLists.txt index 597626b111..606d83d18b 100644 --- a/lib/kokkos/algorithms/src/CMakeLists.txt +++ b/lib/kokkos/algorithms/src/CMakeLists.txt @@ -25,7 +25,7 @@ INSTALL ( # These will get ignored for standalone CMake and a true interface library made KOKKOS_ADD_INTERFACE_LIBRARY( kokkosalgorithms - HEADERS ${ALGO_HEADERS} + NOINSTALLHEADERS ${ALGO_HEADERS} SOURCES ${ALGO_SOURCES} ) KOKKOS_LIB_INCLUDE_DIRECTORIES(kokkosalgorithms diff --git a/lib/kokkos/cmake/kokkos_arch.cmake b/lib/kokkos/cmake/kokkos_arch.cmake index f20a91e42f..3aff6857a3 100644 --- a/lib/kokkos/cmake/kokkos_arch.cmake +++ b/lib/kokkos/cmake/kokkos_arch.cmake @@ -214,6 +214,9 @@ GLOBAL_SET(KOKKOS_AMDGPU_OPTIONS) IF(KOKKOS_ENABLE_HIP) SET(AMDGPU_ARCH_FLAG "--offload-arch") IF(NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC) + IF(KOKKOS_CXX_STANDARD STREQUAL 14 AND NOT CMAKE_CXX_STANDARD) + message(FATAL_ERROR "Set CMAKE_CXX_STANDARD to 14") + ENDIF() GLOBAL_APPEND(KOKKOS_AMDGPU_OPTIONS -x hip) IF(DEFINED ENV{ROCM_PATH}) GLOBAL_APPEND(KOKKOS_AMDGPU_OPTIONS --rocm-path=$ENV{ROCM_PATH}) diff --git a/lib/kokkos/cmake/kokkos_tribits.cmake b/lib/kokkos/cmake/kokkos_tribits.cmake index 34e45ecf72..9a55d2a5e9 100644 --- a/lib/kokkos/cmake/kokkos_tribits.cmake +++ b/lib/kokkos/cmake/kokkos_tribits.cmake @@ -534,13 +534,6 @@ FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME) IF (KOKKOS_HAS_TRILINOS) TRIBITS_ADD_LIBRARY(${NAME} ${ARGN}) ELSE() - CMAKE_PARSE_ARGUMENTS(PARSE - "" - "" - "HEADERS;SOURCES" - ${ARGN} - ) - ADD_LIBRARY(${NAME} INTERFACE) KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME}) ENDIF() diff --git a/lib/kokkos/containers/src/Kokkos_DynamicView.hpp b/lib/kokkos/containers/src/Kokkos_DynamicView.hpp index a2b68064de..8450c06077 100644 --- a/lib/kokkos/containers/src/Kokkos_DynamicView.hpp +++ b/lib/kokkos/containers/src/Kokkos_DynamicView.hpp @@ -915,8 +915,8 @@ inline void deep_copy(const View& dst, template inline void deep_copy(const Kokkos::Experimental::DynamicView& dst, const View& src) { - using dst_type = Kokkos::Experimental::DynamicView; - using src_type = View; + using dst_type = Kokkos::Experimental::DynamicView; + using src_type = View; using dst_execution_space = typename ViewTraits::execution_space; using src_memory_space = typename ViewTraits::memory_space; diff --git a/lib/kokkos/containers/unit_tests/TestDynamicView.hpp b/lib/kokkos/containers/unit_tests/TestDynamicView.hpp index 5345f8ea24..303e3643c9 100644 --- a/lib/kokkos/containers/unit_tests/TestDynamicView.hpp +++ b/lib/kokkos/containers/unit_tests/TestDynamicView.hpp @@ -240,6 +240,83 @@ struct TestDynamicView { ASSERT_EQ(new_result_sum, (value_type)(da_resize * (da_resize - 1) / 2)); #endif } // end scope + + // Test: Reproducer to demonstrate compile-time error of deep_copy + // of DynamicView to/from on-host View. + // Case 4: + { + using device_view_type = Kokkos::View; + using host_view_type = typename Kokkos::View::HostMirror; + + view_type device_dynamic_view("on-device DynamicView", 1024, + arg_total_size); + device_view_type device_view("on-device View", arg_total_size); + host_view_type host_view("on-host View", arg_total_size); + + unsigned da_size = arg_total_size / 8; + device_dynamic_view.resize_serial(da_size); + + // Use parallel_for to populate device_dynamic_view and verify values +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(i); }); + + value_type result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + result_sum); + + ASSERT_EQ(result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Use an on-device View as intermediate to deep_copy the + // device_dynamic_view to host, zero out the device_dynamic_view, + // deep_copy from host back to the device_dynamic_view and verify + Kokkos::deep_copy(device_view, device_dynamic_view); + Kokkos::deep_copy(host_view, device_view); + Kokkos::deep_copy(device_view, host_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(0); }); +#endif + Kokkos::deep_copy(device_dynamic_view, device_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + value_type new_result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + new_result_sum); + + ASSERT_EQ(new_result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Try to deep_copy device_dynamic_view directly to/from host. + // host-to-device currently fails to compile because DP and SP are + // swapped in the deep_copy implementation. + // Once that's fixed, both deep_copy's will fail at runtime because the + // destination execution space cannot access the source memory space. + try { + Kokkos::deep_copy(host_view, device_dynamic_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-device DynamicView to on-host View failed:\n" + << msg << std::endl; + } + try { + Kokkos::deep_copy(device_dynamic_view, host_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-host View to on-device DynamicView failed:\n" + << msg << std::endl; + } + } } }; diff --git a/lib/kokkos/core/perf_test/test_atomic.cpp b/lib/kokkos/core/perf_test/test_atomic.cpp index 54824e5b39..094c40bfa7 100644 --- a/lib/kokkos/core/perf_test/test_atomic.cpp +++ b/lib/kokkos/core/perf_test/test_atomic.cpp @@ -73,7 +73,7 @@ void textcolor(int attr, int fg, int bg) { char command[40]; /* Command is the control command to the terminal */ - sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); + snprintf(command, 40, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); printf("%s", command); } void textcolor_standard() { textcolor(RESET, BLACK, WHITE); } diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp index ba43e362bb..a91d0eb313 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp @@ -710,7 +710,7 @@ struct CudaParallelLaunchImpl< " occupancy requests are currently broken.")); } - KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + ensure_cuda_lock_arrays_on_device(); // Invoke the driver function on the device base_t::invoke_kernel(driver, grid, block, shmem, cuda_instance); diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp index 84d4307cfd..3796534816 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp @@ -79,8 +79,7 @@ CudaLockArrays g_host_cuda_lock_arrays = {nullptr, 0}; void initialize_host_cuda_lock_arrays() { #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS desul::Impl::init_lock_arrays(); - - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + desul::ensure_cuda_lock_arrays_on_device(); #endif if (g_host_cuda_lock_arrays.atomic != nullptr) return; KOKKOS_IMPL_CUDA_SAFE_CALL( @@ -89,7 +88,7 @@ void initialize_host_cuda_lock_arrays() { Impl::cuda_device_synchronize( "Kokkos::Impl::initialize_host_cuda_lock_arrays: Pre Init Lock Arrays"); g_host_cuda_lock_arrays.n = Cuda::concurrency(); - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); init_lock_array_kernel_atomic<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); Impl::cuda_device_synchronize( @@ -106,7 +105,7 @@ void finalize_host_cuda_lock_arrays() { g_host_cuda_lock_arrays.atomic = nullptr; g_host_cuda_lock_arrays.n = 0; #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp index bdb7723985..84bfc953fd 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp @@ -67,7 +67,7 @@ struct CudaLockArrays { /// \brief This global variable in Host space is the central definition /// of these arrays. -extern Kokkos::Impl::CudaLockArrays g_host_cuda_lock_arrays; +extern CudaLockArrays g_host_cuda_lock_arrays; /// \brief After this call, the g_host_cuda_lock_arrays variable has /// valid, initialized arrays. @@ -105,12 +105,12 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE __constant__ extern #endif - Kokkos::Impl::CudaLockArrays g_device_cuda_lock_arrays; + CudaLockArrays g_device_cuda_lock_arrays; #define CUDA_SPACE_ATOMIC_MASK 0x1FFFF @@ -123,9 +123,7 @@ __device__ inline bool lock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - return ( - 0 == - atomicCAS(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0, 1)); + return (0 == atomicCAS(&g_device_cuda_lock_arrays.atomic[offset], 0, 1)); } /// \brief Release lock for the address @@ -138,7 +136,7 @@ __device__ inline void unlock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - atomicExch(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0); + atomicExch(&g_device_cuda_lock_arrays.atomic[offset], 0); } } // namespace Impl @@ -151,45 +149,49 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace -} // namespace Impl -} // namespace Kokkos -/* Dan Ibanez: it is critical that this code be a macro, so that it will - capture the right address for Kokkos::Impl::g_device_cuda_lock_arrays! - putting this in an inline function will NOT do the right thing! */ -#define KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::Kokkos::Impl::lock_array_copied == 0) { \ - KOKKOS_IMPL_CUDA_SAFE_CALL( \ - cudaMemcpyToSymbol(Kokkos::Impl::g_device_cuda_lock_arrays, \ - &Kokkos::Impl::g_host_cuda_lock_arrays, \ - sizeof(Kokkos::Impl::CudaLockArrays))); \ - } \ - lock_array_copied = 1; \ +#ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemcpyToSymbol(g_device_cuda_lock_arrays, + &g_host_cuda_lock_arrays, + sizeof(CudaLockArrays))); } + lock_array_copied = 1; +} #ifndef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); +} #endif #else #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else // Still Need COPY_CUDA_LOCK_ARRAYS for team scratch etc. -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); + desul::ensure_cuda_lock_arrays_on_device(); +} #endif #endif /* defined( KOKKOS_ENABLE_IMPL_DESUL_ATOMICS ) */ +} // namespace Impl +} // namespace Kokkos + #endif /* defined( KOKKOS_ENABLE_CUDA ) */ #endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP */ diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp index 3785cfe80b..bdba322fcc 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -428,6 +428,8 @@ void HIPInternal::finalize() { if (this == &singleton()) { (void)Kokkos::Impl::hip_global_unique_token_locks(true); + Kokkos::Impl::finalize_host_hip_lock_arrays(); + KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(constantMemHostStaging)); KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(constantMemReusable)); } diff --git a/lib/kokkos/core/src/Kokkos_Macros.hpp b/lib/kokkos/core/src/Kokkos_Macros.hpp index e42944d819..8d2aa4d188 100644 --- a/lib/kokkos/core/src/Kokkos_Macros.hpp +++ b/lib/kokkos/core/src/Kokkos_Macros.hpp @@ -228,11 +228,6 @@ #define KOKKOS_ENABLE_PRAGMA_SIMD 1 #endif -// FIXME Workaround for ICE with intel 17,18,19,20,21 in Trilinos -#if (KOKKOS_COMPILER_INTEL <= 2100) -#define KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS -#endif - // FIXME_SYCL #if !defined(KOKKOS_ENABLE_SYCL) #define KOKKOS_ENABLE_PRAGMA_IVDEP 1 @@ -653,7 +648,8 @@ static constexpr bool kokkos_omp_on_host() { return false; } #if (defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) || \ defined(KOKKOS_COMPILER_INTEL) || defined(KOKKOS_COMPILER_PGI)) && \ !defined(_WIN32) -#if (!defined(__linux__) || defined(__GLIBC_MINOR__)) +// disable stacktrace for musl-libc +#if !defined(__linux__) || defined(__GLIBC_MINOR__) #define KOKKOS_IMPL_ENABLE_STACKTRACE #endif #define KOKKOS_IMPL_ENABLE_CXXABI diff --git a/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp b/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp index 3e37eb61dc..a1d77071f5 100644 --- a/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp +++ b/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp @@ -73,9 +73,8 @@ class ScratchMemorySpace { "Instantiating ScratchMemorySpace on non-execution-space type."); public: - // Alignment of memory chunks returned by 'get' - // must be a power of two - enum { ALIGN = 8 }; + // Minimal overalignment used by view scratch allocations + constexpr static int ALIGN = 8; private: mutable char* m_iter_L0 = nullptr; @@ -87,7 +86,9 @@ class ScratchMemorySpace { mutable int m_offset = 0; mutable int m_default_level = 0; - enum { MASK = ALIGN - 1 }; // Alignment used by View::shmem_size +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + constexpr static int DEFAULT_ALIGNMENT_MASK = ALIGN - 1; +#endif public: //! Tag this class as a memory space @@ -101,39 +102,59 @@ class ScratchMemorySpace { static constexpr const char* name() { return "ScratchMemorySpace"; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + // This function is unused template - KOKKOS_INLINE_FUNCTION static IntType align(const IntType& size) { - return (size + MASK) & ~MASK; + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static constexpr IntType align( + const IntType& size) { + return (size + DEFAULT_ALIGNMENT_MASK) & ~DEFAULT_ALIGNMENT_MASK; } +#endif template KOKKOS_INLINE_FUNCTION void* get_shmem(const IntType& size, int level = -1) const { - return get_shmem_common(size, 1, level); + return get_shmem_common(size, 1, level); } template KOKKOS_INLINE_FUNCTION void* get_shmem_aligned(const IntType& size, const ptrdiff_t alignment, int level = -1) const { - return get_shmem_common(size, alignment, level); + return get_shmem_common(size, alignment, + level); } private: - template + template KOKKOS_INLINE_FUNCTION void* get_shmem_common(const IntType& size, const ptrdiff_t alignment, int level = -1) const { if (level == -1) level = m_default_level; - auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; - auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - char* previous = m_iter; - const ptrdiff_t missalign = size_t(m_iter) % alignment; - if (missalign) m_iter += alignment - missalign; + auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; + auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - void* tmp = m_iter + m_offset * (aligned ? size : align(size)); - if (m_end < (m_iter += (aligned ? size : align(size)) * m_multiplier)) { - m_iter = previous; // put it back like it was + if (alignment_requested) { + const ptrdiff_t missalign = size_t(m_iter) % alignment; + if (missalign) m_iter += alignment - missalign; + } + + // This is each thread's start pointer for its allocation + // Note: for team scratch m_offset is 0, since every + // thread will get back the same shared pointer + void* tmp = m_iter + m_offset * size; + ptrdiff_t increment = size * m_multiplier; + + // increment m_iter first and decrement it again if not + // enough memory was available. In the non-failing path + // this will save instructions. + m_iter += increment; + + if (m_end < m_iter) { + // Request did overflow: reset the base team ptr, and + // return nullptr + m_iter -= increment; + tmp = nullptr; #ifdef KOKKOS_ENABLE_DEBUG // mfh 23 Jun 2015: printf call consumes 25 registers // in a CUDA build, so only print in debug mode. The @@ -143,7 +164,6 @@ class ScratchMemorySpace { "%ld byte(s); remaining capacity is %ld byte(s)\n", long(size), long(m_end - m_iter)); #endif // KOKKOS_ENABLE_DEBUG - tmp = nullptr; } return tmp; } diff --git a/lib/kokkos/core/src/Kokkos_Serial.hpp b/lib/kokkos/core/src/Kokkos_Serial.hpp index ffdd1e9fc8..b0d1d693fc 100644 --- a/lib/kokkos/core/src/Kokkos_Serial.hpp +++ b/lib/kokkos/core/src/Kokkos_Serial.hpp @@ -203,19 +203,11 @@ class Serial { static const char* name(); Impl::SerialInternal* impl_internal_space_instance() const { -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - return m_space_instance; -#else return m_space_instance.get(); -#endif } private: -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - Impl::SerialInternal* m_space_instance; -#else Kokkos::Impl::HostSharedPtr m_space_instance; -#endif //-------------------------------------------------------------------------- }; diff --git a/lib/kokkos/core/src/Kokkos_View.hpp b/lib/kokkos/core/src/Kokkos_View.hpp index f8dcfc869e..795ef91e6a 100644 --- a/lib/kokkos/core/src/Kokkos_View.hpp +++ b/lib/kokkos/core/src/Kokkos_View.hpp @@ -67,6 +67,8 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") #include +#include + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- @@ -1692,19 +1694,27 @@ class View : public ViewTraits { arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)); } + private: + // Want to be able to align to minimum scratch alignment or sizeof or alignof + // elements + static constexpr size_t scratch_value_alignment = + ::Kokkos::max(::Kokkos::max(sizeof(typename traits::value_type), + alignof(typename traits::value_type)), + static_cast( + traits::execution_space::scratch_memory_space::ALIGN)); + + public: static KOKKOS_INLINE_FUNCTION size_t shmem_size(typename traits::array_layout const& arg_layout) { - return map_type::memory_span(arg_layout) + - sizeof(typename traits::value_type); + return map_type::memory_span(arg_layout) + scratch_value_alignment; } explicit KOKKOS_INLINE_FUNCTION View( const typename traits::execution_space::scratch_memory_space& arg_space, const typename traits::array_layout& arg_layout) - : View(Impl::ViewCtorProp( - reinterpret_cast(arg_space.get_shmem_aligned( - map_type::memory_span(arg_layout), - sizeof(typename traits::value_type)))), + : View(Impl::ViewCtorProp(reinterpret_cast( + arg_space.get_shmem_aligned(map_type::memory_span(arg_layout), + scratch_value_alignment))), arg_layout) {} explicit KOKKOS_INLINE_FUNCTION View( @@ -1722,7 +1732,7 @@ class View : public ViewTraits { map_type::memory_span(typename traits::array_layout( arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)), - sizeof(typename traits::value_type)))), + scratch_value_alignment))), typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7), check_input_args::yes) { diff --git a/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp b/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp index 9205e82560..25d220e45d 100644 --- a/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp +++ b/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp @@ -173,14 +173,8 @@ void SerialInternal::resize_thread_team_data(size_t pool_reduce_bytes, } // namespace Impl Serial::Serial() -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - : m_space_instance(&Impl::SerialInternal::singleton()) { -} -#else : m_space_instance(&Impl::SerialInternal::singleton(), - [](Impl::SerialInternal*) {}) { -} -#endif + [](Impl::SerialInternal*) {}) {} void Serial::print_configuration(std::ostream& os, bool /*verbose*/) const { os << "Host Serial Execution Space:\n"; diff --git a/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp b/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp index d726a86f76..c3e28c59f4 100644 --- a/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp +++ b/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp @@ -63,11 +63,10 @@ class ParallelFor, const FunctorType m_functor; const MDRangePolicy m_mdr_policy; - const Policy m_policy; void exec() const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { + const typename Policy::member_type e = m_mdr_policy.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { iterate_type(m_mdr_policy, m_functor)(i); } } @@ -85,9 +84,7 @@ class ParallelFor, } inline ParallelFor(const FunctorType& arg_functor, const MDRangePolicy& arg_policy) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {} + : m_functor(arg_functor), m_mdr_policy(arg_policy) {} }; template @@ -120,13 +117,12 @@ class ParallelReduce, ReducerType, const FunctorType m_functor; const MDRangePolicy m_mdr_policy; - const Policy m_policy; const ReducerType m_reducer; const pointer_type m_result_ptr; inline void exec(reference_type update) const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { + const typename Policy::member_type e = m_mdr_policy.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { iterate_type(m_mdr_policy, m_functor, update)(i); } } @@ -148,7 +144,8 @@ class ParallelReduce, ReducerType, const size_t team_shared_size = 0; // Never shrinks const size_t thread_local_size = 0; // Never shrinks - auto* internal_instance = m_policy.space().impl_internal_space_instance(); + auto* internal_instance = + m_mdr_policy.space().impl_internal_space_instance(); // Need to lock resize_thread_team_data std::lock_guard lock( internal_instance->m_thread_team_data_mutex); @@ -181,7 +178,6 @@ class ParallelReduce, ReducerType, void*> = nullptr) : m_functor(arg_functor), m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), m_reducer(InvalidType()), m_result_ptr(arg_result_view.data()) { static_assert(Kokkos::is_view::value, @@ -197,7 +193,6 @@ class ParallelReduce, ReducerType, MDRangePolicy arg_policy, const ReducerType& reducer) : m_functor(arg_functor), m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), m_reducer(reducer), m_result_ptr(reducer.view().data()) { /*static_assert( std::is_same< typename ViewType::memory_space diff --git a/lib/kokkos/core/src/impl/Kokkos_Core.cpp b/lib/kokkos/core/src/impl/Kokkos_Core.cpp index a5bd003237..fc89e485fd 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Core.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Core.cpp @@ -1165,6 +1165,5 @@ void _kokkos_pgi_compiler_bug_workaround() {} #endif } // namespace Kokkos -Kokkos::Impl::InitializationSettingsHelper::storage_type const - Kokkos::Impl::InitializationSettingsHelper::unspecified = - "some string we don't expect user would ever provide"; +constexpr char + Kokkos::Impl::InitializationSettingsHelper::unspecified[]; diff --git a/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp b/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp index ceb35f0247..00b2335fd7 100644 --- a/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp +++ b/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp @@ -104,7 +104,9 @@ struct InitializationSettingsHelper { using value_type = std::string; using storage_type = std::string; - static storage_type const unspecified; + // prefer c-string to avoid static initialization order nightmare + static constexpr char unspecified[] = + "some string we don't expect user would ever provide"; }; } // namespace Impl diff --git a/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp b/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp index 480b1a392b..796552cead 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp @@ -655,9 +655,9 @@ void initialize(const std::string& profileLibrary) { char* envProfileLibrary = const_cast(profileLibrary.c_str()); - const auto envProfileCopy = - std::make_unique(strlen(envProfileLibrary) + 1); - sprintf(envProfileCopy.get(), "%s", envProfileLibrary); + const size_t envProfileLen = strlen(envProfileLibrary) + 1; + const auto envProfileCopy = std::make_unique(envProfileLen); + snprintf(envProfileCopy.get(), envProfileLen, "%s", envProfileLibrary); char* profileLibraryName = strtok(envProfileCopy.get(), ";"); diff --git a/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp b/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp index d915b7e472..55a29f1128 100644 --- a/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp +++ b/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp @@ -69,9 +69,10 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, nargs = (do_threads ? 1 : 0) + (do_numa ? 1 : 0) + (do_device ? 1 : 0) + (do_other ? 4 : 0) + (do_tune ? 1 : 0); - char** args_kokkos = new char*[nargs]; + char** args_kokkos = new char*[nargs]; + const int max_args_size = 45; for (int i = 0; i < nargs; i++) { - args_kokkos[i] = new char[45]; + args_kokkos[i] = new char[max_args_size]; delete_these.insert(args_kokkos[i]); } @@ -112,7 +113,7 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_threads = nthreads; - sprintf(args_kokkos[threads_idx], "--threads=%i", nthreads); + snprintf(args_kokkos[threads_idx], max_args_size, "--threads=%i", nthreads); } if (do_numa) { @@ -130,24 +131,27 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_numa = numa; - sprintf(args_kokkos[numa_idx], "--numa=%i", numa); + snprintf(args_kokkos[numa_idx], max_args_size, "--numa=%i", numa); } if (do_device) { init_args.device_id = 0; - sprintf(args_kokkos[device_idx], "--device-id=%i", 0); + snprintf(args_kokkos[device_idx], max_args_size, "--device-id=%i", 0); } if (do_other) { - sprintf(args_kokkos[0], "--dummyarg=1"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], "--dummy2arg"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], "dummy3arg"); - sprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], "dummy4arg=1"); + snprintf(args_kokkos[0], max_args_size, "--dummyarg=1"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], max_args_size, + "--dummy2arg"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], max_args_size, + "dummy3arg"); + snprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], max_args_size, + "dummy4arg=1"); } if (do_tune) { init_args.tune_internals = true; - sprintf(args_kokkos[tune_idx], "--kokkos-tune-internals"); + snprintf(args_kokkos[tune_idx], max_args_size, "--kokkos-tune-internals"); } return args_kokkos; diff --git a/lib/kokkos/core/unit_test/TestSharedAlloc.hpp b/lib/kokkos/core/unit_test/TestSharedAlloc.hpp index f66b35dc9f..18f3c9a777 100644 --- a/lib/kokkos/core/unit_test/TestSharedAlloc.hpp +++ b/lib/kokkos/core/unit_test/TestSharedAlloc.hpp @@ -91,7 +91,7 @@ void test_shared_alloc() { // Since always executed on host space, leave [=] Kokkos::parallel_for(range, [=](int i) { char name[64]; - sprintf(name, "test_%.2d", i); + snprintf(name, 64, "test_%.2d", i); r[i] = RecordMemS::allocate(s, name, size * (i + 1)); h[i] = Header::get_header(r[i]->data()); @@ -135,7 +135,7 @@ void test_shared_alloc() { Kokkos::parallel_for(range, [=](size_t i) { char name[64]; - sprintf(name, "test_%.2d", int(i)); + snprintf(name, 64, "test_%.2d", int(i)); RecordFull* rec = RecordFull::allocate(s, name, size * (i + 1)); diff --git a/lib/kokkos/core/unit_test/TestTeam.hpp b/lib/kokkos/core/unit_test/TestTeam.hpp index 3f05b2ef66..58db4360e5 100644 --- a/lib/kokkos/core/unit_test/TestTeam.hpp +++ b/lib/kokkos/core/unit_test/TestTeam.hpp @@ -1551,14 +1551,16 @@ struct TestScratchAlignment { double x, y, z; }; TestScratchAlignment() { - test(true); - test(false); + test_view(true); + test_view(false); + test_minimal(); + test_raw(); } using ScratchView = Kokkos::View; using ScratchViewInt = Kokkos::View; - void test(bool allocate_small) { + void test_view(bool allocate_small) { int shmem_size = ScratchView::shmem_size(11); #ifdef KOKKOS_ENABLE_OPENMPTARGET int team_size = @@ -1580,12 +1582,68 @@ struct TestScratchAlignment { }); Kokkos::fence(); } + + void test_minimal() { + using member_type = typename Kokkos::TeamPolicy::member_type; + Kokkos::TeamPolicy policy(1, 1); + size_t scratch_size = sizeof(int); + Kokkos::View flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr = (int *)team.team_shmem().get_shmem(scratch_size); + if (scratch_ptr == nullptr) flag() = 1; + }); + Kokkos::fence(); + int minimal_scratch_allocation_failed = 0; + Kokkos::deep_copy(minimal_scratch_allocation_failed, flag); + ASSERT_TRUE(minimal_scratch_allocation_failed == 0); + } + + void test_raw() { + using member_type = typename Kokkos::TeamPolicy::member_type; + Kokkos::TeamPolicy policy(1, 1); + Kokkos::View flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(1024)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr1 = (int *)team.team_shmem().get_shmem(24); + int *scratch_ptr2 = (int *)team.team_shmem().get_shmem(32); + int *scratch_ptr3 = (int *)team.team_shmem().get_shmem(12); + + if ((int(scratch_ptr2 - scratch_ptr1) != 6) || + (int(scratch_ptr3 - scratch_ptr2) != 8)) + flag() = 1; + + if (((scratch_ptr3 - static_cast(nullptr)) + 3) % 2 == 1) + scratch_ptr1 = (int *)team.team_shmem().get_shmem_aligned(24, 4); + else { + scratch_ptr1 = (int *)team.team_shmem().get_shmem_aligned(12, 4); + } + scratch_ptr2 = (int *)team.team_shmem().get_shmem_aligned(32, 8); + scratch_ptr3 = (int *)team.team_shmem().get_shmem_aligned(8, 4); + + if ((int(scratch_ptr2 - scratch_ptr1) != 7) && + (int(scratch_ptr2 - scratch_ptr1) != 4)) + flag() = 1; + if (int(scratch_ptr3 - scratch_ptr2) != 8) flag() = 1; + if ((int(size_t(scratch_ptr1) % 4) != 0) || + (int(size_t(scratch_ptr2) % 8) != 0) || + (int(size_t(scratch_ptr3) % 4) != 0)) + flag() = 1; + }); + Kokkos::fence(); + int raw_get_shmem_alignment_failed = 0; + Kokkos::deep_copy(raw_get_shmem_alignment_failed, flag); + ASSERT_TRUE(raw_get_shmem_alignment_failed == 0); + } }; } // namespace namespace { - template struct TestTeamPolicyHandleByValue { using scalar = double; diff --git a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp index 31fd63f084..c4381b29e7 100644 --- a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp @@ -59,9 +59,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // Cuda. TEST(cuda, raw_cuda_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp index f11f657e00..69aef6f8d8 100644 --- a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp @@ -48,9 +48,11 @@ namespace Test { // Test Interoperability with Cuda Streams TEST(cuda, raw_cuda_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + cudaStream_t stream; cudaStreamCreate(&stream); - Kokkos::initialize(); int* p; cudaMalloc(&p, sizeof(int) * 100); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp index af20e753d4..ce76076f9b 100644 --- a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp @@ -59,9 +59,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // HIP. TEST(hip, raw_hip_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp index 95d102d4d1..6c7fdd7044 100644 --- a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp @@ -50,9 +50,11 @@ namespace Test { // The difference with the CUDA tests are: raw HIP vs raw CUDA and no launch // bound in HIP due to an error when computing the block size. TEST(hip, raw_hip_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + hipStream_t stream; KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream)); - Kokkos::initialize(); int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp index e45d990745..1189aba26f 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp @@ -52,8 +52,8 @@ namespace Test { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // SYCL. TEST(sycl, raw_sycl_interop) { + // Make sure all queues use the same context Kokkos::initialize(); - Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp index 114d2a4aa2..7b9a664304 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp @@ -51,6 +51,7 @@ namespace Test { // Test whether external allocations can be accessed by the default queue. TEST(sycl, raw_sycl_interop_context_1) { + // Make sure all queues use the same context Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp index 8ffada1dab..be093d8edc 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp @@ -48,9 +48,13 @@ namespace Test { // Test Interoperability with SYCL Streams TEST(sycl, raw_sycl_queues) { - sycl::default_selector device_selector; - sycl::queue queue(device_selector); + // Make sure all queues use the same context Kokkos::initialize(); + Kokkos::Experimental::SYCL default_space; + sycl::context default_context = default_space.sycl_queue().get_context(); + + sycl::default_selector device_selector; + sycl::queue queue(default_context, device_selector); int* p = sycl::malloc_device(100, queue); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp b/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp index 1815adb4a7..b55be52264 100644 --- a/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp +++ b/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp @@ -76,7 +76,7 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef __CUDACC_RDC__ __constant__ extern @@ -138,33 +138,42 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace + +#ifdef __CUDACC_RDC__ +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_DEVICE, + &CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, + sizeof(int32_t*)); + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_NODE, + &CUDA_SPACE_ATOMIC_LOCKS_NODE_h, + sizeof(int32_t*)); + } + lock_array_copied = 1; +} + } // namespace Impl } // namespace desul -/* It is critical that this code be a macro, so that it will - capture the right address for desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE - putting this in an inline function will NOT do the right thing! */ -#define DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::desul::Impl::lock_array_copied == 0) { \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, \ - sizeof(int32_t*)); \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE_h, \ - sizeof(int32_t*)); \ - } \ - ::desul::Impl::lock_array_copied = 1; \ - } #endif /* defined( __CUDACC__ ) */ #endif /* defined( DESUL_HAVE_CUDA_ATOMICS ) */ +namespace desul { + #if defined(__CUDACC_RDC__) || (!defined(__CUDACC__)) -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +static inline void ensure_cuda_lock_arrays_on_device() { + Impl::copy_cuda_lock_arrays_to_device(); +} #endif -#endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP_ */ +} // namespace desul + +#endif /* #ifndef DESUL_ATOMICS_LOCK_ARRAY_CUDA_HPP_ */ diff --git a/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp b/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp index cb8482c5da..19944b378e 100644 --- a/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp +++ b/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp @@ -70,7 +70,7 @@ void init_lock_arrays_cuda() { "init_lock_arrays_cuda: cudaMalloc host locks"); auto error_sync1 = cudaDeviceSynchronize(); - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); check_error_and_throw_cuda(error_sync1, "init_lock_arrays_cuda: post mallocs"); init_lock_arrays_cuda_kernel<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); auto error_sync2 = cudaDeviceSynchronize(); @@ -85,7 +85,7 @@ void finalize_lock_arrays_cuda() { CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h = nullptr; CUDA_SPACE_ATOMIC_LOCKS_NODE_h = nullptr; #ifdef __CUDACC_RDC__ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 491cd375bb..a417b82e96 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -987,4 +987,3 @@ typedef struct { } molfile_plugin_t; #endif - diff --git a/lib/molfile/vmdplugin.h b/lib/molfile/vmdplugin.h index 7afc358e97..9336d3e24f 100644 --- a/lib/molfile/vmdplugin.h +++ b/lib/molfile/vmdplugin.h @@ -11,7 +11,7 @@ * * $RCSfile: vmdplugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.34 $ $Date: 2018/05/02 03:12:56 $ + * $Revision: 1.35 $ $Date: 2020/10/16 07:50:56 $ * ***************************************************************************/ @@ -58,8 +58,8 @@ /*@}*/ -/** "WIN32" is defined on both WIN32 and WIN64 platforms... */ -#if (defined(WIN32)) +/** Detect compilations targeting Windows x86 and x64 platforms */ +#if (defined(WIN32) || defined(WIN64) || defined(_MSC_VER)) #define WIN32_LEAN_AND_MEAN #include diff --git a/potentials/BNC.tersoff b/potentials/BNC.tersoff index 046566dd99..a072aa05b3 100644 --- a/potentials/BNC.tersoff +++ b/potentials/BNC.tersoff @@ -1,4 +1,4 @@ -# DATE: 2013-03-21 UNITS: metal CONTRIBUTOR: Cem Sevik CITATION: Kinaci, Haskins, Sevik and Cagin, Phys Rev B, 86, 115410 (2012) +# DATE: 2013-03-21 UNITS: metal CONTRIBUTOR: Cem Sevik CITATION: Kinaci, Haskins, Sevik and Cagin, Phys Rev B, 86, 115410 (2012) # Tersoff parameters for B, C, and BN-C hybrid based graphene like nano structures # multiple entries can be added to this file, LAMMPS reads the ones it needs @@ -7,11 +7,11 @@ # other quantities are unitless # Cem Sevik (csevik at anadolu.edu.tr) takes full blame for this -# file. It specifies B-N, B-C, and N-C interaction parameters -# generated and published by the reseacrh group of Prof. Tahir Cagin. +# file. It specifies B-N, B-C, and N-C interaction parameters +# generated and published by the research group of Prof. Tahir Cagin. # 1. Physical Review B 84, 085409 2011 -# Characterization of thermal transport in low-dimensional boron nitride nanostructures, +# Characterization of thermal transport in low-dimensional boron nitride nanostructures, # # 2. Physical Review B 86, 075403 2012 @@ -22,14 +22,14 @@ # Thermal conductivity of BN-C nanostructures # -# The file also specifies C-C, interaction parameters +# The file also specifies C-C, interaction parameters # generated and published by the research group of Dr. D. A. Broido # Physical Review B 81, 205441 2010 -# Optimized Tersoff and Brenner empirical potential parameters for +# Optimized Tersoff and Brenner empirical potential parameters for # lattice dynamics and phonon thermal transport in carbon nanotubes and graphene # Users in referring the full parameters can cite the full parameter paper (3) as: -# A. Kinaci, J. B. Haskins, C. Sevik, T. Cagin, Physical Review B 86, 115410 (2012) +# A. Kinaci, J. B. Haskins, C. Sevik, T. Cagin, Physical Review B 86, 115410 (2012) # Thermal conductivity of BN-C nanostructures # @@ -38,11 +38,11 @@ # m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A N B B 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 -N B N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 +N B N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 N B C 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 B N B 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 -B N N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 +B N N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 B N C 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 N N B 3.0 1.0 0.0 17.7959 5.9484 0.00000 0.6184432 0.019251 2.6272721 138.77866 2.0 0.1 2.8293093 128.86866 diff --git a/potentials/COH.DMC.aip.water.2dm b/potentials/COH.DMC.aip.water.2dm new file mode 100644 index 0000000000..f3619dd3f1 --- /dev/null +++ b/potentials/COH.DMC.aip.water.2dm @@ -0,0 +1,28 @@ +# DATE: 2022-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Anisotropic Interfacial Potential (AIP) parameters for water/graphene heterojunctions +# The parameters below are fitted against the DMC reference data that rescaled from PBE+MBD-NL. +# +# ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +# For graphene and hydrocarbons +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 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 + +# For water-graphene +C Ow 4.03686677 15.09817069 1.00000323 1.03838111 0.16372013 9.00010553 1.12057182 2.96484087 21887.14173222 1.0 2.0 +C Hw 3.08246994 6.412090180 1.00000265 2.89390420 -1.85748759 9.00009101 1.04574423 2.21642099 4652.78021666 1.0 2.0 +Ow C 4.03686677 15.09817069 1.00000323 1.03838111 0.16372013 9.00010553 1.12057182 2.96484087 21887.14173222 1.0 1.2 +Hw C 3.08246994 6.412090180 1.00000265 2.89390420 -1.85748759 9.00009101 1.04574423 2.21642099 4652.78021666 1.0 1.2 + +# # The ILPs for other systems are set to zero +H Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +H Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 + +Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 diff --git a/potentials/COH.aip.water.2dm b/potentials/COH.aip.water.2dm new file mode 100644 index 0000000000..5325399abe --- /dev/null +++ b/potentials/COH.aip.water.2dm @@ -0,0 +1,28 @@ +# DATE: 2022-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Anisotropic Interfacial Potential (AIP) parameters for water/graphene heterojunctions +# The parameters below are fitted against the PBE + MBD-NL DFT reference data from 2.5 A to 15 A. +# +# ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +# For graphene and hydrocarbons +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 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 + +# For water-graphene +C Ow 5.45369612 6.18172364 1.25025450 3.34909245 0.68780636 9.05706482 1.23249498 2.77577173 100226.55503127 1.0 2.0 +C Hw 2.55380862 9.68664390 1.96489198 41.77617053 -16.30012807 9.01568534 0.74415463 2.41545571 7409.12856378 1.0 2.0 +Ow C 5.45369612 6.18172364 1.25025450 3.34909245 0.68780636 9.05706482 1.23249498 2.77577173 100226.55503127 1.0 1.2 +Hw C 2.55380862 9.68664390 1.96489198 41.77617053 -16.30012807 9.01568534 0.74415463 2.41545571 7409.12856378 1.0 1.2 + +# # The ILPs for other systems are set to zero +H Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +H Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 + +Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 diff --git a/python/install.py b/python/install.py index 25784791b4..853479e9f6 100644 --- a/python/install.py +++ b/python/install.py @@ -11,7 +11,7 @@ independently and used to build the wheel without installing it. """ from __future__ import print_function -import sys,os,shutil,glob,subprocess +import sys, os, shutil, glob, subprocess from argparse import ArgumentParser parser = ArgumentParser(prog='install.py', @@ -105,12 +105,12 @@ os.system(sys.executable + ' makewheel.py') for wheel in glob.glob('lammps-*.whl'): if args.wheeldir: shutil.copy(wheel, args.wheeldir) - -print('wheel = ', wheel) + else: + shutil.copy(wheel, olddir) # remove temporary folders and files os.chdir(olddir) -shutil.rmtree('build-python',True) +shutil.rmtree('build-python', True) # stop here if we were asked not to install the wheel we created if args.noinstall: diff --git a/python/lammps/constants.py b/python/lammps/constants.py index 8fd6a9eaf5..1d0d8adb78 100644 --- a/python/lammps/constants.py +++ b/python/lammps/constants.py @@ -13,7 +13,13 @@ # various symbolic constants to be used # in certain calls to select data formats + +# these must be kept in sync with the enums in src/library.h, src/lmptype.h, +# tools/swig/lammps.i, examples/COUPLE/plugin/liblammpsplugin.h, +# and the constants in fortran/lammps.f90 + LAMMPS_AUTODETECT = None +LAMMPS_NONE = -1 LAMMPS_INT = 0 LAMMPS_INT_2D = 1 LAMMPS_DOUBLE = 2 @@ -22,8 +28,6 @@ LAMMPS_INT64 = 4 LAMMPS_INT64_2D = 5 LAMMPS_STRING = 6 -# these must be kept in sync with the enums in src/library.h, tools/swig/lammps.i, -# examples/COUPLE/plugin/liblammpsplugin.h, and the constants in fortran/lammps.f90 LMP_STYLE_GLOBAL = 0 LMP_STYLE_ATOM = 1 LMP_STYLE_LOCAL = 2 diff --git a/python/lammps/core.py b/python/lammps/core.py index 80961186f3..84a80e77a3 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -272,6 +272,9 @@ class lammps(object): self.lib.lammps_get_thermo.argtypes = [c_void_p, c_char_p] self.lib.lammps_get_thermo.restype = c_double + self.lib.lammps_last_thermo.argtypes = [c_void_p, c_char_p, c_int] + self.lib.lammps_last_thermo.restype = c_void_p + self.lib.lammps_encode_image_flags.restype = self.c_imageint self.lib.lammps_config_has_package.argtypes = [c_char_p] @@ -503,9 +506,9 @@ class lammps(object): def error(self, error_type, error_text): """Forward error to the LAMMPS Error class. - This is a wrapper around the :cpp:func:`lammps_error` function of the C-library interface. + .. versionadded:: 3Nov2022 - .. versionadded:: TBD + This is a wrapper around the :cpp:func:`lammps_error` function of the C-library interface. :param error_type: :type error_type: int @@ -742,6 +745,64 @@ class lammps(object): with ExceptionCheck(self): return self.lib.lammps_get_thermo(self.lmp,name) + # ------------------------------------------------------------------------- + @property + def last_thermo_step(self): + """ Get the last timestep where thermodynamic data was computed + + :return: the timestep or a negative number if there has not been any thermo output yet + :rtype: int + """ + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("step".encode()), 0) + return cast(ptr, POINTER(self.c_bigint)).contents.value + + def last_thermo(self): + """Get a dictionary of the last thermodynamic output + + This is a wrapper around the :cpp:func:`lammps_last_thermo` + function of the C-library interface. It collects the cached thermo + data from the last timestep into a dictionary. The return value + is None, if there has not been any thermo output yet. + + :return: a dictionary containing the last computed thermo output values + :rtype: dict or None + """ + + rv = dict() + mystep = self.last_thermo_step + if mystep < 0: + return None + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("num".encode()), 0) + nfield = cast(ptr, POINTER(c_int)).contents.value + + for i in range(nfield): + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("keyword".encode()), i) + kw = cast(ptr, c_char_p).value.decode() + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("type".encode()), i) + typ = cast(ptr, POINTER(c_int)).contents.value + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("data".encode()), i) + + if typ == LAMMPS_DOUBLE: + val = cast(ptr, POINTER(c_double)).contents.value + elif typ == LAMMPS_INT: + val = cast(ptr, POINTER(c_int)).contents.value + elif typ == LAMMPS_INT64: + val = cast(ptr, POINTER(c_int64)).contents.value + else: + # we should not get here + raise TypeError("Unknown LAMMPS data type " + str(typ)) + rv[kw] = val + + return rv + # ------------------------------------------------------------------------- def extract_setting(self, name): @@ -1289,6 +1350,8 @@ class lammps(object): def gather_bonds(self): """Retrieve global list of bonds + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_gather_bonds` function of the C-library interface. @@ -1296,8 +1359,6 @@ class lammps(object): flat list of ctypes integer values with the bond type, bond atom1, bond atom2 for each bond. - .. versionadded:: 28Jul2021 - :return: a tuple with the number of bonds and a list of c_int or c_long :rtype: (int, 3*nbonds*c_tagint) """ @@ -1312,6 +1373,8 @@ class lammps(object): def gather_angles(self): """Retrieve global list of angles + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_angles` function of the C-library interface. @@ -1319,8 +1382,6 @@ class lammps(object): flat list of ctypes integer values with the angle type, angle atom1, angle atom2, angle atom3 for each angle. - .. versionadded:: TBD - :return: a tuple with the number of angles and a list of c_int or c_long :rtype: (int, 4*nangles*c_tagint) """ @@ -1335,6 +1396,8 @@ class lammps(object): def gather_dihedrals(self): """Retrieve global list of dihedrals + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_dihedrals` function of the C-library interface. @@ -1342,8 +1405,6 @@ class lammps(object): flat list of ctypes integer values with the dihedral type, dihedral atom1, dihedral atom2, dihedral atom3, dihedral atom4 for each dihedral. - .. versionadded:: TBD - :return: a tuple with the number of dihedrals and a list of c_int or c_long :rtype: (int, 5*ndihedrals*c_tagint) """ @@ -1358,6 +1419,8 @@ class lammps(object): def gather_impropers(self): """Retrieve global list of impropers + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_impropers` function of the C-library interface. @@ -1365,8 +1428,6 @@ class lammps(object): flat list of ctypes integer values with the improper type, improper atom1, improper atom2, improper atom3, improper atom4 for each improper. - .. versionadded:: TBD - :return: a tuple with the number of impropers and a list of c_int or c_long :rtype: (int, 5*nimpropers*c_tagint) """ @@ -1605,13 +1666,13 @@ class lammps(object): def is_running(self): """ Report whether being called from a function during a run or a minimization + .. versionadded:: 9Oct2020 + Various LAMMPS commands must not be called during an ongoing run or minimization. This property allows to check for that. This is a wrapper around the :cpp:func:`lammps_is_running` function of the library interface. - .. versionadded:: 9Oct2020 - :return: True when called during a run otherwise false :rtype: bool """ @@ -1622,12 +1683,13 @@ class lammps(object): def force_timeout(self): """ Trigger an immediate timeout, i.e. a "soft stop" of a run. + .. versionadded:: 9Oct2020 + This function allows to cleanly stop an ongoing run or minimization at the next loop iteration. This is a wrapper around the :cpp:func:`lammps_force_timeout` function of the library interface. - .. versionadded:: 9Oct2020 """ self.lib.lammps_force_timeout(self.lmp) @@ -1710,11 +1772,11 @@ class lammps(object): def has_package(self, name): """ Report if the named package has been enabled in the LAMMPS shared library. + .. versionadded:: 3Nov2022 + This is a wrapper around the :cpp:func:`lammps_config_has_package` function of the library interface. - .. versionadded:: TBD - :param name: name of the package :type name: string @@ -1854,11 +1916,11 @@ class lammps(object): def has_id(self, category, name): """Returns whether a given ID name is available in a given category + .. versionadded:: 9Oct2020 + This is a wrapper around the function :cpp:func:`lammps_has_id` of the library interface. - .. versionadded:: 9Oct2020 - :param category: name of category :type category: string :param name: name of the ID @@ -1874,11 +1936,11 @@ class lammps(object): def available_ids(self, category): """Returns a list of IDs available for a given category + .. versionadded:: 9Oct2020 + This is a wrapper around the functions :cpp:func:`lammps_id_count()` and :cpp:func:`lammps_id_name()` of the library interface. - .. versionadded:: 9Oct2020 - :param category: name of category :type category: string @@ -1901,11 +1963,11 @@ class lammps(object): def available_plugins(self, category): """Returns a list of plugins available for a given category + .. versionadded:: 10Mar2021 + This is a wrapper around the functions :cpp:func:`lammps_plugin_count()` and :cpp:func:`lammps_plugin_name()` of the library interface. - .. versionadded:: 10Mar2021 - :return: list of style/name pairs of loaded plugins :rtype: list """ @@ -1970,11 +2032,11 @@ class lammps(object): def fix_external_get_force(self, fix_id): """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :return: requested data @@ -1989,11 +2051,11 @@ class lammps(object): def fix_external_set_energy_global(self, fix_id, eng): """Set the global energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_global` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eng: potential energy value to be added by fix external @@ -2008,11 +2070,11 @@ class lammps(object): def fix_external_set_virial_global(self, fix_id, virial): """Set the global virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_global` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eng: list of 6 floating point numbers with the virial to be added by fix external @@ -2028,11 +2090,11 @@ class lammps(object): def fix_external_set_energy_peratom(self, fix_id, eatom): """Set the per-atom energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_peratom` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: list of potential energy values for local atoms to be added by fix external @@ -2051,11 +2113,11 @@ class lammps(object): def fix_external_set_virial_peratom(self, fix_id, vatom): """Set the per-atom virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_peratom` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param vatom: list of natoms lists with 6 floating point numbers to be added by fix external @@ -2083,11 +2145,11 @@ class lammps(object): def fix_external_set_vector_length(self, fix_id, length): """Set the vector length for a global vector stored with fix external for analysis + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector_length` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param length: length of the global vector @@ -2101,11 +2163,11 @@ class lammps(object): def fix_external_set_vector(self, fix_id, idx, val): """Store a global vector value for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param idx: 1-based index of the value in the global vector diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 8286fb9a5c..f3ea0fdf8e 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -262,12 +262,12 @@ class numpy_wrapper: def gather_bonds(self): """Retrieve global list of bonds as NumPy array + .. versionadded:: 28Jul2021 + This is a wrapper around :py:meth:`lammps.gather_bonds() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: 28Jul2021 - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nbonds,3) """ @@ -280,12 +280,12 @@ class numpy_wrapper: def gather_angles(self): """ Retrieve global list of angles as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_angles() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nangles,4) """ @@ -298,12 +298,12 @@ class numpy_wrapper: def gather_dihedrals(self): """ Retrieve global list of dihedrals as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_dihedrals() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(ndihedrals,5) """ @@ -316,12 +316,12 @@ class numpy_wrapper: def gather_impropers(self): """ Retrieve global list of impropers as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_impropers() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nimpropers,5) """ @@ -334,13 +334,13 @@ class numpy_wrapper: def fix_external_get_force(self, fix_id): """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + .. versionchanged:: 28Jul2021 + This function is a wrapper around the :py:meth:`lammps.fix_external_get_force() ` method. It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` pointer. - .. versionchanged:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :return: requested data @@ -356,13 +356,13 @@ class numpy_wrapper: def fix_external_set_energy_peratom(self, fix_id, eatom): """Set the per-atom energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This function is an alternative to :py:meth:`lammps.fix_external_set_energy_peratom() ` method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy @@ -383,13 +383,13 @@ class numpy_wrapper: def fix_external_set_virial_peratom(self, fix_id, vatom): """Set the per-atom virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This function is an alternative to :py:meth:`lammps.fix_external_set_virial_peratom() ` method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index d0ff7ab1aa..c693b7d565 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -13,7 +13,7 @@ ################################################################################ # Alternative Python Wrapper -# Written by Richard Berger +# Written by Richard Berger ################################################################################ # for python2/3 compatibility @@ -28,6 +28,7 @@ import tempfile from collections import namedtuple from .core import lammps +from .constants import * # lgtm [py/polluting-import] # ------------------------------------------------------------------------- @@ -65,22 +66,43 @@ class OutputCapture(object): # ------------------------------------------------------------------------- class Variable(object): - def __init__(self, pylammps_instance, name, style, definition): + def __init__(self, pylammps_instance, name): self._pylmp = pylammps_instance self.name = name - self.style = style - self.definition = definition.split() + + @property + def style(self): + vartype = self._pylmp.lmp.lib.lammps_extract_variable_datatype(self._pylmp.lmp.lmp, self.name.encode()) + if vartype == LMP_VAR_EQUAL: + return "equal" + elif vartype == LMP_VAR_ATOM: + return "atom" + elif vartype == LMP_VAR_VECTOR: + return "vector" + elif vartype == LMP_VAR_STRING: + return "string" + return None @property def value(self): - if self.style == 'atom': - return list(self._pylmp.lmp.extract_variable(self.name, "all", 1)) + return self._pylmp.lmp.extract_variable(self.name) + + @value.setter + def value(self, newvalue): + style = self.style + if style == "equal" or style == "string": + self._pylmp.variable("{} {} {}".format(self.name, style, newvalue)) else: - value = self._pylmp.lmp_print('"${%s}"' % self.name).strip() - try: - return float(value) - except ValueError: - return value + raise Exception("Setter not implemented for {} style variables.".format(style)) + + def __str__(self): + value = self.value + if isinstance(value, str): + value = "\"{}\"".format(value) + return "Variable(name=\"{}\", value={})".format(self.name, value) + + def __repr__(self): + return self.__str__() # ------------------------------------------------------------------------- @@ -377,55 +399,6 @@ class variable_set: def __repr__(self): return self.__str__() -# ------------------------------------------------------------------------- - -def get_thermo_data(output): - """ traverse output of runs and extract thermo data columns """ - if isinstance(output, str): - lines = output.splitlines() - else: - lines = output - - runs = [] - columns = [] - in_run = False - current_run = {} - - for line in lines: - if line.startswith("Per MPI rank memory allocation"): - in_run = True - elif in_run and len(columns) == 0: - # first line after memory usage are column names - columns = line.split() - - current_run = {} - - for col in columns: - current_run[col] = [] - - elif line.startswith("Loop time of "): - in_run = False - columns = [] - thermo_data = variable_set('ThermoData', current_run) - r = {'thermo' : thermo_data } - runs.append(namedtuple('Run', list(r.keys()))(*list(r.values()))) - elif in_run and len(columns) > 0: - items = line.split() - # Convert thermo output and store it. - # It must have the same number of columns and - # all of them must be convertible to floats. - # Otherwise we ignore the line - if len(items) == len(columns): - try: - values = [float(x) for x in items] - for i, col in enumerate(columns): - current_run[col].append(values[i]) - except ValueError: - # cannot convert. must be a non-thermo output. ignore. - pass - - return runs - # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- @@ -483,6 +456,9 @@ class PyLammps(object): self._enable_cmd_history = False self.runs = [] + if not self.lmp.has_package("PYTHON"): + print("WARNING: run thermo data not captured since PYTHON LAMMPS package is not enabled") + def __enter__(self): return self @@ -573,16 +549,49 @@ class PyLammps(object): if self.enable_cmd_history: self._cmd_history.append(cmd) + def _append_run_thermo(self, thermo): + for k, v in thermo.items(): + if k in self._current_run: + self._current_run[k].append(v) + else: + self._current_run[k] = [v] + def run(self, *args, **kwargs): """ Execute LAMMPS run command with given arguments - All thermo output during the run is captured and saved as new entry in + Thermo data of the run is recorded and saved as new entry in :py:attr:`PyLammps.runs`. The latest run can be retrieved by :py:attr:`PyLammps.last_run`. + + Note, for recording of all thermo steps during a run, the PYTHON package + needs to be enabled in LAMMPS. Otherwise, it will only capture the final + timestep. """ + self._current_run = {} + self._last_thermo_step = -1 + def end_of_step_callback(lmp): + if self.lmp.last_thermo_step == self._last_thermo_step: return + thermo = self.lmp.last_thermo() + self._append_run_thermo(thermo) + self._last_thermo_step = thermo['Step'] + + import __main__ + __main__._PyLammps_end_of_step_callback = end_of_step_callback + capture_thermo = self.lmp.has_package("PYTHON") + + if capture_thermo: + self.fix("__pylammps_internal_run_callback", "all", "python/invoke", "1", "end_of_step", "_PyLammps_end_of_step_callback") + output = self.__getattr__('run')(*args, **kwargs) - self.runs += get_thermo_data(output) + + if capture_thermo: + self.unfix("__pylammps_internal_run_callback") + self._append_run_thermo(self.lmp.last_thermo()) + + thermo_data = variable_set('ThermoData', self._current_run) + r = {'thermo' : thermo_data } + self.runs.append(namedtuple('Run', list(r.keys()))(*list(r.values()))) return output @property @@ -677,9 +686,7 @@ class PyLammps(object): :getter: Returns a list of atom groups that are currently active in this LAMMPS instance :type: list """ - output = self.lmp_info("groups") - output = output[output.index("Group information:")+1:] - return self._parse_groups(output) + return self.lmp.available_ids("group") @property def variables(self): @@ -689,11 +696,9 @@ class PyLammps(object): :getter: Returns a dictionary of all variables that are defined in this LAMMPS instance :type: dict """ - output = self.lmp_info("variables") - output = output[output.index("Variable information:")+1:] variables = {} - for v in self._parse_element_list(output): - variables[v['name']] = Variable(self, v['name'], v['style'], v['def']) + for name in self.lmp.available_ids("variable"): + variables[name] = Variable(self, name) return variables def eval(self, expr): @@ -720,66 +725,53 @@ class PyLammps(object): def _parse_info_system(self, output): system = {} + system['dimensions'] = self.lmp.extract_setting("dimension") + system['xlo'] = self.lmp.extract_global("boxxlo") + system['ylo'] = self.lmp.extract_global("boxylo") + system['zlo'] = self.lmp.extract_global("boxzlo") + system['xhi'] = self.lmp.extract_global("boxxhi") + system['yhi'] = self.lmp.extract_global("boxyhi") + system['zhi'] = self.lmp.extract_global("boxzhi") + xprd = system["xhi"] - system["xlo"] + yprd = system["yhi"] - system["ylo"] + zprd = system["zhi"] - system["zlo"] + if self.lmp.extract_setting("triclinic") == 1: + system['triclinic_box'] = (xprd, yprd, zprd) + else: + system['orthogonal_box'] = (xprd, yprd, zprd) + system['nangles'] = self.lmp.extract_global("nbonds") + system['nangletypes'] = self.lmp.extract_setting("nbondtypes") + system['angle_style'] = self.lmp.extract_global("angle_style") + system['nbonds'] = self.lmp.extract_global("nbonds") + system['nbondtypes'] = self.lmp.extract_setting("nbondtypes") + system['bond_style'] = self.lmp.extract_global("bond_style") + system['ndihedrals'] = self.lmp.extract_global("ndihedrals") + system['ndihedraltypes'] = self.lmp.extract_setting("ndihedraltypes") + system['dihedral_style'] = self.lmp.extract_global("dihedral_style") + system['nimpropers'] = self.lmp.extract_global("nimpropers") + system['nimpropertypes'] = self.lmp.extract_setting("nimpropertypes") + system['improper_style'] = self.lmp.extract_global("improper_style") + system['kspace_style'] = self.lmp.extract_global("kspace_style") + system['natoms'] = self.lmp.extract_global("natoms") + system['ntypes'] = self.lmp.extract_global("ntypes") + system['pair_style'] = self.lmp.extract_global("pair_style") + system['atom_style'] = self.lmp.extract_global("atom_style") + system['units'] = self.lmp.extract_global("units") for line in output: - if line.startswith("Units"): - system['units'] = self._get_pair(line)[1] - elif line.startswith("Atom style"): - system['atom_style'] = self._get_pair(line)[1] - elif line.startswith("Atom map"): + if line.startswith("Atom map"): system['atom_map'] = self._get_pair(line)[1] - elif line.startswith("Atoms"): - parts = self._split_values(line) - system['natoms'] = int(self._get_pair(parts[0])[1]) - system['ntypes'] = int(self._get_pair(parts[1])[1]) - system['style'] = self._get_pair(parts[2])[1] - elif line.startswith("Kspace style"): - system['kspace_style'] = self._get_pair(line)[1] - elif line.startswith("Dimensions"): - system['dimensions'] = int(self._get_pair(line)[1]) - elif line.startswith("Orthogonal box"): - system['orthogonal_box'] = [float(x) for x in self._get_pair(line)[1].split('x')] elif line.startswith("Boundaries"): system['boundaries'] = self._get_pair(line)[1] - elif line.startswith("xlo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) - elif line.startswith("ylo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) - elif line.startswith("zlo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) elif line.startswith("Molecule type"): system['molecule_type'] = self._get_pair(line)[1] - elif line.startswith("Bonds"): - parts = self._split_values(line) - system['nbonds'] = int(self._get_pair(parts[0])[1]) - system['nbondtypes'] = int(self._get_pair(parts[1])[1]) - system['bond_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Angles"): - parts = self._split_values(line) - system['nangles'] = int(self._get_pair(parts[0])[1]) - system['nangletypes'] = int(self._get_pair(parts[1])[1]) - system['angle_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Dihedrals"): - parts = self._split_values(line) - system['ndihedrals'] = int(self._get_pair(parts[0])[1]) - system['ndihedraltypes'] = int(self._get_pair(parts[1])[1]) - system['dihedral_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Impropers"): - parts = self._split_values(line) - system['nimpropers'] = int(self._get_pair(parts[0])[1]) - system['nimpropertypes'] = int(self._get_pair(parts[1])[1]) - system['improper_style'] = self._get_pair(parts[2])[1] return system def _parse_info_communication(self, output): comm = {} + comm['nprocs'] = self.lmp.extract_setting("world_size") + comm['nthreads'] = self.lmp.extract_setting("nthreads") for line in output: if line.startswith("MPI library"): @@ -792,10 +784,6 @@ class PyLammps(object): comm['proc_grid'] = [int(x) for x in self._get_pair(line)[1].split('x')] elif line.startswith("Communicate velocities for ghost atoms"): comm['ghost_velocity'] = (self._get_pair(line)[1] == "yes") - elif line.startswith("Nprocs"): - parts = self._split_values(line) - comm['nprocs'] = int(self._get_pair(parts[0])[1]) - comm['nthreads'] = int(self._get_pair(parts[1])[1]) return comm def _parse_element_list(self, output): @@ -810,16 +798,6 @@ class PyLammps(object): elements.append(element) return elements - def _parse_groups(self, output): - groups = [] - group_pattern = re.compile(r"(?P.+) \((?P.+)\)") - - for line in output: - m = group_pattern.match(line.split(':')[1].strip()) - group = {'name': m.group('name'), 'type': m.group('type')} - groups.append(group) - return groups - def lmp_print(self, s): """ needed for Python2 compatibility, since print is a reserved keyword """ return self.__getattr__("print")(s) diff --git a/src/.gitignore b/src/.gitignore index 204eec5e0b..2cb2fd315b 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1058,6 +1058,10 @@ /pair_adp.h /pair_agni.cpp /pair_agni.h +/pair_aip_water_2dm.cpp +/pair_aip_water_2dm.h +/pair_aip_water_2dm_opt.cpp +/pair_aip_water_2dm_opt.h /pair_airebo.cpp /pair_airebo.h /pair_airebo_morse.cpp @@ -1549,6 +1553,10 @@ /fix_langevin_drude.h /fix_mol_swap.cpp /fix_mol_swap.h +/fix_pimd.cpp +/fix_pimd.h +/fix_pimd_langevin.cpp +/fix_pimd_langevin.h /fix_alchemy.cpp /fix_alchemy.h /fix_pimd_nvt.cpp diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 4d0517e527..6f0622cbf6 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -44,7 +44,7 @@ enum {FAR=0,XLO,XHI,YLO,YHI}; //#define _POLYGON_DEBUG #define DELTA 10000 -#define EPSILON 1e-2 +#define EPSILON 1e-2 // dimensionless threshold (dot products, end point checks, contact checks) #define BIG 1.0e20 #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 212830eb81..546ef1f0d4 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -42,7 +42,7 @@ enum {FAR=0,XLO,XHI,YLO,YHI,ZLO,ZHI}; //#define _POLYHEDRON_DEBUG #define DELTA 10000 -#define EPSILON 1e-2 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks) #define BIG 1.0e20 #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 0e83b63f99..24f38a6a0a 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; #define DELTA 10000 -#define EPSILON 1e-3 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models @@ -624,7 +624,8 @@ void PairBodyRoundedPolygon::sphere_against_sphere(int i, int j, fy = dely*fpair/rij; fz = delz*fpair/rij; - if (R <= EPSILON) { // in contact + double rmin = MIN(rradi, rradj); + if (R <= EPSILON*rmin) { // in contact // relative translational velocity @@ -1019,6 +1020,7 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody, double xi1[3],xi2[3],u[3],v[3],uij[3]; double udotv, magv, magucostheta; double delx,dely,delz; + double rmin = MIN(rounded_radius, x0_rounded_radius); ifirst = dfirst[ibody]; iefirst = edfirst[ibody]; @@ -1105,17 +1107,17 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody, // x0 and xmi are on the different sides // t is the ratio to detect if x0 is closer to the vertices xi or xj - if (fabs(xi2[0] - xi1[0]) > EPSILON) + if (fabs(xi2[0] - xi1[0]) > EPSILON*rmin) t = (hi[0] - xi1[0]) / (xi2[0] - xi1[0]); - else if (fabs(xi2[1] - xi1[1]) > EPSILON) + else if (fabs(xi2[1] - xi1[1]) > EPSILON*rmin) t = (hi[1] - xi1[1]) / (xi2[1] - xi1[1]); - else if (fabs(xi2[2] - xi1[2]) > EPSILON) + else if (fabs(xi2[2] - xi1[2]) > EPSILON*rmin) t = (hi[2] - xi1[2]) / (xi2[2] - xi1[2]); double contact_dist = rounded_radius + x0_rounded_radius; if (t >= 0 && t <= 1) { mode = EDGE; - if (d < contact_dist + EPSILON) + if (d < contact_dist + EPSILON*rmin) contact = 1; } else { // t < 0 || t > 1: closer to either vertices of the edge @@ -1293,8 +1295,14 @@ double PairBodyRoundedPolygon::contact_separation(const Contact& c1, double x3 = c2.xv[0]; double y3 = c2.xv[1]; + int ibody = c1.ibody; + int jbody = c1.ibody; + double rradi = rounded_radius[ibody]; + double rradj = rounded_radius[jbody]; + double rmin = MIN(rradi, rradj); + double delta_a = 0.0; - if (fabs(x2 - x1) > EPSILON) { + if (fabs(x2 - x1) > EPSILON*rmin) { double A = (y2 - y1) / (x2 - x1); delta_a = fabs(y1 - A * x1 - y3 + A * x3) / sqrt(1 + A * A); } else { diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 2c23199e33..9425707ef1 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; using namespace MathConst; #define DELTA 10000 -#define EPSILON 1e-3 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_FACE_SIZE 4 // maximum number of vertices per face (same as BodyRoundedPolyhedron) #define MAX_CONTACTS 32 // for 3D models (including duplicated counts) @@ -1186,7 +1186,13 @@ int PairBodyRoundedPolyhedron::interaction_edge_to_edge(int ibody, // singularity case, ignore interactions - if (r < EPSILON) return interact; + double rmin = MIN(rounded_radius_i, rounded_radius_j); + if (r < EPSILON*rmin) { + #ifdef _POLYHEDRON_DEBUG + printf("ignore interaction: r = %0.16f\n", r); + #endif + return interact; + } // include the vertices for interactions @@ -1898,11 +1904,13 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, { int i,n,ifirst,iffirst,npi1,npi2; - double xi1[3],xi2[3],u[3],v[3],costheta,anglesum1,anglesum2,magu,magv; + double xi1[3],xi2[3],u[3],v[3],costheta,anglesum1,anglesum2,magu,magv,rradi; ifirst = dfirst[ibody]; iffirst = facfirst[ibody]; - anglesum1 = anglesum2 = 0;; + rradi = rounded_radius[ibody]; + double rradsq = rradi*rradi; + anglesum1 = anglesum2 = 0; for (i = 0; i < MAX_FACE_SIZE; i++) { npi1 = static_cast(face[iffirst+face_index][i]); if (npi1 < 0) break; @@ -1929,7 +1937,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, // the point is at either vertices - if (magu * magv < EPSILON) inside1 = 1; + if (magu * magv < EPSILON*rradsq) inside1 = 1; else { costheta = MathExtra::dot3(u,v)/(magu*magv); anglesum1 += acos(costheta); @@ -1940,7 +1948,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, MathExtra::sub3(xi2,q2,v); magu = MathExtra::len3(u); magv = MathExtra::len3(v); - if (magu * magv < EPSILON) inside2 = 1; + if (magu * magv < EPSILON*rradsq) inside2 = 1; else { costheta = MathExtra::dot3(u,v)/(magu*magv); anglesum2 += acos(costheta); @@ -2338,7 +2346,12 @@ void PairBodyRoundedPolyhedron::find_unique_contacts(Contact* contact_list, for (int j = i + 1; j < n; j++) { if (contact_list[i].unique == 0) continue; double d = contact_separation(contact_list[i], contact_list[j]); - if (d < EPSILON) contact_list[j].unique = 0; + int ibody = contact_list[i].ibody; + int jbody = contact_list[i].jbody; + double rradi = rounded_radius[ibody]; + double rradj = rounded_radius[jbody]; + double rmin = MIN(rradi, rradj); + if (d < EPSILON*rmin) contact_list[j].unique = 0; } } } diff --git a/src/BPM/atom_vec_bpm_sphere.cpp b/src/BPM/atom_vec_bpm_sphere.cpp index 375a33c28d..2820a74c8a 100644 --- a/src/BPM/atom_vec_bpm_sphere.cpp +++ b/src/BPM/atom_vec_bpm_sphere.cpp @@ -17,7 +17,6 @@ #include "comm.h" #include "error.h" #include "fix.h" -#include "fix_adapt.h" #include "math_const.h" #include "modify.h" @@ -33,6 +32,7 @@ AtomVecBPMSphere::AtomVecBPMSphere(LAMMPS *_lmp) : AtomVec(_lmp) mass_type = PER_ATOM; molecular = Atom::MOLECULAR; bonds_allow = 1; + radvary = 0; atom->molecule_flag = 1; atom->sphere_flag = 1; @@ -98,16 +98,12 @@ void AtomVecBPMSphere::init() // check if optional radvary setting should have been set to 1 - for (auto ifix : modify->get_fix_by_style("^adapt")) { - if (radvary == 0) { - if ((strcmp(ifix->style, "adapt") == 0) && (dynamic_cast(ifix)->diamflag)) - error->all(FLERR, "Fix adapt changes atom radii but atom_style bpm/sphere is not dynamic"); - // cannot properly check for fix adapt/fep since its header is optional - if ((strcmp(ifix->style, "adapt/fep") == 0) && (comm->me == 0)) - error->warning( - FLERR, "Fix adapt/fep may change atom radii but atom_style bpm/sphere is not dynamic"); + if (radvary == 0) + for (const auto &ifix : modify->get_fix_by_style("^adapt")) { + if (ifix->diam_flag) + error->all(FLERR, "Fix {} changes atom radii but atom_style bpm/sphere is not dynamic", + ifix->style); } - } } /* ---------------------------------------------------------------------- diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index a68aea3e68..3ebeed3f1d 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -94,10 +94,10 @@ void BondBPM::init_style() } if (overlay_flag) { - if (force->special_lj[1] != 1.0) + if (force->special_lj[1] != 1.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0 || + force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || force->special_coul[3] != 1.0) error->all(FLERR, - "With overlay/pair, BPM bond styles require special_bonds weight of 1.0 for " - "first neighbors"); + "With overlay/pair yes, BPM bond styles require a value of 1.0 for all special_bonds weights"); if (id_fix_update) { modify->delete_fix(id_fix_update); delete[] id_fix_update; @@ -106,18 +106,18 @@ void BondBPM::init_style() } else { // Require atoms know about all of their bonds and if they break if (force->newton_bond && break_flag) - error->all(FLERR, "Without overlay/pair or break/no, BPM bond styles require Newton bond off"); + error->all(FLERR, "With overlay/pair no, or break yes, BPM bond styles require Newton bond off"); // special lj must be 0 1 1 to censor pair forces between bonded particles - // special coulomb must be 1 1 1 to ensure all pairs are included in the - // neighbor list and 1-3 and 1-4 special bond lists are skipped if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) error->all(FLERR, - "Without overlay/pair, BPM bond styles requires special LJ weights = 0,1,1"); - if (force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || - force->special_coul[3] != 1.0) + "With overlay/pair no, BPM bond styles require special LJ weights = 0,1,1"); + // if bonds can break, special coulomb must be 1 1 1 to ensure all pairs are included in the + // neighbor list and 1-3 and 1-4 special bond lists are skipped + if (break_flag && (force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || + force->special_coul[3] != 1.0)) error->all(FLERR, - "Without overlay/pair, BPM bond styles requires special Coulomb weights = 1,1,1"); + "With overlay/pair no, and break yes, BPM bond styles requires special Coulomb weights = 1,1,1"); if (id_fix_dummy && break_flag) { id_fix_update = utils::strdup("BPM_UPDATE_SPECIAL_BONDS"); @@ -187,11 +187,13 @@ void BondBPM::settings(int narg, char **arg) iarg++; } } else if (strcmp(arg[iarg], "overlay/pair") == 0) { - overlay_flag = 1; - iarg++; - } else if (strcmp(arg[iarg], "break/no") == 0) { - break_flag = 0; - iarg++; + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for overlay/pair"); + overlay_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "break") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for break"); + break_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; } else { leftover_iarg.push_back(iarg); iarg++; @@ -333,7 +335,7 @@ void BondBPM::read_restart(FILE *fp) void BondBPM::process_broken(int i, int j) { if (!break_flag) - error->one(FLERR, "BPM bond broke with break/no option"); + error->one(FLERR, "BPM bond broke with break no option"); if (fix_store_local) { for (int n = 0; n < nvalues; n++) (this->*pack_choice[n])(n, i, j); diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index ac29c0e376..ffb0d9521d 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -50,6 +50,7 @@ BondBPMRotational::BondBPMRotational(LAMMPS *_lmp) : { partial_flag = 1; smooth_flag = 1; + normalize_flag = 0; single_extra = 7; svector = new double[7]; @@ -203,6 +204,13 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, double Ts[3], Tb[3], Tt[3], Tbp[3], Ttp[3], Tsp[3], T_rot[3], Ttmp[3]; double **quat = atom->quat; + double r0_mag_inv = 1.0 / r0_mag; + double Kr_type = Kr[type]; + double Ks_type = Ks[type]; + if (normalize_flag) { + Kr_type *= r0_mag_inv; + Ks_type *= r0_mag_inv; + } q1[0] = quat[i1][0]; q1[1] = quat[i1][1]; @@ -217,26 +225,26 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, // Calculate normal forces, rb = bond vector in particle 1's frame MathExtra::qconjugate(q2, q2inv); MathExtra::quatrotvec(q2inv, r, rb); - Fr = Kr[type] * (r_mag - r0_mag); + Fr = Kr_type * (r_mag - r0_mag); MathExtra::scale3(Fr * r_mag_inv, rb, F_rot); // Calculate forces due to tangential displacements (no rotation) r0_dot_rb = MathExtra::dot3(r0, rb); - c = r0_dot_rb * r_mag_inv / r0_mag; + c = r0_dot_rb * r_mag_inv * r0_mag_inv; gamma = acos_limit(c); MathExtra::cross3(rb, r0, rb_x_r0); MathExtra::cross3(rb, rb_x_r0, s); MathExtra::norm3(s); - MathExtra::scale3(Ks[type] * r_mag * gamma, s, Fs); + MathExtra::scale3(Ks_type * r_mag * gamma, s, Fs); // Calculate torque due to tangential displacements MathExtra::cross3(r0, rb, t); MathExtra::norm3(t); - MathExtra::scale3(0.5 * r_mag * Ks[type] * r_mag * gamma, t, Ts); + MathExtra::scale3(0.5 * r_mag * Ks_type * r_mag * gamma, t, Ts); // Relative rotation force/torque // Use representation of X'Y'Z' rotations from Wang, Mora 2009 @@ -316,12 +324,12 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, Ttp[1] = 0.0; Ttp[2] = Kt[type] * psi; - Fsp[0] = -0.5 * Ks[type] * r_mag * theta * cos_phi; - Fsp[1] = -0.5 * Ks[type] * r_mag * theta * sin_phi; + Fsp[0] = -0.5 * Ks_type * r_mag * theta * cos_phi; + Fsp[1] = -0.5 * Ks_type * r_mag * theta * sin_phi; Fsp[2] = 0.0; - Tsp[0] = 0.25 * Ks[type] * r_mag * r_mag * theta * sin_phi; - Tsp[1] = -0.25 * Ks[type] * r_mag * r_mag * theta * cos_phi; + Tsp[0] = 0.25 * Ks_type * r_mag * r_mag * theta * sin_phi; + Tsp[1] = -0.25 * Ks_type * r_mag * r_mag * theta * cos_phi; Tsp[2] = 0.0; // Rotate forces/torques back to 1st particle's frame @@ -667,6 +675,10 @@ void BondBPMRotational::settings(int narg, char **arg) if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for smooth"); smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); i += 1; + } else if (strcmp(arg[iarg], "normalize") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for normalize"); + normalize_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; } else { error->all(FLERR, "Illegal bond bpm command, invalid argument {}", arg[iarg]); } @@ -793,7 +805,7 @@ double BondBPMRotational::single(int type, double rsq, int i, int j, double &ffo double breaking = elastic_forces(i, j, type, r_mag, r0_mag, r_mag_inv, rhat, r, r0, force1on2, torque1on2, torque2on1); damping_forces(i, j, type, rhat, r, force1on2, torque1on2, torque2on1); - fforce = MathExtra::dot3(force1on2, r); + fforce = MathExtra::dot3(force1on2, rhat); fforce *= -1; double smooth = 1.0; diff --git a/src/BPM/bond_bpm_rotational.h b/src/BPM/bond_bpm_rotational.h index 0fb38e7343..9fdc418d2d 100644 --- a/src/BPM/bond_bpm_rotational.h +++ b/src/BPM/bond_bpm_rotational.h @@ -41,7 +41,7 @@ class BondBPMRotational : public BondBPM { protected: double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist; double *Fcr, *Fcs, *Tct, *Tcb; - int smooth_flag; + int smooth_flag, normalize_flag; double elastic_forces(int, int, int, double, double, double, double *, double *, double *, double *, double *, double *); diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index ed4e71daf1..37b79f93fb 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -37,6 +37,7 @@ BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) : { partial_flag = 1; smooth_flag = 1; + normalize_flag = 0; single_extra = 1; svector = new double[1]; @@ -190,7 +191,10 @@ void BondBPMSpring::compute(int eflag, int vflag) } rinv = 1.0 / r; - fbond = k[type] * (r0 - r); + if (normalize_flag) + fbond = -k[type] * e; + else + fbond = k[type] * (r0 - r); delvx = v[i1][0] - v[i2][0]; delvy = v[i1][1] - v[i2][1]; @@ -302,6 +306,10 @@ void BondBPMSpring::settings(int narg, char **arg) if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for smooth"); smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); i += 1; + } else if (strcmp(arg[iarg], "normalize") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for normalize"); + normalize_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; } else { error->all(FLERR, "Illegal bond bpm command, invalid argument {}", arg[iarg]); } @@ -376,7 +384,11 @@ double BondBPMSpring::single(int type, double rsq, int i, int j, double &fforce) double r = sqrt(rsq); double rinv = 1.0 / r; - fforce = k[type] * (r0 - r); + + if (normalize_flag) + fforce = k[type] * (r0 - r) / r0; + else + fforce = k[type] * (r0 - r); double **x = atom->x; double **v = atom->v; diff --git a/src/BPM/bond_bpm_spring.h b/src/BPM/bond_bpm_spring.h index 409469bef3..93f4b49a26 100644 --- a/src/BPM/bond_bpm_spring.h +++ b/src/BPM/bond_bpm_spring.h @@ -40,7 +40,7 @@ class BondBPMSpring : public BondBPM { protected: double *k, *ecrit, *gamma; - int smooth_flag; + int smooth_flag, normalize_flag; void allocate(); void store_data(); diff --git a/src/CG-DNA/bond_oxdna_fene.cpp b/src/CG-DNA/bond_oxdna_fene.cpp index 2d471cbbe6..780b71e44c 100644 --- a/src/CG-DNA/bond_oxdna_fene.cpp +++ b/src/CG-DNA/bond_oxdna_fene.cpp @@ -146,7 +146,7 @@ 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 delf[3], delta[3], deltb[3]; // force, torque increment double delr[3], ebond, fbond; double rsq, Deltasq, rlogarg; double r, rr0, rr0sq; diff --git a/src/CG-DNA/pair_oxdna2_coaxstk.cpp b/src/CG-DNA/pair_oxdna2_coaxstk.cpp index 844ba56577..527020076c 100644 --- a/src/CG-DNA/pair_oxdna2_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna2_coaxstk.cpp @@ -612,7 +612,7 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) (0.5 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one) - k_cxst_one * 0.5 * (cut_cxst_0_one -cut_cxst_c_one) * (cut_cxst_0_one - cut_cxst_c_one)/k_cxst_one); - cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one;; + cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one; b_cxst_hi_one = 0.25 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one)/ (0.5 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one) - diff --git a/src/CG-DNA/pair_oxdna2_dh.cpp b/src/CG-DNA/pair_oxdna2_dh.cpp index dcfe3f9ea1..a8114c84d7 100644 --- a/src/CG-DNA/pair_oxdna2_dh.cpp +++ b/src/CG-DNA/pair_oxdna2_dh.cpp @@ -79,7 +79,7 @@ void PairOxdna2Dh::compute_interaction_sites(double e1[3], void PairOxdna2Dh::compute(int eflag, int vflag) { - double delf[3],delta[3],deltb[3]; // force, torque increment;; + double delf[3],delta[3],deltb[3]; // force, torque increment double rtmp_s[3],delr[3]; double evdwl,fpair,factor_lj; double r,rsq,rinv; diff --git a/src/CG-DNA/pair_oxdna_coaxstk.cpp b/src/CG-DNA/pair_oxdna_coaxstk.cpp index b9b34338fe..679bfbf18d 100644 --- a/src/CG-DNA/pair_oxdna_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna_coaxstk.cpp @@ -749,7 +749,7 @@ void PairOxdnaCoaxstk::coeff(int narg, char **arg) (0.5 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one) - k_cxst_one * 0.5 * (cut_cxst_0_one -cut_cxst_c_one) * (cut_cxst_0_one - cut_cxst_c_one)/k_cxst_one); - cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one;; + cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one; b_cxst_hi_one = 0.25 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one)/ (0.5 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one) - diff --git a/src/CG-DNA/pair_oxdna_xstk.cpp b/src/CG-DNA/pair_oxdna_xstk.cpp index d95004f537..6ef6091889 100644 --- a/src/CG-DNA/pair_oxdna_xstk.cpp +++ b/src/CG-DNA/pair_oxdna_xstk.cpp @@ -696,7 +696,7 @@ void PairOxdnaXstk::coeff(int narg, char **arg) (0.5 * (cut_xst_lo_one - cut_xst_0_one) * (cut_xst_lo_one - cut_xst_0_one) - k_xst_one * 0.5 * (cut_xst_0_one -cut_xst_c_one) * (cut_xst_0_one - cut_xst_c_one)/k_xst_one); - cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one;; + cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one; b_xst_hi_one = 0.25 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one)/ (0.5 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one) - diff --git a/src/CG-DNA/pair_oxrna2_xstk.cpp b/src/CG-DNA/pair_oxrna2_xstk.cpp index cdba56e33a..e28b6573bf 100644 --- a/src/CG-DNA/pair_oxrna2_xstk.cpp +++ b/src/CG-DNA/pair_oxrna2_xstk.cpp @@ -639,7 +639,7 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) (0.5 * (cut_xst_lo_one - cut_xst_0_one) * (cut_xst_lo_one - cut_xst_0_one) - k_xst_one * 0.5 * (cut_xst_0_one -cut_xst_c_one) * (cut_xst_0_one - cut_xst_c_one)/k_xst_one); - cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one;; + cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one; b_xst_hi_one = 0.25 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one)/ (0.5 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one) - diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp index b11ac7e482..40f7d0c853 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp @@ -350,7 +350,6 @@ void FixPolarizeBEMGMRES::compute_induced_charges() double *ed = atom->ed; double *em = atom->em; double *epsilon = atom->epsilon; - int *mask = atom->mask; int nlocal = atom->nlocal; int eflag = 1; int vflag = 0; @@ -445,31 +444,7 @@ void FixPolarizeBEMGMRES::compute_induced_charges() comm->forward_comm(this); - // compute the total induced charges of the interface particles - // for interface particles: set the charge to be the sum of unscaled (free) charges and induced charges - - double tmp = 0; - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - - double q_bound = q_scaled[i] - q[i]; - tmp += q_bound; - q[i] = q_scaled[i]; - } - if (first) first = 0; - - // ensure sum of all induced charges being zero - - int ncount = group->count(igroup); - double sum = 0; - MPI_Allreduce(&tmp, &sum, 1, MPI_DOUBLE, MPI_SUM, world); - double qboundave = sum / (double) ncount; - - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - q[i] -= qboundave; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index 697d45f416..4dc7dd2669 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -361,30 +361,6 @@ void FixPolarizeBEMICC::compute_induced_charges() } iterations = itr; - - // compute the total induced charges of the interface particles - // for interface particles: set the charge to be the sum of unscaled (free) charges and induced charges - - double tmp = 0; - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - - double q_bound = q_scaled[i] - q[i]; - tmp += q_bound; - q[i] = q_scaled[i]; - } - - // ensure sum of all induced charges being zero - - int ncount = group->count(igroup); - double sum = 0; - MPI_Allreduce(&tmp, &sum, 1, MPI_DOUBLE, MPI_SUM, world); - double qboundave = sum / (double) ncount; - - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - q[i] -= qboundave; - } } /* ---------------------------------------------------------------------- */ @@ -479,6 +455,7 @@ void FixPolarizeBEMICC::set_dielectric_params(double ediff, double emean, double double *ed = atom->ed; double *em = atom->em; double *q = atom->q; + double *q_scaled = atom->q_scaled; double *epsilon = atom->epsilon; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -490,6 +467,7 @@ void FixPolarizeBEMICC::set_dielectric_params(double ediff, double emean, double if (areai > 0) area[i] = areai; if (epsiloni > 0) epsilon[i] = epsiloni; if (set_charge) q[i] = qvalue; + q_scaled[i] = q[i] / epsilon[i]; } } } diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index a0dc034818..dd0c0eb648 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -55,9 +55,9 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathExtra; -using namespace MathConst; -using namespace MathSpecial; +using MathConst::MY_PI; +using MathConst::MY_PIS; +using MathSpecial::square; //#define _POLARIZE_DEBUG @@ -378,26 +378,12 @@ void FixPolarizeFunctional::update_induced_charges() // assign charges to the particles in the group double *q_scaled = atom->q_scaled; - double *q = atom->q; - double *epsilon = atom->epsilon; int nlocal = atom->nlocal; - double tmp = 0; for (int i = 0; i < nlocal; i++) { if (induced_charge_idx[i] < 0) continue; int idx = induced_charge_idx[i]; - q[i] = -induced_charges[idx] / (4 * MY_PI); - q_scaled[i] = q[i] / epsilon[i]; - tmp += q_scaled[i]; - } - - double sum = 0; - MPI_Allreduce(&tmp, &sum, 1, MPI_DOUBLE, MPI_SUM, world); - double qboundave = sum/(double)num_induced_charges; - - for (int i = 0; i < nlocal; i++) { - if (induced_charge_idx[i] < 0) continue; - q_scaled[i] -= qboundave; + q_scaled[i] = -induced_charges[idx] / (4 * MY_PI); } // revert to scaled charges to calculate forces diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index b9ae1d65ff..e308cb0826 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -575,7 +575,7 @@ void PPPMDielectric::slabcorr() int nlocal = atom->nlocal; double dipole = 0.0; - for (int i = 0; i < nlocal; i++) dipole += q[i]*x[i][2]; + for (int i = 0; i < nlocal; i++) dipole += eps[i]*q[i]*x[i][2]; // sum local contributions to get global dipole moment @@ -588,7 +588,7 @@ void PPPMDielectric::slabcorr() double dipole_r2 = 0.0; if (eflag_atom || fabs(qsum) > SMALL) { for (int i = 0; i < nlocal; i++) - dipole_r2 += q[i]*x[i][2]*x[i][2]; + dipole_r2 += eps[i]*q[i]*x[i][2]*x[i][2]; // sum local contributions @@ -621,6 +621,6 @@ void PPPMDielectric::slabcorr() for (int i = 0; i < nlocal; i++) { f[i][2] += ffact * eps[i]*q[i]*(dipole_all - qsum*x[i][2]); - efield[i][2] += ffact * eps[i]*(dipole_all - qsum*x[i][2]); + efield[i][2] += ffact * (dipole_all - qsum*x[i][2]); } } diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index 010e5bcb7d..426248b31e 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -90,8 +90,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : ztype[i] = j; } } - if (ztype[i] == XRDmaxType + 1) - error->all(FLERR,"Compute XRD: Invalid ASF atom type"); + if (ztype[i] == XRDmaxType + 1) error->all(FLERR,"Compute XRD: Invalid ASF atom type {}", arg[iarg]); iarg++; } diff --git a/src/DIPOLE/angle_dipole.cpp b/src/DIPOLE/angle_dipole.cpp index f6508022db..6ad4a0fb4c 100644 --- a/src/DIPOLE/angle_dipole.cpp +++ b/src/DIPOLE/angle_dipole.cpp @@ -31,6 +31,8 @@ using namespace LAMMPS_NS; using namespace MathConst; +static constexpr double SMALL = 1.0e-100; + /* ---------------------------------------------------------------------- */ AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp) @@ -72,7 +74,7 @@ void AngleDipole::compute(int eflag, int vflag) double **f = atom->f; double delTx, delTy, delTz; - double fx, fy, fz, fmod, fmod_sqrtff; + double fx, fy, fz, fmod, fmod_len, len; if (!newton_bond) error->all(FLERR, "'newton' flag for bonded interactions must be 'on'"); @@ -87,6 +89,7 @@ void AngleDipole::compute(int eflag, int vflag) delz = x[iRef][2] - x[iDip][2]; r = sqrt(delx * delx + dely * dely + delz * delz); + if (r < SMALL) continue; rmu = r * mu[iDip][3]; cosGamma = (mu[iDip][0] * delx + mu[iDip][1] * dely + mu[iDip][2] * delz) / rmu; @@ -111,11 +114,13 @@ void AngleDipole::compute(int eflag, int vflag) fz = delx * delTy - dely * delTx; fmod = sqrt(delTx * delTx + delTy * delTy + delTz * delTz) / r; // magnitude - fmod_sqrtff = fmod / sqrt(fx * fx + fy * fy + fz * fz); + len = sqrt(fx * fx + fy * fy + fz * fz); + if (len < SMALL) continue; + fmod_len = fmod / len; - fi[0] = fx * fmod_sqrtff; - fi[1] = fy * fmod_sqrtff; - fi[2] = fz * fmod_sqrtff; + fi[0] = fx * fmod_len; + fi[1] = fy * fmod_len; + fi[2] = fz * fmod_len; fj[0] = -fi[0]; fj[1] = -fi[1]; @@ -249,6 +254,8 @@ double AngleDipole::single(int type, int iRef, int iDip, int /*iDummy*/) domain->minimum_image(delx, dely, delz); double r = sqrt(delx * delx + dely * dely + delz * delz); + if (r < SMALL) return 0.0; + double rmu = r * mu[iDip][3]; double cosGamma = (mu[iDip][0] * delx + mu[iDip][1] * dely + mu[iDip][2] * delz) / rmu; double deltaGamma = cosGamma - cos(gamma0[type]); diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index 2687a11658..f7afddc64f 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -476,16 +476,14 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) utils::sfgets(FLERR,line,MAXLINE,fp,file,error); nwords = utils::count_words(utils::trim_comment(line)); - if (nwords != nspecies+2) { - printf("nwords=%d nspecies=%d\n",nwords,nspecies); - error->all(FLERR,"Illegal fix eos/table/rx command"); - } - nwords = 0; + if (nwords != nspecies+2) + error->all(FLERR,"Illegal fix eos/table/rx command: nwords={} nspecies={}", nwords, nspecies); + word = strtok(line," \t\n\r\f"); word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); - for (int icolumn=0;icolumn FixElectrodeConp::ele_ele_interaction(const std::vector &q_local) { - assert((int)q_local.size() == nlocalele); + assert((int) q_local.size() == nlocalele); assert(algo == Algo::CG || algo == Algo::MATRIX_CG); if (algo == Algo::CG) { set_charges(q_local); @@ -873,7 +873,7 @@ std::vector FixElectrodeConp::ele_ele_interaction(const std::vector q_local) { - assert((int)q_local.size() == nlocalele); + assert((int) q_local.size() == nlocalele); double *q = atom->q; for (int i = 0; i < nlocalele; i++) q[atom->map(taglist_local[i])] = q_local[i]; comm->forward_comm(this); @@ -942,7 +942,7 @@ std::vector FixElectrodeConp::scale_vector(double alpha, std::vector FixElectrodeConp::add_nlocalele(std::vector a, std::vector b) { - assert(((int)a.size() == nlocalele) && ((int)b.size() == nlocalele)); + assert(((int) a.size() == nlocalele) && ((int) b.size() == nlocalele)); for (int i = 0; i < nlocalele; i++) a[i] += b[i]; return a; } @@ -951,7 +951,7 @@ std::vector FixElectrodeConp::add_nlocalele(std::vector a, std:: double FixElectrodeConp::dot_nlocalele(std::vector a, std::vector b) { - assert(((int)a.size() == nlocalele) && ((int)b.size() == nlocalele)); + assert(((int) a.size() == nlocalele) && ((int) b.size() == nlocalele)); double out = 0.; for (int i = 0; i < nlocalele; i++) out += a[i] * b[i]; MPI_Allreduce(MPI_IN_PLACE, &out, 1, MPI_DOUBLE, MPI_SUM, world); @@ -962,7 +962,7 @@ double FixElectrodeConp::dot_nlocalele(std::vector a, std::vector FixElectrodeConp::times_elastance(std::vector x) { - assert((int)x.size() == ngroup); + assert((int) x.size() == ngroup); auto out = std::vector(nlocalele, 0.); for (int i = 0; i < nlocalele; i++) { double *_noalias row = elastance[list_iele[i]]; @@ -1209,8 +1209,8 @@ FixElectrodeConp::~FixElectrodeConp() } catch (std::exception &) { } } - if (!modify->get_fix_by_id(id)) // avoid segfault if derived fixes' ctor throws err - atom->delete_callback(id, Atom::GROW); // atomvec track local electrode atoms + + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); delete[] recvcounts; delete[] displs; @@ -1412,7 +1412,7 @@ void FixElectrodeConp::gather_list_iele() } } nlocalele = static_cast(taglist_local.size()); // just for safety - assert((int)iele_to_group_local.size() == nlocalele); + assert((int) iele_to_group_local.size() == nlocalele); if (matrix_algo) { MPI_Allgather(&nlocalele, 1, MPI_INT, recvcounts, 1, MPI_INT, world); diff --git a/src/EXTRA-COMPUTE/compute_ackland_atom.cpp b/src/EXTRA-COMPUTE/compute_ackland_atom.cpp index d8a77b9c2f..fd7a5fb05c 100644 --- a/src/EXTRA-COMPUTE/compute_ackland_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ackland_atom.cpp @@ -357,7 +357,7 @@ void ComputeAcklandAtom::select(int k, int n, double *arr) arr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -378,7 +378,7 @@ void ComputeAcklandAtom::select(int k, int n, double *arr) i = l+1; j = ir; a = arr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; @@ -403,7 +403,7 @@ void ComputeAcklandAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -430,7 +430,7 @@ void ComputeAcklandAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l+1]; ia = iarr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/EXTRA-COMPUTE/compute_adf.cpp b/src/EXTRA-COMPUTE/compute_adf.cpp index fc74cb8037..35ff8bfd33 100644 --- a/src/EXTRA-COMPUTE/compute_adf.cpp +++ b/src/EXTRA-COMPUTE/compute_adf.cpp @@ -288,7 +288,7 @@ void ComputeADF::init() rcutinnerk[0] = 0.0; rcutouterj[0] = force->pair->cutforce; rcutouterk[0] = force->pair->cutforce; - maxouter = force->pair->cutforce;; + maxouter = force->pair->cutforce; } else { for (int m = 0; m < ntriples; m++) { maxouter = MAX(rcutouterj[m],maxouter); diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.cpp b/src/EXTRA-COMPUTE/compute_basal_atom.cpp index b149746fb4..8b65917111 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_basal_atom.cpp @@ -442,7 +442,7 @@ void ComputeBasalAtom::select(int k, int n, double *arr) arr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -463,7 +463,7 @@ void ComputeBasalAtom::select(int k, int n, double *arr) i = l+1; j = ir; a = arr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; @@ -488,7 +488,7 @@ void ComputeBasalAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -515,7 +515,7 @@ void ComputeBasalAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l+1]; ia = iarr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp b/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp index a10e810e82..dc04c6b650 100644 --- a/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp @@ -281,7 +281,7 @@ void ComputeHexOrderAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -308,7 +308,7 @@ void ComputeHexOrderAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l+1]; ia = iarr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 53ff70c561..0380acbb82 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -14,6 +14,7 @@ #include "compute_stress_cartesian.h" #include "atom.h" +#include "bond.h" #include "citeme.h" #include "comm.h" #include "domain.h" @@ -61,14 +62,12 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg { if (lmp->citeme) lmp->citeme->add(cite_compute_stress_cartesian); - // narg == 5 for one-dimensional and narg == 7 for two-dimensional - if (narg == 5) - dims = 1; - else if (narg == 7) - dims = 2; - else - error->all(FLERR, "Illegal compute stress/cartesian command. Illegal number of arguments."); + if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/cartesian", error); + // no triclinic boxes + if (domain->triclinic) error->all(FLERR, "Compute stress/cartesian requires an orthogonal box"); + + // Direction of first dimension if (strcmp(arg[3], "x") == 0) dir1 = 0; else if (strcmp(arg[3], "y") == 0) @@ -78,14 +77,8 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg else error->all(FLERR, "Illegal compute stress/cartesian direction: {}", arg[3]); - dir2 = 0; bin_width1 = utils::numeric(FLERR, arg[4], false, lmp); - bin_width2 = domain->boxhi[dir2] - domain->boxlo[dir2]; nbins1 = (int) ((domain->boxhi[dir1] - domain->boxlo[dir1]) / bin_width1); - nbins2 = 1; - - // no triclinic boxes - if (domain->triclinic) error->all(FLERR, "Compute stress/cartesian requires an orthogonal box"); // adjust bin width if not a perfect match double tmp_binwidth = (domain->boxhi[dir1] - domain->boxlo[dir1]) / nbins1; @@ -93,14 +86,23 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg utils::logmesg(lmp, "Adjusting first bin width for compute {} from {:.6f} to {:.6f}\n", style, bin_width1, tmp_binwidth); bin_width1 = tmp_binwidth; + invV = bin_width1; if (bin_width1 <= 0.0) error->all(FLERR, "Illegal compute stress/cartesian command. First bin width must be > 0"); else if (bin_width1 > domain->boxhi[dir1] - domain->boxlo[dir1]) error->all(FLERR, "Illegal compute stress/cartesian command. First bin width > box."); - invV = bin_width1; - if (dims == 2) { + // Direction of second dimension + if (strcmp(arg[5], "NULL") == 0) { + dims = 1; + dir2 = 0; + bin_width2 = domain->boxhi[dir2] - domain->boxlo[dir2]; + nbins2 = 1; + } else { + dims = 2; + + // Direction of first dimension if (strcmp(arg[5], "x") == 0) dir2 = 0; else if (strcmp(arg[5], "y") == 0) @@ -149,6 +151,25 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg if (box_incompatible) error->all(FLERR, "Must not use compute stress/cartesian on variable box dimension"); + // process optional args + if (narg > 7) { + compute_ke = false; + compute_pair = false; + compute_bond = false; + int iarg = 7; + while (iarg < narg) { + if (strcmp(arg[iarg], "ke") == 0) + compute_ke = true; + else if (strcmp(arg[iarg], "pair") == 0) + compute_pair = true; + else if (strcmp(arg[iarg], "bond") == 0) + compute_bond = true; + else + error->all(FLERR, "Unknown compute stress/cartesian keyword: {}", arg[iarg]); + iarg++; + } + } + for (int i = 0; i < 3; i++) if ((dims == 1 && i != dir1) || (dims == 2 && (i != dir1 && i != dir2))) invV *= domain->boxhi[i] - domain->boxlo[i]; @@ -229,13 +250,6 @@ void ComputeStressCartesian::init_list(int /* id */, NeighList *ptr) void ComputeStressCartesian::compute_array() { - int i, j, ii, jj, inum, jnum, itype, jtype; - int bin, bin1, bin2; - tagint itag, jtag; - double xtmp, ytmp, ztmp, delx, dely, delz; - double rsq, fpair, factor_coul, factor_lj; - int *ilist, *jlist, *numneigh, **firstneigh; - double **x = atom->x; double **v = atom->v; double *mass = atom->mass; @@ -251,13 +265,13 @@ void ComputeStressCartesian::compute_array() // invoke half neighbor list (will copy or build if necessary) neighbor->build_one(list); - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; + int inum = list->inum; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; // Zero arrays - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] = 0; tpkxx[bin] = 0; tpkyy[bin] = 0; @@ -268,105 +282,129 @@ void ComputeStressCartesian::compute_array() } // calculate number density and kinetic contribution to pressure - for (i = 0; i < nlocal; i++) { - bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; - bin2 = 0; - if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; + if (compute_ke) { + for (int i = 0; i < nlocal; i++) { + int bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; + int bin2 = 0; + if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; - // Apply periodic boundary conditions and avoid out of range access - if (domain->periodicity[dir1] == 1) { - if (bin1 < 0) - bin1 = (bin1 + nbins1) % nbins1; + // Apply periodic boundary conditions and avoid out of range access + if (domain->periodicity[dir1] == 1) { + if (bin1 < 0) + bin1 = (bin1 + nbins1) % nbins1; + else if (bin1 >= nbins1) + bin1 = (bin1 - nbins1) % nbins1; + } else if (bin1 < 0) + bin1 = 0; else if (bin1 >= nbins1) - bin1 = (bin1 - nbins1) % nbins1; - } else if (bin1 < 0) - bin1 = 0; - else if (bin1 >= nbins1) - bin1 = nbins1 - 1; + bin1 = nbins1 - 1; - if (domain->periodicity[dir2] == 1) { - if (bin2 < 0) - bin2 = (bin2 + nbins2) % nbins2; + if (domain->periodicity[dir2] == 1) { + if (bin2 < 0) + bin2 = (bin2 + nbins2) % nbins2; + else if (bin2 >= nbins2) + bin2 = (bin2 - nbins2) % nbins2; + } else if (bin2 < 0) + bin2 = 0; else if (bin2 >= nbins2) - bin2 = (bin2 - nbins2) % nbins2; - } else if (bin2 < 0) - bin2 = 0; - else if (bin2 >= nbins2) - bin2 = nbins2 - 1; + bin2 = nbins2 - 1; - j = bin1 + bin2 * nbins1; - tdens[j] += 1; - tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; - tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; - tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + int j = bin1 + bin2 * nbins1; + tdens[j] += 1; + tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; + tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; + tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + } } // loop over neighbors of my atoms - // skip if I or J are not in group - // for newton = 0 and J = ghost atom, - // need to ensure I,J pair is only output by one proc - // use same itag,jtag logic as in Neighbor::neigh_half_nsq() - // for flag = 0, just count pair interactions within force cutoff - // for flag = 1, calculate requested output fields + if (compute_pair && force->pair) { + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; - Pair *pair = force->pair; - double **cutsq = force->pair->cutsq; + // skip if I or J are not in group + if (!(mask[i] & groupbit)) continue; - double xi1, xi2; + double xi1 = x[i][dir1] - boxlo[dir1]; + double xi2 = x[i][dir2] - boxlo[dir2]; - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - if (!(mask[i] & groupbit)) continue; + for (int jj = 0; jj < numneigh[i]; jj++) { + int j = firstneigh[i][jj]; + double factor_lj = special_lj[sbmask(j)]; + double factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + if (!(mask[j] & groupbit)) continue; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - xi1 = x[i][dir1] - boxlo[dir1]; - xi2 = x[i][dir2] - boxlo[dir2]; - itag = tag[i]; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - factor_lj = special_lj[sbmask(j)]; - factor_coul = special_coul[sbmask(j)]; - j &= NEIGHMASK; - if (!(mask[j] & groupbit)) continue; - - // itag = jtag is possible for long cutoffs that include images of self - // do calculation only on appropriate processor - if (newton_pair == 0 && j >= nlocal) { - jtag = tag[j]; - if (itag > jtag) { - if ((itag + jtag) % 2 == 0) continue; - } else if (itag < jtag) { - if ((itag + jtag) % 2 == 1) continue; - } else { - if (x[j][2] < ztmp) continue; - if (x[j][2] == ztmp) { - if (x[j][1] < ytmp) continue; - if (x[j][1] == ytmp && x[j][0] < xtmp) continue; + // for newton = 0 and J = ghost atom, need to ensure I,J pair is only output by one proc + // use same tag[i],tag[j] logic as in Neighbor::neigh_half_nsq() + if (newton_pair == 0 && j >= nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] + tag[j]) % 2 == 1) continue; + } else { + // tag[i] = tag[j] is possible for long cutoffs that include images of self + if (x[j][2] < x[i][2]) continue; + if (x[j][2] == x[i][2]) { + if (x[j][1] < x[i][1]) continue; + if (x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue; + } } } + + double delx = x[j][0] - x[i][0]; + double dely = x[j][1] - x[i][1]; + double delz = x[j][2] - x[i][2]; + double rsq = delx * delx + dely * dely + delz * delz; + + // Check if inside cut-off + int itype = type[i]; + int jtype = type[j]; + if (rsq >= force->pair->cutsq[itype][jtype]) continue; + + double fpair; + force->pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + compute_pressure(fpair, xi1, xi2, delx, dely, delz); } - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; + } + } - rsq = delx * delx + dely * dely + delz * delz; - jtype = type[j]; + // Loop over all bonds + if (compute_bond && force->bond) { + for (int i_bond = 0; i_bond < neighbor->nbondlist; i_bond++) { + // i == atom1, j == atom2 + int i = neighbor->bondlist[i_bond][0]; + int j = neighbor->bondlist[i_bond][1]; + int btype = neighbor->bondlist[i_bond][2]; - // Check if inside cut-off - if (rsq >= cutsq[itype][jtype]) continue; - pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - compute_pressure(fpair, xi1, xi2, delx, dely, delz); + // Skip if one of both atoms is not in group + if (!(mask[i] & groupbit)) continue; + if (!(mask[j] & groupbit)) continue; + + // if newton_bond is off and atom2 is a ghost atom, only compute this on one processor + if (!force->newton_bond && j >= nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] < tag[j]) % 2 == 1) continue; + } + } + + double dx = x[j][0] - x[i][0]; + double dy = x[j][1] - x[i][1]; + double dz = x[j][2] - x[i][2]; + double rsq = dx * dx + dy * dy + dz * dz; + double xi = x[i][dir1] - boxlo[dir1]; + double yi = x[i][dir2] - boxlo[dir2]; + + double fbond; + force->bond->single(btype, rsq, i, j, fbond); + compute_pressure(fbond, xi, yi, dx, dy, dz); } } // normalize pressure - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] *= invV; tpkxx[bin] *= invV; tpkyy[bin] *= invV; @@ -386,9 +424,9 @@ void ComputeStressCartesian::compute_array() MPI_Allreduce(tpczz, pczz, nbins1 * nbins2, MPI_DOUBLE, MPI_SUM, world); // populate array to output. - for (bin = 0; bin < nbins1 * nbins2; bin++) { - array[bin][0] = (bin % nbins1 + 0.5) * bin_width1; - if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2; + for (int bin = 0; bin < nbins1 * nbins2; bin++) { + array[bin][0] = (bin % nbins1 + 0.5) * bin_width1 + boxlo[dir1]; + if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2 + boxlo[dir2]; array[bin][0 + dims] = dens[bin]; array[bin][1 + dims] = pkxx[bin]; array[bin][2 + dims] = pkyy[bin]; @@ -402,25 +440,26 @@ void ComputeStressCartesian::compute_array() void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double delx, double dely, double delz) { - int bin1, bin2, next_bin1, next_bin2; double la = 0.0, lb = 0.0, l_sum = 0.0; double rij[3] = {delx, dely, delz}; - double l1 = 0.0, l2, rij1, rij2; - rij1 = rij[dir1]; - rij2 = rij[dir2]; + double rij1 = rij[dir1]; + double rij2 = rij[dir2]; - next_bin1 = (int) floor(xi / bin_width1); - next_bin2 = (int) floor(yi / bin_width2); + int next_bin1 = (int) floor(xi / bin_width1); + int next_bin2 = (int) floor(yi / bin_width2); // Integrating along line while (lb < 1.0) { - bin1 = next_bin1; - bin2 = next_bin2; + int bin1 = next_bin1; + int bin2 = next_bin2; + double l1; if (rij1 > 0) l1 = ((bin1 + 1) * bin_width1 - xi) / rij1; else l1 = (bin1 * bin_width1 - xi) / rij1; + + double l2; if (rij2 > 0) l2 = ((bin2 + 1) * bin_width2 - yi) / rij2; else diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.h b/src/EXTRA-COMPUTE/compute_stress_cartesian.h index 0954d9ca71..40f2e9d4af 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.h +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.h @@ -36,6 +36,9 @@ class ComputeStressCartesian : public Compute { private: int nbins1, nbins2, dir1, dir2, dims; double bin_width1, bin_width2, invV; + bool compute_ke = true; + bool compute_pair = true; + bool compute_bond = true; // Number density, kinetic and configurational contribution to the pressure. double *dens, *pkxx, *pkyy, *pkzz, *pcxx, *pcyy, *pczz; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 60f2d76e06..fc9de602a7 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.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,21 @@ /*------------------------------------------------------------------------ Contributing Authors : Romain Vermorel (LFCR), Laurent Joly (ULyon) + Support for bonds and angles added by : Evangelos Voyiatzis (NovaMechanics) --------------------------------------------------------------------------*/ #include "compute_stress_mop.h" +#include "angle.h" #include "atom.h" +#include "atom_vec.h" +#include "bond.h" +#include "comm.h" #include "domain.h" #include "error.h" #include "force.h" #include "memory.h" +#include "molecule.h" #include "neigh_list.h" #include "neighbor.h" #include "pair.h" @@ -33,41 +38,54 @@ using namespace LAMMPS_NS; -enum{X,Y,Z}; -enum{TOTAL,CONF,KIN}; - -#define BIG 1000000000 +enum { X, Y, Z }; +enum { TOTAL, CONF, KIN, PAIR, BOND, ANGLE }; /* ---------------------------------------------------------------------- */ -ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg) +ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 6) error->all(FLERR,"Illegal compute stress/mop command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "compute stress/mop", error); - MPI_Comm_rank(world,&me); + bondflag = 0; + angleflag = 0; // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x")==0) { + if (strcmp(arg[3], "x") == 0) { dir = X; - } else if (strcmp(arg[3],"y")==0) { + } else if (strcmp(arg[3], "y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z")==0) { + } else if (strcmp(arg[3], "z") == 0) { dir = Z; - } else error->all(FLERR,"Illegal compute stress/mop command"); + } else + error->all(FLERR, "Illegal compute stress/mop command"); // Position of the plane - if (strcmp(arg[4],"lower")==0) { + if (strcmp(arg[4], "lower") == 0) { pos = domain->boxlo[dir]; - } else if (strcmp(arg[4],"upper")==0) { + } else if (strcmp(arg[4], "upper") == 0) { pos = domain->boxhi[dir]; - } else if (strcmp(arg[4],"center")==0) { - pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); - } else pos = utils::numeric(FLERR,arg[4],false,lmp); + } else if (strcmp(arg[4], "center") == 0) { + pos = 0.5 * (domain->boxlo[dir] + domain->boxhi[dir]); + } else + pos = utils::numeric(FLERR, arg[4], false, lmp); - if (pos < (domain->boxlo[dir]+domain->prd_half[dir])) { + // plane inside the box + + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) { + error->warning(FLERR, "The specified initial plane lies outside of the simulation box"); + double dx[3] = {0.0, 0.0, 0.0}; + dx[dir] = pos - 0.5 * (domain->boxhi[dir] + domain->boxlo[dir]); + domain->minimum_image(dx[0], dx[1], dx[2]); + pos = 0.5 * (domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; + + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) + error->all(FLERR, "Plane for compute stress/mop is out of bounds"); + } + + if (pos < (domain->boxlo[dir] + domain->prd_half[dir])) { pos1 = pos + domain->prd[dir]; } else { pos1 = pos - domain->prd[dir]; @@ -75,71 +93,93 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // parse values until one isn't recognized - which = new int[3*(narg-5)]; + which = new int[3 * (narg - 5)]; nvalues = 0; int i; - int iarg=5; + int iarg = 5; while (iarg < narg) { - if (strcmp(arg[iarg],"conf") == 0) { - for (i=0; i<3; i++) { + if (strcmp(arg[iarg], "conf") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = CONF; nvalues++; } - } else if (strcmp(arg[iarg],"kin") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "kin") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = KIN; nvalues++; } - } else if (strcmp(arg[iarg],"total") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "total") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = TOTAL; nvalues++; } - } else error->all(FLERR, "Illegal compute stress/mop command"); //break; + } else if (strcmp(arg[iarg], "pair") == 0) { + for (i = 0; i < 3; i++) { + which[nvalues] = PAIR; + nvalues++; + } + } else if (strcmp(arg[iarg], "bond") == 0) { + for (i = 0; i < 3; i++) { + which[nvalues] = BOND; + nvalues++; + } + } else if (strcmp(arg[iarg], "angle") == 0) { + for (i = 0; i < 3; i++) { + which[nvalues] = ANGLE; + nvalues++; + } + } else + error->all(FLERR, "Illegal compute stress/mop command"); //break; iarg++; } - // Error check + // Error checks: + // 3D only - if (domain->dimension < 3) - error->all(FLERR, "Compute stress/mop incompatible with simulation dimension"); + if (domain->dimension != 3) error->all(FLERR, "Compute stress/mop requires a 3d system"); // orthogonal simulation box if (domain->triclinic != 0) - error->all(FLERR, "Compute stress/mop incompatible with triclinic simulation box"); - // plane inside the box - if (pos >domain->boxhi[dir] || pos boxlo[dir]) - error->all(FLERR, "Plane for compute stress/mop is out of bounds"); - + error->all(FLERR, "Compute stress/mop is incompatible with triclinic simulation box"); // Initialize some variables values_local = values_global = vector = nullptr; + bond_local = nullptr; + bond_global = nullptr; + angle_local = nullptr; + angle_global = nullptr; // this fix produces a global vector - memory->create(vector,nvalues,"stress/mop:vector"); - memory->create(values_local,nvalues,"stress/mop/spatial:values_local"); - memory->create(values_global,nvalues,"stress/mop/spatial:values_global"); + memory->create(vector, nvalues, "stress/mop:vector"); + memory->create(values_local, nvalues, "stress/mop:values_local"); + memory->create(values_global, nvalues, "stress/mop:values_global"); + memory->create(bond_local, nvalues, "stress/mop:bond_local"); + memory->create(bond_global, nvalues, "stress/mop:bond_global"); + memory->create(angle_local, nvalues, "stress/mop:angle_local"); + memory->create(angle_global, nvalues, "stress/mop:angle_global"); size_vector = nvalues; vector_flag = 1; extvector = 0; - } /* ---------------------------------------------------------------------- */ ComputeStressMop::~ComputeStressMop() { - - delete [] which; + delete[] which; memory->destroy(values_local); memory->destroy(values_global); + memory->destroy(bond_local); + memory->destroy(bond_global); + memory->destroy(angle_local); + memory->destroy(angle_global); memory->destroy(vector); } @@ -157,8 +197,8 @@ void ComputeStressMop::init() area = 1; int i; - for (i=0; i<3; i++) { - if (i!=dir) area = area*domain->prd[i]; + for (i = 0; i < 3; i++) { + if (i != dir) area = area * domain->prd[i]; } // Timestep Value @@ -169,32 +209,41 @@ void ComputeStressMop::init() // Compute stress/mop requires fixed simulation box if (domain->box_change_size || domain->box_change_shape || domain->deform_flag) - error->all(FLERR, "Compute stress/mop requires a fixed simulation box"); + error->all(FLERR, "Compute stress/mop requires a fixed size simulation box"); // This compute requires a pair style with pair_single method implemented - if (force->pair == nullptr) - error->all(FLERR,"No pair style is defined for compute stress/mop"); + if (!force->pair) error->all(FLERR, "No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) - error->all(FLERR,"Pair style does not support compute stress/mop"); + error->all(FLERR, "Pair style does not support compute stress/mop"); - // Warnings + // Errors - if (me==0) { + if (comm->me == 0) { - //Compute stress/mop only accounts for pair interactions. - // issue a warning if any intramolecular potential or Kspace is defined. + // issue an error for unimplemented intramolecular potentials or Kspace. - if (force->bond!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for bond potentials"); - if (force->angle!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for angle potentials"); - if (force->dihedral!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); - if (force->improper!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for improper potentials"); - if (force->kspace!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); + if (force->bond) bondflag = 1; + if (force->angle) { + if (force->angle->born_matrix_enable == 0) { + if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) + error->all(FLERR, "compute stress/mop does not account for angle potentials"); + } else { + angleflag = 1; + } + } + if (force->dihedral) { + if ((strcmp(force->dihedral_style, "zero") != 0) && + (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR, "compute stress/mop does not account for dihedral potentials"); + } + if (force->improper) { + if ((strcmp(force->improper_style, "zero") != 0) && + (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR, "compute stress/mop does not account for improper potentials"); + } + if (force->kspace) + error->warning(FLERR, "compute stress/mop does not account for kspace contributions"); } // need an occasional half neighbor list @@ -208,7 +257,6 @@ void ComputeStressMop::init_list(int /* id */, NeighList *ptr) list = ptr; } - /* ---------------------------------------------------------------------- compute output vector ------------------------------------------------------------------------- */ @@ -217,20 +265,42 @@ void ComputeStressMop::compute_vector() { invoked_array = update->ntimestep; - //Compute pressures on separate procs + // Compute pressures on separate procs + compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(values_local,values_global,nvalues, - MPI_DOUBLE,MPI_SUM,world); - int m; - for (m=0; mmass; double *rmass = atom->rmass; @@ -253,7 +323,6 @@ void ComputeStressMop::compute_pairs() double *special_lj = force->special_lj; int newton_pair = force->newton_pair; - // zero out arrays for one sample for (i = 0; i < nvalues; i++) values_local[i] = 0.0; @@ -280,8 +349,8 @@ void ComputeStressMop::compute_pairs() double xj[3]; m = 0; - while (m= cutsq[itype][jtype]) continue; if (newton_pair || j < nlocal) { //check if ij pair is across plane, add contribution to pressure - if (((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir]single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + if (((xi[dir] > pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + values_local[m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; + } else if (((xi[dir] < pos) && (xj[dir] > pos)) || + ((xi[dir] < pos1) && (xj[dir] > pos1))) { + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + values_local[m] -= fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[m + 1] -= fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[m + 2] -= fpair * (xi[2] - xj[2]) / area * nktv2p; } - else if (((xi[dir]pos)) || ((xi[dir]pos1))) { - - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - - values_local[m] -= fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[m+1] -= fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[m+2] -= fpair*(xi[2]-xj[2])/area*nktv2p; - } - } else { - - if (((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir]single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + if (((xi[dir] > pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + values_local[m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; } - } - } - } - } - // Compute kinetic contribution to pressure // counts local particles transfers across the plane - if (which[m] == KIN || which[m] == TOTAL) { + if ((which[m] == KIN) || (which[m] == TOTAL)) { double sgn; for (int i = 0; i < nlocal; i++) { // skip if I is not in group + if (mask[i] & groupbit) { itype = type[i]; - //coordinates at t + // coordinates at t + xi[0] = atom->x[i][0]; xi[1] = atom->x[i][1]; xi[2] = atom->x[i][2]; - //velocities at t + // velocities at t + vi[0] = atom->v[i][0]; vi[1] = atom->v[i][1]; vi[2] = atom->v[i][2]; - //forces at t + // forces at t + fi[0] = atom->f[i][0]; fi[1] = atom->f[i][1]; fi[2] = atom->f[i][2]; - //coordinates at t-dt (based on Velocity-Verlet alg.) - if (rmass) { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/rmass[i]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/rmass[i]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/rmass[i]*dt*dt*ftm2v; - } else { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/mass[itype]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/mass[itype]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/mass[itype]*dt*dt*ftm2v; - } + const double imass = (rmass) ? rmass[i] : mass[itype]; + const double iterm = 0.5 / imass * dt * ftm2v; + + // coordinates at t-dt (based on Velocity-Verlet alg.) + + xj[0] = xi[0] - vi[0] * dt + fi[0] * iterm * dt; + xj[1] = xi[1] - vi[1] * dt + fi[1] * iterm * dt; + xj[2] = xi[2] - vi[2] * dt + fi[2] * iterm * dt; // because LAMMPS does not put atoms back in the box // at each timestep, must check atoms going through the // image of the plane that is closest to the box - double pos_temp = pos+copysign(1.0,domain->prd_half[dir]-pos)*domain->prd[dir]; - if (fabs(xi[dir]-pos)prd_half[dir] - pos) * domain->prd[dir]; + if (fabs(xi[dir] - pos) < fabs(xi[dir] - pos_temp)) pos_temp = pos; - if (((xi[dir]-pos_temp)*(xj[dir]-pos_temp)<0)) { + if (((xi[dir] - pos_temp) * (xj[dir] - pos_temp)) < 0) { - //sgn = copysign(1.0,vi[dir]-vcm[dir]); - sgn = copysign(1.0,vi[dir]); + // sgn = copysign(1.0,vi[dir]-vcm[dir]); + + sgn = copysign(1.0, vi[dir]); + + // approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) - //approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) double vcross[3]; - if (rmass) { - vcross[0] = vi[0]-fi[0]/rmass[i]/2*ftm2v*dt; - vcross[1] = vi[1]-fi[1]/rmass[i]/2*ftm2v*dt; - vcross[2] = vi[2]-fi[2]/rmass[i]/2*ftm2v*dt; - } else { - vcross[0] = vi[0]-fi[0]/mass[itype]/2*ftm2v*dt; - vcross[1] = vi[1]-fi[1]/mass[itype]/2*ftm2v*dt; - vcross[2] = vi[2]-fi[2]/mass[itype]/2*ftm2v*dt; - } + vcross[0] = vi[0] - fi[0] * iterm; + vcross[1] = vi[1] - fi[1] * iterm; + vcross[2] = vi[2] - fi[2] * iterm; - values_local[m] += mass[itype]*vcross[0]*sgn/dt/area*nktv2p/ftm2v; - values_local[m+1] += mass[itype]*vcross[1]*sgn/dt/area*nktv2p/ftm2v; - values_local[m+2] += mass[itype]*vcross[2]*sgn/dt/area*nktv2p/ftm2v; + values_local[m] += imass * vcross[0] * sgn / dt / area * nktv2p / ftm2v; + values_local[m + 1] += imass * vcross[1] * sgn / dt / area * nktv2p / ftm2v; + values_local[m + 2] += imass * vcross[2] * sgn / dt / area * nktv2p / ftm2v; } } } } - m+=3; + m += 3; } } +/*------------------------------------------------------------------------ + * compute bond contribution to pressure of local proc + *-------------------------------------------------------------------------*/ + +void ComputeStressMop::compute_bonds() +{ + int i, nb, atom1, atom2, imol, iatom, btype; + tagint tagprev; + double rsq, fpair; + + double **x = atom->x; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + double dx[3] = {0.0, 0.0, 0.0}; + double x_bond_1[3] = {0.0, 0.0, 0.0}; + double x_bond_2[3] = {0.0, 0.0, 0.0}; + double local_contribution[3] = {0.0, 0.0, 0.0}; + + // initialization + + for (int i = 0; i < nvalues; i++) bond_local[i] = 0.0; + + // loop over all bonded atoms in the current proc + + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + // minimum image of atom1 with respect to the plane of interest + + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_1[0] = dx[0]; + x_bond_1[1] = dx[1]; + x_bond_1[2] = dx[2]; + x_bond_1[dir] += pos; + + // minimum image of atom2 with respect to atom1 + + dx[0] = x[atom2][0] - x_bond_1[0]; + dx[1] = x[atom2][1] - x_bond_1[1]; + dx[2] = x[atom2][2] - x_bond_1[2]; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_2[0] = x_bond_1[0] + dx[0]; + x_bond_2[1] = x_bond_1[1] + dx[1]; + x_bond_2[2] = x_bond_1[2] + dx[2]; + + // check if the bond vector crosses the plane of interest + + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); + if ((tau <= 1) && (tau >= 0)) { + dx[0] = x_bond_1[0] - x_bond_2[0]; + dx[1] = x_bond_1[1] - x_bond_2[1]; + dx[2] = x_bond_1[2] - x_bond_2[2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + bond->single(btype, rsq, atom1, atom2, fpair); + + double sgn = copysign(1.0, x_bond_1[dir] - pos); + local_contribution[0] += sgn * fpair * dx[0] / area * nktv2p; + local_contribution[1] += sgn * fpair * dx[1] / area * nktv2p; + local_contribution[2] += sgn * fpair * dx[2] / area * nktv2p; + } + } + } + + // loop over the keywords and if necessary add the bond contribution + + int m = 0; + while (m < nvalues) { + if (which[m] == CONF || which[m] == TOTAL || which[m] == BOND) { + bond_local[m] = local_contribution[0]; + bond_local[m + 1] = local_contribution[1]; + bond_local[m + 2] = local_contribution[2]; + } + m += 3; + } +} + +/*------------------------------------------------------------------------ + compute angle contribution to pressure of local proc + -------------------------------------------------------------------------*/ + +void ComputeStressMop::compute_angles() +{ + int na, atom1, atom2, atom3, imol, iatom, atype; + tagint tagprev; + double r1, r2, cos_theta; + + double **x = atom->x; + tagint *tag = atom->tag; + int *num_angle = atom->num_angle; + tagint **angle_atom1 = atom->angle_atom1; + tagint **angle_atom2 = atom->angle_atom2; + tagint **angle_atom3 = atom->angle_atom3; + int **angle_type = atom->angle_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int molecular = atom->molecular; + + // loop over all atoms and their angles + + Angle *angle = force->angle; + + double duang, du2ang; + double dx[3] = {0.0, 0.0, 0.0}; + double dx_left[3] = {0.0, 0.0, 0.0}; + double dx_right[3] = {0.0, 0.0, 0.0}; + double x_angle_left[3] = {0.0, 0.0, 0.0}; + double x_angle_middle[3] = {0.0, 0.0, 0.0}; + double x_angle_right[3] = {0.0, 0.0, 0.0}; + double dcos_theta[3] = {0.0, 0.0, 0.0}; + double local_contribution[3] = {0.0, 0.0, 0.0}; + + // initialization + + for (int i = 0; i < nvalues; i++) angle_local[i] = 0.0; + + for (atom2 = 0; atom2 < nlocal; atom2++) { + if (!(mask[atom2] & groupbit)) continue; + + if (molecular == 1) + na = num_angle[atom2]; + else { + if (molindex[atom2] < 0) continue; + imol = molindex[atom2]; + iatom = molatom[atom2]; + na = onemols[imol]->num_angle[iatom]; + } + + for (int i = 0; i < na; i++) { + if (molecular == 1) { + if (tag[atom2] != angle_atom2[atom2][i]) continue; + atype = angle_type[atom2][i]; + atom1 = atom->map(angle_atom1[atom2][i]); + atom3 = atom->map(angle_atom3[atom2][i]); + } else { + if (tag[atom2] != onemols[imol]->angle_atom2[atom2][i]) continue; + atype = onemols[imol]->angle_type[atom2][i]; + tagprev = tag[atom2] - iatom - 1; + atom1 = atom->map(onemols[imol]->angle_atom1[atom2][i] + tagprev); + atom3 = atom->map(onemols[imol]->angle_atom3[atom2][i] + tagprev); + } + + if (atom1 < 0 || !(mask[atom1] & groupbit)) continue; + if (atom3 < 0 || !(mask[atom3] & groupbit)) continue; + if (atype <= 0) continue; + + // minimum image of atom1 with respect to the plane of interest + + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_angle_left[0] = dx[0]; + x_angle_left[1] = dx[1]; + x_angle_left[2] = dx[2]; + x_angle_left[dir] += pos; + + // minimum image of atom2 with respect to atom1 + + dx_left[0] = x[atom2][0] - x_angle_left[0]; + dx_left[1] = x[atom2][1] - x_angle_left[1]; + dx_left[2] = x[atom2][2] - x_angle_left[2]; + domain->minimum_image(dx_left[0], dx_left[1], dx_left[2]); + x_angle_middle[0] = x_angle_left[0] + dx_left[0]; + x_angle_middle[1] = x_angle_left[1] + dx_left[1]; + x_angle_middle[2] = x_angle_left[2] + dx_left[2]; + + // minimum image of atom3 with respect to atom2 + + dx_right[0] = x[atom3][0] - x_angle_middle[0]; + dx_right[1] = x[atom3][1] - x_angle_middle[1]; + dx_right[2] = x[atom3][2] - x_angle_middle[2]; + domain->minimum_image(dx_right[0], dx_right[1], dx_right[2]); + x_angle_right[0] = x_angle_middle[0] + dx_right[0]; + x_angle_right[1] = x_angle_middle[1] + dx_right[1]; + x_angle_right[2] = x_angle_middle[2] + dx_right[2]; + + // check if any bond vector crosses the plane of interest + + double tau_right = (x_angle_right[dir] - pos) / (x_angle_right[dir] - x_angle_middle[dir]); + double tau_left = (x_angle_middle[dir] - pos) / (x_angle_middle[dir] - x_angle_left[dir]); + bool right_cross = ((tau_right >= 0) && (tau_right <= 1)); + bool left_cross = ((tau_left >= 0) && (tau_left <= 1)); + + // no bonds crossing the plane + + if (!right_cross && !left_cross) continue; + + // compute the cos(theta) of the angle + + r1 = sqrt(dx_left[0] * dx_left[0] + dx_left[1] * dx_left[1] + dx_left[2] * dx_left[2]); + r2 = sqrt(dx_right[0] * dx_right[0] + dx_right[1] * dx_right[1] + dx_right[2] * dx_right[2]); + cos_theta = + -(dx_right[0] * dx_left[0] + dx_right[1] * dx_left[1] + dx_right[2] * dx_left[2]) / + (r1 * r2); + + if (cos_theta > 1.0) cos_theta = 1.0; + if (cos_theta < -1.0) cos_theta = -1.0; + + // The method returns derivative with regards to cos(theta) + + angle->born_matrix(atype, atom1, atom2, atom3, duang, du2ang); + + // only right bond crossing the plane + + if (right_cross && !left_cross) { + double sgn = copysign(1.0, x_angle_right[dir] - pos); + dcos_theta[0] = sgn * (dx_right[0] * cos_theta / r2 + dx_left[0] / r1) / r2; + dcos_theta[1] = sgn * (dx_right[1] * cos_theta / r2 + dx_left[1] / r1) / r2; + dcos_theta[2] = sgn * (dx_right[2] * cos_theta / r2 + dx_left[2] / r1) / r2; + } + + // only left bond crossing the plane + + if (!right_cross && left_cross) { + double sgn = copysign(1.0, x_angle_left[dir] - pos); + dcos_theta[0] = -sgn * (dx_left[0] * cos_theta / r1 + dx_right[0] / r2) / r1; + dcos_theta[1] = -sgn * (dx_left[1] * cos_theta / r1 + dx_right[1] / r2) / r1; + dcos_theta[2] = -sgn * (dx_left[2] * cos_theta / r1 + dx_right[2] / r2) / r1; + } + + // both bonds crossing the plane + + if (right_cross && left_cross) { + + // due to right bond + + double sgn = copysign(1.0, x_angle_middle[dir] - pos); + dcos_theta[0] = -sgn * (dx_right[0] * cos_theta / r2 + dx_left[0] / r1) / r2; + dcos_theta[1] = -sgn * (dx_right[1] * cos_theta / r2 + dx_left[1] / r1) / r2; + dcos_theta[2] = -sgn * (dx_right[2] * cos_theta / r2 + dx_left[2] / r1) / r2; + + // due to left bond + + dcos_theta[0] += sgn * (dx_left[0] * cos_theta / r1 + dx_right[0] / r2) / r1; + dcos_theta[1] += sgn * (dx_left[1] * cos_theta / r1 + dx_right[1] / r2) / r1; + dcos_theta[2] += sgn * (dx_left[2] * cos_theta / r1 + dx_right[2] / r2) / r1; + } + + // final contribution of the given angle term + + local_contribution[0] += duang * dcos_theta[0] / area * nktv2p; + local_contribution[1] += duang * dcos_theta[1] / area * nktv2p; + local_contribution[2] += duang * dcos_theta[2] / area * nktv2p; + } + } + + // loop over the keywords and if necessary add the angle contribution + + int m = 0; + while (m < nvalues) { + if (which[m] == CONF || which[m] == TOTAL || which[m] == ANGLE) { + angle_local[m] = local_contribution[0]; + angle_local[m + 1] = local_contribution[1]; + angle_local[m + 2] = local_contribution[2]; + } + m += 3; + } +} diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index 5357d36371..86140dc278 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -38,11 +38,17 @@ class ComputeStressMop : public Compute { private: void compute_pairs(); + void compute_bonds(); + void compute_angles(); - int me, nvalues, dir; + int nvalues, dir; int *which; + int bondflag, angleflag; + double *values_local, *values_global; + double *bond_local, *bond_global; + double *angle_local, *angle_global; double pos, pos1, dt, nktv2p, ftm2v; double area; class NeighList *list; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 709f109cb1..cc201fdbaa 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -14,85 +13,103 @@ /*------------------------------------------------------------------------ Contributing Authors : Romain Vermorel (LFCR), Laurent Joly (ULyon) + Support for bonds added by : Evangelos Voyiatzis (NovaMechanics) --------------------------------------------------------------------------*/ #include "compute_stress_mop_profile.h" #include "atom.h" -#include "update.h" +#include "atom_vec.h" +#include "bond.h" +#include "comm.h" #include "domain.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "neigh_list.h" #include "error.h" +#include "force.h" #include "memory.h" +#include "molecule.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" #include #include using namespace LAMMPS_NS; -enum{X,Y,Z}; -enum{LOWER,CENTER,UPPER,COORD}; -enum{TOTAL,CONF,KIN}; - -#define BIG 1000000000 +enum { X, Y, Z }; +enum { LOWER, CENTER, UPPER, COORD }; +enum { TOTAL, CONF, KIN, PAIR, BOND }; /* ---------------------------------------------------------------------- */ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg) + Compute(lmp, narg, arg) { - if (narg < 7) error->all(FLERR,"Illegal compute stress/mop/profile command"); + if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/mop/profile", error); - MPI_Comm_rank(world,&me); + bondflag = 0; // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x")==0) { + if (strcmp(arg[3], "x") == 0) { dir = X; - } else if (strcmp(arg[3],"y")==0) { + } else if (strcmp(arg[3], "y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z")==0) { + } else if (strcmp(arg[3], "z") == 0) { dir = Z; - } else error->all(FLERR,"Illegal compute stress/mop/profile command"); + } else + error->all(FLERR, "Illegal compute stress/mop/profile command"); // bin parameters - if (strcmp(arg[4],"lower") == 0) originflag = LOWER; - else if (strcmp(arg[4],"center") == 0) originflag = CENTER; - else if (strcmp(arg[4],"upper") == 0) originflag = UPPER; - else originflag = COORD; - if (originflag == COORD) - origin = utils::numeric(FLERR,arg[4],false,lmp); - delta = utils::numeric(FLERR,arg[5],false,lmp); - invdelta = 1.0/delta; + if (strcmp(arg[4], "lower") == 0) + originflag = LOWER; + else if (strcmp(arg[4], "center") == 0) + originflag = CENTER; + else if (strcmp(arg[4], "upper") == 0) + originflag = UPPER; + else + originflag = COORD; + if (originflag == COORD) origin = utils::numeric(FLERR, arg[4], false, lmp); + delta = utils::numeric(FLERR, arg[5], false, lmp); + invdelta = 1.0 / delta; // parse values until one isn't recognized - which = new int[3*(narg-6)]; + which = new int[3 * (narg - 6)]; nvalues = 0; int i; - int iarg=6; + int iarg = 6; while (iarg < narg) { - if (strcmp(arg[iarg],"conf") == 0) { - for (i=0; i<3; i++) { + if (strcmp(arg[iarg], "conf") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = CONF; nvalues++; } - } else if (strcmp(arg[iarg],"kin") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "kin") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = KIN; nvalues++; } - } else if (strcmp(arg[iarg],"total") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "total") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = TOTAL; nvalues++; } - } else error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; + } else if (strcmp(arg[iarg], "pair") == 0) { + for (i = 0; i < 3; i++) { + which[nvalues] = PAIR; + nvalues++; + } + } else if (strcmp(arg[iarg], "bond") == 0) { + for (i = 0; i < 3; i++) { + which[nvalues] = BOND; + nvalues++; + } + } else + error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; iarg++; } @@ -114,6 +131,9 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a nbins = 0; coord = coordp = nullptr; values_local = values_global = array = nullptr; + bond_local = nullptr; + bond_global = nullptr; + local_contribution = nullptr; // bin setup @@ -121,7 +141,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a // this fix produces a global array - memory->create(array,nbins,1+nvalues,"stress/mop/profile:array"); + memory->create(array, nbins, 1 + nvalues, "stress/mop/profile:array"); size_array_rows = nbins; size_array_cols = 1 + nvalues; @@ -133,13 +153,15 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a ComputeStressMopProfile::~ComputeStressMopProfile() { - - delete [] which; + delete[] which; memory->destroy(coord); memory->destroy(coordp); memory->destroy(values_local); memory->destroy(values_global); + memory->destroy(bond_local); + memory->destroy(bond_global); + memory->destroy(local_contribution); memory->destroy(array); } @@ -147,7 +169,6 @@ ComputeStressMopProfile::~ComputeStressMopProfile() void ComputeStressMopProfile::init() { - // conversion constants nktv2p = force->nktv2p; @@ -157,44 +178,49 @@ void ComputeStressMopProfile::init() area = 1; int i; - for (i=0; i<3; i++) { - if (i!=dir) area = area*domain->prd[i]; + for (i = 0; i < 3; i++) { + if (i != dir) area = area * domain->prd[i]; } // timestep Value dt = update->dt; - // Error check + // Error checks: + // Compute stress/mop/profile requires fixed simulation box if (domain->box_change_size || domain->box_change_shape || domain->deform_flag) error->all(FLERR, "Compute stress/mop/profile requires a fixed simulation box"); - //This compute requires a pair style with pair_single method implemented + // This compute requires a pair style with pair_single method implemented - if (force->pair == nullptr) - error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); + if (!force->pair) error->all(FLERR, "No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) - error->all(FLERR,"Pair style does not support compute stress/mop/profile"); + error->all(FLERR, "Pair style does not support compute stress/mop/profile"); - // Warnings + // Errors - if (me==0) { + if (comm->me == 0) { - //Compute stress/mop/profile only accounts for pair interactions. - // issue a warning if any intramolecular potential or Kspace is defined. + // Compute stress/mop/profile only accounts for pair interactions. + // issue an error if any intramolecular potential or Kspace is defined. - if (force->bond!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for bond potentials"); - if (force->angle!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for angle potentials"); - if (force->dihedral!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); - if (force->improper!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for improper potentials"); - if (force->kspace!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); + if (force->bond) bondflag = 1; + + if (force->angle) + if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) + error->all(FLERR, "compute stress/mop/profile does not account for angle potentials"); + if (force->dihedral) + if ((strcmp(force->dihedral_style, "zero") != 0) && + (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR, "compute stress/mop/profile does not account for dihedral potentials"); + if (force->improper) + if ((strcmp(force->improper_style, "zero") != 0) && + (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR, "compute stress/mop/profile does not account for improper potentials"); + if (force->kspace) + error->warning(FLERR, "compute stress/mop/profile does not account for kspace contributions"); } // need an occasional half neighbor list @@ -209,7 +235,6 @@ void ComputeStressMopProfile::init_list(int /* id */, NeighList *ptr) list = ptr; } - /* ---------------------------------------------------------------------- compute output array ------------------------------------------------------------------------- */ @@ -218,27 +243,41 @@ void ComputeStressMopProfile::compute_array() { invoked_array = update->ntimestep; - //Compute pressures on separate procs + // Compute pressures on separate procs + compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues, - MPI_DOUBLE,MPI_SUM,world); - int ibin,m,mo; - for (ibin=0; ibinmass; double *rmass = atom->rmass; @@ -261,8 +300,8 @@ void ComputeStressMopProfile::compute_pairs() double *special_lj = force->special_lj; int newton_pair = force->newton_pair; - // zero out arrays for one sample + for (m = 0; m < nbins; m++) { for (i = 0; i < nvalues; i++) values_local[m][i] = 0.0; } @@ -289,8 +328,8 @@ void ComputeStressMopProfile::compute_pairs() double xj[3]; m = 0; - while (m= cutsq[itype][jtype]) continue; if (newton_pair || j < nlocal) { - for (ibin=0;ibinpos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - values_local[ibin][m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[ibin][m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[ibin][m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + values_local[ibin][m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[ibin][m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[ibin][m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; - } else if ( ((xi[dir]pos)) - || ((xi[dir]pos1))) { + } else if (((xi[dir] < pos) && (xj[dir] > pos)) || + ((xi[dir] < pos1) && (xj[dir] > pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - values_local[ibin][m] -= fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[ibin][m+1] -= fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[ibin][m+2] -= fpair*(xi[2]-xj[2])/area*nktv2p; + values_local[ibin][m] -= fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[ibin][m + 1] -= fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[ibin][m + 2] -= fpair * (xi[2] - xj[2]) / area * nktv2p; } } } else { - for (ibin=0;ibinpos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - values_local[ibin][m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[ibin][m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[ibin][m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + values_local[ibin][m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[ibin][m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[ibin][m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; } } } @@ -377,7 +414,7 @@ void ComputeStressMopProfile::compute_pairs() // compute kinetic contribution to pressure // counts local particles transfers across the plane - if (which[m] == KIN || which[m] == TOTAL) { + if ((which[m] == KIN) || (which[m] == TOTAL)) { double sgn; @@ -389,66 +426,184 @@ void ComputeStressMopProfile::compute_pairs() itype = type[i]; - //coordinates at t + // coordinates at t + xi[0] = atom->x[i][0]; xi[1] = atom->x[i][1]; xi[2] = atom->x[i][2]; - //velocities at t + // velocities at t + vi[0] = atom->v[i][0]; vi[1] = atom->v[i][1]; vi[2] = atom->v[i][2]; - //forces at t + // forces at t + fi[0] = atom->f[i][0]; fi[1] = atom->f[i][1]; fi[2] = atom->f[i][2]; - //coordinates at t-dt (based on Velocity-Verlet alg.) - if (rmass) { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/rmass[i]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/rmass[i]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/rmass[i]*dt*dt*ftm2v; - } else { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/mass[itype]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/mass[itype]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/mass[itype]*dt*dt*ftm2v; - } + const double imass = (rmass) ? rmass[i] : mass[itype]; + const double iterm = 0.5 / imass * dt * ftm2v; - for (ibin=0;ibinx; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + double dx[3] = {0.0, 0.0, 0.0}; + double x_bond_1[3] = {0.0, 0.0, 0.0}; + double x_bond_2[3] = {0.0, 0.0, 0.0}; + + // initialization + + for (int m = 0; m < nbins; m++) { + for (int i = 0; i < nvalues; i++) { bond_local[m][i] = 0.0; } + local_contribution[m][0] = 0.0; + local_contribution[m][1] = 0.0; + local_contribution[m][2] = 0.0; + } + + // loop over all bonded atoms in the current proc + + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + for (int ibin = 0; ibin < nbins; ibin++) { + double pos = coord[ibin][0]; + + // minimum image of atom1 with respect to the plane of interest + + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_1[0] = dx[0]; + x_bond_1[1] = dx[1]; + x_bond_1[2] = dx[2]; + x_bond_1[dir] += pos; + + // minimum image of atom2 with respect to atom1 + + dx[0] = x[atom2][0] - x_bond_1[0]; + dx[1] = x[atom2][1] - x_bond_1[1]; + dx[2] = x[atom2][2] - x_bond_1[2]; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_2[0] = x_bond_1[0] + dx[0]; + x_bond_2[1] = x_bond_1[1] + dx[1]; + x_bond_2[2] = x_bond_1[2] + dx[2]; + + // check if the bond vector crosses the plane of interest + + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); + if ((tau <= 1) && (tau >= 0)) { + dx[0] = x_bond_1[0] - x_bond_2[0]; + dx[1] = x_bond_1[1] - x_bond_2[1]; + dx[2] = x_bond_1[2] - x_bond_2[2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + bond->single(btype, rsq, atom1, atom2, fpair); + + double sgn = copysign(1.0, x_bond_1[dir] - pos); + local_contribution[ibin][0] += sgn * fpair * dx[0] / area * nktv2p; + local_contribution[ibin][1] += sgn * fpair * dx[1] / area * nktv2p; + local_contribution[ibin][2] += sgn * fpair * dx[2] / area * nktv2p; + } + } + } + } + + // loop over the keywords and if necessary add the bond contribution + + int m = 0; + while (m < nvalues) { + if ((which[m] == CONF) || (which[m] == TOTAL) || (which[m] == BOND)) { + for (int ibin = 0; ibin < nbins; ibin++) { + bond_local[ibin][m] = local_contribution[ibin][0]; + bond_local[ibin][m + 1] = local_contribution[ibin][1]; + bond_local[ibin][m + 2] = local_contribution[ibin][2]; + } + } + m += 3; } } @@ -459,44 +614,51 @@ void ComputeStressMopProfile::compute_pairs() void ComputeStressMopProfile::setup_bins() { - int i,n; + int i, n; double lo = 0.0, hi = 0.0; - double *boxlo,*boxhi; + double *boxlo, *boxhi; boxlo = domain->boxlo; boxhi = domain->boxhi; - if (originflag == LOWER) origin = boxlo[dir]; - else if (originflag == UPPER) origin = boxhi[dir]; + if (originflag == LOWER) + origin = boxlo[dir]; + else if (originflag == UPPER) + origin = boxhi[dir]; else if (originflag == CENTER) origin = 0.5 * (boxlo[dir] + boxhi[dir]); if (origin < boxlo[dir]) { - error->all(FLERR,"Origin of bins for compute stress/mop/profile is out of bounds" ); + error->all(FLERR, "Origin of bins for compute stress/mop/profile is out of bounds"); } else { - n = static_cast ((origin - boxlo[dir]) * invdelta); - lo = origin - n*delta; + n = static_cast((origin - boxlo[dir]) * invdelta); + lo = origin - n * delta; } if (origin < boxhi[dir]) { - n = static_cast ((boxhi[dir] - origin) * invdelta); - hi = origin + n*delta; + n = static_cast((boxhi[dir] - origin) * invdelta); + hi = origin + n * delta; } else { - error->all(FLERR,"Origin of bins for compute stress/mop/profile is out of bounds" ); + error->all(FLERR, "Origin of bins for compute stress/mop/profile is out of bounds"); } offset = lo; - nbins = static_cast ((hi-lo) * invdelta + 1.5); + nbins = static_cast((hi - lo) * invdelta + 1.5); - //allocate bin arrays - memory->create(coord,nbins,1,"stress/mop/profile:coord"); - memory->create(coordp,nbins,1,"stress/mop/profile:coordp"); - memory->create(values_local,nbins,nvalues,"stress/mop/profile:values_local"); - memory->create(values_global,nbins,nvalues,"stress/mop/profile:values_global"); + // allocate bin arrays + + memory->create(coord, nbins, 1, "stress/mop/profile:coord"); + memory->create(coordp, nbins, 1, "stress/mop/profile:coordp"); + memory->create(values_local, nbins, nvalues, "stress/mop/profile:values_local"); + memory->create(values_global, nbins, nvalues, "stress/mop/profile:values_global"); + memory->create(bond_local, nbins, nvalues, "stress/mop/profile:bond_local"); + memory->create(bond_global, nbins, nvalues, "stress/mop/profile:bond_global"); + memory->create(local_contribution, nbins, 3, "stress/mop/profile:local_contribution"); // set bin coordinates + for (i = 0; i < nbins; i++) { - coord[i][0] = offset + i*delta; - if (coord[i][0] < (domain->boxlo[dir]+domain->prd_half[dir])) { + coord[i][0] = offset + i * delta; + if (coord[i][0] < (domain->boxlo[dir] + domain->prd_half[dir])) { coordp[i][0] = coord[i][0] + domain->prd[dir]; } else { coordp[i][0] = coord[i][0] - domain->prd[dir]; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h index b58f762c12..2b0ffef0f8 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h @@ -38,16 +38,21 @@ class ComputeStressMopProfile : public Compute { private: void compute_pairs(); + void compute_bonds(); void setup_bins(); - int me, nvalues, dir; + int nvalues, dir; int *which; + int bondflag; + int originflag; double origin, delta, offset, invdelta; int nbins; double **coord, **coordp; double **values_local, **values_global; + double **bond_local, **bond_global; + double **local_contribution; double dt, nktv2p, ftm2v; double area; diff --git a/src/EXTRA-DUMP/dump_xtc.cpp b/src/EXTRA-DUMP/dump_xtc.cpp index 6b0b97181b..798bdcb391 100644 --- a/src/EXTRA-DUMP/dump_xtc.cpp +++ b/src/EXTRA-DUMP/dump_xtc.cpp @@ -740,7 +740,7 @@ static void receiveints(int buf[], const int num_of_ints, int num_of_bits, } for (i = num_of_ints-1; i > 0; i--) { num = 0; - for (j = num_of_bytes-1; j >=0; j--) { + for (j = num_of_bytes-1; j >= 0; j--) { num = (num << 8) | bytes[j]; p = num / sizes[i]; bytes[j] = p; @@ -1046,7 +1046,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx]; } } - if (buf[1] != 0) buf[0]++;; + if (buf[1] != 0) buf[0]++; xdr_int(xdrs, &(buf[0])); /* buf[0] holds the length in bytes */ return errval * (xdr_opaque(xdrs, (caddr_t)&(buf[3]), (u_int)buf[0])); } else { diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 3c35ec43ba..3ca5c59edf 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -60,21 +60,29 @@ void DumpYAML::write_header(bigint ndump) std::string thermo_data; if (thermo) { Thermo *th = output->thermo; - thermo_data += "thermo:\n - keywords: [ "; - for (int i = 0; i < th->nfield; ++i) thermo_data += fmt::format("{}, ", th->keyword[i]); - thermo_data += "]\n - data: [ "; + // output thermo data only on timesteps where it was computed + if (update->ntimestep == *th->get_timestep()) { + int nfield = *th->get_nfield(); + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); - for (int i = 0; i < th->nfield; ++i) { - th->call_vfunc(i); - if (th->vtype[i] == Thermo::FLOAT) - thermo_data += fmt::format("{}, ", th->dvalue); - else if (th->vtype[i] == Thermo::INT) - thermo_data += fmt::format("{}, ", th->ivalue); - else if (th->vtype[i] == Thermo::BIGINT) - thermo_data += fmt::format("{}, ", th->bivalue); + thermo_data += "thermo:\n - keywords: [ "; + for (int i = 0; i < nfield; ++i) thermo_data += fmt::format("{}, ", keywords[i]); + thermo_data += "]\n - data: [ "; + + for (int i = 0; i < nfield; ++i) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) + thermo_data += fmt::format("{}, ", fields[i].data.d); + else if (fields[i].type == multitype::LAMMPS_INT) + thermo_data += fmt::format("{}, ", fields[i].data.i); + else if (fields[i].type == multitype::LAMMPS_INT64) + thermo_data += fmt::format("{}, ", fields[i].data.b); + else + thermo_data += ", "; + } + thermo_data += "]\n"; + MPI_Barrier(world); } - thermo_data += "]\n"; - MPI_Barrier(world); } if (comm->me == 0) { @@ -85,7 +93,7 @@ void DumpYAML::write_header(bigint ndump) fmt::print(fp, "natoms: {}\n", ndump); fputs("boundary: [ ", fp); - for (const auto bflag : boundary) { + for (const auto &bflag : boundary) { if (bflag == ' ') continue; fmt::print(fp, "{}, ", bflag); } diff --git a/src/EXTRA-FIX/fix_efield_tip4p.cpp b/src/EXTRA-FIX/fix_efield_tip4p.cpp index 3d6a2f66b7..47b1d9e27a 100644 --- a/src/EXTRA-FIX/fix_efield_tip4p.cpp +++ b/src/EXTRA-FIX/fix_efield_tip4p.cpp @@ -47,6 +47,7 @@ void FixEfieldTIP4P::init() if (atom->tag_enable == 0) error->all(FLERR, "Fix efield/tip4p requires atom IDs"); if (!atom->q_flag) error->all(FLERR, "Fix efield/tip4p requires atom attribute q"); if (!force->pair) error->all(FLERR, "A TIP4P pair style must be defined fix efield/tip4p"); + if (pstr) error->all(FLERR, "Fix efield/tip4p does not support the potential keyword"); int itmp; double *p_qdist = (double *) force->pair->extract("qdist", itmp); diff --git a/src/EXTRA-FIX/fix_electron_stopping.cpp b/src/EXTRA-FIX/fix_electron_stopping.cpp index 4a9421be6c..37f33f4ea0 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping.cpp @@ -175,7 +175,8 @@ void FixElectronStopping::post_force(int /*vflag*/) if (energy < Ecut) continue; if (energy < elstop_ranges[0][0]) continue; if (energy > elstop_ranges[0][table_entries - 1]) - error->one(FLERR, "Atom kinetic energy too high for fix electron/stopping"); + error->one(FLERR, "Fix electron/stopping: kinetic energy too high for atom {}: {} vs {}", + atom->tag[i], energy, elstop_ranges[0][table_entries - 1]); if (region) { // Only apply in the given region diff --git a/src/EXTRA-FIX/fix_npt_cauchy.cpp b/src/EXTRA-FIX/fix_npt_cauchy.cpp index 380964f058..feb5a95c6f 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.cpp +++ b/src/EXTRA-FIX/fix_npt_cauchy.cpp @@ -2461,7 +2461,7 @@ void FixNPTCauchy::CauchyStat_init() if (!init_store) init_store = dynamic_cast( - modify->add_fix(std::string(id_store) + " all STORE global 1 6")); + modify->add_fix(std::string(id_store) + " all STORE/GLOBAL 1 6")); initRUN = 0; initPK = 1; diff --git a/src/EXTRA-FIX/fix_wall_ees.cpp b/src/EXTRA-FIX/fix_wall_ees.cpp index 230b8f6ac0..0e4d5aa1eb 100644 --- a/src/EXTRA-FIX/fix_wall_ees.cpp +++ b/src/EXTRA-FIX/fix_wall_ees.cpp @@ -116,7 +116,7 @@ void FixWallEES::wall_particle(int m, int which, double coord) nhat[(dim+2)%3] = 0 ; - double* shape = bonus[ellipsoid[i]].shape;; + double* shape = bonus[ellipsoid[i]].shape; MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); MathExtra::transpose_matvec(A,nhat,tempvec); for (int k = 0; k<3; k++) { diff --git a/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp b/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp index c0b44530e8..c435cc14ae 100644 --- a/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp +++ b/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp @@ -109,7 +109,7 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : for (int dir = 0; dir < 3; dir++) { wallvel[nwall][dir]= utils::numeric(FLERR,arg[iarg+dir+3],false,lmp); int dim = wallwhich[nwall] / 2; - if ((wallvel[nwall][dir] !=0) & (dir == dim)) + if ((wallvel[nwall][dir] != 0) & (dir == dim)) error->all(FLERR,"The wall velocity must be tangential"); // DIFFUSIVE = no accommodation coeffs diff --git a/src/EXTRA-PAIR/pair_lj_relres.cpp b/src/EXTRA-PAIR/pair_lj_relres.cpp index 85d0a04bf9..1826f3f1db 100644 --- a/src/EXTRA-PAIR/pair_lj_relres.cpp +++ b/src/EXTRA-PAIR/pair_lj_relres.cpp @@ -453,7 +453,7 @@ double PairLJRelRes::init_one(int i, int j) offset[i][j] = 0.0; } - if (epsilonf[i][j] != 0 ) { // fg (cut=cutf coefficients) + if (epsilonf[i][j] != 0) { // fg (cut=cutf coefficients) ljf1[i][j] = 48.0 * epsilonf[i][j] * pow(sigmaf[i][j],12.0); ljf2[i][j] = 24.0 * epsilonf[i][j] * pow(sigmaf[i][j],6.0); ljf3[i][j] = 4.0 * epsilonf[i][j] * pow(sigmaf[i][j],12.0); diff --git a/src/FEP/fix_adapt_fep.cpp b/src/FEP/fix_adapt_fep.cpp index 6e38c90ef2..e050b8cf21 100644 --- a/src/FEP/fix_adapt_fep.cpp +++ b/src/FEP/fix_adapt_fep.cpp @@ -82,7 +82,6 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : // parse keywords nadapt = 0; - diamflag = 0; chgflag = 0; iarg = 4; @@ -114,7 +113,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : adapt[nadapt].which = ATOM; if (strcmp(arg[iarg+1],"diameter") == 0) { adapt[nadapt].aparam = DIAMETER; - diamflag = 1; + diam_flag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { adapt[nadapt].aparam = CHARGE; chgflag = 1; @@ -201,7 +200,7 @@ int FixAdaptFEP::setmask() void FixAdaptFEP::post_constructor() { if (!resetflag) return; - if (!diamflag && !chgflag) return; + if (!diam_flag && !chgflag) return; // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix @@ -209,7 +208,7 @@ void FixAdaptFEP::post_constructor() id_fix_diam = nullptr; id_fix_chg = nullptr; - if (diamflag) { + if (diam_flag) { id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM")); fix_diam = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE/ATOM 1 0 0 1", id_fix_diam,group->names[igroup]))); @@ -513,7 +512,7 @@ void FixAdaptFEP::restore_settings() *kspace_scale = 1.0; } else if (ad->which == ATOM) { - if (diamflag) { + if (diam_flag) { double density; double *vec = fix_diam->vstore; diff --git a/src/FEP/fix_adapt_fep.h b/src/FEP/fix_adapt_fep.h index 370a34a0f3..97749abcb6 100644 --- a/src/FEP/fix_adapt_fep.h +++ b/src/FEP/fix_adapt_fep.h @@ -26,7 +26,6 @@ namespace LAMMPS_NS { class FixAdaptFEP : public Fix { public: - int diamflag; // 1 if atom diameters will vary, for AtomVecGranular int chgflag; FixAdaptFEP(class LAMMPS *, int, char **); diff --git a/src/GPU/pair_amoeba_gpu.cpp b/src/GPU/pair_amoeba_gpu.cpp index b7e1f8e118..8b3cf2cfea 100644 --- a/src/GPU/pair_amoeba_gpu.cpp +++ b/src/GPU/pair_amoeba_gpu.cpp @@ -745,15 +745,15 @@ void PairAmoebaGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -762,15 +762,15 @@ void PairAmoebaGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -976,15 +976,15 @@ void PairAmoebaGPU::ufield0c(double **field, double **fieldp) auto field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -993,15 +993,15 @@ void PairAmoebaGPU::ufield0c(double **field, double **fieldp) auto field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -2029,9 +2029,9 @@ void PairAmoebaGPU::compute_force_from_torque(const numtyp* tq_ptr, int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - _tq[0] = tq_ptr[4*i]; - _tq[1] = tq_ptr[4*i+1]; - _tq[2] = tq_ptr[4*i+2]; + _tq[0] = tq_ptr[3*i]; + _tq[1] = tq_ptr[3*i+1]; + _tq[2] = tq_ptr[3*i+2]; torque2force(i,_tq,fix,fiy,fiz,force_comp); iz = zaxis2local[i]; diff --git a/src/GPU/pair_hippo_gpu.cpp b/src/GPU/pair_hippo_gpu.cpp index f87676ec08..256b4088d8 100644 --- a/src/GPU/pair_hippo_gpu.cpp +++ b/src/GPU/pair_hippo_gpu.cpp @@ -859,15 +859,15 @@ void PairHippoGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -877,15 +877,15 @@ void PairHippoGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -1087,15 +1087,15 @@ void PairHippoGPU::ufield0c(double **field, double **fieldp) auto *field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -1105,15 +1105,15 @@ void PairHippoGPU::ufield0c(double **field, double **fieldp) auto *field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -1456,9 +1456,9 @@ void PairHippoGPU::compute_force_from_torque(const numtyp* tq_ptr, int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - _tq[0] = tq_ptr[4*i]; - _tq[1] = tq_ptr[4*i+1]; - _tq[2] = tq_ptr[4*i+2]; + _tq[0] = tq_ptr[3*i]; + _tq[1] = tq_ptr[3*i+1]; + _tq[2] = tq_ptr[3*i+2]; torque2force(i,_tq,fix,fiy,fiz,force_comp); iz = zaxis2local[i]; diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index a9c110a2e7..d0d7a73ce6 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -1,4 +1,3 @@ -// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,39 +25,37 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum {NONE, CONSTANT, TYPE}; +enum { NONE, CONSTANT, TYPE }; /* ---------------------------------------------------------------------- */ -FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg < 4) error->all(FLERR,"Illegal fix command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "fix heat/flow", error); cp_style = NONE; comm_forward = 1; comm_reverse = 1; int ntypes = atom->ntypes; - if (strcmp(arg[3],"constant") == 0) { - if (narg != 5) error->all(FLERR,"Illegal fix command"); + if (strcmp(arg[3], "constant") == 0) { + if (narg != 5) error->all(FLERR, "Illegal fix heat/flow constant command"); cp_style = CONSTANT; - cp = utils::numeric(FLERR,arg[4],false,lmp); - if (cp < 0.0) error->all(FLERR,"Illegal fix command"); - } else if (strcmp(arg[3],"type") == 0) { - if (narg != 4 + ntypes) error->all(FLERR,"Illegal fix command"); + cp = utils::numeric(FLERR, arg[4], false, lmp); + if (cp < 0.0) error->all(FLERR, "Illegal fix heat/flow constant command value"); + } else if (strcmp(arg[3], "type") == 0) { + if (narg != 4 + ntypes) error->all(FLERR, "Illegal fix heat/flow type command"); cp_style = TYPE; - memory->create(cp_type,ntypes+1,"fix/temp/integrate:cp_type"); + memory->create(cp_type, ntypes + 1, "fix_heat_flow:cp_type"); for (int i = 1; i <= ntypes; i++) { - cp_type[i] = utils::numeric(FLERR,arg[3+i],false,lmp); - if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + cp_type[i] = utils::numeric(FLERR, arg[3 + i], false, lmp); + if (cp_type[i] < 0.0) error->all(FLERR, "Illegal fix heat/flow type command value"); } } else { - error->all(FLERR,"Illegal fix command"); + error->all(FLERR, "Unknown fix heat/flow keyword {}", arg[3]); } - if (cp_style == NONE) - error->all(FLERR, "Must specify specific heat in fix temp/integrate"); + if (cp_style == NONE) error->all(FLERR, "Must specify specific heat in fix heat/flow"); dynamic_group_allow = 1; } @@ -80,32 +77,24 @@ void FixHeatFlow::init() dt = update->dt; if (!atom->temperature_flag) - error->all(FLERR,"Fix temp/integrate requires atom style with temperature property"); + error->all(FLERR, "Fix heat/flow requires atom style with temperature property"); if (!atom->heatflow_flag) - error->all(FLERR,"Fix temp/integrate requires atom style with heatflow property"); -} - -/* ---------------------------------------------------------------------- */ - -void FixHeatFlow::setup(int /*vflag*/) -{ - // Identify whether this is the first instance of fix heat/flow - first_flag = 0; - - int i = 0; - auto fixlist = modify->get_fix_by_style("heat/flow"); - for (const auto &ifix : fixlist) { - if (strcmp(ifix->id, id) == 0) break; - i++; - } - - if (i == 0) first_flag = 1; + error->all(FLERR, "Fix heat/flow requires atom style with heatflow property"); } /* ---------------------------------------------------------------------- */ void FixHeatFlow::setup_pre_force(int /*vflag*/) { + // Identify whether this is the first instance of fix heat/flow + first_flag = 0; + int i = 0; + auto fixlist = modify->get_fix_by_style("heat/flow"); + for (const auto &ifix : fixlist) { + if (strcmp(ifix->id, id) == 0) break; + i++; + } + if (i == 0) first_flag = 1; pre_force(0); } @@ -138,19 +127,14 @@ void FixHeatFlow::final_integrate() if (igroup == atom->firstgroup) nlocal = atom->nfirst; // add ghost contributions to heatflow if first instance of fix - if (first_flag) - comm->reverse_comm(this); + if (first_flag) comm->reverse_comm(this); if (rmass) { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - temperature[i] += dt * heatflow[i] / (calc_cp(i) * rmass[i]); - } + if (mask[i] & groupbit) temperature[i] += dt * heatflow[i] / (calc_cp(i) * rmass[i]); } else { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); - } + if (mask[i] & groupbit) temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); } } @@ -219,9 +203,7 @@ int FixHeatFlow::pack_reverse_comm(int n, int first, double *buf) int last = first + n; double *heatflow = atom->heatflow; - for (int i = first; i < last; i++) { - buf[m++] = heatflow[i]; - } + for (int i = first; i < last; i++) { buf[m++] = heatflow[i]; } return m; } @@ -233,6 +215,5 @@ void FixHeatFlow::unpack_reverse_comm(int n, int *list, double *buf) int m = 0; double *heatflow = atom->heatflow; - for (int i = 0; i < n; i++) - heatflow[list[i]] += buf[m++]; + for (int i = 0; i < n; i++) heatflow[list[i]] += buf[m++]; } diff --git a/src/GRANULAR/fix_heat_flow.h b/src/GRANULAR/fix_heat_flow.h index 5a06eed4d3..89fabc5a4d 100644 --- a/src/GRANULAR/fix_heat_flow.h +++ b/src/GRANULAR/fix_heat_flow.h @@ -30,7 +30,6 @@ class FixHeatFlow : public Fix { int setmask() override; void init() override; - void setup(int) override; void setup_pre_force(int) override; void pre_force(int) override; void final_integrate() override; diff --git a/src/GRANULAR/gran_sub_mod_heat.cpp b/src/GRANULAR/gran_sub_mod_heat.cpp index 75dcd30b73..5378a72fd4 100644 --- a/src/GRANULAR/gran_sub_mod_heat.cpp +++ b/src/GRANULAR/gran_sub_mod_heat.cpp @@ -41,6 +41,34 @@ double GranSubModHeatNone::calculate_heat() return 0.0; } +/* ---------------------------------------------------------------------- + Radius-based heat conduction +------------------------------------------------------------------------- */ + +GranSubModHeatRadius::GranSubModHeatRadius(GranularModel *gm, LAMMPS *lmp) : GranSubModHeat(gm, lmp) +{ + num_coeffs = 1; + contact_radius_flag = 1; + conductivity = 0.0; +} + +/* ---------------------------------------------------------------------- */ + +void GranSubModHeatRadius::coeffs_to_local() +{ + conductivity = coeffs[0]; + + if (conductivity < 0.0) error->all(FLERR, "Illegal radius heat model"); +} + +/* ---------------------------------------------------------------------- */ + +double GranSubModHeatRadius::calculate_heat() +{ + return 2 * conductivity * gm->contact_radius * (gm->Tj - gm->Ti); +} + + /* ---------------------------------------------------------------------- Area-based heat conduction ------------------------------------------------------------------------- */ @@ -49,20 +77,21 @@ GranSubModHeatArea::GranSubModHeatArea(GranularModel *gm, LAMMPS *lmp) : GranSub { num_coeffs = 1; contact_radius_flag = 1; + heat_transfer_coeff = 0.0; } /* ---------------------------------------------------------------------- */ void GranSubModHeatArea::coeffs_to_local() { - conductivity = coeffs[0]; + heat_transfer_coeff = coeffs[0]; - if (conductivity < 0.0) error->all(FLERR, "Illegal area heat model"); + if (heat_transfer_coeff < 0.0) error->all(FLERR, "Illegal area heat model"); } /* ---------------------------------------------------------------------- */ double GranSubModHeatArea::calculate_heat() { - return conductivity * MY_PI * gm->contact_radius * gm->contact_radius * (gm->Tj - gm->Ti); + return heat_transfer_coeff * MY_PI * gm->contact_radius * gm->contact_radius * (gm->Tj - gm->Ti); } diff --git a/src/GRANULAR/gran_sub_mod_heat.h b/src/GRANULAR/gran_sub_mod_heat.h index 8e5dc2693d..5f264cb913 100644 --- a/src/GRANULAR/gran_sub_mod_heat.h +++ b/src/GRANULAR/gran_sub_mod_heat.h @@ -14,6 +14,7 @@ #ifdef GRAN_SUB_MOD_CLASS // clang-format off GranSubModStyle(none,GranSubModHeatNone,HEAT); +GranSubModStyle(radius,GranSubModHeatRadius,HEAT); GranSubModStyle(area,GranSubModHeatArea,HEAT); // clang-format on #else @@ -42,9 +43,9 @@ namespace Granular_NS { /* ---------------------------------------------------------------------- */ - class GranSubModHeatArea : public GranSubModHeat { + class GranSubModHeatRadius : public GranSubModHeat { public: - GranSubModHeatArea(class GranularModel *, class LAMMPS *); + GranSubModHeatRadius(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; double calculate_heat() override; @@ -52,6 +53,18 @@ namespace Granular_NS { double conductivity; }; + /* ---------------------------------------------------------------------- */ + + class GranSubModHeatArea : public GranSubModHeat { + public: + GranSubModHeatArea(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + double calculate_heat() override; + + protected: + double heat_transfer_coeff; + }; + } // namespace Granular_NS } // namespace LAMMPS_NS diff --git a/src/GRANULAR/gran_sub_mod_normal.cpp b/src/GRANULAR/gran_sub_mod_normal.cpp index fcd9cdd27f..ffc18b8c32 100644 --- a/src/GRANULAR/gran_sub_mod_normal.cpp +++ b/src/GRANULAR/gran_sub_mod_normal.cpp @@ -150,6 +150,7 @@ GranSubModNormalHertzMaterial::GranSubModNormalHertzMaterial(GranularModel *gm, material_properties = 1; num_coeffs = 3; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -159,10 +160,12 @@ void GranSubModNormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - if (gm->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); @@ -175,6 +178,10 @@ void GranSubModNormalHertzMaterial::mix_coeffs(double *icoeffs, double *jcoeffs) coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0], icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + + k = FOURTHIRDS * coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } @@ -188,6 +195,7 @@ GranSubModNormalDMT::GranSubModNormalDMT(GranularModel *gm, LAMMPS *lmp) : GranS cohesive_flag = 1; num_coeffs = 4; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -198,10 +206,13 @@ void GranSubModNormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - if (gm->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); @@ -215,6 +226,10 @@ void GranSubModNormalDMT::mix_coeffs(double *icoeffs, double *jcoeffs) coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + + k = FOURTHIRDS * coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } @@ -246,6 +261,7 @@ GranSubModNormalJKR::GranSubModNormalJKR(GranularModel *gm, LAMMPS *lmp) : GranS beyond_contact = 1; num_coeffs = 4; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -257,10 +273,12 @@ void GranSubModNormalJKR::coeffs_to_local() poiss = coeffs[2]; cohesion = coeffs[3]; - if (gm->contact_type == PAIR) { - Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - Emix = mix_stiffnessE_wall(Emod, poiss); + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + Emix = mix_stiffnessE_wall(Emod, poiss); + } } k = FOURTHIRDS * Emix; @@ -276,6 +294,10 @@ void GranSubModNormalJKR::mix_coeffs(double *icoeffs, double *jcoeffs) coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + + Emix = coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } diff --git a/src/GRANULAR/gran_sub_mod_normal.h b/src/GRANULAR/gran_sub_mod_normal.h index 7fb4a259e0..6f2f3aabbe 100644 --- a/src/GRANULAR/gran_sub_mod_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -29,6 +29,7 @@ GranSubModStyle(jkr,GranSubModNormalJKR,NORMAL); namespace LAMMPS_NS { namespace Granular_NS { + class GranSubModNormal : public GranSubMod { public: GranSubModNormal(class GranularModel *, class LAMMPS *); @@ -92,6 +93,8 @@ namespace Granular_NS { GranSubModNormalHertzMaterial(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double *, double *) override; + private: + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -107,6 +110,7 @@ namespace Granular_NS { protected: double k, cohesion; double F_pulloff, Fne; + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -125,6 +129,7 @@ namespace Granular_NS { protected: double k, cohesion; double Emix, F_pulloff, Fne; + int mixed_coefficients; }; } // namespace Granular_NS diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 0b6bd537e5..30f272791e 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -767,10 +767,10 @@ double PairGranular::single(int i, int j, int itype, int jtype, model->history = history; model->calculate_forces(); - double *forces = model->forces; // apply forces & torques - fforce = MathExtra::len3(forces); + // Calculate normal component, normalized by r + fforce = model->Fnormal * model->rinv; // set single_extra quantities svector[0] = model->fs[0]; diff --git a/src/INTEL/TEST/run_benchmarks.sh b/src/INTEL/TEST/run_benchmarks.sh index 01ddfbebf3..82eb51c928 100755 --- a/src/INTEL/TEST/run_benchmarks.sh +++ b/src/INTEL/TEST/run_benchmarks.sh @@ -7,12 +7,10 @@ # --------------------- MPI Launch Command export MPI="mpirun" -#export MPI="numactl -p 1 mpirun" # -- Systems w/ MCDRAM in flat mode # ------------- Name and location of the LAMMPS binary export LMP_BIN=../../lmp_intel_cpu_intelmpi -#export LMP_BIN=../../lmp_knl # ------------- Directory containing the LAMMPS installation @@ -20,21 +18,18 @@ export LMP_ROOT=../../../ # ------------- Number of physical cores (not HW threads) -export LMP_CORES=36 # -- For Intel Xeon E5-2697v4 SKU -#export LMP_CORES=68 # -- For Intel Xeon Phi x200 7250 SKU +export LMP_CORES=36 +# Set automatically with lscpu +export LMP_CORES=`lscpu | awk '$1=="Core(s)"{t=NF; cores=$t}$1=="Socket(s):"{t=NF; sockets=$t}END{print cores*sockets}'` # ------------- Number of HW threads to use in tests -export LMP_THREAD_LIST="2" # -- For 2 threads per core w/ HT enabled -#export LMP_THREAD_LIST="2 4" # -- For 2 threads per core w/ HT enabled +export LMP_THREAD_LIST="1 2" # -- Also test 2 threads per core w/ HT enabled # ------------- MPI Tuning Parameters -#export I_MPI_SHM_LMT=shm # -- Uncomment for Xeon Phi x200 series - -# ------------- Library locations for build - -#source /opt/intel/parallel_studio_xe_2017.2.050/psxevars.sh +export I_MPI_FABRICS=shm +export I_MPI_PIN_DOMAIN=core ######################################################################### # End settings for your system @@ -50,8 +45,6 @@ export DATE_STRING=`date +%s` export LOG_DIR=$LOG_DIR_HOST"_"$LOG_DIR_HEADER"_"$DATE_STRING mkdir $LOG_DIR -export I_MPI_PIN_DOMAIN=core -#export I_MPI_FABRICS=shm export KMP_BLOCKTIME=0 echo -n "Creating restart file...." @@ -73,6 +66,9 @@ do export LOGFILE=$LOG_DIR/$workload"_lrt".$LMP_CORES"c"$threads"t".log cmd="$MPI -np $LMP_CORES $LMP_BIN -in in.intel.$workload -log $LOGFILE $RLMP_ARGS"; rthreads=$((threads-1)) + if [ $rthreads -lt 1 ]; then + rthreads=1 + fi export KMP_AFFINITY=none export OMP_NUM_THREADS=$rthreads echo " $cmd" >> $LOG_DIR/commands.info @@ -82,4 +78,5 @@ do done # Performance reported by LAMMPS (Timesteps/second ignoring warm-up run) -grep Perf $LOG_DIR/*.log | awk 'BEGIN{n=1}n%2==0{print $0}{n++}' | sed 's/\/day//g' | sed 's/steps\/s/steps_s/g' | sed 's/hours\/ns//g' | sed 's/.*\///g' | sed 's/\.log:Performance://g' | awk '{c=NF-1; print $1,$c}' +grep Perf $LOG_DIR/*.log | awk 'n%2==1{c=NF-3; print $1,$c}{n++}' | sed -e 's/.*\///g' -e 's/:.*://g' + diff --git a/src/INTEL/angle_charmm_intel.cpp b/src/INTEL/angle_charmm_intel.cpp index 1ea9c8348e..e13448e28a 100644 --- a/src/INTEL/angle_charmm_intel.cpp +++ b/src/INTEL/angle_charmm_intel.cpp @@ -178,7 +178,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delz1 = x[i1].z - x[i2].z; const flt_t rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - flt_t ir12 = (flt_t)1.0/sqrt(rsq1); + flt_t ir12 = (flt_t)1.0/std::sqrt(rsq1); // 2nd bond @@ -187,7 +187,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delz2 = x[i3].z - x[i2].z; const flt_t rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - ir12 *= (flt_t)1.0/sqrt(rsq2); + ir12 *= (flt_t)1.0/std::sqrt(rsq2); // Urey-Bradley bond @@ -196,7 +196,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delzUB = x[i3].z - x[i1].z; const flt_t rsqUB = delxUB*delxUB + delyUB*delyUB + delzUB*delzUB; - const flt_t irUB = (flt_t)1.0/sqrt(rsqUB); + const flt_t irUB = (flt_t)1.0/std::sqrt(rsqUB); // Urey-Bradley force & energy @@ -219,12 +219,12 @@ void AngleCharmmIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0 / sqrt(sd); + flt_t s = (flt_t)1.0 / std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // harmonic force & energy - const flt_t dtheta = acos(c) - fc.fc[type].theta0; + const flt_t dtheta = std::acos(c) - fc.fc[type].theta0; const flt_t tk = fc.fc[type].k * dtheta; if (EFLAG) eangle += tk*dtheta; diff --git a/src/INTEL/angle_harmonic_intel.cpp b/src/INTEL/angle_harmonic_intel.cpp index 8cdab1d43a..98125b164b 100644 --- a/src/INTEL/angle_harmonic_intel.cpp +++ b/src/INTEL/angle_harmonic_intel.cpp @@ -178,7 +178,7 @@ void AngleHarmonicIntel::eval(const int vflag, const flt_t delz1 = x[i1].z - x[i2].z; const flt_t rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - const flt_t r1 = (flt_t)1.0/sqrt(rsq1); + const flt_t r1 = (flt_t)1.0/std::sqrt(rsq1); // 2nd bond @@ -187,7 +187,7 @@ void AngleHarmonicIntel::eval(const int vflag, const flt_t delz2 = x[i3].z - x[i2].z; const flt_t rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - const flt_t r2 = (flt_t)1.0/sqrt(rsq2); + const flt_t r2 = (flt_t)1.0/std::sqrt(rsq2); // angle (cos and sin) @@ -199,12 +199,12 @@ void AngleHarmonicIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0/sqrt(sd); + flt_t s = (flt_t)1.0/std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // harmonic force & energy - const flt_t dtheta = acos(c) - fc.fc[type].theta0; + const flt_t dtheta = std::acos(c) - fc.fc[type].theta0; const flt_t tk = fc.fc[type].k * dtheta; flt_t eangle; diff --git a/src/INTEL/bond_harmonic_intel.cpp b/src/INTEL/bond_harmonic_intel.cpp index a60050bb6b..ab38cefea4 100644 --- a/src/INTEL/bond_harmonic_intel.cpp +++ b/src/INTEL/bond_harmonic_intel.cpp @@ -168,7 +168,7 @@ void BondHarmonicIntel::eval(const int vflag, const flt_t delz = x[i1].z - x[i2].z; const flt_t rsq = delx*delx + dely*dely + delz*delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t dr = r - fc.fc[type].r0; const flt_t rk = fc.fc[type].k * dr; diff --git a/src/INTEL/dihedral_charmm_intel.cpp b/src/INTEL/dihedral_charmm_intel.cpp index 6c3ae2c927..a41cfb867c 100644 --- a/src/INTEL/dihedral_charmm_intel.cpp +++ b/src/INTEL/dihedral_charmm_intel.cpp @@ -240,14 +240,14 @@ void DihedralCharmmIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); @@ -367,7 +367,7 @@ void DihedralCharmmIntel::eval(const int vflag, flt_t forcecoul; if (implicit) forcecoul = qqrd2e * q[i1]*q[i4]*r2inv; - else forcecoul = qqrd2e * q[i1]*q[i4]*sqrt(r2inv); + else forcecoul = qqrd2e * q[i1]*q[i4]*std::sqrt(r2inv); const flt_t forcelj = r6inv * (fc.ljp[itype][jtype].lj1*r6inv - fc.ljp[itype][jtype].lj2); const flt_t fpair = tweight * (forcelj+forcecoul)*r2inv; diff --git a/src/INTEL/dihedral_fourier_intel.cpp b/src/INTEL/dihedral_fourier_intel.cpp index 5448fdae98..595d747839 100644 --- a/src/INTEL/dihedral_fourier_intel.cpp +++ b/src/INTEL/dihedral_fourier_intel.cpp @@ -199,14 +199,14 @@ void DihedralFourierIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); diff --git a/src/INTEL/dihedral_harmonic_intel.cpp b/src/INTEL/dihedral_harmonic_intel.cpp index 8d91a3fd27..138545d94a 100644 --- a/src/INTEL/dihedral_harmonic_intel.cpp +++ b/src/INTEL/dihedral_harmonic_intel.cpp @@ -199,14 +199,14 @@ void DihedralHarmonicIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); diff --git a/src/INTEL/dihedral_opls_intel.cpp b/src/INTEL/dihedral_opls_intel.cpp index 82151a8585..52763e6bd8 100644 --- a/src/INTEL/dihedral_opls_intel.cpp +++ b/src/INTEL/dihedral_opls_intel.cpp @@ -195,15 +195,15 @@ void DihedralOPLSIntel::eval(const int vflag, // 1st and 2nd angle const flt_t b1mag2 = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z; - const flt_t rb1 = (flt_t)1.0 / sqrt(b1mag2); + const flt_t rb1 = (flt_t)1.0 / std::sqrt(b1mag2); const flt_t sb1 = (flt_t)1.0 / b1mag2; const flt_t b2mag2 = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rb2 = (flt_t)1.0 / sqrt(b2mag2); + const flt_t rb2 = (flt_t)1.0 / std::sqrt(b2mag2); const flt_t sb2 = (flt_t)1.0 / b2mag2; const flt_t b3mag2 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t rb3 = (flt_t)1.0 / sqrt(b3mag2); + const flt_t rb3 = (flt_t)1.0 / std::sqrt(b3mag2); const flt_t sb3 = (flt_t)1.0 / b3mag2; const flt_t c0 = (vb1x*vb3x + vb1y*vb3y + vb1z*vb3z) * rb1*rb3; @@ -219,11 +219,11 @@ void DihedralOPLSIntel::eval(const int vflag, // cos and sin of 2 angles and final c flt_t sin2 = MAX((flt_t)1.0 - c1mag*c1mag,(flt_t)0.0); - flt_t sc1 = (flt_t)1.0/sqrt(sin2); + flt_t sc1 = (flt_t)1.0/std::sqrt(sin2); if (sin2 < SMALL2) sc1 = INVSMALL; sin2 = MAX((flt_t)1.0 - c2mag*c2mag,(flt_t)0.0); - flt_t sc2 = (flt_t)1.0/sqrt(sin2); + flt_t sc2 = (flt_t)1.0/std::sqrt(sin2); if (sin2 < SMALL2) sc2 = INVSMALL; const flt_t s1 = sc1 * sc1; @@ -234,7 +234,7 @@ void DihedralOPLSIntel::eval(const int vflag, const flt_t cx = vb1z*vb2ym - vb1y*vb2zm; const flt_t cy = vb1x*vb2zm - vb1z*vb2xm; const flt_t cz = vb1y*vb2xm - vb1x*vb2ym; - const flt_t cmag = (flt_t)1.0/sqrt(cx*cx + cy*cy + cz*cz); + const flt_t cmag = (flt_t)1.0/std::sqrt(cx*cx + cy*cy + cz*cz); const flt_t dx = (cx*vb3x + cy*vb3y + cz*vb3z)*cmag*rb3; // error check @@ -252,7 +252,7 @@ void DihedralOPLSIntel::eval(const int vflag, const flt_t cossq = c * c; const flt_t sinsq = (flt_t)1.0 - cossq; - flt_t siinv = (flt_t)1.0/sqrt(sinsq); + flt_t siinv = (flt_t)1.0/std::sqrt(sinsq); if (sinsq < SMALLER2 ) siinv = INVSMALLER; if (dx < (flt_t)0.0) siinv = -siinv; diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 1ce0b41338..0a3d27a978 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -61,6 +61,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _hybrid_nonpair = 0; _print_pkg_info = 1; _nthreads = comm->nthreads; + _torque_flag = 0; _precision_mode = PREC_MODE_MIXED; _offload_balance = -1.0; @@ -95,6 +96,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _allow_separate_buffers = 1; _offload_ghost = -1; _lrt = 0; + _p3m_table = 1; int iarg = 4; while (iarg < narg) { @@ -135,11 +137,14 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); _lrt = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; - } + } else if (strcmp(arg[iarg], "pppm_table") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); + _p3m_table = utils::logical(FLERR,arg[iarg+1],false,lmp); + iarg += 2; // undocumented options - else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) { + } else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) { _offload_affinity_balanced = 1; iarg++; } else if (strcmp(arg[iarg],"buffers") == 0) { @@ -275,10 +280,8 @@ int FixIntel::setmask() int mask = 0; mask |= PRE_REVERSE; mask |= MIN_PRE_REVERSE; - #ifdef _LMP_INTEL_OFFLOAD mask |= POST_FORCE; mask |= MIN_POST_FORCE; - #endif mask |= POST_RUN; return mask; } @@ -299,14 +302,30 @@ void FixIntel::init() } #endif + _torque_flag = 0; + if (force->pair_match("gayberne/intel$", 0)) _torque_flag = 1; + const int nstyles = _pair_intel_count; - if (force->pair_match("^hybrid", 0) != nullptr) { + if (force->pair_match("^hybrid", 0)) { _pair_hybrid_flag = 1; + + // Check if need to handle torque + auto hybrid = dynamic_cast(force->pair); + if (hybrid) { + for (int i = 0; i < hybrid->nstyles; i++) + if (utils::strmatch(hybrid->keywords[i],"/intel$") && + utils::strmatch(hybrid->keywords[i],"gayberne")) + _torque_flag = 1; + } if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR,"INTEL package requires fdotr virial with newton on."); } else _pair_hybrid_flag = 0; + if (_torque_flag && nstyles > 1) + error->all(FLERR,"gayberne/intel style cannot yet be used with other " + "intel pair styles."); + if (nstyles > 1 && _pair_hybrid_flag) _pair_hybrid_flag = 2; else if (force->newton_pair == 0) _pair_hybrid_flag = 0; @@ -333,14 +352,17 @@ void FixIntel::init() int off_mode = 0; if (_offload_balance != 0.0) off_mode = 1; if (_precision_mode == PREC_MODE_SINGLE) { + _single_buffers->set_torque_flag(_torque_flag); _single_buffers->zero_ev(); _single_buffers->grow_ncache(off_mode, comm->nthreads); _single_buffers->free_list_ptrs(); } else if (_precision_mode == PREC_MODE_MIXED) { + _mixed_buffers->set_torque_flag(_torque_flag); _mixed_buffers->zero_ev(); _mixed_buffers->grow_ncache(off_mode, comm->nthreads); _mixed_buffers->free_list_ptrs(); } else { + _double_buffers->set_torque_flag(_torque_flag); _double_buffers->zero_ev(); _double_buffers->grow_ncache(off_mode, comm->nthreads); _double_buffers->free_list_ptrs(); @@ -390,7 +412,7 @@ bool FixIntel::pair_hybrid_check() void FixIntel::pair_init_check(const bool cdmessage) { #ifdef INTEL_VMASK - atom->sortfreq = 1; + if (atom->sortfreq) atom->sortfreq = 1; #endif _nbor_pack_width = 1; @@ -408,7 +430,7 @@ void FixIntel::pair_init_check(const bool cdmessage) double *time1 = off_watch_pair(); double *time2 = off_watch_neighbor(); int *overflow = get_off_overflow_flag(); - if (_offload_balance !=0.0) { + if (_offload_balance != 0.0) { #pragma offload_transfer target(mic:_cop) \ nocopy(time1,time2:length(1) alloc_if(1) free_if(0)) \ in(overflow:length(5) alloc_if(1) free_if(0)) @@ -597,6 +619,19 @@ void FixIntel::pre_reverse(int /*eflag*/, int /*vflag*/) /* ---------------------------------------------------------------------- */ +void FixIntel::post_force(int vflag) +{ + // Redundant call to sync Intel data structs with native for methods that + // call force compute but do not call prereverse + _sync_main_arrays(1); + + #ifdef LMP_INTEL_OFFLOAD + if (_sync_mode == 2) sync_coprocessor(); + #endif +} + +/* ---------------------------------------------------------------------- */ + template void FixIntel::reduce_results(acc_t * _noalias const f_scalar) { @@ -605,7 +640,7 @@ void FixIntel::reduce_results(acc_t * _noalias const f_scalar) o_range = atom->nlocal + atom->nghost; else o_range = atom->nlocal; - IP_PRE_get_stride(f_stride, o_range, (sizeof(acc_t)*4), lmp->atom->torque); + IP_PRE_get_stride(f_stride, o_range, (sizeof(acc_t)*4), _torque_flag); o_range *= 4; const int f_stride4 = f_stride * 4; @@ -704,7 +739,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, add_oresults(f_in, ev_global, eatom, vatom, 0, _offload_nlocal); const acc_t * _noalias const enull = 0; int offset = _offload_nlocal; - if (atom->torque) offset *= 2; + if (_torque_flag) offset *= 2; add_oresults(f_in + offset, enull, eatom, vatom, _offload_min_ghost, _offload_nghost); } else @@ -715,7 +750,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, _host_min_local, _host_used_local); const acc_t * _noalias const enull = 0; int offset = _host_used_local; - if (atom->torque) offset *= 2; + if (_torque_flag) offset *= 2; add_oresults(f_in + offset, enull, eatom, vatom, _host_min_ghost, _host_used_ghost); } else { @@ -764,7 +799,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, const int eatom, const int /*vatom*/, const int out_offset, const int nall) { lmp_ft * _noalias const f = (lmp_ft *) lmp->atom->f[0] + out_offset; - if (atom->torque) { + if (_torque_flag) { if (f_in[1].w) { if (f_in[1].w == 1) @@ -788,7 +823,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, #endif int ifrom, ito; IP_PRE_omp_range_align(ifrom, ito, tid, nall, packthreads, sizeof(acc_t)); - if (atom->torque) { + if (_torque_flag) { int ii = ifrom * 2; lmp_ft * _noalias const tor = (lmp_ft *) lmp->atom->torque[0] + out_offset; @@ -883,13 +918,6 @@ double FixIntel::memory_usage() /* ---------------------------------------------------------------------- */ -void FixIntel::post_force(int vflag) -{ - if (_sync_mode == 2) sync_coprocessor(); -} - -/* ---------------------------------------------------------------------- */ - template void FixIntel::add_off_results(const ft * _noalias const f_in, const acc_t * _noalias const ev_global) { @@ -919,7 +947,7 @@ void FixIntel::add_off_results(const ft * _noalias const f_in, _offload_nlocal; } - if (atom->torque) + if (_torque_flag) if (f_in[1].w < 0.0) error->all(FLERR,"Bad matrix inversion in mldivide3"); add_results(f_in, ev_global, _off_results_eatom, _off_results_vatom, 1); diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 9214fe3419..08d0a534d9 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -55,6 +55,7 @@ class FixIntel : public Fix { 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_force(int vflag) override; void post_run() override { _print_pkg_info = 1; } // Get all forces, calculation results from coprocesser @@ -102,7 +103,7 @@ class FixIntel : public Fix { inline int pppm_table() { if (force->kspace_match("^pppm/.*intel$", 0)) - return INTEL_P3M_TABLE; + return _p3m_table; else return 0; } @@ -115,7 +116,7 @@ class FixIntel : public Fix { int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor; int _pair_intel_count, _pair_hybrid_flag, _print_pkg_info; // These should be removed in subsequent update w/ simpler hybrid arch - int _pair_hybrid_zero, _hybrid_nonpair, _zero_master; + int _pair_hybrid_zero, _hybrid_nonpair, _zero_master, _torque_flag; public: inline int *get_overflow_flag() { return _overflow_flag; } @@ -132,7 +133,6 @@ class FixIntel : public Fix { inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal); #ifdef _LMP_INTEL_OFFLOAD - void post_force(int vflag); inline int coprocessor_number() { return _cop; } inline int full_host_list() { return _full_host_list; } void set_offload_affinity(); @@ -194,7 +194,7 @@ class FixIntel : public Fix { protected: int _overflow_flag[5]; _alignvar(int _off_overflow_flag[5], 64); - int _allow_separate_buffers, _offload_ghost, _lrt; + int _allow_separate_buffers, _offload_ghost, _lrt, _p3m_table; IntelBuffers::vec3_acc_t *_force_array_s; IntelBuffers::vec3_acc_t *_force_array_m; diff --git a/src/INTEL/fix_nh_intel.cpp b/src/INTEL/fix_nh_intel.cpp index 87ce0dbe43..2c05c3f6fa 100644 --- a/src/INTEL/fix_nh_intel.cpp +++ b/src/INTEL/fix_nh_intel.cpp @@ -166,28 +166,28 @@ void FixNHIntel::remap() if (pstyle == TRICLINIC) { if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; } if (p_flag[3]) { - expfac = exp(dto4*omega_dot[1]); + expfac = std::exp(dto4*omega_dot[1]); h[3] *= expfac; h[3] += dto2*(omega_dot[3]*h[2]); h[3] *= expfac; } if (p_flag[5]) { - expfac = exp(dto4*omega_dot[0]); + expfac = std::exp(dto4*omega_dot[0]); h[5] *= expfac; h[5] += dto2*(omega_dot[5]*h[1]); h[5] *= expfac; } if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; @@ -200,7 +200,7 @@ void FixNHIntel::remap() if (p_flag[0]) { oldlo = domain->boxlo[0]; oldhi = domain->boxhi[0]; - expfac = exp(dto*omega_dot[0]); + expfac = std::exp(dto*omega_dot[0]); domain->boxlo[0] = (oldlo-fixedpoint[0])*expfac + fixedpoint[0]; domain->boxhi[0] = (oldhi-fixedpoint[0])*expfac + fixedpoint[0]; } @@ -208,7 +208,7 @@ void FixNHIntel::remap() if (p_flag[1]) { oldlo = domain->boxlo[1]; oldhi = domain->boxhi[1]; - expfac = exp(dto*omega_dot[1]); + expfac = std::exp(dto*omega_dot[1]); domain->boxlo[1] = (oldlo-fixedpoint[1])*expfac + fixedpoint[1]; domain->boxhi[1] = (oldhi-fixedpoint[1])*expfac + fixedpoint[1]; if (scalexy) h[5] *= expfac; @@ -217,7 +217,7 @@ void FixNHIntel::remap() if (p_flag[2]) { oldlo = domain->boxlo[2]; oldhi = domain->boxhi[2]; - expfac = exp(dto*omega_dot[2]); + expfac = std::exp(dto*omega_dot[2]); domain->boxlo[2] = (oldlo-fixedpoint[2])*expfac + fixedpoint[2]; domain->boxhi[2] = (oldhi-fixedpoint[2])*expfac + fixedpoint[2]; if (scalexz) h[4] *= expfac; @@ -229,28 +229,28 @@ void FixNHIntel::remap() if (pstyle == TRICLINIC) { if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; } if (p_flag[3]) { - expfac = exp(dto4*omega_dot[1]); + expfac = std::exp(dto4*omega_dot[1]); h[3] *= expfac; h[3] += dto2*(omega_dot[3]*h[2]); h[3] *= expfac; } if (p_flag[5]) { - expfac = exp(dto4*omega_dot[0]); + expfac = std::exp(dto4*omega_dot[0]); h[5] *= expfac; h[5] += dto2*(omega_dot[5]*h[1]); h[5] *= expfac; } if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; @@ -427,9 +427,9 @@ void FixNHIntel::nh_v_press() int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; - double f0 = exp(-dt4*(omega_dot[0]+mtk_term2)); - double f1 = exp(-dt4*(omega_dot[1]+mtk_term2)); - double f2 = exp(-dt4*(omega_dot[2]+mtk_term2)); + double f0 = std::exp(-dt4*(omega_dot[0]+mtk_term2)); + double f1 = std::exp(-dt4*(omega_dot[1]+mtk_term2)); + double f2 = std::exp(-dt4*(omega_dot[2]+mtk_term2)); f0 *= f0; f1 *= f1; f2 *= f2; diff --git a/src/INTEL/improper_cvff_intel.cpp b/src/INTEL/improper_cvff_intel.cpp index 09b2d42167..a503f45541 100644 --- a/src/INTEL/improper_cvff_intel.cpp +++ b/src/INTEL/improper_cvff_intel.cpp @@ -191,15 +191,15 @@ void ImproperCvffIntel::eval(const int vflag, // 1st and 2nd angle const flt_t b1mag2 = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z; - const flt_t rb1 = (flt_t)1.0 / sqrt(b1mag2); + const flt_t rb1 = (flt_t)1.0 / std::sqrt(b1mag2); const flt_t sb1 = (flt_t)1.0 / b1mag2; const flt_t b2mag2 = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rb2 = (flt_t)1.0 / sqrt(b2mag2); + const flt_t rb2 = (flt_t)1.0 / std::sqrt(b2mag2); const flt_t sb2 = (flt_t)1.0 / b2mag2; const flt_t b3mag2 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t rb3 = (flt_t)1.0 / sqrt(b3mag2); + const flt_t rb3 = (flt_t)1.0 / std::sqrt(b3mag2); const flt_t sb3 = (flt_t)1.0 / b3mag2; const flt_t c0 = (vb1x * vb3x + vb1y * vb3y + vb1z * vb3z) * rb1 * rb3; @@ -215,11 +215,11 @@ void ImproperCvffIntel::eval(const int vflag, // cos and sin of 2 angles and final c const flt_t sd1 = (flt_t)1.0 - c1mag * c1mag; - flt_t sc1 = (flt_t)1.0/sqrt(sd1); + flt_t sc1 = (flt_t)1.0/std::sqrt(sd1); if (sd1 < SMALL2) sc1 = INVSMALL; const flt_t sd2 = (flt_t)1.0 - c2mag * c2mag; - flt_t sc2 = (flt_t)1.0/sqrt(sd2); + flt_t sc2 = (flt_t)1.0/std::sqrt(sd2); if (sc2 < SMALL2) sc2 = INVSMALL; const flt_t s1 = sc1 * sc1; diff --git a/src/INTEL/improper_harmonic_intel.cpp b/src/INTEL/improper_harmonic_intel.cpp index a9a152d5f0..869051ab6b 100644 --- a/src/INTEL/improper_harmonic_intel.cpp +++ b/src/INTEL/improper_harmonic_intel.cpp @@ -194,9 +194,9 @@ void ImproperHarmonicIntel::eval(const int vflag, flt_t ss2 = vb2x*vb2x + vb2y*vb2y + vb2z*vb2z; flt_t ss3 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t r1 = (flt_t)1.0 / sqrt(ss1); - const flt_t r2 = (flt_t)1.0 / sqrt(ss2); - const flt_t r3 = (flt_t)1.0 / sqrt(ss3); + const flt_t r1 = (flt_t)1.0 / std::sqrt(ss1); + const flt_t r2 = (flt_t)1.0 / std::sqrt(ss2); + const flt_t r3 = (flt_t)1.0 / std::sqrt(ss3); ss1 = (flt_t)1.0 / ss1; ss2 = (flt_t)1.0 / ss2; @@ -214,7 +214,7 @@ void ImproperHarmonicIntel::eval(const int vflag, flt_t s2 = (flt_t)1.0 - c2*c2; if (s2 < SMALL) s2 = SMALL; - flt_t s12 = (flt_t)1.0 / sqrt(s1*s2); + flt_t s12 = (flt_t)1.0 / std::sqrt(s1*s2); s1 = (flt_t)1.0 / s1; s2 = (flt_t)1.0 / s2; flt_t c = (c1*c2 + c0) * s12; @@ -229,12 +229,12 @@ void ImproperHarmonicIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0 / sqrt(sd); + flt_t s = (flt_t)1.0 / std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // force & energy - const flt_t domega = acos(c) - fc.fc[type].chi; + const flt_t domega = std::acos(c) - fc.fc[type].chi; flt_t a; a = fc.fc[type].k * domega; diff --git a/src/INTEL/intel_buffers.cpp b/src/INTEL/intel_buffers.cpp index bb54577097..6d4c9bffcd 100644 --- a/src/INTEL/intel_buffers.cpp +++ b/src/INTEL/intel_buffers.cpp @@ -28,6 +28,7 @@ template IntelBuffers::IntelBuffers(class LAMMPS *lmp_in) : lmp(lmp_in), _x(nullptr), _q(nullptr), _quat(nullptr), _f(nullptr), _off_threads(0), _n_list_ptrs(1), _max_list_ptrs(4), _buf_size(0), _buf_local_size(0) { + _torque_flag = 0; _neigh_list_ptrs = new IntelNeighListPtrs[_max_list_ptrs]; _neigh_list_ptrs[0].cnumneigh = nullptr; _list_alloc_atoms = 0; @@ -695,7 +696,7 @@ double IntelBuffers::memory_usage(const int nthreads) { double tmem = sizeof(atom_t); if (lmp->atom->q) tmem += sizeof(flt_t); - if (lmp->atom->torque) tmem += sizeof(quat_t); + if (_torque_flag) tmem += sizeof(quat_t); #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) tmem *= 2; #endif diff --git a/src/INTEL/intel_buffers.h b/src/INTEL/intel_buffers.h index 7422850184..1e9739c3b2 100644 --- a/src/INTEL/intel_buffers.h +++ b/src/INTEL/intel_buffers.h @@ -57,7 +57,7 @@ class IntelBuffers { inline int get_stride(int nall) { int stride; IP_PRE_get_stride(stride, nall, sizeof(vec3_acc_t), - lmp->atom->torque); + _torque_flag); return stride; } @@ -76,6 +76,8 @@ class IntelBuffers { _neigh_list_ptrs[0].numneighhalf = atombin; } + inline void set_torque_flag(const int in) { _torque_flag = in; } + inline void grow(const int nall, const int nlocal, const int nthreads, const int offload_end) { if (nall >= _buf_size || nlocal >= _buf_local_size) @@ -329,7 +331,7 @@ class IntelBuffers { flt_t *_q; quat_t *_quat; vec3_acc_t * _f; - int _off_threads, _off_map_listlocal; + int _torque_flag, _off_threads, _off_map_listlocal; int _list_alloc_atoms; int *_list_alloc, *_cnumneigh, *_atombin, *_binpacked; diff --git a/src/INTEL/intel_intrinsics.h b/src/INTEL/intel_intrinsics.h index 1ff405edd2..c106dfd411 100644 --- a/src/INTEL/intel_intrinsics.h +++ b/src/INTEL/intel_intrinsics.h @@ -1764,7 +1764,7 @@ struct vector_ops { return a < b; } static fvec invsqrt(const fvec &a) { - return 1. / sqrt(a); + return 1. / std::sqrt(a); } static fvec sincos(fvec *c, const fvec &a) { *c = cos(a); diff --git a/src/INTEL/intel_preprocess.h b/src/INTEL/intel_preprocess.h index a3c961f436..2c4b9a0c1b 100644 --- a/src/INTEL/intel_preprocess.h +++ b/src/INTEL/intel_preprocess.h @@ -86,8 +86,6 @@ enum {TIME_PACK, TIME_HOST_NEIGHBOR, TIME_HOST_PAIR, TIME_OFFLOAD_NEIGHBOR, #define INTEL_MAX_STENCIL_CHECK 4096 #define INTEL_P3M_MAXORDER 8 #define INTEL_P3M_ALIGNED_MAXORDER 8 -// PRECOMPUTE VALUES IN TABLE (DOESN'T AFFECT ACCURACY) -#define INTEL_P3M_TABLE 1 #ifdef __INTEL_COMPILER #ifdef __AVX__ diff --git a/src/INTEL/math_extra_intel.h b/src/INTEL/math_extra_intel.h index a8869f7384..556f3f4590 100644 --- a/src/INTEL/math_extra_intel.h +++ b/src/INTEL/math_extra_intel.h @@ -100,12 +100,12 @@ normalize a vector, return in ans ------------------------------------------------------------------------- */ -#define ME_normalize3(v0, v1, v2, ans) \ -{ \ - flt_t scale = (flt_t)1.0 / sqrt(v0*v0+v1*v1+v2*v2); \ - ans##_0 = v0 * scale; \ - ans##_1 = v1 * scale; \ - ans##_2 = v2 * scale; \ +#define ME_normalize3(v0, v1, v2, ans) \ +{ \ + flt_t scale = (flt_t)1.0 / std::sqrt(v0*v0+v1*v1+v2*v2); \ + ans##_0 = v0 * scale; \ + ans##_1 = v1 * scale; \ + ans##_2 = v2 * scale; \ } /* ---------------------------------------------------------------------- @@ -359,7 +359,7 @@ #define ME_qnormalize(q) \ { \ double norm = 1.0 / \ - sqrt(q##_w*q##_w + q##_i*q##_i + q##_j*q##_j + q##_k*q##_k); \ + std::sqrt(q##_w*q##_w + q##_i*q##_i + q##_j*q##_j + q##_k*q##_k); \ q##_w *= norm; \ q##_i *= norm; \ q##_j *= norm; \ diff --git a/src/INTEL/npair_full_bin_ghost_intel.cpp b/src/INTEL/npair_full_bin_ghost_intel.cpp index b7b9ee4aea..920c0c559a 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/INTEL/npair_full_bin_ghost_intel.cpp @@ -292,12 +292,13 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, else ito -= wlocal - nlocal; int e_ito = ito; - const int list_size = (e_ito + tid * 2 + 2) * maxnbors; + const bigint list_size = (bigint)(e_ito + tid * 2 + 2) * + (bigint)maxnbors; int pack_offset = maxnbors; - int ct = (ifrom + tid * 2) * maxnbors; + bigint ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; int * _noalias neighptr = intel_list + ct; - const int obound = pack_offset + maxnbors * 2; + const bigint obound = pack_offset + maxnbors * 2; const int toffs = tid * ncache_stride; flt_t * _noalias const tx = ncachex + toffs; @@ -558,7 +559,7 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } diff --git a/src/INTEL/npair_full_bin_intel.cpp b/src/INTEL/npair_full_bin_intel.cpp index 2f8af4c8af..285ed35ec9 100644 --- a/src/INTEL/npair_full_bin_intel.cpp +++ b/src/INTEL/npair_full_bin_intel.cpp @@ -62,7 +62,7 @@ fbi(NeighList *list, IntelBuffers *buffers) { list->inum = nlocal; list->gnum = 0; - int host_start = _fix->host_start_neighbor();; + int host_start = _fix->host_start_neighbor(); const int off_end = _fix->offload_end_neighbor(); #ifdef _LMP_INTEL_OFFLOAD diff --git a/src/INTEL/npair_intel.cpp b/src/INTEL/npair_intel.cpp index b85873f677..600109d7ae 100644 --- a/src/INTEL/npair_intel.cpp +++ b/src/INTEL/npair_intel.cpp @@ -287,16 +287,17 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (imod) e_ito += pack_width - imod; } #endif - const int list_size = (e_ito + tid * 2 + 2) * maxnbors; + const bigint list_size = (bigint)(e_ito + tid * 2 + 2) * + (bigint)maxnbors; #ifdef LMP_INTEL_3BODY_FAST const int pack_offset = maxnbors * pack_width; - const int obound = pack_offset + maxnbors * 2; + const bigint obound = pack_offset + maxnbors * 2; #else const int pack_offset = 0; - const int obound = maxnbors * 3; + const bigint obound = maxnbors * 3; #endif - int ct = (ifrom + tid * 2) * maxnbors; + bigint ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; int * _noalias neighptr = intel_list + ct; int * _noalias neighptr2; if (THREE) neighptr2 = neighptr; @@ -722,7 +723,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } @@ -736,7 +737,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 0b05447dd7..7bc2b3edb8 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -905,7 +905,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, flt_t rho_k = ka->params.rho[ktype][1]; flt_t rho_j = ka->params.rho[jtype][1]; flt_t lamdajik = 4 * itype * ((rho_k - rikmag) - (rho_j - rijmag)); - flt_t ex_lam = exp(lamdajik); + flt_t ex_lam = overloaded::exp(lamdajik); flt_t rcminik = ka->params.rcmin[itype][ktype]; flt_t rcmaxik = ka->params.rcmax[itype][ktype]; flt_t dwik; diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index 01a9f91bcf..424e38c16a 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -267,7 +267,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, const flt_t delz = ztmp - x[j].z; const int jtype = IP_PRE_dword_index(x[j].w); const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t r2inv = (flt_t)1.0 / rsq; #ifdef INTEL_VMASK diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index ff57b571a4..48007c30d9 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -322,7 +322,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, const int jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; const flt_t r2inv = (flt_t)1.0 / rsq; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); #ifdef INTEL_ALLOW_TABLE if (!ncoultablebits || rsq <= tabinnersq) { diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index 2461361788..1f2a033784 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -255,7 +255,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, const flt_t delz = ztmp - x[j].z; const int jtype = IP_PRE_dword_index(x[j].w); const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t r2inv = (flt_t)1.0 / rsq; #ifdef INTEL_VMASK diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index 011979223e..7b11053d41 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -180,7 +180,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, ATOM_T * _noalias const x = buffers->get_x(offload); typedef struct { double x, y, z; } lmp_vt; auto *v = (lmp_vt *)atom->v[0]; - const flt_t dtinvsqrt = 1.0/sqrt(update->dt); + const flt_t dtinvsqrt = 1.0/std::sqrt(update->dt); const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; @@ -322,7 +322,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, icut = parami[jtype].icut; } const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t rinv = (flt_t)1.0/sqrt(rsq); + const flt_t rinv = (flt_t)1.0/std::sqrt(rsq); if (rinv > icut) { flt_t factor_dpd, factor_sqrt; diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index ba5047a15a..9c5d6da5e5 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -340,7 +340,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int j = tj[jj] & NEIGHMASK; if (!ONETYPE) jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; - flt_t p = sqrt(rsq)*frdr + (flt_t)1.0; + flt_t p = std::sqrt(rsq)*frdr + (flt_t)1.0; int m = static_cast (p); m = MIN(m,nr-1); p -= m; @@ -546,7 +546,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int j = tj[jj] & NEIGHMASK; if (!ONETYPE) jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); flt_t p = r*frdr + (flt_t)1.0; int m = static_cast (p); m = MIN(m,nr-1); diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index 5609479388..92e074e5e1 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -492,7 +492,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, flt_t r12hat_0, r12hat_1, r12hat_2; ME_normalize3(delx_form[jj], dely_form[jj], delz_form[jj], r12hat); - flt_t r = sqrt(rsq_form[jj]); + flt_t r = std::sqrt(rsq_form[jj]); // compute distance of closest approach diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index e920257ef4..faae6e5cbc 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -306,7 +306,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, const int sbindex = tj[jj] >> SBBITS & 3; const flt_t rsq = trsq[jj]; const flt_t r2inv = (flt_t)1.0 / rsq; - const flt_t r_inv = (flt_t)1.0 / sqrt(rsq); + const flt_t r_inv = (flt_t)1.0 / std::sqrt(rsq); forcecoul = qqrd2e * qtmp * q[j] * r_inv; if (rsq > cut_coul_innersq) { const flt_t ccr = cut_coulsq - rsq; diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 0a93621bcd..412af17357 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -339,7 +339,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, const flt_t EWALD_F = 1.12837917; const flt_t INV_EWALD_P = 1.0 / 0.3275911; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); const flt_t grij = g_ewald * r; const flt_t expm2 = std::exp(-grij * grij); const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij); @@ -591,10 +591,10 @@ void PairLJCharmmCoulLongIntel::pack_force_const(ForceConst &fc, for (int j = 1; j < tp1; j++) { if (i <= j) { fc.lj[i][j].x = epsilon[i][j] * 4.0; - fc.lj[i][j].y = pow(sigma[i][j],6.0); + fc.lj[i][j].y = std::pow(sigma[i][j],6.0); } else { fc.lj[i][j].x = epsilon[j][i] * 4.0; - fc.lj[i][j].y = pow(sigma[j][i],6.0); + fc.lj[i][j].y = std::pow(sigma[j][i],6.0); } fc.cutsq[i][j] = cutsq[i][j]; } diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index 89e556defa..5eb3cbc1f7 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -332,7 +332,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, const flt_t EWALD_F = 1.12837917; const flt_t INV_EWALD_P = 1.0 / 0.3275911; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); const flt_t grij = g_ewald * r; const flt_t expm2 = std::exp(-grij * grij); const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij); diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index 07d590ee2c..fa62f499de 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -382,7 +382,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t rsq1 = trsq[jj]; const flt_t rinvsq1 = (flt_t)1.0 / rsq1; - const flt_t r1 = (flt_t)1.0/sqrt(rinvsq1); + const flt_t r1 = (flt_t)1.0/std::sqrt(rinvsq1); if (!ONETYPE) cut = p2f[ijtype].cut; const flt_t rainv1 = (flt_t)1.0 / (r1 - cut); @@ -475,7 +475,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t rsq2 = trsq[kk]; const flt_t rinvsq2 = (flt_t)1.0 / rsq2; - const flt_t r2 = (flt_t)1.0 / sqrt(rinvsq2); + const flt_t r2 = (flt_t)1.0 / std::sqrt(rinvsq2); const flt_t rainv2 = (flt_t)1.0 / (r2 - cut); const flt_t gsrainv2 = sigma_gamma * rainv2; const flt_t gsrainvsq2 = gsrainv2 * rainv2 / r2; diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index fdff23fe5e..6dac9fad99 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -124,8 +124,7 @@ void PPPMDispIntel::init() _use_lrt = fix->lrt(); if (_use_lrt) - error->all(FLERR, - "LRT mode is currently not supported for pppm/disp/intel"); + error->all(FLERR, "LRT mode is currently not supported for pppm/disp/intel"); // For vectorization, we need some padding in the end @@ -142,19 +141,15 @@ void PPPMDispIntel::init() if (_use_table) { rho_points = 5000; memory->destroy(rho_lookup); - memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:rho_lookup"); + memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:rho_lookup"); memory->destroy(rho6_lookup); - memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:rho6_lookup"); + memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:rho6_lookup"); if (differentiation_flag == 1) { memory->destroy(drho_lookup); - memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:drho_lookup"); + memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:drho_lookup"); memory->destroy(drho6_lookup); - memory->create(drho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:drho6_lookup"); + memory->create(drho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:drho6_lookup"); } precompute_rho(); } @@ -662,8 +657,8 @@ void PPPMDispIntel::compute(int eflag, int vflag) energy_1 -= g_ewald*qsqsum/MY_PIS + MY_PI2*qsum*qsum / (g_ewald*g_ewald*volume); - energy_6 += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij + - 1.0/12.0*pow(g_ewald_6,6)*csum; + energy_6 += - MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)*csumij + + 1.0/12.0*std::pow(g_ewald_6,6)*csum; energy_1 *= qscale; } @@ -676,7 +671,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) MPI_Allreduce(virial_6,virial_all,6,MPI_DOUBLE,MPI_SUM,world); for (i = 0; i < 6; i++) virial[i] += 0.5*volume*virial_all[i]; if (function[1]+function[2]+function[3]) { - double a = MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij; + double a = MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)*csumij; virial[0] -= a; virial[1] -= a; virial[2] -= a; @@ -695,8 +690,8 @@ void PPPMDispIntel::compute(int eflag, int vflag) int tmp; for (i = 0; i < atom->nlocal; i++) { tmp = atom->type[i]; - eatom[i] += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumi[tmp] + - 1.0/12.0*pow(g_ewald_6,6)*cii[tmp]; + eatom[i] += - MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)* + csumi[tmp] + 1.0/12.0*std::pow(g_ewald_6,6)*cii[tmp]; } } } @@ -708,7 +703,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) tmp = atom->type[i]; //dispersion self virial correction for (int n = 0; n < 3; n++) vatom[i][n] -= MY_PI*MY_PIS/(6*volume)* - pow(g_ewald_6,3)*csumi[tmp]; + std::pow(g_ewald_6,3)*csumi[tmp]; } } } @@ -1483,7 +1478,7 @@ void PPPMDispIntel::fieldforce_c_ik(IntelBuffers * /*buffers*/) int nxsum = nx + nlower; int nysum = ny + nlower; - int nzsum = nz + nlower;; + int nzsum = nz + nlower; FFT_SCALAR dx = nx+fshiftone - (x[i][0]-lo0)*xi; FFT_SCALAR dy = ny+fshiftone - (x[i][1]-lo1)*yi; @@ -1788,18 +1783,18 @@ void PPPMDispIntel::fieldforce_c_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoqsq; f[i][0] += qfactor * particle_ekx[i] - fqqrd2es * sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoqsq; f[i][1] += qfactor * particle_eky[i] - fqqrd2es * sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoqsq; if (slabflag != 2) f[i][2] += qfactor * particle_ekz[i] - fqqrd2es * sf; @@ -2160,18 +2155,18 @@ void PPPMDispIntel::fieldforce_g_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoljsq; f[i][0] += lj * particle_ekx[i] - sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoljsq; f[i][1] += lj * particle_eky[i] - sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoljsq; if (slabflag != 2) f[i][2] += lj * particle_ekz[i] - sf; @@ -2707,22 +2702,22 @@ void PPPMDispIntel::fieldforce_a_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; f[i][0] += lj0*particle_ekx0[i] + lj1*particle_ekx1[i] + lj2*particle_ekx2[i] + lj3*particle_ekx3[i] + lj4*particle_ekx4[i] + lj5*particle_ekx5[i] + lj6*particle_ekx6[i] - sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; f[i][1] += lj0*particle_eky0[i] + lj1*particle_eky1[i] + lj2*particle_eky2[i] + lj3*particle_eky3[i] + lj4*particle_eky4[i] + lj5*particle_eky5[i] + lj6*particle_eky6[i] - sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; if (slabflag != 2) f[i][2] += lj0*particle_ekz0[i] + lj1*particle_ekz1[i] + @@ -3106,14 +3101,14 @@ void PPPMDispIntel::fieldforce_none_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf1 = fsf_coeff0 * sin(ftwo_pi * s1); - sf1 += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf1 = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf1 += fsf_coeff1 * std::sin(ffour_pi * s1); - flt_t sf2 = fsf_coeff2 * sin(ftwo_pi * s2); - sf2 += fsf_coeff3 * sin(ffour_pi * s2); + flt_t sf2 = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf2 += fsf_coeff3 * std::sin(ffour_pi * s2); - flt_t sf3 = fsf_coeff4 * sin(ftwo_pi * s3); - sf3 += fsf_coeff5 * sin(ffour_pi * s3); + flt_t sf3 = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf3 += fsf_coeff5 * std::sin(ffour_pi * s3); for (int k = 0; k < nsplit; k++) { const flt_t lj = B[nsplit*type + k]; const flt_t twoljsq = lj*lj * B[k] * 2; diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index 2ceca54d29..f67b3a89b3 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -953,18 +953,18 @@ void PPPMIntel::fieldforce_ad(IntelBuffers *buffers) const flt_t s1 = x[i].x * hx_inv; const flt_t s2 = x[i].y * hy_inv; const flt_t s3 = x[i].z * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoqsq; f[i].x += qfactor * particle_ekx[i] - fqqrd2es * sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoqsq; f[i].y += qfactor * particle_eky[i] - fqqrd2es * sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoqsq; if (slabflag != 2) f[i].z += qfactor * particle_ekz[i] - fqqrd2es * sf; diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index 42414420b6..9df17d8cef 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -19,7 +19,6 @@ #include "atom_vec.h" #include "bond.h" #include "comm.h" -#include "compute.h" #include "dihedral.h" #include "domain.h" #include "error.h" @@ -27,7 +26,6 @@ #include "force.h" #include "improper.h" #include "kspace.h" -#include "memory.h" #include "modify.h" #include "neighbor.h" #include "output.h" @@ -35,9 +33,7 @@ #include "timer.h" #include "update.h" -#if defined(_OPENMP) -#include -#endif +#include using namespace LAMMPS_NS; @@ -67,7 +63,7 @@ void VerletLRTIntel::init() { Verlet::init(); - _intel_kspace = dynamic_cast(force->kspace_match("^pppm\\..*intel$", 0)); + _intel_kspace = dynamic_cast(force->kspace_match("^pppm/.*intel$", 0)); // include pppm/electrode/intel #ifndef LMP_INTEL_USELRT @@ -95,12 +91,15 @@ void VerletLRTIntel::setup(int flag) } #endif - if (comm->me == 0) { - fprintf(screen,"Setting up VerletLRTIntel run ...\n"); - fprintf(screen," Unit style : %s\n", update->unit_style); - fmt::print(screen," Current step : {}\n", update->ntimestep); - fprintf(screen," Time step : %g\n", update->dt); - timer->print_timeout(screen); + if (comm->me == 0 && screen) { + fputs("Setting up VerletLRTIntel run ...\n",screen); + if (flag) { + fmt::print(screen," Unit style : {}\n" + " Current step : {}\n" + " Time step : {}\n", + update->unit_style,update->ntimestep,update->dt); + timer->print_timeout(screen); + } } #if defined(_LMP_INTEL_LRT_PTHREAD) @@ -110,8 +109,9 @@ void VerletLRTIntel::setup(int flag) sched_getaffinity(0, sizeof(cpuset), &cpuset); int my_cpu_count = CPU_COUNT(&cpuset); if (my_cpu_count < comm->nthreads + 1) { - error->warning(FLERR, "Using {} threads per MPI rank, but only {} core(s) allocated " - "for each MPI rank", comm->nthreads + 1, my_cpu_count); + error->warning(FLERR, "Using {} threads per MPI rank, but only {} " + "core(s) allocated for each MPI rank", + comm->nthreads + 1, my_cpu_count); } } #endif @@ -144,6 +144,7 @@ void VerletLRTIntel::setup(int flag) domain->box_too_small_check(); modify->setup_pre_neighbor(); neighbor->build(1); + modify->setup_post_neighbor(); neighbor->ncalls = 0; // compute all forces @@ -189,11 +190,11 @@ void VerletLRTIntel::setup(int flag) if (kspace_compute_flag) _intel_kspace->compute_second(eflag,vflag); - modify->pre_reverse(eflag,vflag); + modify->setup_pre_reverse(eflag,vflag); if (force->newton) comm->reverse_comm(); modify->setup(vflag); - output->setup(); + output->setup(flag); update->setupflag = 0; } @@ -214,9 +215,10 @@ void VerletLRTIntel::run(int n) int n_post_integrate = modify->n_post_integrate; int n_pre_exchange = modify->n_pre_exchange; int n_pre_neighbor = modify->n_pre_neighbor; + int n_post_neighbor = modify->n_post_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force_any; + int n_post_force_any = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; if (atom->sortfreq > 0) sortflag = 1; @@ -279,6 +281,10 @@ void VerletLRTIntel::run(int n) } neighbor->build(1); timer->stamp(Timer::NEIGH); + if (n_post_neighbor) { + modify->post_neighbor(); + timer->stamp(Timer::MODIFY); + } } // force computations @@ -353,7 +359,7 @@ void VerletLRTIntel::run(int n) // force modifications, final time integration, diagnostics - if (n_post_force) modify->post_force(vflag); + if (n_post_force_any) modify->post_force(vflag); modify->final_integrate(); if (n_end_of_step) modify->end_of_step(); timer->stamp(Timer::MODIFY); diff --git a/src/INTERLAYER/pair_aip_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp new file mode 100644 index 0000000000..6e2bf7228d --- /dev/null +++ b/src/INTERLAYER/pair_aip_water_2dm.cpp @@ -0,0 +1,72 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + This is a full version of the potential described in + [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] +------------------------------------------------------------------------- */ + +#include "pair_aip_water_2dm.h" + +#include "citeme.h" +#include "error.h" +#include "force.h" + +#include +#include + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define DELTA 4 +#define PGDELTA 1 + +static const char cite_aip_water[] = + "aip/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" + "@Article{Feng2023\n" + " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" + " title = {Registry-Dependent Potential for Interfaces of Water with Graphene},\n" + " journal = {J. Phys. Chem. C},\n" + " volume = 127,\n" + " pages = {8704-8713}\n" + " year = 2023,\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairAIPWATER2DM::PairAIPWATER2DM(LAMMPS *lmp) : PairILPGrapheneHBN(lmp), PairILPTMD(lmp) +{ + variant = AIP_WATER_2DM; + single_enable = 0; + + // for TMD, each atom have six neighbors + Nnei = 6; + + if (lmp->citeme) lmp->citeme->add(cite_aip_water); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairAIPWATER2DM::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 aip/water/2dm must be used as sub-style with hybrid/overlay"); + + cut_global = utils::numeric(FLERR, arg[0], false, lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); +} diff --git a/src/INTERLAYER/pair_aip_water_2dm.h b/src/INTERLAYER/pair_aip_water_2dm.h new file mode 100644 index 0000000000..295cdfffb9 --- /dev/null +++ b/src/INTERLAYER/pair_aip_water_2dm.h @@ -0,0 +1,39 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(aip/water/2dm,PairAIPWATER2DM); +// clang-format on +#else + +#ifndef LMP_PAIR_AIP_WATER_2DM_H +#define LMP_PAIR_AIP_WATER_2DM_H + +#include "pair_ilp_tmd.h" + +namespace LAMMPS_NS { + +class PairAIPWATER2DM : virtual public PairILPTMD { + public: + PairAIPWATER2DM(class LAMMPS *); + + protected: + void settings(int, char **) override; + +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/INTERLAYER/pair_coul_shield.cpp b/src/INTERLAYER/pair_coul_shield.cpp index e647e1ea91..a5e3e63442 100644 --- a/src/INTERLAYER/pair_coul_shield.cpp +++ b/src/INTERLAYER/pair_coul_shield.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com This is a Coulomb potential described in diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 0ff2811339..69896d7c0b 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -11,13 +11,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + 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 - [Maaravi et al, J. Phys. Chem. C 121, 22826-22835 (2017)] - The definition of normals are the same as that in - [Kolmogorov & Crespi, Phys. Rev. B 71, 235415 (2005)] + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] ------------------------------------------------------------------------- */ #include "pair_ilp_graphene_hbn.h" @@ -59,6 +57,7 @@ static const char cite_ilp[] = static std::map variant_map = { {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, + {PairILPGrapheneHBN::AIP_WATER_2DM, "aip/water/2dm"}, {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; /* ---------------------------------------------------------------------- */ @@ -632,7 +631,7 @@ void PairILPGrapheneHBN::calc_FRep(int eflag, int /* vflag */) void PairILPGrapheneHBN::ILP_neigh() { - int i, j, ii, jj, n, allnum, jnum, itype, jtype; + int i, j, ii, jj, n, inum, jnum, itype, jtype; double xtmp, ytmp, ztmp, delx, dely, delz, rsq; int *ilist, *jlist, *numneigh, **firstneigh; int *neighptr; @@ -649,7 +648,7 @@ void PairILPGrapheneHBN::ILP_neigh() (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPGrapheneHBN:firstneigh"); } - allnum = list->inum + list->gnum; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -659,7 +658,7 @@ void PairILPGrapheneHBN::ILP_neigh() ipage->reset(); - for (ii = 0; ii < allnum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; n = 0; diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index 9987830b1d..e151ecc801 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -39,7 +39,7 @@ class PairILPGrapheneHBN : public Pair { static constexpr int NPARAMS_PER_LINE = 13; - enum { ILP_GrhBN, ILP_TMD, SAIP_METAL }; // for telling class variants apart in shared code + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, AIP_WATER_2DM }; // for telling class variants apart in shared code protected: int me; diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index c024e23079..8b08de39c0 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -15,7 +15,7 @@ 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).] + [Ouyang et al., J. Chem. Theory Comput. 17, 7237 (2021).] ------------------------------------------------------------------------- */ #include "pair_ilp_tmd.h" @@ -35,10 +35,6 @@ 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" @@ -232,7 +228,7 @@ void PairILPTMD::calc_FRep(int eflag, int /* vflag */) void PairILPTMD::ILP_neigh() { - int i, j, l, ii, jj, ll, n, allnum, jnum, itype, jtype, ltype, imol, jmol, count; + int i, j, l, ii, jj, ll, n, inum, 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; @@ -249,7 +245,7 @@ void PairILPTMD::ILP_neigh() ILP_firstneigh = (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPTMD:firstneigh"); } - allnum = list->inum + list->gnum; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -259,7 +255,7 @@ void PairILPTMD::ILP_neigh() ipage->reset(); - for (ii = 0; ii < allnum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; //initialize varibles @@ -288,21 +284,21 @@ void PairILPTMD::ILP_neigh() 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 || + // check if the atom i is a TMD atom, 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. + } else { // atom i can be P, 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 || + 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++) { @@ -336,9 +332,6 @@ void PairILPTMD::ILP_neigh() } } // 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"); } @@ -367,11 +360,11 @@ void PairILPTMD::ILP_neigh() ll++; } } // end of sorting the order of neighbors - } else { // for B/N/C/H atoms + } else { // for P/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"); + "There are too many neighbors for P/B/N/C/H atoms, please check your configuration"); for (ll = 0; ll < n; ll++) { neighsort[ll] = neighptr[ll]; } } @@ -390,12 +383,14 @@ 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; + int iH1,iH2,jH1,jH2; double Nave[3], dni[3], dpvdri[3][3]; + double nn, xtp, ytp, ztp, delx, dely, delz, nn2; double **x = atom->x; int *type = atom->type; + tagint *tag = atom->tag; memory->destroy(dnn); memory->destroy(vect); @@ -479,9 +474,60 @@ void PairILPTMD::calc_normal() for (m = 0; m < Nnei; m++) { dnormal[i][id][m][ip] = 0.0; } } } + // for hydrogen in water molecule + if (strcmp(elements[itype], "Hw") == 0) { + if(cont == 0) { + jH1 = atom->map(tag[i] - 1); + jH2 = atom->map(tag[i] - 2); + iH1 = map[type[jH1]]; + iH2 = map[type[jH2]]; + if (strcmp(elements[iH1], "Ow") == 0) { + vect[0][0] = x[jH1][0] - xtp; + vect[0][1] = x[jH1][1] - ytp; + vect[0][2] = x[jH1][2] - ztp; + } else if (strcmp(elements[iH2], "Ow") == 0) { + vect[0][0] = x[jH2][0] - xtp; + vect[0][1] = x[jH2][1] - ytp; + vect[0][2] = x[jH2][2] - ztp; + } else { + error->one(FLERR, "The order of atoms in water molecule should be O H H !"); + } + } + Nave[0] = vect[0][0]; + Nave[1] = vect[0][1]; + Nave[2] = vect[0][2]; + // 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; + + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + if (ip == id) { dpvdri[id][ip] = -1.0;} + else {dpvdri[id][ip] = 0.0;} + } + } + + // 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; + dnormal[i][id][0][ip] = -dnormdri[i][id][ip]; + } + } + } } //############################ For the edge atoms of TMD ################################ - else if (cont < Nnei) { + 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 @@ -557,8 +603,7 @@ void PairILPTMD::calc_normal() 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; + 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. @@ -589,12 +634,99 @@ void PairILPTMD::calc_normal() } } } // for TMD + //############################ For Oxygen in the water molecule ####################### + else if (strcmp(elements[itype], "Ow") == 0) { + if(cont == 0) { + jH1 = atom->map(tag[i] + 1); + jH2 = atom->map(tag[i] + 2); + iH1 = map[type[jH1]]; + iH2 = map[type[jH2]]; + if (strcmp(elements[iH1], "Hw") == 0 && strcmp(elements[iH2], "Hw") == 0) { + vect[0][0] = x[jH1][0] - xtp; + vect[0][1] = x[jH1][1] - ytp; + vect[0][2] = x[jH1][2] - ztp; + + vect[1][0] = x[jH2][0] - xtp; + vect[1][1] = x[jH2][1] - ytp; + vect[1][2] = x[jH2][2] - ztp; + + cont = 2; + } else { + error->one(FLERR, "The order of atoms in water molecule should be O H H !"); + } + } + if (cont == 2) { + Nave[0] = (vect[0][0] + vect[1][0])/cont; + Nave[1] = (vect[0][1] + vect[1][1])/cont; + Nave[2] = (vect[0][2] + vect[1][2])/cont; + // 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 (ip == id) { dNave[id][m][ip] = 0.5;} + else {dNave[id][m][ip] = 0.0;} + } + } + } + // 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; + } + } + } + else if (cont >= 3) { + error->one(FLERR, + "There are too many neighbors for calculating normals of water molecules"); + } + } //############################ 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)]; + 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 @@ -657,8 +789,7 @@ void PairILPTMD::calc_normal() 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; + 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. diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index b2eba787b1..b497ae3568 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com based on previous versions by Jaap Kroes diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp index 05fbfbf7f4..bd327391a4 100644 --- a/src/INTERLAYER/pair_saip_metal.cpp +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -15,7 +15,7 @@ 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)] + [Ouyang et al., J. Chem. Theory Comput. 17, 7215-7223 (2021)] ------------------------------------------------------------------------- */ #include "pair_saip_metal.h" diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index ae2e6e6ea0..e0fc90ea46 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -198,8 +198,7 @@ PairKIM::~PairKIM() void PairKIM::set_contributing() { int const nall = atom->nlocal + atom->nghost; - for (int i = 0; i < nall; ++i) - kim_particleContributing[i] = ( (i < atom->nlocal) ? 1 : 0 ); + for (int i = 0; i < nall; ++i) kim_particleContributing[i] = (i < atom->nlocal) ? 1 : 0; } /* ---------------------------------------------------------------------- */ @@ -596,7 +595,7 @@ void PairKIM::init_style() if (kim_cutoff_values[i] <= neighbor->skin) error->all(FLERR,"Illegal neighbor request (force cutoff {:.3} <= skin {:.3})", kim_cutoff_values[i], neighbor->skin); - req->set_cutoff(kim_cutoff_values[i] + neighbor->skin); + req->set_cutoff(kim_cutoff_values[i]); } // increment instance_me in case of need to change the neighbor list // request settings diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.cpp b/src/KOKKOS/atom_vec_dpd_kokkos.cpp index eda26a92dc..a8ce29f666 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dpd_kokkos.cpp @@ -116,22 +116,22 @@ void AtomVecDPDKokkos::grow_pointers() d_dpdTheta = atomKK->k_dpdTheta.d_view; h_dpdTheta = atomKK->k_dpdTheta.h_view; uCond = atomKK->uCond; - d_uCond = atomKK->k_uCond.d_view;; + d_uCond = atomKK->k_uCond.d_view; h_uCond = atomKK->k_uCond.h_view; uMech = atomKK->uMech; - d_uMech = atomKK->k_uMech.d_view;; + d_uMech = atomKK->k_uMech.d_view; h_uMech = atomKK->k_uMech.h_view; uChem = atomKK->uChem; - d_uChem = atomKK->k_uChem.d_view;; + d_uChem = atomKK->k_uChem.d_view; h_uChem = atomKK->k_uChem.h_view; uCG = atomKK->uCG; - d_uCG = atomKK->k_uCG.d_view;; + d_uCG = atomKK->k_uCG.d_view; h_uCG = atomKK->k_uCG.h_view; uCGnew = atomKK->uCGnew; - d_uCGnew = atomKK->k_uCGnew.d_view;; + d_uCGnew = atomKK->k_uCGnew.d_view; h_uCGnew = atomKK->k_uCGnew.h_view; duChem = atomKK->duChem; - d_duChem = atomKK->k_duChem.d_view;; + d_duChem = atomKK->k_duChem.d_view; h_duChem = atomKK->k_duChem.h_view; } diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.cpp b/src/KOKKOS/atom_vec_sphere_kokkos.cpp index a9b64fc835..5a1c2beee3 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.cpp +++ b/src/KOKKOS/atom_vec_sphere_kokkos.cpp @@ -20,7 +20,6 @@ #include "domain.h" #include "error.h" #include "fix.h" -#include "fix_adapt.h" #include "math_const.h" #include "memory.h" #include "memory_kokkos.h" diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 7d007a666c..b0394821fc 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -980,9 +980,9 @@ void CommKokkos::borders() } else { atomKK->sync(Host,ALL_MASK); k_sendlist.sync(); - CommBrick::borders(); k_sendlist.modify(); - atomKK->modified(Host,ALL_MASK); + atomKK->modified(Host,ALL_MASK); // needed here for atom map + CommBrick::borders(); } if (comm->nprocs == 1 && !ghost_velocity && !forward_comm_classic) diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp index 157d41126f..263a070a3a 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp @@ -386,7 +386,7 @@ void ComputeOrientOrderAtomKokkos::select3(int k, int n, int ii) con l = 0; ir = n-1; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr,l,ir); @@ -421,7 +421,7 @@ void ComputeOrientOrderAtomKokkos::select3(int k, int n, int ii) con a3[0] = arr3(l+1,0); a3[1] = arr3(l+1,1); a3[2] = arr3(l+1,2); - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/KOKKOS/dihedral_harmonic_kokkos.cpp b/src/KOKKOS/dihedral_harmonic_kokkos.cpp index 96287946ea..8ca0b368df 100644 --- a/src/KOKKOS/dihedral_harmonic_kokkos.cpp +++ b/src/KOKKOS/dihedral_harmonic_kokkos.cpp @@ -265,9 +265,9 @@ void DihedralHarmonicKokkos::operator()(TagDihedralHarmonicCompute &Sorter) override; - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void get_chi_field(); - double memory_usage(); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void get_chi_field() override; + double memory_usage() override; void sparse_matvec_acks2(typename AT::t_ffloat_1d &, typename AT::t_ffloat_1d &); }; diff --git a/src/KOKKOS/fix_wall_gran_old.cpp b/src/KOKKOS/fix_wall_gran_old.cpp index 95aaa144e5..8c02e6146d 100644 --- a/src/KOKKOS/fix_wall_gran_old.cpp +++ b/src/KOKKOS/fix_wall_gran_old.cpp @@ -1470,7 +1470,7 @@ void FixWallGranOld::granular(double rsq, double dx, double dy, double dz, if (twist_model != TWIST_NONE) { magtwist = relrot1*nx + relrot2*ny + relrot3*nz; //Omega_T (eq 29 of Marshall) if (twist_model == TWIST_MARSHALL) { - k_twist = 0.5*k_tangential*a*a;; // eq 32 of Marshall paper + k_twist = 0.5*k_tangential*a*a; // eq 32 of Marshall paper damp_twist = 0.5*damp_tangential*a*a; mu_twist = TWOTHIRDS*a*tangential_coeffs[2]; } diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 3c9886905e..fac75221bc 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -1310,9 +1310,13 @@ struct alignas(4 * sizeof(int)) reax_int4 { #define SNAP_KOKKOS_HOST_VECLEN 1 #ifdef LMP_KOKKOS_GPU -#define SNAP_KOKKOS_DEVICE_VECLEN 32 + #if defined(KOKKOS_ENABLE_SYCL) + #define SNAP_KOKKOS_DEVICE_VECLEN 16 + #else + #define SNAP_KOKKOS_DEVICE_VECLEN 32 + #endif #else -#define SNAP_KOKKOS_DEVICE_VECLEN 1 + #define SNAP_KOKKOS_DEVICE_VECLEN 1 #endif diff --git a/src/KOKKOS/mliap_so3_kokkos.cpp b/src/KOKKOS/mliap_so3_kokkos.cpp index 128e0f0a0c..bfdf4af0aa 100644 --- a/src/KOKKOS/mliap_so3_kokkos.cpp +++ b/src/KOKKOS/mliap_so3_kokkos.cpp @@ -856,7 +856,7 @@ void MLIAP_SO3Kokkos::spectrum_dxdr(int nlocal, DAT::tdual_int_1d nu memoryKK->create_kokkos(m_clisttot_i, nlocal, m_nmax, m_numYlms, "MLIAP_SO3Kokkos:m_clisttot_i"); int num_of_temp = std::min(nlocal, m_chunk_size); int delta=num_of_temp-m_ulist_r.extent(0); - if (delta > 0 ){ + if (delta > 0){ memoryKK->destroy_kokkos(m_ulist_r); memoryKK->create_kokkos(m_ulist_r, num_of_temp, m_idxu_count, "MLIAP_SO3Kokkos:m_ulist_r"); memoryKK->destroy_kokkos(m_ulist_i); diff --git a/src/KOKKOS/mliap_unified_couple_kokkos.pyx b/src/KOKKOS/mliap_unified_couple_kokkos.pyx index 5e274d7f36..bd94b79eb4 100644 --- a/src/KOKKOS/mliap_unified_couple_kokkos.pyx +++ b/src/KOKKOS/mliap_unified_couple_kokkos.pyx @@ -346,6 +346,16 @@ cdef class MLIAPDataPy: return None return create_array(self.data.dev, self.data.rij, [self.npairs,3],False) + @property + def rij_max(self): + if self.data.rij is NULL: + return None + return create_array(self.data.dev, self.data.rij, [self.nneigh_max,3], False) + + @property + def nneigh_max(self): + return self.data.nneigh_max + @write_only_property def graddesc(self, value): if self.data.graddesc is NULL: diff --git a/src/KOKKOS/mliap_unified_kokkos.cpp b/src/KOKKOS/mliap_unified_kokkos.cpp index 1fdf039473..deb9cbc346 100644 --- a/src/KOKKOS/mliap_unified_kokkos.cpp +++ b/src/KOKKOS/mliap_unified_kokkos.cpp @@ -371,6 +371,25 @@ void LAMMPS_NS::update_pair_forces(MLIAPDataKokkosDevice *data, double *fij) } } +/* ---------------------------------------------------------------------- + set energy for i indexed atoms + ---------------------------------------------------------------------- */ + +void LAMMPS_NS::update_atom_energy(MLIAPDataKokkosDevice *data, double *ei) +{ + auto d_eatoms = data->eatoms; + const auto nlistatoms = data->nlistatoms; + + Kokkos::parallel_reduce(nlistatoms, KOKKOS_LAMBDA(int i, double &local_sum){ + double e = ei[i]; + // must not count any contribution where i is not a local atom + if (i < nlistatoms) { + d_eatoms[i] = e; + local_sum += e; + } + },*data->energy); +} + namespace LAMMPS_NS { template class MLIAPDummyModelKokkos; template class MLIAPDummyDescriptorKokkos; diff --git a/src/KOKKOS/mliap_unified_kokkos.h b/src/KOKKOS/mliap_unified_kokkos.h index aad25891b0..1af7715dad 100644 --- a/src/KOKKOS/mliap_unified_kokkos.h +++ b/src/KOKKOS/mliap_unified_kokkos.h @@ -60,6 +60,7 @@ template MLIAPBuildUnifiedKokkos_t build_unified(char *, MLIAPDataKokkos *, LAMMPS *, char * = NULL); void update_pair_energy(MLIAPDataKokkosDevice *, double *); void update_pair_forces(MLIAPDataKokkosDevice *, double *); +void update_atom_energy(MLIAPDataKokkosDevice *, double *); } // namespace LAMMPS_NS diff --git a/src/KOKKOS/neigh_bond_kokkos.cpp b/src/KOKKOS/neigh_bond_kokkos.cpp index 9067284426..4cfe440b1f 100644 --- a/src/KOKKOS/neigh_bond_kokkos.cpp +++ b/src/KOKKOS/neigh_bond_kokkos.cpp @@ -266,7 +266,7 @@ void NeighBondKokkos::bond_all() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && me ==0) + if (all && me == 0) error->warning(FLERR,"Bond atoms missing at step {}", update->ntimestep); k_bondlist.modify(); @@ -345,7 +345,7 @@ void NeighBondKokkos::bond_partial() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && me ==0) + if (all && me == 0) error->warning(FLERR,"Bond atoms missing at step {}", update->ntimestep); k_bondlist.modify(); diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 852a4a9280..06567cbeb6 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -240,22 +240,25 @@ void NPairKokkos::build(NeighList *list_) // assumes newton off NPairKokkosBuildFunctorGhost f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU - if (ExecutionSpaceFromDevice::space == Device) { - int team_size = atoms_per_bin*factor; - int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); - if (team_size <= team_size_max) { - Kokkos::TeamPolicy config((mbins+factor-1)/factor,team_size); - Kokkos::parallel_for(config, f); - } else { // fall back to flat method - f.sharedsize = 0; - Kokkos::parallel_for(nall, f); - } - } else - Kokkos::parallel_for(nall, f); -#else + +// temporarily disable team policy for ghost due to known bug + +//#ifdef LMP_KOKKOS_GPU +// if (ExecutionSpaceFromDevice::space == Device) { +// int team_size = atoms_per_bin*factor; +// int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); +// if (team_size <= team_size_max) { +// Kokkos::TeamPolicy config((mbins+factor-1)/factor,team_size); +// Kokkos::parallel_for(config, f); +// } else { // fall back to flat method +// f.sharedsize = 0; +// Kokkos::parallel_for(nall, f); +// } +// } else +// Kokkos::parallel_for(nall, f); +//#else Kokkos::parallel_for(nall, f); -#endif +//#endif } else { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 6 * sizeof(X_FLOAT) * factor); diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index ec72cabf33..2b81e21e2b 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -32,10 +32,10 @@ #include "potential_file_reader.h" #include -#include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + // Cannot use virtual inheritance on the GPU, so must duplicate code /* ---------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ PairEAMAlloyKokkos::PairEAMAlloyKokkos(LAMMPS *lmp) : PairEAM(lmp) respa_enable = 0; single_enable = 0; one_coeff = 1; + manybody_flag = 1; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -59,10 +60,10 @@ PairEAMAlloyKokkos::PairEAMAlloyKokkos(LAMMPS *lmp) : PairEAM(lmp) template PairEAMAlloyKokkos::~PairEAMAlloyKokkos() { - if (!copymode) { - memoryKK->destroy_kokkos(k_eatom,eatom); - memoryKK->destroy_kokkos(k_vatom,vatom); - } + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); } /* ---------------------------------------------------------------------- */ @@ -118,7 +119,7 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -138,9 +139,9 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) // zero out density if (newton_pair) - Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); else - Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); // loop over neighbors of my atoms @@ -152,15 +153,15 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -178,18 +179,22 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } if (eflag) { @@ -208,41 +213,65 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } } @@ -427,7 +456,7 @@ int PairEAMAlloyKokkos::pack_forward_comm_kokkos(int n, DAT::tdual_i 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; } @@ -445,7 +474,7 @@ void PairEAMAlloyKokkos::unpack_forward_comm_kokkos(int n, int first { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); } template @@ -588,6 +617,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelB, const int &ii, EV_FLOAT& ev) const { + // fp = derivative of embedding energy at each atom // phi = embedding energy at each atom // if rho > rhomax (e.g. due to close approach of two atoms), @@ -644,6 +674,7 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); @@ -806,6 +837,235 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMAlloyKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMAlloyKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -1214,6 +1474,35 @@ void PairEAMAlloyKokkos::file2array_alloy() /* ---------------------------------------------------------------------- */ +template +template +struct PairEAMAlloyKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMAlloyKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); + return policy; + } +}; +#endif + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMAlloyKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index c6cb73ca5d..2eb40189ac 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -61,7 +61,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { ~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 @@ -93,6 +92,14 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelC, const int&, EV_FLOAT&) const; @@ -101,6 +108,14 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -125,7 +140,7 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -139,7 +154,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; - NonDupScatterView ndup_rho; NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; @@ -163,17 +177,18 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_frho_spline; t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - + void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void file2array() override; void file2array_alloy(); void array2spline() override; - void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void read_file(char *) override; + template + struct policyInstance; + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; - //NeighListKokkos k_list; int iswap; int first; @@ -187,7 +202,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { }; } - #endif #endif diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 50abbc3191..4572d14e48 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -32,10 +32,10 @@ #include "potential_file_reader.h" #include -#include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + // Cannot use virtual inheritance on the GPU, so must duplicate code /* ---------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ PairEAMFSKokkos::PairEAMFSKokkos(LAMMPS *lmp) : PairEAM(lmp) respa_enable = 0; single_enable = 0; one_coeff = 1; + manybody_flag = 1; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -59,10 +60,10 @@ PairEAMFSKokkos::PairEAMFSKokkos(LAMMPS *lmp) : PairEAM(lmp) template PairEAMFSKokkos::~PairEAMFSKokkos() { - if (!copymode) { - memoryKK->destroy_kokkos(k_eatom,eatom); - memoryKK->destroy_kokkos(k_vatom,vatom); - } + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); } /* ---------------------------------------------------------------------- */ @@ -118,7 +119,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -138,9 +139,9 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) // zero out density if (newton_pair) - Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); else - Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); // loop over neighbors of my atoms @@ -152,15 +153,15 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -178,18 +179,22 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } if (eflag) { @@ -197,7 +202,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) ev.evdwl = 0.0; } - // communicate derivative of embedding function (on the device) + // communicate derivative of embedding function k_fp.template modify(); comm->forward_comm(this); @@ -208,41 +213,65 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } } @@ -427,7 +456,7 @@ int PairEAMFSKokkos::pack_forward_comm_kokkos(int n, DAT::tdual_int_ 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; } @@ -445,7 +474,7 @@ void PairEAMFSKokkos::unpack_forward_comm_kokkos(int n, int first_in { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); } template @@ -645,6 +674,7 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, const for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); @@ -691,7 +721,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, const int &ii) const { - EV_FLOAT ev; + EV_FLOAT ev; this->template operator()(TagPairEAMFSKernelAB(), ii, ev); this->template operator()(TagPairEAMFSKernelAB(), ii, ev); } @@ -807,6 +837,235 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMFSKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMFSKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -1225,6 +1484,35 @@ void PairEAMFSKokkos::file2array_fs() /* ---------------------------------------------------------------------- */ +template +template +struct PairEAMFSKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMFSKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); + return policy; + } +}; +#endif + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMFSKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 06a395cba7..bd03ab0015 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -61,7 +61,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { ~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 @@ -93,6 +92,14 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelC, const int&, EV_FLOAT&) const; @@ -101,6 +108,14 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -125,7 +140,7 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -139,7 +154,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; - NonDupScatterView ndup_rho; NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; @@ -163,13 +177,15 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_frho_spline; t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - + void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void file2array() override; void file2array_fs(); void array2spline() override; - void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void read_file(char *) override; + template + struct policyInstance; + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; @@ -186,7 +202,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { }; } - #endif #endif diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 6e1cd1feea..de6d3646bf 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -31,9 +31,10 @@ #include "pair_kokkos.h" #include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + /* ---------------------------------------------------------------------- */ template @@ -113,7 +114,7 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -147,15 +148,15 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -173,18 +174,22 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } if (eflag) { @@ -203,41 +208,65 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } } @@ -583,6 +612,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelB, const int &ii, EV_FLOAT& ev) const { + // fp = derivative of embedding energy at each atom // phi = embedding energy at each atom // if rho > rhomax (e.g. due to close approach of two atoms), @@ -802,6 +832,235 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -898,6 +1157,37 @@ void PairEAMKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int & } } +/* ---------------------------------------------------------------------- */ + +template +template +struct PairEAMKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); + return policy; + } +}; +#endif + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 006dceb1f2..9d066d40a0 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -60,6 +60,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { void compute(int, int) override; void init_style() override; + KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; @@ -89,6 +90,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelC, const int&, EV_FLOAT&) const; @@ -97,6 +106,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -121,7 +138,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -162,6 +179,9 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { void file2array() override; void array2spline() override; + template + struct policyInstance; + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; diff --git a/src/KOKKOS/pair_meam_kokkos.cpp b/src/KOKKOS/pair_meam_kokkos.cpp index c2b03c2054..daf9c1e18b 100644 --- a/src/KOKKOS/pair_meam_kokkos.cpp +++ b/src/KOKKOS/pair_meam_kokkos.cpp @@ -980,7 +980,7 @@ void PairMEAMKokkos::update_meam_views() namespace LAMMPS_NS { template class PairMEAMKokkos; -#ifdef KOKKOS_ENABLE_CUDA +#ifdef LMP_KOKKOS_GPU template class PairMEAMKokkos; #endif } diff --git a/src/KOKKOS/pair_meam_ms_kokkos.cpp b/src/KOKKOS/pair_meam_ms_kokkos.cpp index 491fc0273c..eaa7d500b9 100644 --- a/src/KOKKOS/pair_meam_ms_kokkos.cpp +++ b/src/KOKKOS/pair_meam_ms_kokkos.cpp @@ -26,7 +26,7 @@ PairMEAMMSKokkos::PairMEAMMSKokkos(LAMMPS *lmp) : PairMEAMKokkos; -#ifdef KOKKOS_ENABLE_CUDA +#ifdef LMP_KOKKOS_GPU template class PairMEAMMSKokkos; #endif } diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index fba95a679e..ca1884bfd2 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -97,6 +97,17 @@ class PairSNAPKokkos : public PairSNAP { 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; +#elif defined(KOKKOS_ENABLE_SYCL) + static constexpr int team_size_compute_neigh = 4; + static constexpr int tile_size_compute_ck = 4; + static constexpr int tile_size_pre_ui = 8; + static constexpr int team_size_compute_ui = 8; + static constexpr int tile_size_transform_ui = 8; + static constexpr int tile_size_compute_zi = 4; + static constexpr int tile_size_compute_bi = 4; + static constexpr int tile_size_transform_bi = 4; + static constexpr int tile_size_compute_yi = 8; + static constexpr int team_size_compute_fused_deidrj = 4; #else static constexpr int team_size_compute_neigh = 4; static constexpr int tile_size_compute_ck = 4; diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index f76cab6f0f..912ae36f6f 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -138,7 +138,7 @@ PPPMKokkos::~PPPMKokkos() template void PPPMKokkos::init() { - if (me == 0) utils::logmesg(lmp,"PPPM initialization ...\n"); + if (me == 0) utils::logmesg(lmp,"PPPM Kokkos initialization ...\n"); // error check @@ -146,6 +146,10 @@ void PPPMKokkos::init() error->all(FLERR,"Cannot (yet) use PPPM Kokkos with 'kspace_modify diff ad'"); triclinic_check(); + + if (triclinic != domain->triclinic) + error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); + if (domain->triclinic && slabflag) error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and slab correction"); if (domain->dimension == 2) diff --git a/src/KOKKOS/pppm_kokkos.h b/src/KOKKOS/pppm_kokkos.h index 50b5ac0f35..d621313873 100644 --- a/src/KOKKOS/pppm_kokkos.h +++ b/src/KOKKOS/pppm_kokkos.h @@ -33,7 +33,7 @@ KSpaceStyle(pppm/kk/host,PPPMKokkos); // clang-format off -// fix up FFT defines for KOKKOS with CUDA +// fix up FFT defines for KOKKOS with CUDA and HIP #ifdef KOKKOS_ENABLE_CUDA # if defined(FFT_FFTW) @@ -48,6 +48,19 @@ KSpaceStyle(pppm/kk/host,PPPMKokkos); # if !defined(FFT_CUFFT) && !defined(FFT_KISSFFT) # define FFT_KISSFFT # endif +#elif defined(KOKKOS_ENABLE_HIP) +# if defined(FFT_FFTW) +# undef FFT_FFTW +# endif +# if defined(FFT_FFTW3) +# undef FFT_FFTW3 +# endif +# if defined(FFT_MKL) +# undef FFT_MKL +# endif +# if !defined(FFT_HIPFFT) && !defined(FFT_KISSFFT) +# define FFT_KISSFFT +# endif #endif #include "pppm.h" @@ -430,7 +443,6 @@ class PPPMKokkos : public PPPM, public KokkosBaseFFT { // triclinic - int triclinic; // domain settings, orthog or triclinic void setup_triclinic(); void compute_gf_ik_triclinic(); void poisson_ik_triclinic(); diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index fd58f1c4f3..d5690ea60a 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -2298,7 +2298,7 @@ void SNAKokkos::compute_s_dsfac(const real constexpr real_type zero = static_cast(0.0); constexpr real_type onehalf = static_cast(0.5); - if (switch_flag == 0) { sfac_outer = zero; dsfac_outer = zero; } + if (switch_flag == 0) { sfac_outer = one; dsfac_outer = zero; } else if (switch_flag == 1) { if (r <= rmin0) { sfac_outer = one; dsfac_outer = zero; } else if (r > rcut) { sfac = zero; dsfac = zero; return; } diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index b61a1d36c6..93470c60ac 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -857,7 +857,7 @@ void Ewald::coeffs() vg[kcount][3] = -vterm*unitk[0]*k*unitk[1]*l; vg[kcount][4] = 0.0; vg[kcount][5] = 0.0; - kcount++;; + kcount++; } } } diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index fd76d2fc00..b7635c49c7 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -230,7 +230,7 @@ void PairLJCharmmfswCoulLong::compute(int eflag, int vflag) evdwl12 = lj3[itype][jtype]*cut_lj6*denom_lj12 * (r6inv - cut_lj6inv)*(r6inv - cut_lj6inv); evdwl6 = -lj4[itype][jtype]*cut_lj3*denom_lj6 * - (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv);; + (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv); evdwl = evdwl12 + evdwl6; } else { evdwl12 = r6inv*lj3[itype][jtype]*r6inv - @@ -588,7 +588,7 @@ void PairLJCharmmfswCoulLong::compute_outer(int eflag, int vflag) evdwl12 = lj3[itype][jtype]*cut_lj6*denom_lj12 * (r6inv - cut_lj6inv)*(r6inv - cut_lj6inv); evdwl6 = -lj4[itype][jtype]*cut_lj3*denom_lj6 * - (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv);; + (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv); evdwl = evdwl12 + evdwl6; } else { evdwl12 = r6inv*lj3[itype][jtype]*r6inv - @@ -1015,7 +1015,7 @@ double PairLJCharmmfswCoulLong::single(int i, int j, int itype, int jtype, philj12 = lj3[itype][jtype]*cut_lj6*denom_lj12 * (r6inv - cut_lj6inv)*(r6inv - cut_lj6inv); philj6 = -lj4[itype][jtype]*cut_lj3*denom_lj6 * - (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv);; + (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv); philj = philj12 + philj6; } else { philj12 = r6inv*lj3[itype][jtype]*r6inv - diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 70f7c8f6b7..2f5b4fc670 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -3004,7 +3004,7 @@ double PPPM::memory_usage() if (group_allocate_flag) { bytes += (double)2 * nbrick * sizeof(FFT_SCALAR); - bytes += (double)2 * nfft_both * sizeof(FFT_SCALAR);; + bytes += (double)2 * nfft_both * sizeof(FFT_SCALAR); } // two Grid3d bufs diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 84a21b46e6..7ab76ad62a 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -110,6 +110,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), { triclinic_support = 0; pppmflag = dispersionflag = 1; + triclinic = domain->triclinic; nfactors = 3; factors = new int[nfactors]; @@ -242,12 +243,12 @@ void PPPMDisp::settings(int narg, char **arg) PPPMDisp::~PPPMDisp() { - delete [] factors; - delete [] B; + delete[] factors; + delete[] B; B = nullptr; - delete [] cii; + delete[] cii; cii = nullptr; - delete [] csumi; + delete[] csumi; csumi = nullptr; PPPMDisp::deallocate(); PPPMDisp::deallocate_peratom(); @@ -268,6 +269,9 @@ void PPPMDisp::init() triclinic_check(); + if (triclinic != domain->triclinic) + error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); + if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMDisp with 2d simulation"); if (comm->style != Comm::BRICK) @@ -1277,7 +1281,7 @@ void PPPMDisp::init_coeffs() int n = atom->ntypes; int converged; - delete [] B; + delete[] B; B = nullptr; // no mixing rule or arithmetic @@ -3352,10 +3356,10 @@ void PPPMDisp::calc_csum() int ntypes = atom->ntypes; int i,j,k; - delete [] cii; + delete[] cii; cii = new double[ntypes+1]; for (i = 0; i<=ntypes; i++) cii[i] = 0.0; - delete [] csumi; + delete[] csumi; csumi = new double[ntypes+1]; for (i = 0; i<=ntypes; i++) csumi[i] = 0.0; int *neach = new int[ntypes+1]; @@ -3447,8 +3451,8 @@ void PPPMDisp::calc_csum() } } - delete [] neach; - delete [] neach_all; + delete[] neach; + delete[] neach_all; } /* ---------------------------------------------------------------------- @@ -4647,7 +4651,7 @@ void PPPMDisp::poisson_ik(FFT_SCALAR* wk1, FFT_SCALAR* wk2, for (j = nylo_i; j <= nyhi_i; j++) for (i = nxlo_i; i <= nxhi_i; i++) { vz_brick[k][j][i] = wk2[n++]; - u_pa[k][j][i] = -wk2[n++];; + u_pa[k][j][i] = -wk2[n++]; } } @@ -6538,9 +6542,9 @@ void PPPMDisp::fieldforce_none_ik() } } - delete [] ekx; - delete [] eky; - delete [] ekz; + delete[] ekx; + delete[] eky; + delete[] ekz; } /* ---------------------------------------------------------------------- @@ -6660,9 +6664,9 @@ void PPPMDisp::fieldforce_none_ad() } } - delete [] ekx; - delete [] eky; - delete [] ekz; + delete[] ekx; + delete[] eky; + delete[] ekz; } /* ---------------------------------------------------------------------- @@ -6756,13 +6760,13 @@ void PPPMDisp::fieldforce_none_peratom() } } - delete [] u_pa; - delete [] v0; - delete [] v1; - delete [] v2; - delete [] v3; - delete [] v4; - delete [] v5; + delete[] u_pa; + delete[] v0; + delete[] v1; + delete[] v2; + delete[] v3; + delete[] v4; + delete[] v5; } /* ---------------------------------------------------------------------- diff --git a/src/MAKE/MACHINES/Makefile.aurora_kokkos b/src/MAKE/MACHINES/Makefile.aurora_kokkos new file mode 100644 index 0000000000..a263d4cb8c --- /dev/null +++ b/src/MAKE/MACHINES/Makefile.aurora_kokkos @@ -0,0 +1,121 @@ +# aurora_kokkos = KOKKOS/SYCL, Intel Data Center Max (Ponte Vecchio) GPU, Intel Sapphire Rapids CPU, mpicxx compiler + +SHELL = /bin/sh + +# --------------------------------------------------------------------- +# compiler/linker settings +# specify flags and libraries needed for your compiler + +CC = mpicxx +CCFLAGS = -g -O3 -DNDEBUG +SHFLAGS = -fPIC +DEPFLAGS = -M + +LINK = mpicxx +LINKFLAGS = -g -O3 +LIB = +SIZE = size + +ARCHIVE = ar +ARFLAGS = -rc +SHLIBFLAGS = -shared +KOKKOS_DEVICES = SYCL +KOKKOS_ARCH = PVC,SPR + +# --------------------------------------------------------------------- +# 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 +MPI_PATH = +MPI_LIB = + +# 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.crusher_kokkos b/src/MAKE/MACHINES/Makefile.frontier_kokkos similarity index 93% rename from src/MAKE/MACHINES/Makefile.crusher_kokkos rename to src/MAKE/MACHINES/Makefile.frontier_kokkos index d6332805f7..86cddd12b7 100644 --- a/src/MAKE/MACHINES/Makefile.crusher_kokkos +++ b/src/MAKE/MACHINES/Makefile.frontier_kokkos @@ -1,4 +1,4 @@ -# crusher_kokkos = KOKKOS/HIP, AMD MI250X GPU and AMD EPYC 7A53 "Optimized 3rd Gen EPYC" CPU, Cray MPICH, hipcc compiler, hipFFT +# frontier_kokkos = KOKKOS/HIP, AMD MI250X GPU and AMD EPYC 7A53 "Optimized 3rd Gen EPYC" CPU, Cray MPICH, hipcc compiler, hipFFT SHELL = /bin/sh @@ -6,8 +6,6 @@ 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 -munsafe-fp-atomics -DNDEBUG -DKOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS SHFLAGS = -fPIC @@ -22,7 +20,7 @@ ARCHIVE = ar ARFLAGS = -rc SHLIBFLAGS = -shared KOKKOS_DEVICES = HIP -KOKKOS_ARCH = Zen3,Vega90A +KOKKOS_ARCH = Vega90A,Zen3 # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL diff --git a/src/MAKE/MACHINES/Makefile.spock_kokkos b/src/MAKE/MACHINES/Makefile.perlmutter_kokkos similarity index 84% rename from src/MAKE/MACHINES/Makefile.spock_kokkos rename to src/MAKE/MACHINES/Makefile.perlmutter_kokkos index 8f7e5bd63d..2882fb6260 100644 --- a/src/MAKE/MACHINES/Makefile.spock_kokkos +++ b/src/MAKE/MACHINES/Makefile.perlmutter_kokkos @@ -1,4 +1,4 @@ -# spock_kokkos = KOKKOS/HIP, AMD MI100 GPU and AMD EPYC 7662 "Rome" CPU, Cray MPICH, hipcc compiler, hipFFT +# perlmutter_kokkos = KOKKOS/CUDA, NVIDIA A100 GPU and AMD EPYC 7763 (Milan) CPU, Cray MPICH, nvcc compiler with gcc SHELL = /bin/sh @@ -8,12 +8,12 @@ SHELL = /bin/sh KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) -CC = hipcc -CCFLAGS = -g -O3 -DNDEBUG -DKOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS +CC = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper +CCFLAGS = -g -O3 -DNDEBUG -Xcudafe --diag_suppress=unrecognized_pragma SHFLAGS = -fPIC DEPFLAGS = -M -LINK = hipcc +LINK = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper LINKFLAGS = -g -O3 LIB = SIZE = size @@ -21,8 +21,8 @@ SIZE = size ARCHIVE = ar ARFLAGS = -rc SHLIBFLAGS = -shared -KOKKOS_DEVICES = HIP -KOKKOS_ARCH = Zen2,Vega908 +KOKKOS_DEVICES = Cuda +KOKKOS_ARCH = Ampere80,Zen3 # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL @@ -44,8 +44,8 @@ LMP_INC = -DLAMMPS_GZIP # 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 +MPI_PATH = +MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_cuda # FFT library # see discussion in Section 3.5.2 of manual @@ -54,12 +54,9 @@ MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa # PATH = path for FFT library # LIB = name of FFT library -MY_HIP_EXE = $(shell which hipcc) -MY_HIP_PATH = $(dir ${MY_HIP_EXE}) - -FFT_INC = -DFFT_HIPFFT -FFT_PATH = -FFT_LIB = -L${MY_HIP_PATH}../lib -lhipfft +FFT_INC = -DFFT_CUFFT +FFT_PATH = +FFT_LIB = -lcufft # JPEG and/or PNG library # see discussion in Section 3.5.4 of manual @@ -72,6 +69,11 @@ 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 @@ -81,7 +83,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) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index ac1ac0ea62..a6a6ed37fd 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -593,9 +593,9 @@ void PairComb3::read_file(char *file) if (params[nparams].lambda < 0.0 || params[nparams].powern < 0.0 || params[nparams].beta < 0.0 || params[nparams].alpha1 < 0.0 || - params[nparams].bigB1< 0.0 || params[nparams].bigA< 0.0 || - params[nparams].bigB2< 0.0 || params[nparams].alpha2 <0.0 || - params[nparams].bigB3< 0.0 || params[nparams].alpha3 <0.0 || + params[nparams].bigB1 < 0.0 || params[nparams].bigA < 0.0 || + params[nparams].bigB2 < 0.0 || params[nparams].alpha2 < 0.0 || + params[nparams].bigB3 < 0.0 || params[nparams].alpha3 < 0.0 || params[nparams].bigr < 0.0 || params[nparams].bigd < 0.0 || params[nparams].bigd > params[nparams].bigr || params[nparams].powerm - params[nparams].powermint != 0.0 || diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index be2a1e41f3..1fd98b80f0 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -73,7 +73,8 @@ PairGW::~PairGW() void PairGW::compute(int eflag, int vflag) { int i,j,k,ii,jj,kk,inum,jnum; - int itag,jtag,itype,jtype,ktype,iparam_ij,iparam_ijk; + int itype,jtype,ktype,iparam_ij,iparam_ijk; + tagint itag,jtag; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; double rsq,rsq1,rsq2; double delr1[3],delr2[3],fi[3],fj[3],fk[3]; diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 65191ae85e..ed085c4b98 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -115,7 +115,7 @@ void PairLCBOP::allocate() ------------------------------------------------------------------------- */ void PairLCBOP::settings(int narg, char **/*arg*/) { - if (narg != 0 ) error->all(FLERR,"Illegal pair_style command"); + if (narg != 0) error->all(FLERR,"Illegal pair_style command"); } /* ---------------------------------------------------------------------- diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index f38ba00861..c7c45bc865 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -14,7 +14,7 @@ /* ---------------------------------------------------------------------- Contributing author: Aidan Thompson (SNL) - original Tersoff implementation - Wengen Ouyang (TAU) - Shift addition + Wengen Ouyang (WHU) - Shift addition ------------------------------------------------------------------------- */ #include "pair_tersoff.h" diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 634b512936..ff8c5eb9c9 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2328,8 +2328,7 @@ double FixGCMC::energy_full() } if (overlaptest) break; } - MPI_Allreduce(&overlaptest, &overlaptestall, 1, - MPI_INT, MPI_MAX, world); + MPI_Allreduce(&overlaptest, &overlaptestall, 1, MPI_INT, MPI_MAX, world); if (overlaptestall) return MAXENERGYSIGNAL; } @@ -2352,12 +2351,6 @@ double FixGCMC::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - // unlike Verlet, not performing a reverse_comm() or forces here - // b/c GCMC does not care about forces - // don't think it will mess up energy due to any post_force() fixes - // but Modify::pre_reverse() is needed for INTEL - - if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index a98f29da5e..cc2f1bc94d 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -1050,13 +1050,7 @@ double FixWidom::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - // unlike Verlet, not performing a reverse_comm() or forces here - // b/c Widom does not care about forces - // don't think it will mess up energy due to any post_force() fixes - // but Modify::pre_reverse() is needed for INTEL - - if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); - if (modify->n_pre_force) modify->pre_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which // operate at pre_force() or post_force() diff --git a/src/MGPT/pair_mgpt.cpp b/src/MGPT/pair_mgpt.cpp index 5c4b889f8a..c924cbea84 100644 --- a/src/MGPT/pair_mgpt.cpp +++ b/src/MGPT/pair_mgpt.cpp @@ -589,8 +589,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, double *e_s,double *e_p,double *e_t,double *e_q, int evflag,int newton_pair) { Hash bond_hash(100000); - int i,j,k,m,ix,jx,kx,mx,itag,jtag,p; - + int i,j,k,m,ix,jx,kx,mx,p; double e_single,e_pair,e_triplet,e_triplet_c,e_quad; double volvir2; diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp index 9411fa763d..69e0f2a7f3 100644 --- a/src/MISC/fix_ipi.cpp +++ b/src/MISC/fix_ipi.cpp @@ -284,17 +284,17 @@ void FixIPI::initial_integrate(int /*vflag*/) // while i-PI just asks for status, signal we are ready and wait readbuffer(ipisock, header, MSGLEN, error); header[MSGLEN]=0; - if (strcmp(header,"STATUS ") == 0 ) + if (strcmp(header,"STATUS ") == 0) writebuffer(ipisock,"READY ",MSGLEN, error); else break; } - if (strcmp(header,"EXIT ") == 0 ) + if (strcmp(header,"EXIT ") == 0) error->one(FLERR, "Got EXIT message from i-PI. Now leaving!"); // when i-PI signals it has positions to evaluate new forces, // read positions and cell data - if (strcmp(header,"POSDATA ") == 0 ) { + if (strcmp(header,"POSDATA ") == 0) { readbuffer(ipisock, (char*) cellh, 9*8, error); readbuffer(ipisock, (char*) cellih, 9*8, error); readbuffer(ipisock, (char*) &nat, 4, error); @@ -454,15 +454,15 @@ void FixIPI::final_integrate() while (true) { readbuffer(ipisock, header, MSGLEN, error); header[MSGLEN]=0; - if (strcmp(header,"STATUS ") == 0 ) + if (strcmp(header,"STATUS ") == 0) writebuffer(ipisock,"HAVEDATA ",MSGLEN, error); else break; } - if (strcmp(header,"EXIT ") == 0 ) + if (strcmp(header,"EXIT ") == 0) error->one(FLERR, "Got EXIT message from i-PI. Now leaving!"); - if (strcmp(header,"GETFORCE ") == 0 ) { + if (strcmp(header,"GETFORCE ") == 0) { writebuffer(ipisock,"FORCEREADY ",MSGLEN, error); writebuffer(ipisock,(char*) &pot,8, error); writebuffer(ipisock,(char*) &nat,4, error); diff --git a/src/MISC/pair_agni.cpp b/src/MISC/pair_agni.cpp index 539c0ca00f..8597e5db93 100644 --- a/src/MISC/pair_agni.cpp +++ b/src/MISC/pair_agni.cpp @@ -347,7 +347,7 @@ void PairAGNI::read_file(char *filename) curparam = -1; } else error->warning(FLERR,"Ignoring unknown tag '{}' in AGNI potential file.",tag); } else { - if (params && wantdata >=0) { + if (params && wantdata >= 0) { if ((int)values.count() == params[wantdata].numeta + 2) { for (k = 0; k < params[wantdata].numeta; ++k) params[wantdata].xU[k][fp_counter] = values.next_double(); diff --git a/src/ML-IAP/mliap_unified_couple.pyx b/src/ML-IAP/mliap_unified_couple.pyx index 3fde99a25e..25852a1c5f 100644 --- a/src/ML-IAP/mliap_unified_couple.pyx +++ b/src/ML-IAP/mliap_unified_couple.pyx @@ -281,6 +281,16 @@ cdef class MLIAPDataPy: return None return np.asarray( &self.data.rij[0][0]) + @property + def rij_max(self): + if self.data.rij is NULL: + return None + return np.asarray( &self.data.rij[0][0]) + + @property + def nneigh_max(self): + return self.data.nneigh_max + @write_only_property def graddesc(self, value): if self.data.graddesc is NULL: @@ -357,6 +367,7 @@ cdef public object mliap_unified_connect(char *fname, MLIAPDummyModel * model, unified_int.descriptor = descriptor unified.interface = unified_int + #print(unified_int) if unified.ndescriptors is None: raise ValueError("no descriptors set") diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 5063c402c6..65caa46153 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -188,7 +188,7 @@ void PairLJCharmmfswCoulCharmmfsh::compute(int eflag, int vflag) evdwl12 = lj3[itype][jtype]*cut_lj6*denom_lj12 * (r6inv - cut_lj6inv)*(r6inv - cut_lj6inv); evdwl6 = -lj4[itype][jtype]*cut_lj3*denom_lj6 * - (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv);; + (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv); evdwl = evdwl12 + evdwl6; } else { evdwl12 = r6inv*lj3[itype][jtype]*r6inv - @@ -525,7 +525,7 @@ single(int i, int j, int itype, int jtype, philj12 = lj3[itype][jtype]*cut_lj6*denom_lj12 * (r6inv - cut_lj6inv)*(r6inv - cut_lj6inv); philj6 = -lj4[itype][jtype]*cut_lj3*denom_lj6 * - (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv);; + (r3inv - cut_lj3inv)*(r3inv - cut_lj3inv); philj = philj12 + philj6; } else { philj12 = r6inv*lj3[itype][jtype]*r6inv - diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 4e0fd47a29..844d1a46e4 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -283,6 +283,8 @@ void DumpAtomMPIIO::init_style() void DumpAtomMPIIO::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*header_choice)(ndump); } diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 32e09675a8..80adefa325 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -309,6 +309,8 @@ void DumpCustomMPIIO::init_style() void DumpCustomMPIIO::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*header_choice)(ndump); } diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 6fecf7f41b..a4699897a3 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -195,6 +195,7 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) : type_nc_real = NC_FLOAT; thermo = false; + thermo_warn = true; thermovar = nullptr; framei = 0; @@ -223,7 +224,7 @@ void DumpNetCDF::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->nfield]; + thermovar = new int[*output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -321,8 +322,11 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - NCERRX( nc_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } } @@ -433,21 +437,17 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { -#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); -#else - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); -#endif + const auto &fields = th->get_fields(); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } } @@ -606,19 +606,30 @@ void DumpNetCDF::write() if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - th->call_vfunc(i); + + // will output current thermo data only on timesteps where it was computed. + // warn (once) about using cached copy from old timestep. + + if (thermo_warn && (update->ntimestep != *th->get_timestep())) { + thermo_warn = false; + if (comm->me == 0) { + error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" + " Dump netcdf always stores thermo data from last thermo output", + id, *th->get_timestep(), update->ntimestep); + } + } + + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); + int nfield = *th->get_nfield(); + for (int i = 0; i < nfield; i++) { if (filewriter) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_put_var1_double(ncid, thermovar[i], start, - &th->dvalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { - NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i].c_str() ); + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( nc_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } } diff --git a/src/NETCDF/dump_netcdf.h b/src/NETCDF/dump_netcdf.h index 20c60ef104..982cd99fb5 100644 --- a/src/NETCDF/dump_netcdf.h +++ b/src/NETCDF/dump_netcdf.h @@ -65,6 +65,7 @@ class DumpNetCDF : public DumpCustom { int type_nc_real; // netcdf type to use for real variables: float or double bool thermo; // write thermo output to netcdf file + bool thermo_warn; // warn (once) that thermo output is on incompatible step bigint n_buffer; // size of buffer bigint *int_buffer; // buffer for passing data to netcdf diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index 0282903d77..2407678386 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -192,6 +192,7 @@ DumpNetCDFMPIIO::DumpNetCDFMPIIO(LAMMPS *lmp, int narg, char **arg) : type_nc_real = NC_FLOAT; thermo = false; + thermo_warn = true; thermovar = nullptr; framei = 0; @@ -220,7 +221,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->nfield]; + thermovar = new int[*output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -319,8 +320,11 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - NCERRX( ncmpi_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } } @@ -423,17 +427,17 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { -#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); -#else - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); -#endif + const auto &fields = th->get_fields(); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } } @@ -595,25 +599,36 @@ void DumpNetCDFMPIIO::write() if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - th->call_vfunc(i); + + // will output current thermo data only on timesteps where it was computed. + // warn (once) about using cached copy from old timestep. + + if (thermo_warn && (update->ntimestep != *th->get_timestep())) { + thermo_warn = false; + if (comm->me == 0) { + error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" + " Dump netcdf/mpiio always stores thermo data from last thermo output", + id, *th->get_timestep(), update->ntimestep); + } + } + + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); + int nfield = *th->get_nfield(); + for (int i = 0; i < nfield; i++) { if (filewriter) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, - &th->dvalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { - NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i].c_str() ); + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } } } - // write timestep header + // write timestep header write_time_and_cell(); diff --git a/src/NETCDF/dump_netcdf_mpiio.h b/src/NETCDF/dump_netcdf_mpiio.h index 5948dc272b..14ee930e26 100644 --- a/src/NETCDF/dump_netcdf_mpiio.h +++ b/src/NETCDF/dump_netcdf_mpiio.h @@ -62,6 +62,7 @@ class DumpNetCDFMPIIO : public DumpCustom { int type_nc_real; // netcdf type to use for real variables: float or double bool thermo; // write thermo output to netcdf file + bool thermo_warn; // warn (once) that thermo output is on incompatible step bigint n_buffer; // size of buffer bigint *int_buffer; // buffer for passing data to netcdf diff --git a/src/OPENMP/npair_full_bin_ghost_omp.cpp b/src/OPENMP/npair_full_bin_ghost_omp.cpp index 5723a418f5..0825d61b49 100644 --- a/src/OPENMP/npair_full_bin_ghost_omp.cpp +++ b/src/OPENMP/npair_full_bin_ghost_omp.cpp @@ -114,7 +114,7 @@ void NPairFullBinGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_full_bin_omp.cpp b/src/OPENMP/npair_full_bin_omp.cpp index 94668002a9..65af519850 100644 --- a/src/OPENMP/npair_full_bin_omp.cpp +++ b/src/OPENMP/npair_full_bin_omp.cpp @@ -108,7 +108,7 @@ void NPairFullBinOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_full_nsq_ghost_omp.cpp b/src/OPENMP/npair_full_nsq_ghost_omp.cpp index 05f402a99d..c1270d9fdc 100644 --- a/src/OPENMP/npair_full_nsq_ghost_omp.cpp +++ b/src/OPENMP/npair_full_nsq_ghost_omp.cpp @@ -108,7 +108,7 @@ void NPairFullNsqGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_full_nsq_omp.cpp b/src/OPENMP/npair_full_nsq_omp.cpp index 6349906771..695cb1bc48 100644 --- a/src/OPENMP/npair_full_nsq_omp.cpp +++ b/src/OPENMP/npair_full_nsq_omp.cpp @@ -108,7 +108,7 @@ void NPairFullNsqOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp index 2255033204..e10d181a8c 100644 --- a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp +++ b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp @@ -122,7 +122,7 @@ void NPairHalfBinNewtoffGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_bin_newtoff_omp.cpp index 36997d9bcb..9d32cc7e2b 100644 --- a/src/OPENMP/npair_half_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_bin_newtoff_omp.cpp @@ -113,7 +113,7 @@ void NPairHalfBinNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newton_omp.cpp b/src/OPENMP/npair_half_bin_newton_omp.cpp index 1663a2f14c..d2da12962c 100644 --- a/src/OPENMP/npair_half_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_bin_newton_omp.cpp @@ -114,7 +114,7 @@ void NPairHalfBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -145,7 +145,7 @@ void NPairHalfBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_bin_newton_tri_omp.cpp index e754456ef1..4d93d06d75 100644 --- a/src/OPENMP/npair_half_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_bin_newton_tri_omp.cpp @@ -119,7 +119,7 @@ void NPairHalfBinNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp b/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp index ac5e9dae04..4447b4414e 100644 --- a/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp @@ -120,7 +120,7 @@ void NPairHalfMultiOldNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_multi_old_newton_omp.cpp b/src/OPENMP/npair_half_multi_old_newton_omp.cpp index baa9dd0724..29c551f17d 100644 --- a/src/OPENMP/npair_half_multi_old_newton_omp.cpp +++ b/src/OPENMP/npair_half_multi_old_newton_omp.cpp @@ -116,7 +116,7 @@ void NPairHalfMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -153,7 +153,7 @@ void NPairHalfMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp b/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp index e4895ff1a9..1d906b1fa5 100644 --- a/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp @@ -129,7 +129,7 @@ void NPairHalfMultiOldNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp index 388e51e1af..54de8b9607 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp @@ -117,7 +117,7 @@ void NPairHalfNsqNewtoffGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_nsq_newtoff_omp.cpp index 002ea37e6b..54a90d9f2b 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newtoff_omp.cpp @@ -109,7 +109,7 @@ void NPairHalfNsqNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_nsq_newton_omp.cpp b/src/OPENMP/npair_half_nsq_newton_omp.cpp index cb08cb7f7a..c010a3b024 100644 --- a/src/OPENMP/npair_half_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newton_omp.cpp @@ -49,8 +49,8 @@ void NPairHalfNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,n,itype,jtype,itag,jtag,which,imol,iatom; - tagint tagprev; + int i,j,n,itype,jtype,which,imol,iatom; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *neighptr; @@ -127,7 +127,7 @@ void NPairHalfNsqNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp index c6be04419d..e1d4ee59b1 100644 --- a/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp @@ -144,7 +144,7 @@ void NPairHalfRespaBinNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_bin_newton_omp.cpp b/src/OPENMP/npair_half_respa_bin_newton_omp.cpp index 51fc7a2ed8..ce8a103170 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_respa_bin_newton_omp.cpp @@ -146,7 +146,7 @@ void NPairHalfRespaBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -190,7 +190,7 @@ void NPairHalfRespaBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp index c998f71290..73f2102dba 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp @@ -151,7 +151,7 @@ void NPairHalfRespaBinNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp index 1167a7601b..428ca778e8 100644 --- a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp @@ -141,7 +141,7 @@ void NPairHalfRespaNsqNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp b/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp index 6604861f74..4bcba0fbef 100644 --- a/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp @@ -55,8 +55,8 @@ void NPairHalfRespaNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,n,itype,jtype,itag,jtag,n_inner,n_middle,imol,iatom; - tagint tagprev; + int i,j,n,itype,jtype,n_inner,n_middle,imol,iatom; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *neighptr,*neighptr_inner,*neighptr_middle; @@ -159,7 +159,7 @@ void NPairHalfRespaNsqNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp index c205b67539..478e28a5f4 100644 --- a/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp @@ -125,7 +125,7 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_bin_newton_omp.cpp b/src/OPENMP/npair_half_size_bin_newton_omp.cpp index 628057d41d..dba392781e 100644 --- a/src/OPENMP/npair_half_size_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newton_omp.cpp @@ -126,7 +126,7 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -161,7 +161,7 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp index c320296442..160cf64194 100644 --- a/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp @@ -132,7 +132,7 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp index 73564a150c..ba0dfc16be 100644 --- a/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp @@ -124,7 +124,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) for (k = 0; k < ns; k++) { js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >=0; j = bins[j]) { + for (j = js; j >= 0; j = bins[j]) { if (j <= i) continue; jtype = type[j]; @@ -145,7 +145,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_newton_omp.cpp index 0ed843ea0b..4bc17f911c 100644 --- a/src/OPENMP/npair_half_size_multi_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newton_omp.cpp @@ -155,7 +155,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -198,7 +198,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp index 9a0ead482b..73e11a2745 100644 --- a/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp @@ -160,7 +160,7 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp index c368e71095..e4169482bc 100644 --- a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp @@ -132,7 +132,7 @@ void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp index 187efe04d1..7d6a3de871 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp @@ -127,7 +127,7 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -170,7 +170,7 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp index c74b191f66..caa993ed38 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp @@ -140,7 +140,7 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp index 020551bd8e..2982586a18 100644 --- a/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp @@ -122,7 +122,7 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp index 35dc42ec5b..0a80da9422 100644 --- a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp @@ -58,8 +58,8 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,jh,n,itag,jtag,which,imol,iatom; - tagint tagprev; + int i,j,jh,n,which,imol,iatom; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -140,7 +140,7 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPT/pair_aip_water_2dm_opt.cpp b/src/OPT/pair_aip_water_2dm_opt.cpp new file mode 100644 index 0000000000..47c8c395db --- /dev/null +++ b/src/OPT/pair_aip_water_2dm_opt.cpp @@ -0,0 +1,63 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This is an optimized version of aip/water/2dm based on the contribution of: + author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + Optimizations are done by: + author1: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + e-mail: sunrise_duan at 126 dot com + + author2: Ping Gao (National Supercomputing Center in Wuxi, China) + e-mail: qdgaoping at gmail dot com + + Optimizations are described in: + Gao, Ping and Duan, Xiaohui, et al.: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 + + Potential is described by: + [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] +*/ +#include "pair_aip_water_2dm_opt.h" + +#include "atom.h" +#include "memory.h" + +#include + +using namespace LAMMPS_NS; + +PairAIPWATER2DMOpt::PairAIPWATER2DMOpt(LAMMPS *lmp) : + PairILPGrapheneHBN(lmp), PairILPTMD(lmp), PairAIPWATER2DM(lmp), PairILPGrapheneHBNOpt(lmp) +{ +} + +void PairAIPWATER2DMOpt::coeff(int narg, char **args) +{ + PairILPTMD::coeff(narg, args); + memory->create(special_type, atom->ntypes + 1, "PairAIPWATER2DMOpt:check_sublayer"); + for (int i = 1; i <= atom->ntypes; i++) { + int itype = map[i]; + 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) { + special_type[i] = TMD_METAL; + } else if (strcmp(elements[itype], "Hw") == 0 || strcmp(elements[itype], "Ow") == 0) { + special_type[i] = WATER; + } else { + special_type[i] = NOT_SPECIAL; + } + } +} diff --git a/src/OPT/pair_aip_water_2dm_opt.h b/src/OPT/pair_aip_water_2dm_opt.h new file mode 100644 index 0000000000..50b5043360 --- /dev/null +++ b/src/OPT/pair_aip_water_2dm_opt.h @@ -0,0 +1,38 @@ + /* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(aip/water/2dm/opt,PairAIPWATER2DMOpt); +// clang-format on +#else + +#ifndef LMP_PAIR_AIP_WATER_2DM_OPT_H +#define LMP_PAIR_AIP_WATER_2DM_OPT_H + +#include "pair_ilp_graphene_hbn_opt.h" +#include "pair_aip_water_2dm.h" + +namespace LAMMPS_NS { + +class PairAIPWATER2DMOpt : public PairAIPWATER2DM, public PairILPGrapheneHBNOpt { + public: + PairAIPWATER2DMOpt(class LAMMPS *); + void coeff(int narg, char **args) override; + + protected: +}; + +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index 586c44be08..5cb896223e 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -11,12 +11,24 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Optimization author1: Ping Gao (National Supercomputing Center in Wuxi, China) + This is an optimized version of ilp/graphene/hbn based on the contirubtion of: + author: Wengen Ouyang (Wuhan University, China) + e-mail: w.g.ouyang at gmail dot com + + Optimizations are done by: + author1: Ping Gao (National Supercomputing Center in Wuxi, China) implements the base ILP potential. e-mail: qdgaoping at gmail dot com - Optimization author2: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + + author2: Xiaohui Duan (Shandong University, China) adjusts the framework to adopt SAIP, TMD, WATER2DM, etc. e-mail: sunrise_duan at 126 dot com - Provides some bugfixes and performance optimizations in this potential. + Optimizations are described in: + Gao, Ping and Duan, Xiaohui, et al: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 + + Potential is described by: + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] */ #include "pair_ilp_graphene_hbn_opt.h" @@ -28,19 +40,21 @@ #include "interlayer_taper.h" #include "memory.h" #include "neigh_list.h" +#include "neigh_request.h" #include "neighbor.h" +#include "pointers.h" #include -#include +#include using namespace LAMMPS_NS; using namespace InterLayer; static const char cite_ilp_cur[] = - "ilp/graphene/hbn/opt potential: doi:10.1145/3458817.3476137\n" + "ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137\n" "@inproceedings{gao2021lmff\n" - " author = {Gao, Ping and Duan, Xiaohui and others},\n" - " title = {{LMFF}: Efficient and Scalable Layered Materials Force Field on Heterogeneous " + " author = {Gao, Ping and Duan, Xiaohui and Others},\n" + " title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous " "Many-Core Processors},\n" " year = {2021},\n" " isbn = {9781450384421},\n" @@ -50,14 +64,12 @@ static const char cite_ilp_cur[] = " doi = {10.1145/3458817.3476137},\n" " booktitle = {Proceedings of the International Conference for High Performance Computing, " "Networking, Storage and Analysis},\n" - " pages = {42},\n" + " articleno = {42},\n" " numpages = {14},\n" - " location = {St.~Louis, Missouri},\n" + " location = {St. Louis, Missouri},\n" " series = {SC'21},\n" "}\n\n"; -static bool check_vdw(tagint itag, tagint jtag, double *xi, double *xj); - /* ---------------------------------------------------------------------- */ PairILPGrapheneHBNOpt::PairILPGrapheneHBNOpt(LAMMPS *lmp) : @@ -168,6 +180,36 @@ void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) } } } + } else if (variant == AIP_WATER_2DM) { + if (eflag_global || eflag_atom) { + if (vflag_either) { + if (tap_flag) { + eval<6, 1, 1, 1, AIP_WATER_2DM>(); + } else { + eval<6, 1, 1, 0, AIP_WATER_2DM>(); + } + } else { + if (tap_flag) { + eval<6, 1, 0, 1, AIP_WATER_2DM>(); + } else { + eval<6, 1, 0, 0, AIP_WATER_2DM>(); + } + } + } else { + if (vflag_either) { + if (tap_flag) { + eval<6, 0, 1, 1, AIP_WATER_2DM>(); + } else { + eval<6, 0, 1, 0, AIP_WATER_2DM>(); + } + } else { + if (tap_flag) { + eval<6, 0, 0, 1, AIP_WATER_2DM>(); + } else { + eval<6, 0, 0, 0, AIP_WATER_2DM>(); + } + } + } } else if (variant == SAIP_METAL) { if (eflag_global || eflag_atom) { if (vflag_either) { @@ -255,7 +297,7 @@ void PairILPGrapheneHBNOpt::eval() rsq = delx * delx + dely * dely + delz * delz; if (rsq != 0 && rsq < cutILPsq[itype_map][jtype]) { - if (VARIANT == ILP_TMD && special_type[itype] && itype != type[j]) continue; + if ((VARIANT == ILP_TMD || VARIANT == AIP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; if (ILP_nneigh >= MAX_NNEIGH) { error->one(FLERR, "There are too many neighbors for calculating normals"); } @@ -269,7 +311,8 @@ void PairILPGrapheneHBNOpt::eval() dproddni[2] = 0.0; double norm[3], dnormdxi[3][3], dnormdxk[MAX_NNEIGH][3][3]; - calc_normal(i, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); + + calc_atom_normal(i, itype, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); for (jj = 0; jj < jnum_inter; jj++) { j = jlist_inter[jj]; @@ -298,7 +341,7 @@ void PairILPGrapheneHBNOpt::eval() Tap = 1.0; dTap = 0.0; } - if (VARIANT != SAIP_METAL || !special_type[itype]) { + if (VARIANT != SAIP_METAL || special_type[itype] != SAIP_BNCH) { // Calculate the transverse distance prodnorm1 = norm[0] * delx + norm[1] * dely + norm[2] * delz; rhosq1 = rsq - prodnorm1 * prodnorm1; // rho_ij @@ -310,7 +353,7 @@ void PairILPGrapheneHBNOpt::eval() frho1 = exp1 * p.C; Erep = 0.5 * p.epsilon + frho1; - if (VARIANT == SAIP_METAL && special_type[jtype]) { Erep += 0.5 * p.epsilon + p.C; } + if (VARIANT == SAIP_METAL && special_type[jtype] == SAIP_BNCH) { Erep += 0.5 * p.epsilon + p.C; } Vilp = exp0 * Erep; // derivatives @@ -428,6 +471,18 @@ inline void deriv_normal(double dndr[3][3], double *del, double *n, double rnnor dndr[1][2] = (del[1] * n[0] * n[1] + del[0] * (n[0] * n[0] + n[2] * n[2])) * rnnorm; dndr[2][2] = (del[1] * n[0] * n[2] - del[0] * n[1] * n[2]) * rnnorm; } +inline void deriv_hat(double dnhatdn[3][3], double *n, double rnnorm, double factor){ + double cfactor = rnnorm * factor; + dnhatdn[0][0] = (n[1]*n[1]+n[2]*n[2])*cfactor; + dnhatdn[1][0] = -n[1]*n[0]*cfactor; + dnhatdn[2][0] = -n[2]*n[0]*cfactor; + dnhatdn[0][1] = -n[0]*n[1]*cfactor; + dnhatdn[1][1] = (n[0]*n[0]+n[2]*n[2])*cfactor; + dnhatdn[2][1] = -n[2]*n[1]*cfactor; + dnhatdn[0][2] = -n[0]*n[2]*cfactor; + dnhatdn[1][2] = -n[1]*n[2]*cfactor; + dnhatdn[2][2] = (n[0]*n[0]+n[1]*n[1])*cfactor; +} inline double normalize_factor(double *n) { double nnorm = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); @@ -441,7 +496,7 @@ inline double normalize_factor(double *n) Yet another normal calculation method for simpiler code. */ template -void PairILPGrapheneHBNOpt::calc_normal(int i, int *ILP_neigh, int nneigh, double *n, +void PairILPGrapheneHBNOpt::calc_atom_normal(int i, int itype, int *ILP_neigh, int nneigh, double *n, double (*dnormdri)[3], double (*dnormdrk)[3][3]) { double **x = atom->x; @@ -475,6 +530,32 @@ void PairILPGrapheneHBNOpt::calc_normal(int i, int *ILP_neigh, int nneigh, doubl vet[jj][2] = x[j][2] - x[i][2]; } + //specialize for AIP_WATER_2DM for hydrogen has special normal vector rule + if (variant == AIP_WATER_2DM && special_type[itype] == WATER) { + if (nneigh == 1){ + n[0] = vet[0][0]; + n[1] = vet[0][1]; + n[2] = vet[0][2]; + + double rnnorm = normalize_factor(n); + + deriv_hat(dnormdri, n, rnnorm, -1.0); + deriv_hat(dnormdrk[0], n, rnnorm, 1.0); + + } else if (nneigh == 2){ + n[0] = (vet[0][0] + vet[1][0])*0.5; + n[1] = (vet[0][1] + vet[1][1])*0.5; + n[2] = (vet[0][2] + vet[1][2])*0.5; + double rnnorm = normalize_factor(n); + + deriv_hat(dnormdri, n, rnnorm, -1.0); + deriv_hat(dnormdrk[0], n, rnnorm, 0.5); + deriv_hat(dnormdrk[1], n, rnnorm, 0.5); + } else { + error->one(FLERR, "malformed water"); + } + return; + } if (nneigh <= 1) { n[0] = 0.0; n[1] = 0.0; diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.h b/src/OPT/pair_ilp_graphene_hbn_opt.h index 0721014e00..01b66bb2fa 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.h +++ b/src/OPT/pair_ilp_graphene_hbn_opt.h @@ -35,7 +35,7 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { protected: void update_internal_list(); template - void calc_normal(int i, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], + void calc_atom_normal(int i, int itype, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], double (*dnormdrk)[3][3]); template void eval(); @@ -44,6 +44,14 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { int *special_type; int *num_intra, *num_inter, *num_vdw; int inum_max, jnum_max; + + enum special_type_const { + NOT_SPECIAL = 0, + TMD_METAL, + SAIP_BNCH, + WATER, + }; + }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_ilp_tmd_opt.cpp b/src/OPT/pair_ilp_tmd_opt.cpp index 834f2a0c9f..3fa95b7e10 100644 --- a/src/OPT/pair_ilp_tmd_opt.cpp +++ b/src/OPT/pair_ilp_tmd_opt.cpp @@ -23,7 +23,7 @@ e-mail: qdgaoping at gmail dot com Optimizations are described in: - Gao, Ping and Duan, Xiaohui, et al: + Gao, Ping and Duan, Xiaohui, et al.: LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors DOI: 10.1145/3458817.3476137 diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index 8e4f8557a2..c2ba34c4c2 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -365,7 +365,7 @@ void DynamicalMatrix::calculateMatrix() 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"); } /* ---------------------------------------------------------------------- diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index 4a8948de77..c31aae0086 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -412,7 +412,7 @@ void ThirdOrder::calculateMatrix() delete [] dynmat; delete [] fdynmat; - if (screen && me ==0) + if (screen && me == 0) fprintf(screen,"Finished Calculating Third Order Tensor\n"); } diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index c8112ca24d..394ce69d22 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -143,7 +143,8 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : FixQEq::~FixQEq() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); memory->destroy(s_hist); memory->destroy(t_hist); diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 784c163f70..d124b06dc2 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -131,6 +131,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; rxnID = 0; + cuff = 1; maxnconstraints = 0; narrhenius = 0; status = PROCEED; @@ -250,8 +251,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(ghostly_rxn_count,nreacts,"bond/react:ghostly_rxn_count"); memory->create(reaction_count_total,nreacts,"bond/react:reaction_count_total"); + rescale_charges_anyflag = 0; for (int i = 0; i < nreacts; i++) { - fraction[i] = 1; + fraction[i] = 1.0; seed[i] = 12345; max_rxn[i] = INT_MAX; for (int j = 0; j < 3; j++) @@ -261,7 +263,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : rescale_charges_flag[i] = 0; create_atoms_flag[i] = 0; modify_create_fragid[i] = -1; - overlapsq[i] = 0; + overlapsq[i] = 0.0; molecule_keyword[i] = OFF; nconstraints[i] = 0; // set default limit duration to 60 timesteps @@ -388,8 +390,16 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'rescale_charges' has too few arguments"); if (strcmp(arg[iarg+1],"no") == 0) rescale_charges_flag[rxn] = 0; //default - else if (strcmp(arg[iarg+1],"yes") == 0) rescale_charges_flag[rxn] = 1; - else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); + else if (strcmp(arg[iarg+1],"yes") == 0) { + if (!atom->q_flag) error->all(FLERR,"Illegal fix bond/react command: cannot use " + "'rescale_charges' without atomic charges enabled"); + twomol = atom->molecules[reacted_mol[rxn]]; + if (!twomol->qflag) error->all(FLERR,"Illegal fix bond/react command: cannot use " + "'rescale_charges' without Charges section in post-reaction template"); + rescale_charges_flag[rxn] = 1; // overloaded below to also indicate number of atoms to update + rescale_charges_anyflag = 1; + cuff = 2; // index shift for extra values carried around by mega_gloves + } else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); iarg += 2; } else if (strcmp(arg[iarg],"molecule") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " @@ -402,7 +412,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"modify_create") == 0) { if (iarg++ > narg) error->all(FLERR,"Illegal fix bond/react command: " "'modify_create' has too few arguments"); - while (iarg < narg && strcmp(arg[iarg],"react") != 0 ) { + while (iarg < narg && strcmp(arg[iarg],"react") != 0) { if (strcmp(arg[iarg],"fit") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'modify_create' has too few arguments"); @@ -442,8 +452,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(delete_atoms,max_natoms,nreacts,"bond/react:delete_atoms"); memory->create(create_atoms,max_natoms,nreacts,"bond/react:create_atoms"); memory->create(chiral_atoms,max_natoms,6,nreacts,"bond/react:chiral_atoms"); + memory->create(mol_total_charge,nreacts,"bond/react:mol_total_charge"); for (int j = 0; j < nreacts; j++) { + mol_total_charge[j] = 0.0; for (int i = 0; i < max_natoms; i++) { edge[i][j] = 0; custom_charges[i][j] = 1; // update all partial charges by default @@ -483,6 +495,21 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (custom_charges_fragid[i] >= 0) CustomCharges(custom_charges_fragid[i],i); } + // charge rescaling values must be calculated after calling CustomCharges + for (int myrxn = 0; myrxn < nreacts; myrxn++) { + if (rescale_charges_flag[myrxn]) { + rescale_charges_flag[myrxn] = 0; // will now store number of updated atoms + twomol = atom->molecules[reacted_mol[myrxn]]; + for (int j = 0; j < twomol->natoms; j++) { + int jj = equivalences[j][1][myrxn]-1; + if (custom_charges[jj][myrxn] == 1 && delete_atoms[jj][myrxn] == 0) { + mol_total_charge[myrxn] += twomol->q[j]; + rescale_charges_flag[myrxn]++; + } + } + } + } + // get the names of per-atom variables needed by 'rxn' functions of custom constraint customvarnames(); @@ -605,6 +632,7 @@ FixBondReact::~FixBondReact() memory->destroy(delete_atoms); memory->destroy(create_atoms); memory->destroy(chiral_atoms); + memory->destroy(mol_total_charge); if (vvec != nullptr) memory->destroy(vvec); memory->destroy(rxn_name); @@ -1282,11 +1310,11 @@ void FixBondReact::superimpose_algorithm() memory->create(restore_pt,MAXGUESS,4,"bond/react:restore_pt"); memory->create(pioneers,max_natoms,"bond/react:pioneers"); memory->create(restore,max_natoms,MAXGUESS*4,"bond/react:restore"); - memory->create(my_mega_glove,max_natoms+1,allnattempt,"bond/react:local_mega_glove"); + memory->create(my_mega_glove,max_natoms+cuff,allnattempt,"bond/react:my_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) + for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < allnattempt; j++) - my_mega_glove[i][j] = 0; + my_mega_glove[i][j] = 0.0; attempted_rxn = 1; @@ -1336,9 +1364,10 @@ void FixBondReact::superimpose_algorithm() status = REJECT; } else { status = ACCEPT; - my_mega_glove[0][my_num_mega] = rxnID; + my_mega_glove[0][my_num_mega] = (double) rxnID; + if (rescale_charges_flag[rxnID]) my_mega_glove[1][my_num_mega] = get_totalcharge(); for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+1][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } my_num_mega++; } @@ -1365,7 +1394,7 @@ void FixBondReact::superimpose_algorithm() } for (int i = 0; i < onemol->natoms; i++) { - if (glove[i][0] !=0 && pioneer_count[i] < onemol_nxspecial[i][0] && edge[i][rxnID] == 0) { + if (glove[i][0] != 0 && pioneer_count[i] < onemol_nxspecial[i][0] && edge[i][rxnID] == 0) { pioneers[i] = 1; } } @@ -1384,9 +1413,10 @@ void FixBondReact::superimpose_algorithm() if (fraction[rxnID] < 1.0 && random[rxnID]->uniform() >= fraction[rxnID]) status = REJECT; else { - my_mega_glove[0][my_num_mega] = rxnID; + my_mega_glove[0][my_num_mega] = (double) rxnID; + if (rescale_charges_flag[rxnID]) my_mega_glove[1][my_num_mega] = get_totalcharge(); for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+1][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } my_num_mega++; } @@ -1405,13 +1435,13 @@ void FixBondReact::superimpose_algorithm() global_megasize = 0; - memory->create(local_mega_glove,max_natoms+1,my_num_mega,"bond/react:local_mega_glove"); - memory->create(ghostly_mega_glove,max_natoms+1,my_num_mega,"bond/react:ghostly_mega_glove"); + memory->create(local_mega_glove,max_natoms+cuff,my_num_mega,"bond/react:local_mega_glove"); + memory->create(ghostly_mega_glove,max_natoms+cuff,my_num_mega,"bond/react:ghostly_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) { + for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < my_num_mega; j++) { - local_mega_glove[i][j] = 0; - ghostly_mega_glove[i][j] = 0; + local_mega_glove[i][j] = 0.0; + ghostly_mega_glove[i][j] = 0.0; } } @@ -1807,7 +1837,7 @@ void FixBondReact::inner_crosscheck_loop() for (int i=1; i < num_choices; ++i) { tagint hold = tag_choices[i]; int j = i - 1; - while ((j >=0) && (tag_choices[j] > hold)) { + while ((j >= 0) && (tag_choices[j] > hold)) { tag_choices[j+1] = tag_choices[j]; --j; } @@ -2186,6 +2216,24 @@ double FixBondReact::get_temperature(tagint **myglove, int row_offset, int col) return t; } +/* ---------------------------------------------------------------------- +compute sum of partial charges in rxn site, for updated atoms +note: currently uses global rxnID and onemol variables +------------------------------------------------------------------------- */ + +double FixBondReact::get_totalcharge() +{ + int j,jj; + double *q = atom->q; + double sim_total_charge = 0.0; + for (j = 0; j < onemol->natoms; j++) { + jj = equivalences[j][1][rxnID]-1; + if (custom_charges[jj][rxnID] == 1) + sim_total_charge += q[atom->map(glove[jj][1])]; + } + return sim_total_charge; +} + /* ---------------------------------------------------------------------- get per-atom variable names used by custom constraint ------------------------------------------------------------------------- */ @@ -2673,18 +2721,18 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) dedup_size = global_megasize; } - tagint **dedup_glove; - memory->create(dedup_glove,max_natoms+1,dedup_size,"bond/react:dedup_glove"); + double **dedup_glove; + memory->create(dedup_glove,max_natoms+cuff,dedup_size,"bond/react:dedup_glove"); if (dedup_mode == LOCAL) { for (int i = 0; i < dedup_size; i++) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = my_mega_glove[j][i]; } } } else if (dedup_mode == GLOBAL) { for (int i = 0; i < dedup_size; i++) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = global_mega_glove[j][i]; } } @@ -2700,16 +2748,16 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) // let's randomly mix up our reaction instances first // then we can feel okay about ignoring ones we've already deleted (or accepted) // based off std::shuffle - int *temp_rxn = new int[max_natoms+1]; + double *temp_rxn = new double[max_natoms+cuff]; for (int i = dedup_size-1; i > 0; --i) { //dedup_size // choose random entry to swap current one with int k = floor(random[0]->uniform()*(i+1)); // swap entries - for (int j = 0; j < max_natoms+1; j++) + for (int j = 0; j < max_natoms+cuff; j++) temp_rxn[j] = dedup_glove[j][i]; - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = dedup_glove[j][k]; dedup_glove[j][k] = temp_rxn[j]; } @@ -2721,13 +2769,13 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int myrxnid1 = dedup_glove[0][i]; onemol = atom->molecules[unreacted_mol[myrxnid1]]; for (int j = 0; j < onemol->natoms; j++) { - int check1 = dedup_glove[j+1][i]; + int check1 = dedup_glove[j+cuff][i]; for (int ii = i + 1; ii < dedup_size; ii++) { if (dedup_mask[ii] == 0) { int myrxnid2 = dedup_glove[0][ii]; twomol = atom->molecules[unreacted_mol[myrxnid2]]; for (int jj = 0; jj < twomol->natoms; jj++) { - int check2 = dedup_glove[jj+1][ii]; + int check2 = dedup_glove[jj+cuff][ii]; if (check2 == check1) { dedup_mask[ii] = 1; break; @@ -2745,7 +2793,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int my_new_megasize = 0; for (int i = 0; i < my_num_mega; i++) { if (dedup_mask[i] == 0) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { my_mega_glove[j][my_new_megasize] = dedup_glove[j][i]; } my_new_megasize++; @@ -2760,8 +2808,8 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int new_global_megasize = 0; for (int i = 0; i < global_megasize; i++) { if (dedup_mask[i] == 0) { - ghostly_rxn_count[dedup_glove[0][i]]++; - for (int j = 0; j < max_natoms + 1; j++) { + ghostly_rxn_count[(int) dedup_glove[0][i]]++; + for (int j = 0; j < max_natoms + cuff; j++) { global_mega_glove[j][new_global_megasize] = dedup_glove[j][i]; } new_global_megasize++; @@ -2830,7 +2878,7 @@ void FixBondReact::glove_ghostcheck() local_rxn_count[i] = 0; for (int i = 0; i < my_num_mega; i++) { - rxnID = my_mega_glove[0][i]; + rxnID = (int) my_mega_glove[0][i]; onemol = atom->molecules[unreacted_mol[rxnID]]; int ghostly = 0; #if !defined(MPI_STUBS) @@ -2839,7 +2887,7 @@ void FixBondReact::glove_ghostcheck() ghostly = 1; } else { for (int j = 0; j < onemol->natoms; j++) { - int ilocal = atom->map(my_mega_glove[j+1][i]); + int ilocal = atom->map((tagint) my_mega_glove[j+cuff][i]); if (ilocal >= atom->nlocal || localsendlist[ilocal] == 1) { ghostly = 1; break; @@ -2852,15 +2900,13 @@ void FixBondReact::glove_ghostcheck() #endif if (ghostly == 1) { - ghostly_mega_glove[0][ghostly_num_mega] = rxnID; - for (int j = 0; j < onemol->natoms+1; j++) { + for (int j = 0; j < onemol->natoms+cuff; j++) { ghostly_mega_glove[j][ghostly_num_mega] = my_mega_glove[j][i]; } ghostly_num_mega++; } else { - local_mega_glove[0][local_num_mega] = rxnID; local_rxn_count[rxnID]++; - for (int j = 0; j < onemol->natoms+1; j++) { + for (int j = 0; j < onemol->natoms+cuff; j++) { local_mega_glove[j][local_num_mega] = my_mega_glove[j][i]; } local_num_mega++; @@ -2899,23 +2945,23 @@ void FixBondReact::ghost_glovecast() } MPI_Allgather(&start, 1, MPI_INT, allstarts, 1, MPI_INT, world); MPI_Datatype columnunsized, column; - int sizes[2] = {max_natoms+1, global_megasize}; - int subsizes[2] = {max_natoms+1, 1}; + int sizes[2] = {max_natoms+cuff, global_megasize}; + int subsizes[2] = {max_natoms+cuff, 1}; int starts[2] = {0,0}; MPI_Type_create_subarray (2, sizes, subsizes, starts, MPI_ORDER_C, - MPI_LMP_TAGINT, &columnunsized); - MPI_Type_create_resized (columnunsized, 0, sizeof(tagint), &column); + MPI_DOUBLE, &columnunsized); + MPI_Type_create_resized (columnunsized, 0, sizeof(double), &column); MPI_Type_commit(&column); memory->destroy(global_mega_glove); - memory->create(global_mega_glove,max_natoms+1,global_megasize,"bond/react:global_mega_glove"); + memory->create(global_mega_glove,max_natoms+cuff,global_megasize,"bond/react:global_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) + for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < global_megasize; j++) global_mega_glove[i][j] = 0; if (ghostly_num_mega > 0) { - for (int i = 0; i < max_natoms+1; i++) { + for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < ghostly_num_mega; j++) { global_mega_glove[i][j+start] = ghostly_mega_glove[i][j]; } @@ -3006,7 +3052,12 @@ void FixBondReact::update_everything() int update_num_mega; tagint **update_mega_glove; - memory->create(update_mega_glove,max_natoms+1,MAX(local_num_mega,global_megasize),"bond/react:update_mega_glove"); + // for now, keeping rxnID in update_mega_glove, but not rest of cuff in update_mega_glove + int maxmega = MAX(local_num_mega,global_megasize); + memory->create(update_mega_glove,max_natoms+1,maxmega,"bond/react:update_mega_glove"); + + double *sim_total_charges; + if (rescale_charges_anyflag) memory->create(sim_total_charges,maxmega,"bond/react:sim_total_charges"); for (int pass = 0; pass < 2; pass++) { update_num_mega = 0; @@ -3014,15 +3065,20 @@ void FixBondReact::update_everything() for (int i = 0; i < nreacts; i++) iskip[i] = 0; if (pass == 0) { for (int i = 0; i < local_num_mega; i++) { - rxnID = local_mega_glove[0][i]; + rxnID = (int) local_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nlocalskips[rxnID]) continue; + // this will be overwritten if reaction skipped by create_atoms below + update_mega_glove[0][update_num_mega] = (tagint) local_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = (tagint) local_mega_glove[j+cuff][i]; + // atoms inserted here for serial MPI_STUBS build only if (create_atoms_flag[rxnID] == 1) { onemol = atom->molecules[unreacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]]; - if (insert_atoms(local_mega_glove,i)) { + if (insert_atoms(update_mega_glove,update_num_mega)) { inserted_atoms_flag = 1; } else { // create aborted reaction_count_total[rxnID]--; @@ -3030,23 +3086,27 @@ void FixBondReact::update_everything() } } - for (int j = 0; j < max_natoms+1; j++) - update_mega_glove[j][update_num_mega] = local_mega_glove[j][i]; + if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = local_mega_glove[1][i]; update_num_mega++; } } else if (pass == 1) { for (int i = 0; i < global_megasize; i++) { - rxnID = global_mega_glove[0][i]; + rxnID = (int) global_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nghostlyskips[rxnID]) continue; + // this will be overwritten if reaction skipped by create_atoms below + update_mega_glove[0][update_num_mega] = (tagint) global_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = (tagint) global_mega_glove[j+cuff][i]; + // we can insert atoms here, now that reactions are finalized // can't do it any earlier, due to skipped reactions (max_rxn) // for MPI build, reactions that create atoms are always treated as 'global' if (create_atoms_flag[rxnID] == 1) { onemol = atom->molecules[unreacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]]; - if (insert_atoms(global_mega_glove,i)) { + if (insert_atoms(update_mega_glove,update_num_mega)) { inserted_atoms_flag = 1; } else { // create aborted reaction_count_total[rxnID]--; @@ -3054,8 +3114,7 @@ void FixBondReact::update_everything() } } - for (int j = 0; j < max_natoms+1; j++) - update_mega_glove[j][update_num_mega] = global_mega_glove[j][i]; + if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = global_mega_glove[1][i]; update_num_mega++; } } @@ -3090,38 +3149,18 @@ void FixBondReact::update_everything() } } - // get charge rescale delta - double charge_rescale_addend = 0; - if (rescale_charges_flag[rxnID] == 1) { - double sim_total_charge = 0; - double mol_total_charge = 0; - int n_custom_charge = 0; - for (int i = 0; i < update_num_mega; i++) { - rxnID = update_mega_glove[0][i]; - twomol = atom->molecules[reacted_mol[rxnID]]; - for (int j = 0; j < twomol->natoms; j++) { - int jj = equivalences[j][1][rxnID]-1; - if (atom->map(update_mega_glove[jj+1][i]) >= 0 && - atom->map(update_mega_glove[jj+1][i]) < nlocal) { - if (landlocked_atoms[j][rxnID] == 1) - type[atom->map(update_mega_glove[jj+1][i])] = twomol->type[j]; - if (twomol->qflag && atom->q_flag && custom_charges[jj][rxnID] == 1) { - double *q = atom->q; - sim_total_charge += q[atom->map(update_mega_glove[jj+1][i])]; - mol_total_charge += twomol->q[j]; - n_custom_charge++; - } - } - } - } - charge_rescale_addend = (sim_total_charge-mol_total_charge)/n_custom_charge; - } - // update charges and types of landlocked atoms // also keep track of 'stabilization' groups here + int n_custom_charge; + double charge_rescale_addend; for (int i = 0; i < update_num_mega; i++) { + charge_rescale_addend = 0; rxnID = update_mega_glove[0][i]; twomol = atom->molecules[reacted_mol[rxnID]]; + if (rescale_charges_flag[rxnID]) { + n_custom_charge = rescale_charges_flag[rxnID]; + charge_rescale_addend = (sim_total_charges[i]-mol_total_charge[rxnID])/n_custom_charge; + } for (int j = 0; j < twomol->natoms; j++) { int jj = equivalences[j][1][rxnID]-1; int ilocal = atom->map(update_mega_glove[jj+1][i]); @@ -3555,6 +3594,7 @@ void FixBondReact::update_everything() } memory->destroy(update_mega_glove); + if (rescale_charges_anyflag) memory->destroy(sim_total_charges); // delete atoms. taken from fix_evaporate. but don't think it needs to be in pre_exchange // loop in reverse order to avoid copying marked atoms @@ -3643,7 +3683,7 @@ void FixBondReact::update_everything() insert created atoms ------------------------------------------------------------------------- */ -int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) +int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate) { // inserting atoms based off fix_deposit->pre_exchange int flag; @@ -3692,14 +3732,15 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) n2superpose++; } - int ifit = atom->map(my_mega_glove[ibonding[rxnID]+1][iupdate]); // use this local ID to find fitting proc + int ifit = atom->map(my_update_mega_glove[ibonding[rxnID]+1][iupdate]); // use this local ID to find fitting proc Superpose3D superposer(n2superpose); int fitroot = 0; if (ifit >= 0 && ifit < atom->nlocal) { fitroot = comm->me; // get 'temperatere' averaged over site, used for created atoms' vels - t = get_temperature(my_mega_glove,1,iupdate); + // note: row_offset for my_update_mega_glove is unity, not 'cuff' + t = get_temperature(my_update_mega_glove,1,iupdate); double **xfrozen; // coordinates for the "frozen" target molecule double **xmobile; // coordinates for the "mobile" molecule @@ -3713,12 +3754,12 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) if (!twomol->fragmentmask[modify_create_fragid[rxnID]][j]) continue; int ipre = equivalences[j][1][rxnID]-1; // equiv pre-reaction template index if (!create_atoms[j][rxnID] && !delete_atoms[ipre][rxnID]) { - if (atom->map(my_mega_glove[ipre+1][iupdate]) < 0) { + if (atom->map(my_update_mega_glove[ipre+1][iupdate]) < 0) { error->warning(FLERR," eligible atoms skipped for created-atoms fit on rank {}\n", comm->me); continue; } - iatom = atom->map(my_mega_glove[ipre+1][iupdate]); + iatom = atom->map(my_update_mega_glove[ipre+1][iupdate]); if (iref == -1) iref = iatom; iatom = domain->closest_image(iref,iatom); for (int k = 0; k < 3; k++) { @@ -3838,7 +3879,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) atom->tag[n] = maxtag_all + add_count; // locally update mega_glove - my_mega_glove[preID][iupdate] = atom->tag[n]; + my_update_mega_glove[preID][iupdate] = atom->tag[n]; if (atom->molecule_flag) { if (twomol->moleculeflag) { @@ -3866,7 +3907,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) } // globally update mega_glove and equivalences MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world); - MPI_Bcast(&my_mega_glove[preID][iupdate],1,MPI_LMP_TAGINT,root,world); + MPI_Bcast(&my_update_mega_glove[preID][iupdate],1,MPI_LMP_TAGINT,root,world); equivalences[m][0][rxnID] = m+1; equivalences[m][1][rxnID] = preID; reverse_equiv[preID-1][0][rxnID] = preID; diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 66a5e4d6a0..534261e11d 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -71,7 +71,9 @@ class FixBondReact : public Fix { int **store_rxn_count; int *stabilize_steps_flag; int *custom_charges_fragid; - int *rescale_charges_flag; + int *rescale_charges_flag; // if nonzero, indicates number of atoms whose charges are updated + int rescale_charges_anyflag; // indicates if any reactions do charge rescaling + double *mol_total_charge; // sum of charges of post-reaction atoms whose charges are updated int *create_atoms_flag; int *modify_create_fragid; double *overlapsq; @@ -156,10 +158,12 @@ class FixBondReact : public Fix { int lcl_inst; // reaction instance tagint **glove; // 1st colmn: pre-reacted template, 2nd colmn: global IDs // for all mega_gloves: first row is the ID of bond/react - tagint **my_mega_glove; // local + ghostly reaction instances - tagint **local_mega_glove; // consolidation of local reaction instances - tagint **ghostly_mega_glove; // consolidation of nonlocal reaction instances - tagint **global_mega_glove; // consolidation (inter-processor) of gloves + // 'cuff' leaves room for additional values carried around + int cuff; // default = 1, w/ rescale_charges_flag = 2 + double **my_mega_glove; // local + ghostly reaction instances + double **local_mega_glove; // consolidation of local reaction instances + double **ghostly_mega_glove; // consolidation of nonlocal reaction instances + double **global_mega_glove; // consolidation (inter-processor) of gloves // containing nonlocal atoms int *localsendlist; // indicates ghosts of other procs @@ -191,6 +195,7 @@ class FixBondReact : public Fix { int check_constraints(); void get_IDcoords(int, int, double *); double get_temperature(tagint **, int, int); + double get_totalcharge(); void customvarnames(); // get per-atom variables names used by custom constraint void get_customvars(); // evaluate local values for variables names used by custom constraint double custom_constraint(const std::string &); // evaulate expression for custom constraint diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 704b43e642..554b911151 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -404,9 +404,15 @@ void FixQEqReaxFF::init() efield->init(); if (strcmp(update->unit_style,"real") != 0) error->all(FLERR,"Must use unit_style real with fix {} and external fields", style); - if (efield->varflag != FixEfield::CONSTANT) - error->all(FLERR,"Cannot (yet) use fix {} with variable efield", style); + if (efield->varflag == FixEfield::ATOM && efield->pstyle != FixEfield::ATOM) + error->all(FLERR,"Atom-style external electric field requires atom-style " + "potential variable when used with fix {}", style); + if (((efield->xstyle != FixEfield::CONSTANT) && domain->xperiodic) || + ((efield->ystyle != FixEfield::CONSTANT) && domain->yperiodic) || + ((efield->zstyle != FixEfield::CONSTANT) && domain->zperiodic)) + error->all(FLERR,"Must not have electric field component in direction of periodic " + "boundary when using charge equilibration with ReaxFF."); if (((fabs(efield->ex) > SMALL) && domain->xperiodic) || ((fabs(efield->ey) > SMALL) && domain->yperiodic) || ((fabs(efield->ez) > SMALL) && domain->zperiodic)) @@ -1101,26 +1107,36 @@ void FixQEqReaxFF::get_chi_field() // efield energy is in real units of kcal/mol/angstrom, need to convert to eV - const double factor = -1.0/force->qe2f; + const double qe2f = force->qe2f; + const double factor = -1.0/qe2f; + + + if (efield->varflag != FixEfield::CONSTANT) + efield->update_efield_variables(); - // currently we only support constant efield // atom selection is for the group of fix efield - if (efield->varflag == FixEfield::CONSTANT) { - double unwrap[3]; - const double fx = efield->ex; - const double fy = efield->ey; - const double fz = efield->ez; - const int efgroupbit = efield->groupbit; + double unwrap[3]; + const double ex = efield->ex; + const double ey = efield->ey; + const double ez = efield->ez; + const int efgroupbit = efield->groupbit; // charge interactions // force = qE, potential energy = F dot x in unwrapped coords - + if (efield->varflag != FixEfield::ATOM) { for (int i = 0; i < nlocal; i++) { if (mask[i] & efgroupbit) { if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; domain->unmap(x[i],image[i],unwrap); - chi_field[i] = factor*(fx*unwrap[0] + fy*unwrap[1] + fz*unwrap[2]); + chi_field[i] = factor*(ex*unwrap[0] + ey*unwrap[1] + ez*unwrap[2]); + } + } + } else { // must use atom-style potential from FixEfield + for (int i = 0; i < nlocal; i++) { + if (mask[i] & efgroupbit) { + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + chi_field[i] = -efield->efield[i][3]; } } } diff --git a/src/REAXFF/fix_reaxff_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp index 393e22930f..8bd7ed0020 100644 --- a/src/REAXFF/fix_reaxff_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -295,7 +295,7 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, MPI_Isend(&buf[0],nbuf_local,MPI_DOUBLE,0,0,world,&irequest2); MPI_Wait(&irequest2,MPI_STATUS_IGNORE); } - if (me ==0) fputs("# \n",fp); + if (me == 0) fputs("# \n",fp); } diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 92bca99ae0..8fa06cafb3 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -48,15 +48,16 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_reaxff_species_delete[] = - "fix reaxff/species, 'delete' keyword: https://doi.org/10.1016/j.carbon.2022.11.002\n\n" - "@Article{Gissinger23,\n" - " author = {J. R. Gissinger, S. R. Zavada, J. G. Smith, J. Kemppainen, I. Gallegos, G. M. Odegard, E. J. Siochi, K. E. Wise},\n" - " title = {Predicting char yield of high-temperature resins},\n" - " journal = {Carbon},\n" - " year = 2023,\n" - " volume = 202,\n" - " pages = {336-347}\n" - "}\n\n"; + "fix reaxff/species, 'delete' keyword: https://doi.org/10.1016/j.carbon.2022.11.002\n\n" + "@Article{Gissinger23,\n" + " author = {J. R. Gissinger, S. R. Zavada, J. G. Smith, J. Kemppainen, I. Gallegos, G. M. " + "Odegard, E. J. Siochi, K. E. Wise},\n" + " title = {Predicting char yield of high-temperature resins},\n" + " journal = {Carbon},\n" + " year = 2023,\n" + " volume = 202,\n" + " pages = {336-347}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -148,13 +149,11 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : setupflag = 0; // set default bond order cutoff - int itype, jtype; - double bo_cut; - bg_cut = 0.30; + double bo_cut = 0.30; int np1 = ntypes + 1; memory->create(BOCut, np1, np1, "reaxff/species:BOCut"); for (int i = 1; i < np1; i++) - for (int j = 1; j < np1; j++) BOCut[i][j] = bg_cut; + for (int j = 1; j < np1; j++) BOCut[i][j] = bo_cut; // optional args eletype = nullptr; @@ -172,16 +171,19 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : // set BO cutoff if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 4 > narg) utils::missing_cmd_args(FLERR, "fix reaxff/species cutoff", error); - itype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - jtype = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[iarg + 1], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[iarg + 2], 1, atom->ntypes, jlo, jhi, error); bo_cut = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - if ((itype <= 0) || (jtype <= 0) || (itype > ntypes) || (jtype > ntypes)) - error->all(FLERR, "Fix reaxff/species cutoff atom type(s) out of range"); if ((bo_cut > 1.0) || (bo_cut < 0.0)) error->all(FLERR, "Fix reaxff/species invalid cutoff value: {}", bo_cut); - BOCut[itype][jtype] = bo_cut; - BOCut[jtype][itype] = bo_cut; + for (int i = ilo; i <= ihi; ++i) { + for (int j = MAX(jlo, i); j <= jhi; ++j) { + BOCut[i][j] = bo_cut; + BOCut[j][i] = bo_cut; + } + } iarg += 4; // modify element type names @@ -240,17 +242,21 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Unknown fix reaxff/species delete option: {}", arg[iarg]); // rate limit when deleting molecules } else if (strcmp(arg[iarg], "delete_rate_limit") == 0) { - if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "fix reaxff/species delete_rate_limit", error); + if (iarg + 3 > narg) + utils::missing_cmd_args(FLERR, "fix reaxff/species delete_rate_limit", error); delete_Nlimit_varid = -1; - if (strncmp(arg[iarg+1],"v_",2) == 0) { - delete_Nlimit_varname = &arg[iarg+1][2]; + if (strncmp(arg[iarg + 1], "v_", 2) == 0) { + delete_Nlimit_varname = &arg[iarg + 1][2]; delete_Nlimit_varid = input->variable->find(delete_Nlimit_varname.c_str()); if (delete_Nlimit_varid < 0) - error->all(FLERR,"Fix reaxff/species: Variable name {} does not exist",delete_Nlimit_varname); + error->all(FLERR, "Fix reaxff/species: Variable name {} does not exist", + delete_Nlimit_varname); if (!input->variable->equalstyle(delete_Nlimit_varid)) - error->all(FLERR,"Fix reaxff/species: Variable {} is not equal-style",delete_Nlimit_varname); - } else delete_Nlimit = utils::numeric(FLERR, arg[iarg+1], false, lmp); - delete_Nsteps = utils::numeric(FLERR, arg[iarg+2], false, lmp); + error->all(FLERR, "Fix reaxff/species: Variable {} is not equal-style", + delete_Nlimit_varname); + } else + delete_Nlimit = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + delete_Nsteps = utils::numeric(FLERR, arg[iarg + 2], false, lmp); iarg += 3; // position of molecules } else if (strcmp(arg[iarg], "position") == 0) { @@ -292,10 +298,9 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : if (delete_Nsteps > 0) { if (lmp->citeme) lmp->citeme->add(cite_reaxff_species_delete); - memory->create(delete_Tcount,delete_Nsteps,"reaxff/species:delete_Tcount"); + memory->create(delete_Tcount, delete_Nsteps, "reaxff/species:delete_Tcount"); - for (int i = 0; i < delete_Nsteps; i++) - delete_Tcount[i] = -1; + for (int i = 0; i < delete_Nsteps; i++) delete_Tcount[i] = -1; delete_Tcount[0] = 0; } @@ -393,9 +398,11 @@ void FixReaxFFSpecies::init() if (delete_Nsteps > 0) { delete_Nlimit_varid = input->variable->find(delete_Nlimit_varname.c_str()); if (delete_Nlimit_varid < 0) - error->all(FLERR,"Fix reaxff/species: Variable name {} does not exist",delete_Nlimit_varname); + error->all(FLERR, "Fix reaxff/species: Variable name {} does not exist", + delete_Nlimit_varname); if (!input->variable->equalstyle(delete_Nlimit_varid)) - error->all(FLERR,"Fix reaxff/species: Variable {} is not equal-style",delete_Nlimit_varname); + error->all(FLERR, "Fix reaxff/species: Variable {} is not equal-style", + delete_Nlimit_varname); } } @@ -427,8 +434,7 @@ void FixReaxFFSpecies::Output_ReaxFF_Bonds(bigint ntimestep, FILE * /*fp*/) if (ntimestep != nvalid) { // push back delete_Tcount on every step if (delete_Nsteps > 0) - for (int i = delete_Nsteps-1; i > 0; i--) - delete_Tcount[i] = delete_Tcount[i-1]; + for (int i = delete_Nsteps - 1; i > 0; i--) delete_Tcount[i] = delete_Tcount[i - 1]; return; } @@ -732,31 +738,31 @@ void FixReaxFFSpecies::WriteFormulas(int Nmole, int Nspec) int i, j, itemp; bigint ntimestep = update->ntimestep; - fprintf(fp, "# Timestep No_Moles No_Specs "); + fprintf(fp, "# Timestep No_Moles No_Specs"); Nmoltype = 0; for (i = 0; i < Nspec; i++) nd[i] = CheckExistence(i, ntypes); for (i = 0; i < Nmoltype; i++) { + std::string molname; for (j = 0; j < ntypes; j++) { itemp = MolType[ntypes * i + j]; if (itemp != 0) { if (eletype) - fprintf(fp, "%s", eletype[j]); + molname += eletype[j]; else - fprintf(fp, "%c", ele[j]); - if (itemp != 1) fprintf(fp, "%d", itemp); + molname += ele[j]; + if (itemp != 1) molname += std::to_string(itemp); } } - fputs("\t", fp); + fmt::print(fp, " {:>11}", molname); } fputs("\n", fp); - fmt::print(fp, "{} {:11} {:11}\t", ntimestep, Nmole, Nspec); - - for (i = 0; i < Nmoltype; i++) fprintf(fp, " %d\t", NMol[i]); - fprintf(fp, "\n"); + fmt::print(fp, "{:>11} {:>11} {:>11}", ntimestep, Nmole, Nspec); + for (i = 0; i < Nmoltype; i++) fmt::print(fp, " {:>11}", NMol[i]); + fputs("\n", fp); } /* ---------------------------------------------------------------------- */ @@ -884,8 +890,8 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) int ndeletions; int headroom = -1; if (delete_Nsteps > 0) { - if (delete_Tcount[delete_Nsteps-1] == -1) return; - ndeletions = delete_Tcount[0] - delete_Tcount[delete_Nsteps-1]; + if (delete_Tcount[delete_Nsteps - 1] == -1) return; + ndeletions = delete_Tcount[0] - delete_Tcount[delete_Nsteps - 1]; if (delete_Nlimit_varid > -1) delete_Nlimit = input->variable->compute_equal(delete_Nlimit_varid); headroom = MAX(0, delete_Nlimit - ndeletions); @@ -925,13 +931,11 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) std::random_device rnd; std::minstd_rand park_rng(rnd()); int *molrange; - memory->create(molrange,Nmole,"reaxff/species:molrange"); - for (m = 0; m < Nmole; m++) - molrange[m] = m + 1; + memory->create(molrange, Nmole, "reaxff/species:molrange"); + for (m = 0; m < Nmole; m++) molrange[m] = m + 1; if (delete_Nsteps > 0) { // shuffle index when using rate_limit, in case order is biased - if (comm->me == 0) - std::shuffle(&molrange[0],&molrange[Nmole], park_rng); + if (comm->me == 0) std::shuffle(&molrange[0], &molrange[Nmole], park_rng); MPI_Bcast(&molrange[0], Nmole, MPI_INT, 0, world); } @@ -1060,11 +1064,9 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) } } - // push back delete_Tcount on every step if (delete_Nsteps > 0) { - for (i = delete_Nsteps-1; i > 0; i--) - delete_Tcount[i] = delete_Tcount[i-1]; + for (i = delete_Nsteps - 1; i > 0; i--) delete_Tcount[i] = delete_Tcount[i - 1]; delete_Tcount[0] += this_delete_Tcount; } diff --git a/src/REAXFF/fix_reaxff_species.h b/src/REAXFF/fix_reaxff_species.h index 27efa0f915..f711cdeb11 100644 --- a/src/REAXFF/fix_reaxff_species.h +++ b/src/REAXFF/fix_reaxff_species.h @@ -51,8 +51,6 @@ class FixReaxFFSpecies : public Fix { int *Mol2Spec; double *clusterID; AtomCoord *x0; - - double bg_cut; double **BOCut; std::vector del_species; diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp new file mode 100644 index 0000000000..7ba502d2e6 --- /dev/null +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -0,0 +1,1497 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Package FixPIMDLangevin + Purpose Path Integral Molecular Dynamics with Langevin Thermostat + + Yifan Li @ Princeton University (yifanl0716@gmail.com) + Current Features: + - Multi-processor parallelism for each bead + - White-noise Langevin thermostat + - Bussi-Zykova-Parrinello barostat (isotropic and anisotropic) + - Several quantum estimators + Futher plans: + - Triclinic barostat +------------------------------------------------------------------------- */ + +#include "fix_pimd_langevin.h" + +#include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "universe.h" +#include "update.h" +#include "utils.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +using MathConst::MY_PI; +using MathConst::THIRD; + +enum { NMPIMD }; +enum { PHYSICAL, NORMAL }; +enum { BAOAB, OBABO }; +enum { ISO, ANISO, TRICLINIC }; +enum { PILE_L }; +enum { MTTK, BZP }; +enum { NVE, NVT, NPH, NPT }; +enum { SINGLE_PROC, MULTI_PROC }; + +static std::map Barostats{{MTTK, "MTTK"}, {BZP, "BZP"}}; +static std::map Ensembles{{NVE, "NVE"}, {NVT, "NVT"}, {NPH, "NPH"}, {NPT, "NPT"}}; + +/* ---------------------------------------------------------------------- */ + +FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), mass(nullptr), plansend(nullptr), planrecv(nullptr), tagsend(nullptr), + tagrecv(nullptr), bufsend(nullptr), bufrecv(nullptr), bufbeads(nullptr), bufsorted(nullptr), + bufsortedall(nullptr), outsorted(nullptr), buftransall(nullptr), tagsendall(nullptr), + tagrecvall(nullptr), bufsendall(nullptr), bufrecvall(nullptr), counts(nullptr), + displacements(nullptr), lam(nullptr), M_x2xp(nullptr), M_xp2x(nullptr), M_f2fp(nullptr), + M_fp2f(nullptr), modeindex(nullptr), tau_k(nullptr), c1_k(nullptr), c2_k(nullptr), + _omega_k(nullptr), Lan_s(nullptr), Lan_c(nullptr), random(nullptr), xc(nullptr), xcall(nullptr), + x_unwrap(nullptr), id_pe(nullptr), id_press(nullptr), c_pe(nullptr), c_press(nullptr) +{ + restart_global = 1; + time_integrate = 1; + + ntotal = 0; + maxlocal = maxunwrap = maxxc = 0; + + sizeplan = 0; + + method = NMPIMD; + ensemble = NVT; + integrator = OBABO; + thermostat = PILE_L; + barostat = BZP; + fmass = 1.0; + np = universe->nworlds; + inverse_np = 1.0 / np; + sp = 1.0; + temp = 298.15; + Lan_temp = 298.15; + tau = 1.0; + tau_p = 1.0; + Pext = 1.0; + pdim = 0; + pilescale = 1.0; + tstat_flag = 1; + pstat_flag = 0; + mapflag = 1; + removecomflag = 1; + fmmode = PHYSICAL; + pstyle = ISO; + totenthalpy = 0.0; + + int seed = -1; + + for (int i = 0; i < 6; i++) { + p_flag[i] = 0; + p_target[i] = 0.0; + } + + for (int i = 3; i < narg - 1; i += 2) { + if (strcmp(arg[i], "method") == 0) { + if (strcmp(arg[i + 1], "nmpimd") == 0) + method = NMPIMD; + else + error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); + } else if (strcmp(arg[i], "integrator") == 0) { + if (strcmp(arg[i + 1], "obabo") == 0) + integrator = OBABO; + else if (strcmp(arg[i + 1], "baoab") == 0) + integrator = BAOAB; + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); + } else if (strcmp(arg[i], "ensemble") == 0) { + if (strcmp(arg[i + 1], "nve") == 0) { + ensemble = NVE; + tstat_flag = 0; + pstat_flag = 0; + } else if (strcmp(arg[i + 1], "nvt") == 0) { + ensemble = NVT; + tstat_flag = 1; + pstat_flag = 0; + } else if (strcmp(arg[i + 1], "nph") == 0) { + ensemble = NPH; + tstat_flag = 0; + pstat_flag = 1; + } else if (strcmp(arg[i + 1], "npt") == 0) { + ensemble = NPT; + tstat_flag = 1; + pstat_flag = 1; + } else + error->universe_all(FLERR, + "Unknown ensemble parameter for fix pimd/langevin. Only nve, nvt, nph, " + "and npt ensembles are supported!"); + } else if (strcmp(arg[i], "fmass") == 0) { + fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (fmass < 0.0 || fmass > np) + error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); + } else if (strcmp(arg[i], "sp") == 0) { + sp = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (sp < 0.0) error->universe_all(FLERR, "Invalid sp value for fix pimd/nvt"); + } else if (strcmp(arg[i], "fmmode") == 0) { + if (strcmp(arg[i + 1], "physical") == 0) + fmmode = PHYSICAL; + else if (strcmp(arg[i + 1], "normal") == 0) + fmmode = NORMAL; + else + error->universe_all(FLERR, + "Unknown fictitious mass mode for fix pimd/langevin. Only physical " + "mass and normal mode mass are supported!"); + } else if (strcmp(arg[i], "scale") == 0) { + pilescale = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (pilescale < 0.0) + error->universe_all(FLERR, "Invalid pile scale value for fix pimd/langevin"); + } else if (strcmp(arg[i], "temp") == 0) { + temp = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd/langevin"); + } else if (strcmp(arg[i], "lj") == 0) { + lj_epsilon = utils::numeric(FLERR, arg[i + 1], false, lmp); + lj_sigma = utils::numeric(FLERR, arg[i + 2], false, lmp); + lj_mass = utils::numeric(FLERR, arg[i + 3], false, lmp); + other_planck = utils::numeric(FLERR, arg[i + 4], false, lmp); + other_mvv2e = utils::numeric(FLERR, arg[i + 5], false, lmp); + i += 4; + } else if (strcmp(arg[i], "thermostat") == 0) { + if (strcmp(arg[i + 1], "PILE_L") == 0) { + thermostat = PILE_L; + seed = utils::inumeric(FLERR, arg[i + 2], false, lmp); + i++; + } + } else if (strcmp(arg[i], "tau") == 0) { + tau = utils::numeric(FLERR, arg[i + 1], false, lmp); + } else if (strcmp(arg[i], "barostat") == 0) { + if (strcmp(arg[i + 1], "MTTK") == 0) { + barostat = MTTK; + } else if (strcmp(arg[i + 1], "BZP") == 0) { + barostat = BZP; + } else + error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); + } else if (strcmp(arg[i], "iso") == 0) { + pstyle = ISO; + p_flag[0] = p_flag[1] = p_flag[2] = 1; + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); + p_target[0] = p_target[1] = p_target[2] = Pext; + pdim = 3; + } else if (strcmp(arg[i], "aniso") == 0) { + pstyle = ANISO; + p_flag[0] = p_flag[1] = p_flag[2] = 1; + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); + p_target[0] = p_target[1] = p_target[2] = Pext; + pdim = 3; + } else if (strcmp(arg[i], "x") == 0) { + pstyle = ANISO; + p_flag[0] = 1; + p_target[0] = utils::numeric(FLERR, arg[i + 1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "y") == 0) { + pstyle = ANISO; + p_flag[1] = 1; + p_target[1] = utils::numeric(FLERR, arg[i + 1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "z") == 0) { + pstyle = ANISO; + p_flag[2] = 1; + p_target[2] = utils::numeric(FLERR, arg[i + 1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "taup") == 0) { + tau_p = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (tau_p <= 0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd/langevin"); + } else if (strcmp(arg[i], "fixcom") == 0) { + if (strcmp(arg[i + 1], "yes") == 0) + removecomflag = 1; + else if (strcmp(arg[i + 1], "no") == 0) + removecomflag = 0; + } else { + error->universe_all(FLERR, fmt::format("Unknown keyword {} for fix {}", arg[i], style)); + } + } + + if (pstat_flag && !pdim) + error->universe_all( + FLERR, fmt::format("Must use pressure coupling with {} ensemble", Ensembles[ensemble])); + if (!pstat_flag && pdim) + error->universe_all( + FLERR, fmt::format("Must not use pressure coupling with {} ensemble", Ensembles[ensemble])); + + /* Initiation */ + + global_freq = 1; + vector_flag = 1; + if (!pstat_flag) { + size_vector = 10; + } else if (pstat_flag) { + if (pstyle == ISO) { + size_vector = 15; + } else if (pstyle == ANISO) { + size_vector = 17; + } + } + extvector = 1; + kt = force->boltz * temp; + if (pstat_flag) FixPIMDLangevin::baro_init(); + + // some initilizations + + id_pe = utils::strdup(std::string(id) + "_pimd_pe"); + modify->add_compute(std::string(id_pe) + " all pe"); + + id_press = utils::strdup(std::string(id) + "_pimd_press"); + modify->add_compute(std::string(id_press) + " all pressure thermo_temp virial"); + + vol0 = domain->xprd * domain->yprd * domain->zprd; + + 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]); + if (pstat_flag) p_hydro = (p_target[0] + p_target[1] + p_target[2]) / pdim; + + // initialize Marsaglia RNG with processor-unique seed + + if (tstat_flag) { + if (integrator == BAOAB || integrator == OBABO) { + Lan_temp = temp; + random = new RanMars(lmp, seed + universe->me); + } + } + + me = comm->me; + nprocs = comm->nprocs; + if (nprocs == 1) + cmode = SINGLE_PROC; + else + cmode = MULTI_PROC; + + nprocs_universe = universe->nprocs; + nreplica = universe->nworlds; + ireplica = universe->iworld; + + if (nreplica == 1) + mapflag = 0; + else + mapflag = 1; + + int *iroots = new int[nreplica]; + MPI_Group uworldgroup, rootgroup; + + for (int i = 0; i < nreplica; i++) iroots[i] = universe->root_proc[i]; + MPI_Comm_group(universe->uworld, &uworldgroup); + MPI_Group_incl(uworldgroup, nreplica, iroots, &rootgroup); + MPI_Comm_create(universe->uworld, rootgroup, &rootworld); + if (rootgroup != MPI_GROUP_NULL) MPI_Group_free(&rootgroup); + if (uworldgroup != MPI_GROUP_NULL) MPI_Group_free(&uworldgroup); + delete[] iroots; + + ntotal = atom->natoms; + if (atom->nmax > maxlocal) reallocate(); + if (atom->nmax > maxunwrap) reallocate_x_unwrap(); + if (atom->nmax > maxxc) reallocate_xc(); + memory->create(xcall, ntotal * 3, "FixPIMDLangevin:xcall"); + + if (cmode == SINGLE_PROC) { + memory->create(bufsorted, ntotal, 3, "FixPIMDLangevin:bufsorted"); + memory->create(outsorted, ntotal, 3, "FixPIMDLangevin:outsorted"); + memory->create(bufsortedall, nreplica * ntotal, 3, "FixPIMDLangevin:bufsortedall"); + memory->create(buftransall, nreplica * ntotal, 3, "FixPIMDLangevin:buftransall"); + memory->create(counts, nreplica, "FixPIMDLangevin:counts"); + memory->create(displacements, nreplica, "FixPIMDLangevin:displacements"); + } + + if ((cmode == MULTI_PROC) && (counts == nullptr)) { + memory->create(bufsendall, ntotal, 3, "FixPIMDLangevin:bufsendall"); + memory->create(bufrecvall, ntotal, 3, "FixPIMDLangevin:bufrecvall"); + memory->create(tagsendall, ntotal, "FixPIMDLangevin:tagsendall"); + memory->create(tagrecvall, ntotal, "FixPIMDLangevin:tagrecvall"); + memory->create(counts, nprocs, "FixPIMDLangevin:counts"); + memory->create(displacements, nprocs, "FixPIMDLangevin:displacements"); + } +} + +/* ---------------------------------------------------------------------- */ + +FixPIMDLangevin::~FixPIMDLangevin() +{ + modify->delete_compute(id_pe); + modify->delete_compute(id_press); + delete[] id_pe; + delete[] id_press; + delete random; + delete[] mass; + delete[] _omega_k; + delete[] Lan_c; + delete[] Lan_s; + delete[] tau_k; + delete[] c1_k; + delete[] c2_k; + delete[] plansend; + delete[] planrecv; + delete[] modeindex; + memory->destroy(xcall); + if (cmode == SINGLE_PROC) { + memory->destroy(bufsorted); + memory->destroy(outsorted); + memory->destroy(bufsortedall); + memory->destroy(buftransall); + memory->destroy(counts); + memory->destroy(displacements); + } + + if (cmode == MULTI_PROC) { + memory->destroy(bufsendall); + memory->destroy(bufrecvall); + memory->destroy(tagsendall); + memory->destroy(tagrecvall); + memory->destroy(counts); + memory->destroy(displacements); + } + memory->destroy(M_x2xp); + memory->destroy(M_xp2x); + memory->destroy(xc); + memory->destroy(x_unwrap); + memory->destroy(bufsend); + memory->destroy(bufrecv); + memory->destroy(tagsend); + memory->destroy(tagrecv); + memory->destroy(bufbeads); +} + +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::init() +{ + if (atom->map_style == Atom::MAP_NONE) + error->all(FLERR, "fix pimd/langevin requires an atom map, see atom_modify"); + + if (universe->me == 0 && universe->uscreen) + fprintf(universe->uscreen, "fix pimd/langevin initializing Path-Integral ...\n"); + + // prepare the constants + + masstotal = group->mass(igroup); + + double planck; + if (strcmp(update->unit_style, "lj") == 0) { + double planck_star = sqrt(lj_epsilon) * sqrt(lj_mass) * lj_sigma * sqrt(other_mvv2e); + planck = other_planck / planck_star; + } else { + planck = force->hplanck; + } + planck *= sp; + hbar = planck / (2.0 * MY_PI); + double beta = 1.0 / (force->boltz * temp); + double _fbond = 1.0 * np * np / (beta * beta * hbar * hbar); + + omega_np = np / (hbar * beta) * sqrt(force->mvv2e); + beta_np = 1.0 / force->boltz / temp * inverse_np; + fbond = _fbond * force->mvv2e; + + if ((universe->me == 0) && (universe->uscreen)) + fprintf(universe->uscreen, + "fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); + + if (integrator == OBABO) { + dtf = 0.5 * update->dt * force->ftm2v; + dtv = 0.5 * update->dt; + dtv2 = dtv * dtv; + dtv3 = THIRD * dtv2 * dtv * force->ftm2v; + } else if (integrator == BAOAB) { + dtf = 0.5 * update->dt * force->ftm2v; + dtv = 0.5 * update->dt; + dtv2 = dtv * dtv; + dtv3 = THIRD * dtv2 * dtv * force->ftm2v; + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } + + comm_init(); + + mass = new double[atom->ntypes + 1]; + + nmpimd_init(); + + langevin_init(); + + c_pe = modify->get_compute_by_id(id_pe); + c_press = modify->get_compute_by_id(id_press); + + t_prim = t_vir = t_cv = p_prim = p_vir = p_cv = p_md = 0.0; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::setup(int vflag) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + imageint *image = atom->image; + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); + } + + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + collect_xc(); + compute_spring_energy(); + compute_t_prim(); + compute_p_prim(); + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap_inv(x[i], image[i]); + } + + post_force(vflag); + compute_totke(); + end_of_step(); + c_pe->addstep(update->ntimestep + 1); + c_press->addstep(update->ntimestep + 1); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::initial_integrate(int /*vflag*/) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + imageint *image = atom->image; + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); + } + if (integrator == OBABO) { + if (tstat_flag) { + o_step(); + if (removecomflag) remove_com_motion(); + if (pstat_flag) press_o_step(); + } + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + qc_step(); + a_step(); + qc_step(); + a_step(); + } else if (integrator == BAOAB) { + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + qc_step(); + a_step(); + if (tstat_flag) { + o_step(); + if (removecomflag) remove_com_motion(); + if (pstat_flag) press_o_step(); + } + qc_step(); + a_step(); + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } + collect_xc(); + compute_spring_energy(); + compute_t_prim(); + compute_p_prim(); + + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + + if (mapflag) { + for (int i = 0; i < nlocal; i++) { domain->unmap_inv(x[i], image[i]); } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::final_integrate() +{ + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (integrator == OBABO) { + if (tstat_flag) { + o_step(); + if (removecomflag) remove_com_motion(); + if (pstat_flag) press_o_step(); + } + } else if (integrator == BAOAB) { + + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::post_force(int /*flag*/) +{ + if (atom->nmax > maxunwrap) reallocate_x_unwrap(); + if (atom->nmax > maxxc) reallocate_xc(); + int nlocal = atom->nlocal; + double **x = atom->x; + double **f = atom->f; + imageint *image = atom->image; + tagint *tag = atom->tag; + for (int i = 0; i < nlocal; i++) { + x_unwrap[i][0] = x[i][0]; + x_unwrap[i][1] = x[i][1]; + x_unwrap[i][2] = x[i][2]; + } + if (mapflag) { + for (int i = 0; i < nlocal; i++) { domain->unmap(x_unwrap[i], image[i]); } + } + for (int i = 0; i < nlocal; i++) { + xc[i][0] = xcall[3 * (tag[i] - 1) + 0]; + xc[i][1] = xcall[3 * (tag[i] - 1) + 1]; + xc[i][2] = xcall[3 * (tag[i] - 1) + 2]; + } + + compute_vir(); + compute_cvir(); + compute_t_vir(); + compute_pote(); + if (method == NMPIMD) { + inter_replica_comm(f); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, f, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); + } + c_pe->addstep(update->ntimestep + 1); + c_press->addstep(update->ntimestep + 1); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::end_of_step() +{ + compute_totke(); + compute_p_cv(); + compute_tote(); + if (pstat_flag) compute_totenthalpy(); +} + +void FixPIMDLangevin::collect_xc() +{ + int nlocal = atom->nlocal; + double **x = atom->x; + tagint *tag = atom->tag; + if (ireplica == 0) { + if (cmode == SINGLE_PROC) { + for (int i = 0; i < nlocal; i++) { + xcall[3 * i + 0] = xcall[3 * i + 1] = xcall[3 * i + 2] = 0.0; + } + } else if (cmode == MULTI_PROC) { + for (int i = 0; i < ntotal; i++) { + xcall[3 * i + 0] = xcall[3 * i + 1] = xcall[3 * i + 2] = 0.0; + } + } + + for (int i = 0; i < nlocal; i++) { + xcall[3 * (tag[i] - 1) + 0] = x[i][0] / sqrt(np); + xcall[3 * (tag[i] - 1) + 1] = x[i][1] / sqrt(np); + xcall[3 * (tag[i] - 1) + 2] = x[i][2] / sqrt(np); + } + + if (cmode == MULTI_PROC) { + MPI_Allreduce(MPI_IN_PLACE, xcall, ntotal * 3, MPI_DOUBLE, MPI_SUM, world); + } + } + MPI_Bcast(xcall, ntotal * 3, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::b_step() +{ + + int n = atom->nlocal; + int *type = atom->type; + double **v = atom->v; + double **f = atom->f; + + for (int i = 0; i < n; i++) { + double dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::qc_step() +{ + int nlocal = atom->nlocal; + double **x = atom->x; + double **v = atom->v; + double oldlo, oldhi; + + if (!pstat_flag) { + if (universe->iworld == 0) { + for (int i = 0; i < nlocal; i++) { + x[i][0] += dtv * v[i][0]; + x[i][1] += dtv * v[i][1]; + x[i][2] += dtv * v[i][2]; + } + } + } else { + if (universe->iworld == 0) { + double expp[3], expq[3]; + if (pstyle == ISO) { + vw[1] = vw[0]; + vw[2] = vw[0]; + } + for (int j = 0; j < 3; j++) { + expq[j] = exp(dtv * vw[j]); + expp[j] = exp(-dtv * vw[j]); + } + if (barostat == BZP) { + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { + if (p_flag[j]) { + x[i][j] = expq[j] * x[i][j] + (expq[j] - expp[j]) / 2. / vw[j] * v[i][j]; + v[i][j] = expp[j] * v[i][j]; + } else { + x[i][j] += dtv * v[i][j]; + } + } + } + oldlo = domain->boxlo[0]; + oldhi = domain->boxhi[0]; + + domain->boxlo[0] = (oldlo - fixedpoint[0]) * expq[0] + fixedpoint[0]; + domain->boxhi[0] = (oldhi - fixedpoint[0]) * expq[0] + fixedpoint[0]; + + oldlo = domain->boxlo[1]; + oldhi = domain->boxhi[1]; + domain->boxlo[1] = (oldlo - fixedpoint[1]) * expq[1] + fixedpoint[1]; + domain->boxhi[1] = (oldhi - fixedpoint[1]) * expq[1] + fixedpoint[1]; + + oldlo = domain->boxlo[2]; + oldhi = domain->boxhi[2]; + domain->boxlo[2] = (oldlo - fixedpoint[2]) * expq[2] + fixedpoint[2]; + domain->boxhi[2] = (oldhi - fixedpoint[2]) * expq[2] + fixedpoint[2]; + } + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&domain->boxlo[0], 3, MPI_DOUBLE, 0, universe->uworld); + MPI_Bcast(&domain->boxhi[0], 3, MPI_DOUBLE, 0, universe->uworld); + domain->set_global_box(); + domain->set_local_box(); + } + volume = domain->xprd * domain->yprd * domain->zprd; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::a_step() +{ + int n = atom->nlocal; + double **x = atom->x; + double **v = atom->v; + double x0, x1, x2, v0, v1, v2; // three components of x[i] and v[i] + + if (universe->iworld != 0) { + for (int i = 0; i < n; i++) { + x0 = x[i][0]; + x1 = x[i][1]; + x2 = x[i][2]; + v0 = v[i][0]; + v1 = v[i][1]; + v2 = v[i][2]; + x[i][0] = Lan_c[universe->iworld] * x0 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v0; + x[i][1] = Lan_c[universe->iworld] * x1 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v1; + x[i][2] = Lan_c[universe->iworld] * x2 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v2; + v[i][0] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x0 + + Lan_c[universe->iworld] * v0; + v[i][1] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x1 + + Lan_c[universe->iworld] * v1; + v[i][2] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x2 + + Lan_c[universe->iworld] * v2; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::baro_init() +{ + vw[0] = vw[1] = vw[2] = vw[3] = vw[4] = vw[5] = 0.0; + if (pstyle == ISO) { + W = 3 * (atom->natoms) * tau_p * tau_p * np * kt; + } // consistent with the definition in i-Pi + else if (pstyle == ANISO) { + W = atom->natoms * tau_p * tau_p * np * kt; + } + Vcoeff = 1.0; + std::string out = fmt::format("\nInitializing PIMD {:s} barostat...\n", Barostats[barostat]); + out += fmt::format("The barostat mass is W = {:.16e}\n", W); + utils::logmesg(lmp, out); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::press_v_step() +{ + int nlocal = atom->nlocal; + double **f = atom->f; + double **v = atom->v; + int *type = atom->type; + volume = domain->xprd * domain->yprd * domain->zprd; + + if (pstyle == ISO) { + if (barostat == BZP) { + vw[0] += dtv * 3 * (volume * np * (p_cv - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; + if (universe->iworld == 0) { + double dvw_proc = 0.0, dvw = 0.0; + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { + dvw_proc += dtv2 * f[i][j] * v[i][j] / W + dtv3 * f[i][j] * f[i][j] / mass[type[i]] / W; + } + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[0] += dvw; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + } else if (barostat == MTTK) { + mtk_term1 = 2. / atom->natoms * totke / 3; + f_omega = (volume * np * (p_md - p_hydro) + mtk_term1) / W; + vw[0] += 0.5 * dtv * f_omega; + } + } else if (pstyle == ANISO) { + compute_stress_tensor(); + for (int ii = 0; ii < 3; ii++) { + if (p_flag[ii]) { + vw[ii] += dtv * + (volume * np * (stress_tensor[ii] - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; + if (universe->iworld == 0) { + double dvw_proc = 0.0, dvw = 0.0; + for (int i = 0; i < nlocal; i++) { + dvw_proc += + dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[ii] += dvw; + } + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::press_o_step() +{ + if (pstyle == ISO) { + if (universe->me == 0) { + r1 = random->gaussian(); + vw[0] = c1 * vw[0] + c2 * sqrt(1.0 / W / beta_np) * r1; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + } else if (pstyle == ANISO) { + if (universe->me == 0) { + for (int ii = 0; ii < 3; ii++) { + if (p_flag[ii]) { + r1 = random->gaussian(); + vw[ii] = c1 * vw[ii] + c2 * sqrt(1.0 / W / beta_np) * r1; + } + } + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::langevin_init() +{ + double beta = 1.0 / kt; + _omega_np = np / beta / hbar; + double _omega_np_dt_half = _omega_np * update->dt * 0.5; + + _omega_k = new double[np]; + Lan_c = new double[np]; + Lan_s = new double[np]; + if (fmmode == PHYSICAL) { + for (int i = 0; i < np; i++) { + _omega_k[i] = _omega_np * sqrt(lam[i]) / sqrt(fmass); + Lan_c[i] = cos(sqrt(lam[i]) * _omega_np_dt_half); + Lan_s[i] = sin(sqrt(lam[i]) * _omega_np_dt_half); + } + } else if (fmmode == NORMAL) { + for (int i = 0; i < np; i++) { + _omega_k[i] = _omega_np / sqrt(fmass); + Lan_c[i] = cos(_omega_np_dt_half); + Lan_s[i] = sin(_omega_np_dt_half); + } + } else { + error->universe_all(FLERR, "Unknown fmmode setting; only physical and normal are supported!"); + } + + if (tau > 0) + gamma = 1.0 / tau; + else + gamma = np / beta / hbar; + + if (integrator == OBABO) + c1 = exp(-gamma * 0.5 * update->dt); // tau is the damping time of the centroid mode. + else if (integrator == BAOAB) + c1 = exp(-gamma * update->dt); + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); + + c2 = sqrt(1.0 - c1 * c1); // note that c1 and c2 here only works for the centroid mode. + + if (thermostat == PILE_L) { + std::string out = "\nInitializing PI Langevin equation thermostat...\n"; + out += "Bead ID | omega | tau | c1 | c2\n"; + tau_k = new double[np]; + c1_k = new double[np]; + c2_k = new double[np]; + tau_k[0] = tau; + c1_k[0] = c1; + c2_k[0] = c2; + for (int i = 1; i < np; i++) { + tau_k[i] = 0.5 / pilescale / _omega_k[i]; + if (integrator == OBABO) + c1_k[i] = exp(-0.5 * update->dt / tau_k[i]); + else if (integrator == BAOAB) + c1_k[i] = exp(-1.0 * update->dt / tau_k[i]); + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); + c2_k[i] = sqrt(1.0 - c1_k[i] * c1_k[i]); + } + for (int i = 0; i < np; i++) { + out += fmt::format(" {:d} {:.8e} {:.8e} {:.8e} {:.8e}\n", i, _omega_k[i], tau_k[i], + c1_k[i], c2_k[i]); + } + if (thermostat == PILE_L) out += "PILE_L thermostat successfully initialized!\n"; + out += "\n"; + utils::logmesg(lmp, out); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::o_step() +{ + int nlocal = atom->nlocal; + int *type = atom->type; + double beta_np = 1.0 / force->boltz / Lan_temp * inverse_np * force->mvv2e; + if (thermostat == PILE_L) { + for (int i = 0; i < nlocal; i++) { + r1 = random->gaussian(); + r2 = random->gaussian(); + r3 = random->gaussian(); + atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; + atom->v[i][1] = c1_k[universe->iworld] * atom->v[i][1] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r2; + atom->v[i][2] = c1_k[universe->iworld] * atom->v[i][2] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r3; + } + } +} + +/* ---------------------------------------------------------------------- + Normal Mode PIMD +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::nmpimd_init() +{ + memory->create(M_x2xp, np, np, "fix_feynman:M_x2xp"); + memory->create(M_xp2x, np, np, "fix_feynman:M_xp2x"); + + lam = (double *) memory->smalloc(sizeof(double) * np, "FixPIMDLangevin::lam"); + + // Set up eigenvalues + for (int i = 0; i < np; i++) { + double sin_tmp = sin(i * MY_PI / np); + lam[i] = 4 * sin_tmp * sin_tmp; + } + + // Set up eigenvectors for degenerated modes + for (int j = 0; j < np; j++) { + for (int i = 1; i < int(np / 2) + 1; i++) { + M_x2xp[i][j] = sqrt(2.0) * cos(2.0 * MY_PI * double(i) * double(j) / double(np)) / sqrt(np); + } + for (int i = int(np / 2) + 1; i < np; i++) { + M_x2xp[i][j] = sqrt(2.0) * sin(2.0 * MY_PI * double(i) * double(j) / double(np)) / sqrt(np); + } + } + + // Set up eigenvectors for non-degenerated modes + for (int i = 0; i < np; i++) { + M_x2xp[0][i] = 1.0 / sqrt(np); + if (np % 2 == 0) M_x2xp[np / 2][i] = 1.0 / sqrt(np) * pow(-1.0, i); + } + + // Set up Ut + for (int i = 0; i < np; i++) + for (int j = 0; j < np; j++) { M_xp2x[i][j] = M_x2xp[j][i]; } + + // Set up fictitious masses + int iworld = universe->iworld; + for (int i = 1; i <= atom->ntypes; i++) { + mass[i] = atom->mass[i]; + mass[i] *= fmass; + if (iworld) { + if (fmmode == PHYSICAL) { + mass[i] *= 1.0; + } else if (fmmode == NORMAL) { + mass[i] *= lam[iworld]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::nmpimd_transform(double **src, double **des, double *vector) +{ + if (cmode == SINGLE_PROC) { + for (int i = 0; i < ntotal; i++) { + for (int d = 0; d < 3; d++) { + bufsorted[i][d] = 0.0; + for (int j = 0; j < nreplica; j++) { + bufsorted[i][d] += src[j * ntotal + i][d] * vector[j]; + } + } + } + for (int i = 0; i < ntotal; i++) { + tagint tagtmp = atom->tag[i]; + for (int d = 0; d < 3; d++) { des[i][d] = bufsorted[tagtmp - 1][d]; } + } + } else if (cmode == MULTI_PROC) { + int n = atom->nlocal; + int m = 0; + + for (int i = 0; i < n; i++) + for (int d = 0; d < 3; d++) { + des[i][d] = 0.0; + for (int j = 0; j < np; j++) { des[i][d] += (src[j][m] * vector[j]); } + m++; + } + } +} + +/* ---------------------------------------------------------------------- + Comm operations +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::comm_init() +{ + if (sizeplan) { + delete[] plansend; + delete[] planrecv; + } + + sizeplan = np - 1; + plansend = new int[sizeplan]; + planrecv = new int[sizeplan]; + modeindex = new int[sizeplan]; + for (int i = 0; i < sizeplan; i++) { + int isend, irecv; + isend = ireplica + i + 1; + if (isend >= nreplica) isend -= nreplica; + irecv = ireplica - (i + 1); + if (irecv < 0) irecv += nreplica; + plansend[i] = universe->root_proc[isend]; + planrecv[i] = universe->root_proc[irecv]; + modeindex[i] = irecv; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate_xc() +{ + maxxc = atom->nmax; + memory->destroy(xc); + memory->create(xc, maxxc, 3, "FixPIMDLangevin:xc"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate_x_unwrap() +{ + maxunwrap = atom->nmax; + memory->destroy(x_unwrap); + memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate() +{ + maxlocal = atom->nmax; + memory->destroy(bufsend); + memory->destroy(bufrecv); + memory->destroy(tagsend); + memory->destroy(tagrecv); + memory->destroy(bufbeads); + memory->create(bufsend, maxlocal, 3, "FixPIMDLangevin:bufsend"); + memory->create(bufrecv, maxlocal, 3, "FixPIMDLangevin:bufrecv"); + memory->create(tagsend, maxlocal, "FixPIMDLangevin:tagsend"); + memory->create(tagrecv, maxlocal, "FixPIMDLangevin:tagrecv"); + memory->create(bufbeads, nreplica, maxlocal * 3, "FixPIMDLangevin:bufrecv"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::inter_replica_comm(double **ptr) +{ + MPI_Request requests[2]; + MPI_Status statuses[2]; + if (atom->nmax > maxlocal) reallocate(); + int nlocal = atom->nlocal; + tagint *tag = atom->tag; + int i, m; + + // copy local values + for (i = 0; i < nlocal; i++) { + bufbeads[ireplica][3 * i + 0] = ptr[i][0]; + bufbeads[ireplica][3 * i + 1] = ptr[i][1]; + bufbeads[ireplica][3 * i + 2] = ptr[i][2]; + } + + // communicate values from the other beads + if (cmode == SINGLE_PROC) { + m = 0; + for (i = 0; i < nlocal; i++) { + tagint tagtmp = atom->tag[i]; + bufsorted[tagtmp - 1][0] = ptr[i][0]; + bufsorted[tagtmp - 1][1] = ptr[i][1]; + bufsorted[tagtmp - 1][2] = ptr[i][2]; + m++; + } + MPI_Allgather(&m, 1, MPI_INT, counts, 1, MPI_INT, universe->uworld); + for (i = 0; i < nreplica; i++) counts[i] *= 3; + displacements[0] = 0; + for (i = 0; i < nreplica - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; + MPI_Allgatherv(bufsorted[0], 3 * m, MPI_DOUBLE, bufsortedall[0], counts, displacements, + MPI_DOUBLE, universe->uworld); + } else if (cmode == MULTI_PROC) { + m = 0; + for (i = 0; i < nlocal; i++) { + tagsend[m] = tag[i]; + bufsend[m][0] = ptr[i][0]; + bufsend[m][1] = ptr[i][1]; + bufsend[m][2] = ptr[i][2]; + m++; + } + MPI_Gather(&m, 1, MPI_INT, counts, 1, MPI_INT, 0, world); + displacements[0] = 0; + for (i = 0; i < nprocs - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; + MPI_Gatherv(tagsend, m, MPI_LMP_TAGINT, tagsendall, counts, displacements, MPI_LMP_TAGINT, 0, + world); + for (i = 0; i < nprocs; i++) counts[i] *= 3; + for (i = 0; i < nprocs - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; + MPI_Gatherv(bufsend[0], 3 * m, MPI_DOUBLE, bufsendall[0], counts, displacements, MPI_DOUBLE, 0, + world); + for (int iplan = 0; iplan < sizeplan; iplan++) { + if (me == 0) { + MPI_Irecv(bufrecvall[0], 3 * ntotal, MPI_DOUBLE, planrecv[iplan], 0, universe->uworld, + &requests[0]); + MPI_Irecv(tagrecvall, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, + &requests[1]); + MPI_Send(bufsendall[0], 3 * ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); + MPI_Send(tagsendall, ntotal, MPI_LMP_TAGINT, plansend[iplan], 0, universe->uworld); + MPI_Waitall(2, requests, statuses); + } + MPI_Bcast(tagrecvall, ntotal, MPI_LMP_TAGINT, 0, world); + MPI_Bcast(bufrecvall[0], 3 * ntotal, MPI_DOUBLE, 0, world); + for (i = 0; i < ntotal; i++) { + m = atom->map(tagrecvall[i]); + if (m < 0 || m >= nlocal) continue; + bufbeads[modeindex[iplan]][3 * m + 0] = bufrecvall[i][0]; + bufbeads[modeindex[iplan]][3 * m + 1] = bufrecvall[i][1]; + bufbeads[modeindex[iplan]][3 * m + 2] = bufrecvall[i][2]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::remove_com_motion() +{ + if (universe->iworld == 0) { + double **v = atom->v; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (dynamic) masstotal = group->mass(igroup); + double vcm[3]; + group->vcm(igroup, masstotal, vcm); + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + v[i][0] -= vcm[0]; + v[i][1] -= vcm[1]; + v[i][2] -= vcm[2]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_cvir() +{ + int nlocal = atom->nlocal; + xf = vir_ = xcf = centroid_vir = 0.0; + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { + xf += x_unwrap[i][j] * atom->f[i][j]; + xcf += (x_unwrap[i][j] - xc[i][j]) * atom->f[i][j]; + } + } + MPI_Allreduce(&xf, &vir_, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + MPI_Allreduce(&xcf, ¢roid_vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + if (pstyle == ANISO) { + for (int i = 0; i < 6; i++) c_vir_tensor[i] = 0.0; + for (int i = 0; i < nlocal; i++) { + c_vir_tensor[0] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][0]; + c_vir_tensor[1] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][1]; + c_vir_tensor[2] += (x_unwrap[i][2] - xc[i][2]) * atom->f[i][2]; + c_vir_tensor[3] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][1]; + c_vir_tensor[4] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][2]; + c_vir_tensor[5] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][2]; + } + MPI_Allreduce(MPI_IN_PLACE, &c_vir_tensor, 6, MPI_DOUBLE, MPI_SUM, universe->uworld); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_vir() +{ + volume = domain->xprd * domain->yprd * domain->zprd; + c_press->compute_vector(); + virial[0] = c_press->vector[0] * volume; + virial[1] = c_press->vector[1] * volume; + virial[2] = c_press->vector[2] * volume; + virial[3] = c_press->vector[3] * volume; + virial[4] = c_press->vector[4] * volume; + virial[5] = c_press->vector[5] * volume; + for (int i = 0; i < 6; i++) virial[i] /= universe->procs_per_world[universe->iworld]; + double vir_bead = (virial[0] + virial[1] + virial[2]); + MPI_Allreduce(&vir_bead, &vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + MPI_Allreduce(MPI_IN_PLACE, &virial[0], 6, MPI_DOUBLE, MPI_SUM, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_stress_tensor() +{ + int nlocal = atom->nlocal; + int *type = atom->type; + if (universe->iworld == 0) { + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + for (int i = 0; i < 6; i++) ke_tensor[i] = 0.0; + for (int i = 0; i < nlocal; i++) { + ke_tensor[0] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][0] * force->mvv2e; + ke_tensor[1] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][1] * force->mvv2e; + ke_tensor[2] += 0.5 * mass[type[i]] * atom->v[i][2] * atom->v[i][2] * force->mvv2e; + ke_tensor[3] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][1] * force->mvv2e; + ke_tensor[4] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][2] * force->mvv2e; + ke_tensor[5] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][2] * force->mvv2e; + } + MPI_Allreduce(MPI_IN_PLACE, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); + for (int i = 0; i < 6; i++) { + stress_tensor[i] = + inv_volume * ((2 * ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; + } + } + MPI_Bcast(&stress_tensor, 6, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_totke() +{ + kine = 0.0; + totke = ke_bead = 0.0; + int nlocal = atom->nlocal; + int *type = atom->type; + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { kine += 0.5 * mass[type[i]] * atom->v[i][j] * atom->v[i][j]; } + } + kine *= force->mvv2e; + MPI_Allreduce(&kine, &ke_bead, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&ke_bead, &totke, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + totke /= universe->procs_per_world[universe->iworld]; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_spring_energy() +{ + spring_energy = 0.0; + total_spring_energy = se_bead = 0.0; + + double **x = atom->x; + double *_mass = atom->mass; + int *type = atom->type; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + spring_energy += 0.5 * _mass[type[i]] * fbond * lam[universe->iworld] * + (x[i][0] * x[i][0] + x[i][1] * x[i][1] + x[i][2] * x[i][2]); + } + MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&se_bead, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + total_spring_energy /= universe->procs_per_world[universe->iworld]; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_pote() +{ + pe_bead = 0.0; + pot_energy_partition = 0.0; + pote = 0.0; + c_pe->compute_scalar(); + pe_bead = c_pe->scalar; + pot_energy_partition = pe_bead / universe->procs_per_world[universe->iworld]; + MPI_Allreduce(&pot_energy_partition, &pote, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_tote() +{ + tote = totke + pote + total_spring_energy; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_t_prim() +{ + t_prim = 1.5 * atom->natoms * np * force->boltz * temp - total_spring_energy; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_t_vir() +{ + t_vir = -0.5 * inverse_np * vir_; + t_cv = 1.5 * atom->natoms * force->boltz * temp - 0.5 * inverse_np * centroid_vir; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_p_prim() +{ + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + p_prim = atom->natoms * np * force->boltz * temp * inv_volume - + 1.0 / 1.5 * inv_volume * total_spring_energy; + p_prim *= force->nktv2p; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_p_cv() +{ + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + if (universe->iworld == 0) { + p_cv = THIRD * inv_volume * ((2.0 * ke_bead - centroid_vir) * force->nktv2p + vir) / np; + } + p_md = THIRD * inv_volume * (totke + vir); + MPI_Bcast(&p_cv, 1, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_totenthalpy() +{ + volume = domain->xprd * domain->yprd * domain->zprd; + if (barostat == BZP) { + if (pstyle == ISO) { + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * volume / force->nktv2p - + Vcoeff * kt * log(volume); + } else if (pstyle == ANISO) { + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + + 0.5 * W * vw[1] * vw[1] * inverse_np + 0.5 * W * vw[2] * vw[2] * inverse_np + + p_hydro * volume / force->nktv2p - Vcoeff * kt * log(volume); + } + } else if (barostat == MTTK) + totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * (volume - vol0); +} + +/* ---------------------------------------------------------------------- + pack entire state of Fix into one write +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::write_restart(FILE *fp) +{ + int nsize = size_restart_global(); + + double *list; + memory->create(list, nsize, "FixPIMDLangevin:list"); + + pack_restart_data(list); + + if (comm->me == 0) { + int size = nsize * sizeof(double); + fwrite(&size, sizeof(int), 1, fp); + fwrite(list, sizeof(double), nsize, fp); + } + + memory->destroy(list); +} +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::size_restart_global() +{ + int nsize = 6; + + return nsize; +} + +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::pack_restart_data(double *list) +{ + int n = 0; + for (int i = 0; i < 6; i++) list[n++] = vw[i]; + return n; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::restart(char *buf) +{ + int n = 0; + auto list = (double *) buf; + for (int i = 0; i < 6; i++) vw[i] = list[n++]; +} + +/* ---------------------------------------------------------------------- */ + +double FixPIMDLangevin::compute_vector(int n) +{ + if (n == 0) return ke_bead; + if (n == 1) return se_bead; + if (n == 2) return pe_bead; + if (n == 3) return tote; + if (n == 4) return t_prim; + if (n == 5) return t_vir; + if (n == 6) return t_cv; + if (n == 7) return p_prim; + if (n == 8) return p_md; + if (n == 9) return p_cv; + + if (pstat_flag) { + volume = domain->xprd * domain->yprd * domain->zprd; + if (pstyle == ISO) { + if (n == 10) return vw[0]; + if (barostat == BZP) { + if (n == 11) return 0.5 * W * vw[0] * vw[0]; + } else if (barostat == MTTK) { + if (n == 11) return 1.5 * W * vw[0] * vw[0]; + } + if (n == 12) { return np * Pext * volume / force->nktv2p; } + if (n == 13) { return -Vcoeff * np * kt * log(volume); } + if (n == 14) return totenthalpy; + } else if (pstyle == ANISO) { + if (n == 10) return vw[0]; + if (n == 11) return vw[1]; + if (n == 12) return vw[2]; + if (n == 13) return 0.5 * W * (vw[0] * vw[0] + vw[1] * vw[1] + vw[2] * vw[2]); + if (n == 14) { return np * Pext * volume / force->nktv2p; } + if (n == 15) { + volume = domain->xprd * domain->yprd * domain->zprd; + return -Vcoeff * np * kt * log(volume); + } + if (n == 16) return totenthalpy; + } + } + + return 0.0; +} diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h new file mode 100644 index 0000000000..d3b9d5b77e --- /dev/null +++ b/src/REPLICA/fix_pimd_langevin.h @@ -0,0 +1,188 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(pimd/langevin,FixPIMDLangevin); +// clang-format on +#else + +#ifndef FIX_PIMD_LANGEVIN_H +#define FIX_PIMD_LANGEVIN_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixPIMDLangevin : public Fix { + public: + FixPIMDLangevin(class LAMMPS *, int, char **); + ~FixPIMDLangevin() override; + + int setmask() override; + + void init() override; + void setup(int) override; + void post_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void end_of_step() override; + + double compute_vector(int) override; + + protected: + // System setting variables + int method; // PIMD or NMPIMD or CMD + int fmmode; // physical or normal + int np; // number of beads + double inverse_np; // 1.0/np + double temp; // temperature + double hbar; // Planck's constant + double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales + double other_planck; + double other_mvv2e; + double kt; // k_B * temp + double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np + int thermostat; // NHC or PILE_L + int barostat; // BZP + int integrator; // obabo or baoab + int ensemble; // nve or nvt or nph or npt + int mapflag; // should be 1 if number of beads > 1 + int removecomflag; + double masstotal; + + double fixedpoint[3]; // location of dilation fixed-point + + // ring-polymer model + + double omega_np, fbond, spring_energy, sp; + + // fictitious mass + + double fmass, *mass; + + // inter-partition communication + + MPI_Comm rootworld; + int me, nprocs, ireplica, nreplica, nprocs_universe; + int ntotal, maxlocal; + + int cmode; + int sizeplan; + int *plansend, *planrecv; + + tagint *tagsend, *tagrecv; + double **bufsend, **bufrecv, **bufbeads; + double **bufsorted, **bufsortedall; + double **outsorted, **buftransall; + + tagint *tagsendall, *tagrecvall; + double **bufsendall, **bufrecvall; + + int *counts, *displacements; + + void comm_init(); + void inter_replica_comm(double **ptr); + + /* normal-mode operations */ + + double *lam, **M_x2xp, **M_xp2x, **M_f2fp, **M_fp2f; + int *modeindex; + + void reallocate(); + void nmpimd_init(); + void nmpimd_transform(double **, double **, double *); + + /* Langevin integration */ + + double dtv, dtf, dtv2, dtv3; + double gamma, c1, c2, tau; + double *tau_k, *c1_k, *c2_k; + double pilescale; + double Lan_temp; + double r1, r2, r3; + double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) + + class RanMars *random; + + int tstat_flag; // tstat_flat = 1 if thermostat if used + void langevin_init(); + void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) + void + a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) + void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) + void o_step(); // integrate for dt according to O part (O-U process, for thermostating) + + /* Bussi-Zykova-Parrinello barostat */ + + double f_omega, mtk_term1; + int pstat_flag; // pstat_flag = 1 if barostat is used + int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) + double W, tau_p, Pext, p_hydro, totenthalpy, Vcoeff; + int pdim; + int p_flag[6]; + double p_target[6]; + double vw[6]; // barostat velocity + double ke_tensor[6]; // kinetic energy tensor + double c_vir_tensor[6]; // centroid-virial tensor + double stress_tensor[6]; // path integral centroid-virial stress tensor + + void baro_init(); + void press_v_step(); + void press_o_step(); + + /* centroid-virial estimator computation */ + double vol0 = 0.0; + double volume; + double **xc, *xcall; + int maxxc; + int maxunwrap; + double **x_unwrap; + void reallocate_x_unwrap(); + void reallocate_xc(); + void collect_xc(); + void remove_com_motion(); + double xf, vir, vir_, xcf, centroid_vir; + double t_prim, t_vir, t_cv, p_prim, p_vir, p_cv, p_md; + + /* Computes */ + double kine, pote, tote, totke; + double ke_bead, se_bead, pe_bead, pot_energy_partition; + double total_spring_energy; + char *id_pe; + char *id_press; + class Compute *c_pe; + class Compute *c_press; + + void compute_totke(); // 1: kinetic energy + void compute_spring_energy(); // 2: spring elastic energy + void compute_pote(); // 3: potential energy + void compute_tote(); // 4: total energy: 1+2+3 for all the beads + void compute_stress_tensor(); + void compute_t_prim(); + void compute_t_vir(); + void compute_t_cv(); + void compute_p_prim(); + void compute_p_cv(); // centroid-virial pressure estimator + void compute_vir(); + void compute_cvir(); + void compute_totenthalpy(); + + void write_restart(FILE *fp) override; + int size_restart_global(); + int pack_restart_data(double *list); + void restart(char *buf) override; +}; +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/REPLICA/fix_pimd_nvt.cpp b/src/REPLICA/fix_pimd_nvt.cpp index 1f2f29f35c..e899c75a27 100644 --- a/src/REPLICA/fix_pimd_nvt.cpp +++ b/src/REPLICA/fix_pimd_nvt.cpp @@ -219,7 +219,7 @@ void FixPIMDNVT::init() const double Boltzmann = force->boltz; const double Plank = force->hplanck; - double hbar = Plank / (2.0 * MY_PI); + double hbar = Plank / (2.0 * MY_PI) * sp; double beta = 1.0 / (Boltzmann * nhc_temp); double _fbond = 1.0 * np / (beta * beta * hbar * hbar); diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 9e7e67d79d..adbdb4d742 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; -// #define TEMPER_DEBUG 1 +#define TEMPER_DEBUG 0 /* ---------------------------------------------------------------------- */ @@ -50,10 +50,10 @@ Temper::~Temper() MPI_Comm_free(&roots); if (ranswap) delete ranswap; delete ranboltz; - delete [] set_temp; - delete [] temp2world; - delete [] world2temp; - delete [] world2root; + delete[] set_temp; + delete[] temp2world; + delete[] world2temp; + delete[] world2root; } /* ---------------------------------------------------------------------- @@ -63,11 +63,10 @@ Temper::~Temper() void Temper::command(int narg, char **arg) { if (universe->nworlds == 1) - error->all(FLERR,"Must have more than one processor partition to temper"); + error->universe_all(FLERR,"More than one processor partition required for temper command"); if (domain->box_exist == 0) - error->all(FLERR,"Temper command before simulation box is defined"); - if (narg != 6 && narg != 7) - error->universe_all(FLERR,"Illegal temper command"); + error->universe_all(FLERR,"Temper command before simulation box is defined"); + if (narg != 6 && narg != 7) error->universe_all(FLERR,"Illegal temper command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); nevery = utils::inumeric(FLERR,arg[1],false,lmp); @@ -77,10 +76,9 @@ void Temper::command(int narg, char **arg) if (timer->is_timeout()) return; - for (whichfix = 0; whichfix < modify->nfix; whichfix++) - if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; - if (whichfix == modify->nfix) - error->universe_all(FLERR,"Tempering fix ID is not defined"); + whichfix = modify->get_fix_by_id(arg[3]); + if (!whichfix) + error->universe_all(FLERR,fmt::format("Tempering fix ID {} is not defined", arg[3])); seed_swap = utils::inumeric(FLERR,arg[4],false,lmp); seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); @@ -88,7 +86,7 @@ void Temper::command(int narg, char **arg) my_set_temp = universe->iworld; if (narg == 7) my_set_temp = utils::inumeric(FLERR,arg[6],false,lmp); if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds)) - error->universe_one(FLERR,"Illegal temperature index"); + error->universe_one(FLERR,"Invalid temperature index value"); // swap frequency must evenly divide total # of timesteps @@ -101,11 +99,11 @@ void Temper::command(int narg, char **arg) // fix style must be appropriate for temperature control, i.e. it needs // to provide a working Fix::reset_target() and must not change the volume. - if ((!utils::strmatch(modify->fix[whichfix]->style,"^nvt")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^langevin")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^gl[de]$")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^rigid/nvt")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^temp/"))) + if ((!utils::strmatch(whichfix->style,"^nvt")) && + (!utils::strmatch(whichfix->style,"^langevin")) && + (!utils::strmatch(whichfix->style,"^gl[de]$")) && + (!utils::strmatch(whichfix->style,"^rigid/nvt")) && + (!utils::strmatch(whichfix->style,"^temp/"))) error->universe_all(FLERR,"Tempering temperature fix is not supported"); // setup for long tempering run @@ -116,8 +114,7 @@ void Temper::command(int narg, char **arg) update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; - if (update->laststep < 0) - error->all(FLERR,"Too many timesteps"); + if (update->laststep < 0) error->all(FLERR,"Too many timesteps"); lmp->init(); @@ -132,9 +129,9 @@ void Temper::command(int narg, char **arg) // pe_compute = ptr to thermo_pe compute // notify compute it will be called at first swap - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all(FLERR,"Tempering could not find thermo_pe compute"); - Compute *pe_compute = modify->compute[id]; + Compute *pe_compute = modify->get_compute_by_id("thermo_pe"); + if (!pe_compute) error->all(FLERR,"Tempering could not find thermo_pe compute"); + pe_compute->addstep(update->ntimestep + nevery); // create MPI communicator for root proc from each world @@ -183,7 +180,7 @@ void Temper::command(int narg, char **arg) if (narg == 7) { double new_temp = set_temp[my_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // setup tempering runs @@ -289,13 +286,12 @@ void Temper::command(int narg, char **arg) else MPI_Recv(&swap,1,MPI_INT,partner,0,universe->uworld,MPI_STATUS_IGNORE); -#ifdef TEMPER_DEBUG +#if TEMPER_DEBUG if (me_universe < partner) - printf("SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", - me_universe,partner,swap,my_set_temp,partner_set_temp, - pe,pe_partner,boltz_factor,exp(boltz_factor)); + fprintf(universe->uscreen,"SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", + me_universe,partner,swap,my_set_temp,partner_set_temp, + pe,pe_partner,boltz_factor,exp(boltz_factor)); #endif - } // bcast swap result to other procs in my world @@ -310,7 +306,7 @@ void Temper::command(int narg, char **arg) if (swap) { new_temp = set_temp[partner_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // update my_set_temp and temp2world on every proc diff --git a/src/REPLICA/temper.h b/src/REPLICA/temper.h index b557e8ddd8..46a6666f07 100644 --- a/src/REPLICA/temper.h +++ b/src/REPLICA/temper.h @@ -40,8 +40,7 @@ class Temper : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - int whichfix; // index of temperature fix to use - int fixstyle; // what kind of temperature fix is used + class Fix *whichfix; // temperature fix to use int my_set_temp; // which set temp I am simulating double *set_temp; // static list of replica set temperatures diff --git a/src/REPLICA/temper_grem.cpp b/src/REPLICA/temper_grem.cpp index 68fbb4eef6..303f502309 100644 --- a/src/REPLICA/temper_grem.cpp +++ b/src/REPLICA/temper_grem.cpp @@ -24,6 +24,7 @@ #include "finish.h" #include "fix.h" #include "fix_grem.h" +#include "fix_nh.h" #include "force.h" #include "integrate.h" #include "modify.h" @@ -37,7 +38,7 @@ using namespace LAMMPS_NS; -//#define TEMPER_DEBUG 1 +#define TEMPER_DEBUG 0 /* ---------------------------------------------------------------------- */ @@ -50,11 +51,10 @@ TemperGrem::~TemperGrem() MPI_Comm_free(&roots); if (ranswap) delete ranswap; delete ranboltz; - delete [] set_lambda; - delete [] lambda2world; - delete [] world2lambda; - delete [] world2root; - delete [] id_nh; + delete[] set_lambda; + delete[] lambda2world; + delete[] world2lambda; + delete[] world2root; } /* ---------------------------------------------------------------------- @@ -64,46 +64,50 @@ TemperGrem::~TemperGrem() void TemperGrem::command(int narg, char **arg) { if (universe->nworlds == 1) - error->all(FLERR,"Must have more than one processor partition to temper"); + error->universe_all(FLERR,"More than one processor partition required for temper/grem command"); if (domain->box_exist == 0) - error->all(FLERR,"Temper/gREM command before simulation box is defined"); - if (narg != 7 && narg != 8) - error->universe_all(FLERR,"Illegal temper command"); + error->universe_all(FLERR,"Temper/grem command before simulation box is defined"); + if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/grem command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); nevery = utils::inumeric(FLERR,arg[1],false,lmp); double lambda = utils::numeric(FLERR,arg[2],false,lmp); // ignore temper command, if walltime limit was already reached + if (timer->is_timeout()) return; - // Get and check if gREM fix exists - for (whichfix = 0; whichfix < modify->nfix; whichfix++) - if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; - if (whichfix == modify->nfix) - error->universe_all(FLERR,"Tempering fix ID is not defined"); - fix_grem = dynamic_cast(modify->fix[whichfix]); + // Get and check if gREM fix exists and is correct style + + auto ifix = modify->get_fix_by_id(arg[3]); + if (!ifix) error->universe_all(FLERR,fmt::format("Tempering fix ID {} is not defined", arg[3])); + + fix_grem = dynamic_cast(ifix); + if (!fix_grem || (strcmp(ifix->style,"grem") != 0)) + error->universe_all(FLERR,"Tempering temperature fix is of incorrect style"); // Check input values lambdas should be equal, assign other gREM values if (lambda != fix_grem->lambda) - error->universe_all(FLERR,"Lambda from tempering and fix in the same world" - " must be the same"); + error->universe_all(FLERR,"Lambda from tempering and fix in the same world must be the same"); double eta = fix_grem->eta; double h0 = fix_grem->h0; double pressref = 0; // Get and check for nh fix - id_nh = utils::strdup(arg[4]); - int ifix = modify->find_fix(id_nh); - if (ifix < 0) - error->all(FLERR,"Fix id for nvt or npt fix does not exist"); - Fix *nh = modify->fix[ifix]; + + FixNH *nh = dynamic_cast(modify->get_fix_by_id(arg[4])); + if (!nh) + error->all(FLERR,fmt::format("Fix {} for Nose-Hoover fix does not exist", arg[4])); // get result from nvt vs npt check from fix_grem + int pressflag = fix_grem->pressflag; + // fix_grem does all the checking... + if (pressflag) { - auto p_start = (double *) nh->extract("p_start",ifix); + int dummy; + auto p_start = (double *) nh->extract("p_start",dummy); pressref = p_start[0]; } @@ -123,11 +127,6 @@ void TemperGrem::command(int narg, char **arg) if (nswaps*nevery != nsteps) error->universe_all(FLERR,"Non integer # of swaps in temper command"); - // Must be used with fix_grem - - if (strcmp(modify->fix[whichfix]->style,"grem") != 0) - error->universe_all(FLERR,"Tempering temperature fix is not supported"); - // setup for long tempering run update->whichflag = 1; @@ -136,8 +135,7 @@ void TemperGrem::command(int narg, char **arg) update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; - if (update->laststep < 0) - error->all(FLERR,"Too many timesteps"); + if (update->laststep < 0) error->all(FLERR,"Too many timesteps"); lmp->init(); @@ -152,9 +150,9 @@ void TemperGrem::command(int narg, char **arg) // pe_compute = ptr to thermo_pe compute // notify compute it will be called at first swap - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all(FLERR,"Tempering could not find thermo_pe compute"); - Compute *pe_compute = modify->compute[id]; + Compute *pe_compute = modify->get_compute_by_id("thermo_pe"); + if (!pe_compute) error->all(FLERR,"Tempering could not find thermo_pe compute"); + pe_compute->addstep(update->ntimestep + nevery); // create MPI communicator for root proc from each world @@ -319,13 +317,12 @@ void TemperGrem::command(int narg, char **arg) else MPI_Recv(&swap,1,MPI_INT,partner,0,universe->uworld,MPI_STATUS_IGNORE); -#ifdef TEMPER_DEBUG +#if TEMPER_DEBUG if (me_universe < partner) - printf("SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", - me_universe,partner,swap,my_set_lambda,partner_set_lambda, - weight,weight_partner,boltz_factor,exp(boltz_factor)); + fprintf(universe->uscreen,"SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", + me_universe,partner,swap,my_set_lambda,partner_set_lambda, + weight,weight_partner,boltz_factor,exp(boltz_factor)); #endif - } // bcast swap result to other procs in my world diff --git a/src/REPLICA/temper_grem.h b/src/REPLICA/temper_grem.h index 3c41f9b082..8fe49ae804 100644 --- a/src/REPLICA/temper_grem.h +++ b/src/REPLICA/temper_grem.h @@ -40,8 +40,7 @@ class TemperGrem : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - int whichfix; // index of temperature fix to use - int fixstyle; // what kind of temperature fix is used + class Fix *whichfix; // temperature fix to use int my_set_lambda; // which set lambda I am simulating double *set_lambda; // static list of replica set lambdas @@ -54,7 +53,6 @@ class TemperGrem : public Command { class FixGrem *fix_grem; protected: - char *id_nh; int pressflag; }; diff --git a/src/REPLICA/temper_npt.cpp b/src/REPLICA/temper_npt.cpp index 6567cb83e1..d814bf6725 100644 --- a/src/REPLICA/temper_npt.cpp +++ b/src/REPLICA/temper_npt.cpp @@ -52,10 +52,10 @@ TemperNPT::~TemperNPT() MPI_Comm_free(&roots); if (ranswap) delete ranswap; delete ranboltz; - delete [] set_temp; - delete [] temp2world; - delete [] world2temp; - delete [] world2root; + delete[] set_temp; + delete[] temp2world; + delete[] world2temp; + delete[] world2root; } /* ---------------------------------------------------------------------- @@ -65,11 +65,10 @@ TemperNPT::~TemperNPT() void TemperNPT::command(int narg, char **arg) { if (universe->nworlds == 1) - error->all(FLERR,"Must have more than one processor partition to temper"); + error->universe_all(FLERR,"More than one processor partition required for temper/npt command"); if (domain->box_exist == 0) - error->all(FLERR,"temper/npt command before simulation box is defined"); - if (narg != 7 && narg != 8) - error->universe_all(FLERR,"Illegal temper/npt command"); + error->universe_all(FLERR,"Temper/npt command before simulation box is defined"); + if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/npt command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); nevery = utils::inumeric(FLERR,arg[1],false,lmp); @@ -80,16 +79,17 @@ void TemperNPT::command(int narg, char **arg) if (timer->is_timeout()) return; - for (whichfix = 0; whichfix < modify->nfix; whichfix++) - if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; - if (whichfix == modify->nfix) - error->universe_all(FLERR,"Tempering fix ID is not defined"); + whichfix = modify->get_fix_by_id(arg[3]); + if (!whichfix) + error->universe_all(FLERR,fmt::format("Tempering fix ID {} is not defined", arg[3])); seed_swap = utils::inumeric(FLERR,arg[4],false,lmp); seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); my_set_temp = universe->iworld; - if (narg == 8) my_set_temp = utils::inumeric(FLERR,arg[6],false,lmp); + if (narg == 8) my_set_temp = utils::inumeric(FLERR,arg[7],false,lmp); + if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds)) + error->universe_one(FLERR,"Invalid temperature index value"); // swap frequency must evenly divide total # of timesteps @@ -104,8 +104,8 @@ void TemperNPT::command(int narg, char **arg) // change the volume. This currently only applies to fix npt and // fix rigid/npt variants - if ( (!utils::strmatch(modify->fix[whichfix]->style,"^npt")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^rigid/npt")) ) + if ( (!utils::strmatch(whichfix->style,"^npt")) && + (!utils::strmatch(whichfix->style,"^rigid/npt")) ) error->universe_all(FLERR,"Tempering temperature and pressure fix is not supported"); // setup for long tempering run @@ -116,8 +116,7 @@ void TemperNPT::command(int narg, char **arg) update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; - if (update->laststep < 0) - error->all(FLERR,"Too many timesteps"); + if (update->laststep < 0) error->all(FLERR,"Too many timesteps"); lmp->init(); @@ -133,9 +132,9 @@ void TemperNPT::command(int narg, char **arg) // pe_compute = ptr to thermo_pe compute // notify compute it will be called at first swap - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all(FLERR,"Tempering could not find thermo_pe compute"); - Compute *pe_compute = modify->compute[id]; + Compute *pe_compute = modify->get_compute_by_id("thermo_pe"); + if (!pe_compute) error->all(FLERR,"Tempering could not find thermo_pe compute"); + pe_compute->addstep(update->ntimestep + nevery); // create MPI communicator for root proc from each world @@ -184,7 +183,7 @@ void TemperNPT::command(int narg, char **arg) if (narg == 8) { double new_temp = set_temp[my_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // setup tempering runs @@ -279,22 +278,23 @@ void TemperNPT::command(int narg, char **arg) swap = 0; if (partner != -1) { - if (me_universe > partner) { + if (me_universe > partner) MPI_Send(&pe,1,MPI_DOUBLE,partner,0,universe->uworld); - } - else { + else MPI_Recv(&pe_partner,1,MPI_DOUBLE,partner,0,universe->uworld,MPI_STATUS_IGNORE); - } - if (me_universe > partner) { + + if (me_universe > partner) MPI_Send(&vol,1, MPI_DOUBLE,partner,0,universe->uworld); - } - else { + else MPI_Recv(&vol_partner,1,MPI_DOUBLE,partner,0,universe->uworld,MPI_STATUS_IGNORE); - } - // Acceptance criteria changed for NPT ensemble + + // Acceptance criteria changed versus temper command for NPT ensemble if (me_universe < partner) { press_units = press_set/nktv2p; - delr = (pe_partner - pe)*(1.0/(boltz*set_temp[my_set_temp]) - 1.0/(boltz*set_temp[partner_set_temp])) + press_units*(1.0/(boltz*set_temp[my_set_temp]) - 1.0/(boltz*set_temp[partner_set_temp]))*(vol_partner - vol); + delr = (pe_partner - pe)*(1.0/(boltz*set_temp[my_set_temp]) + - 1.0/(boltz*set_temp[partner_set_temp])) + + press_units*(1.0/(boltz*set_temp[my_set_temp]) + - 1.0/(boltz*set_temp[partner_set_temp]))*(vol_partner - vol); boltz_factor = -delr; if (boltz_factor >= 0.0) swap = 1; else if (ranboltz->uniform() < exp(boltz_factor)) swap = 1; @@ -304,13 +304,13 @@ void TemperNPT::command(int narg, char **arg) MPI_Send(&swap,1,MPI_INT,partner,0,universe->uworld); else MPI_Recv(&swap,1,MPI_INT,partner,0,universe->uworld,MPI_STATUS_IGNORE); -#ifdef TEMPER_DEBUG + +#if TEMPER_DEBUG if (me_universe < partner) fprintf(universe->uscreen,"SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g, vol = %g %g\n", me_universe,partner,swap,my_set_temp,partner_set_temp, pe,pe_partner,boltz_factor,exp(boltz_factor), vol, vol_partner); #endif - } // bcast swap result to other procs in my world @@ -325,7 +325,7 @@ void TemperNPT::command(int narg, char **arg) if (swap) { new_temp = set_temp[partner_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // update my_set_temp and temp2world on every proc diff --git a/src/REPLICA/temper_npt.h b/src/REPLICA/temper_npt.h index 3a51fc74e4..3ea29a21f6 100644 --- a/src/REPLICA/temper_npt.h +++ b/src/REPLICA/temper_npt.h @@ -42,8 +42,7 @@ class TemperNPT : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - int whichfix; // index of temperature fix to use - int fixstyle; // what kind of temperature fix is used + class Fix *whichfix; // temperature fix to use int my_set_temp; // which set temp I am simulating double *set_temp; // static list of replica set temperatures diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index df49d84439..44427d2914 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -610,7 +610,7 @@ FixRigid::~FixRigid() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); delete random; delete[] inpfile; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 089c644f1e..bf0a847d48 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -259,7 +259,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { - p_start[2] = p_stop[2] = p_period[2] = 0.0; + p_start[2] = p_stop[2] = p_period[2] = 0.0; p_flag[2] = 0; } iarg += 4; @@ -275,7 +275,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; - p_flag[2] = 0; + p_flag[2] = 0; } iarg += 4; @@ -481,7 +481,7 @@ FixRigidSmall::~FixRigidSmall() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); // delete locally stored arrays diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 6cd624c755..b2c65220bc 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -255,7 +255,7 @@ FixShake::~FixShake() // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); // set bond_type and angle_type back to positive for SHAKE clusters // must set for all SHAKE bonds and angles stored by each atom @@ -877,7 +877,7 @@ void FixShake::find_clusters() tagprev = tag[i] - iatom - 1; npartner[i] = atommols[imol]->nspecial[iatom][0]; for (j = 0; j < npartner[i]; j++) - partner_tag[i][j] = atommols[imol]->special[iatom][j] + tagprev;; + partner_tag[i][j] = atommols[imol]->special[iatom][j] + tagprev; } } diff --git a/src/SMTBQ/pair_smtbq.cpp b/src/SMTBQ/pair_smtbq.cpp index 15e5c2da5e..4f924a6fca 100644 --- a/src/SMTBQ/pair_smtbq.cpp +++ b/src/SMTBQ/pair_smtbq.cpp @@ -204,7 +204,7 @@ PairSMTBQ::~PairSMTBQ() memory->destroy(potcov); memory->destroy(nvsm); - memory->destroy(vsm);; + memory->destroy(vsm); memory->destroy(flag_QEq); memory->destroy(nQEqall); @@ -446,7 +446,7 @@ void PairSMTBQ::read_file(char *file) params[i].chi = values.next_double(); params[i].dj = values.next_double(); - if (strcmp(params[i].nom, "O") !=0) { + if (strcmp(params[i].nom, "O") != 0) { params[i].R = values.next_double(); if ((comm->me == 0) && VERBOSE) utils::logmesg(lmp, " {} {} {} {} {}\n",label,params[i].ne,params[i].chi, @@ -782,7 +782,7 @@ void PairSMTBQ::read_file(char *file) if (intparams[m].intsm == 0) continue; intparams[m].neig_cut = 1.2*intparams[m].r0; - if (strcmp(intparams[m].typepot,"second_moment") == 0 ) + if (strcmp(intparams[m].typepot,"second_moment") == 0) if ((comm->me == 0) && VERBOSE) utils::logmesg(lmp, " Rc 1er voisin, typepot {} -> {} Ang\n", intparams[m].typepot,intparams[m].neig_cut); @@ -1020,7 +1020,7 @@ void PairSMTBQ::compute(int eflag, int vflag) // ---------------------------------------------- if ( strcmp(intparams[m].typepot,"buck") == 0 || - strcmp(intparams[m].typepot,"buckPlusAttr") ==0) { + strcmp(intparams[m].typepot,"buckPlusAttr") == 0) { // ---------------------------------------------- evdwl = 0.0; fpair =0.0; @@ -1070,7 +1070,7 @@ void PairSMTBQ::compute(int eflag, int vflag) // ----------------------------------------------------------------- - if (strcmp(intparams[m].typepot,"second_moment") != 0 ) continue; + if (strcmp(intparams[m].typepot,"second_moment") != 0) continue; // ----------------------------------------------------------------- @@ -2575,7 +2575,7 @@ void PairSMTBQ::Charge() if (me == 0 && strcmp(Bavard,"false") != 0) { for (gp = 0; gp < nteam+1; gp++) { printf (" ++++ Groupe %d - Nox %d Ncat %d\n",gp,nQEqaall[gp],nQEqcall[gp]); - if (nQEqcall[gp] !=0 && nQEqaall[gp] !=0 ) + if (nQEqcall[gp] != 0 && nQEqaall[gp] !=0 ) printf (" neutralite des charges %f\n qtotc %f qtota %f\n", qtotll,qtotcll[gp]/nQEqcall[gp],qtotall[gp]/nQEqaall[gp]); printf (" ---------------------------- \n");} @@ -2641,7 +2641,7 @@ void PairSMTBQ::Charge() for (i = 0; i < nteam+1; i++) { - if (nQEqall[i] !=0) TransfAll[i] /= static_cast(nQEqall[i]); + if (nQEqall[i] != 0) TransfAll[i] /= static_cast(nQEqall[i]); enegchk[i] = enegmax[i] = 0.0; } @@ -2665,7 +2665,7 @@ void PairSMTBQ::Charge() for (gp = 0; gp < nteam+1; gp++) { - if (nQEqall[gp] !=0) { + if (nQEqall[gp] != 0) { enegchk[gp] = enegchkall[gp]/static_cast(nQEqall[gp]); enegmax[gp] = enegmaxall[gp]; } @@ -2729,7 +2729,7 @@ void PairSMTBQ::Charge() // Statistique (ecart type) // ------------------------ for (i=0; i(nQEqcall[i]) ; TransfAll[i+2*cluster] /= static_cast(nQEqaall[i]) ;} sigmaa[i] = sigmac[i] = 0.0; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index c9c84239b6..ae9d33a705 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -378,7 +378,7 @@ void MinSpinLBFGS::calc_search_direction() scaling = maximum_rotation(g_cur); for (int i = 0; i < 3 * nlocal; i++) { - p_s[i] = -g_cur[i] * factor * scaling;; + p_s[i] = -g_cur[i] * factor * scaling; g_old[i] = g_cur[i] * factor; for (int k = 0; k < num_mem; k++) { ds[k][i] = 0.0; diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index 3667180bc9..172a092629 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -297,9 +297,10 @@ int DumpVTK::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { compute[i]->compute_peratom(); compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1933,7 +1934,7 @@ void DumpVTK::identify_vectors() // assume components are grouped together and in correct order if (name.count(it->first + 1) && name.count(it->first + 2)) { // more attributes? if (it->second.compare(0,it->second.length()-3,name[it->first + 1],0,it->second.length()-3) == 0 && // same attributes? - it->second.compare(0,it->second.length()-3,name[it->first + 2],0,it->second.length()-3) == 0 ) + it->second.compare(0,it->second.length()-3,name[it->first + 2],0,it->second.length()-3) == 0) { it->second.erase(it->second.length()-1); std::ostringstream oss; diff --git a/src/YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/YAFF/pair_lj_switch3_coulgauss_long.cpp index 5266901318..dbbab7e5fe 100644 --- a/src/YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -165,7 +165,6 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag) // Correction for Gaussian radii if (lj2[itype][jtype]==0.0) { // This means a point charge is considered, so the correction is zero - expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; prefactor2 = 0.0; @@ -616,7 +615,6 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, r6inv = r2inv*r2inv*r2inv; forcelj = r6inv*(12.0*lj3[itype][jtype]*r6inv-6.0*lj4[itype][jtype]); if (lj2[itype][jtype] == 0.0) { - expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; prefactor2 = 0.0; diff --git a/src/atom.cpp b/src/atom.cpp index f30ace174e..c4521a244e 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -966,10 +966,10 @@ void Atom::bonus_check() bigint local_bodies = 0, num_global; for (int i = 0; i < nlocal; ++i) { - if (ellipsoid && (ellipsoid[i] >=0)) ++local_ellipsoids; - if (line && (line[i] >=0)) ++local_lines; - if (tri && (tri[i] >=0)) ++local_tris; - if (body && (body[i] >=0)) ++local_bodies; + if (ellipsoid && (ellipsoid[i] >= 0)) ++local_ellipsoids; + if (line && (line[i] >= 0)) ++local_lines; + if (tri && (tri[i] >= 0)) ++local_tris; + if (body && (body[i] >= 0)) ++local_bodies; } MPI_Allreduce(&local_ellipsoids,&num_global,1,MPI_LMP_BIGINT,MPI_SUM,world); @@ -1818,17 +1818,16 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) void Atom::data_fix_compute_variable(int nprev, int nnew) { - for (const auto &fix : modify->get_fix_list()) { - if (fix->create_attribute) + for (const auto &ifix : modify->get_fix_list()) { + if (ifix->create_attribute) for (int i = nprev; i < nnew; i++) - fix->set_arrays(i); + ifix->set_arrays(i); } - for (int m = 0; m < modify->ncompute; m++) { - Compute *compute = modify->compute[m]; - if (compute->create_attribute) + for (const auto &icompute : modify->get_compute_list()) { + if (icompute->create_attribute) for (int i = nprev; i < nnew; i++) - compute->set_arrays(i); + icompute->set_arrays(i); } for (int i = nprev; i < nnew; i++) @@ -2129,14 +2128,18 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off // initialize custom per-atom properties to zero if present - for (int i = 0; i < nivector; ++i) ivector[i][ilocal] = 0; - for (int i = 0; i < ndvector; ++i) dvector[i][ilocal] = 0.0; + for (int i = 0; i < nivector; ++i) + if (ivname[i]) ivector[i][ilocal] = 0; + for (int i = 0; i < ndvector; ++i) + if (dvname[i]) dvector[i][ilocal] = 0.0; for (int i = 0; i < niarray; ++i) - for (int j = 0; j < icols[i]; ++j) - iarray[i][ilocal][j] = 0; + if (ianame[i]) + for (int j = 0; j < icols[i]; ++j) + iarray[i][ilocal][j] = 0; for (int i = 0; i < ndarray; ++i) - for (int j = 0; j < dcols[i]; ++j) - darray[i][ilocal][j] = 0.0; + if (daname[i]) + for (int j = 0; j < dcols[i]; ++j) + darray[i][ilocal][j] = 0.0; if (molecular != Atom::MOLECULAR) return; diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index d2f9c51880..8769c316d9 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -16,7 +16,6 @@ #include "atom.h" #include "error.h" #include "fix.h" -#include "fix_adapt.h" #include "math_const.h" #include "modify.h" @@ -31,6 +30,7 @@ AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp) { mass_type = PER_ATOM; molecular = Atom::ATOMIC; + radvary = 0; atom->sphere_flag = 1; atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1; @@ -88,11 +88,11 @@ void AtomVecSphere::init() // check if optional radvary setting should have been set to 1 - for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style, "adapt") == 0) { - auto fix = dynamic_cast(modify->fix[i]); - if (fix->diamflag && radvary == 0) - error->all(FLERR, "Fix adapt changes particle radii but atom_style sphere is not dynamic"); + if (radvary == 0) + for (const auto &ifix : modify->get_fix_by_style("^adapt")) { + if (ifix->diam_flag) + error->all(FLERR, "Fix {} changes atom radii but atom_style sphere is not dynamic", + ifix->style); } } diff --git a/src/compute.cpp b/src/compute.cpp index dcad4954fc..2bd1544fd7 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -74,6 +74,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : dynamic = 0; dynamic_group_allow = 1; + initialized_flag = 0; invoked_scalar = invoked_vector = invoked_array = -1; invoked_peratom = invoked_local = -1; invoked_flag = INVOKED_NONE; @@ -111,6 +112,15 @@ Compute::~Compute() /* ---------------------------------------------------------------------- */ +void Compute::init_flags() +{ + initialized_flag = 1; + invoked_scalar = invoked_vector = invoked_array = -1; + invoked_peratom = invoked_local = -1; +} + +/* ---------------------------------------------------------------------- */ + void Compute::modify_params(int narg, char **arg) { if (narg == 0) error->all(FLERR,"Illegal compute_modify command"); diff --git a/src/compute.h b/src/compute.h index 72b0075fd6..8ae01a4469 100644 --- a/src/compute.h +++ b/src/compute.h @@ -62,7 +62,7 @@ class Compute : protected Pointers { int size_local_rows; // rows in local vector or array int size_local_cols; // 0 = vector, N = columns in local array - int pergrid_flag; // 0/1 if compute_pergrid() function exists + int pergrid_flag; // 0/1 if compute_pergrid() function exists int extscalar; // 0/1 if global scalar is intensive/extensive int extvector; // 0/1/-1 if global vector is all int/ext/extlist @@ -88,6 +88,7 @@ class Compute : protected Pointers { int maxtime; // max # of entries time list can hold bigint *tlist; // list of timesteps the Compute is called on + int initialized_flag; // 1 if compute is initialized, 0 if not int invoked_flag; // non-zero if invoked or accessed this step, 0 if not bigint invoked_scalar; // last timestep on which compute_scalar() was invoked bigint invoked_vector; // ditto for compute_vector() @@ -114,6 +115,7 @@ class Compute : protected Pointers { void modify_params(int, char **); virtual void reset_extra_dof(); + void init_flags(); virtual void init() = 0; virtual void init_list(int, class NeighList *) {} virtual void setup() {} @@ -161,6 +163,8 @@ class Compute : protected Pointers { int matchstep(bigint); void clearstep(); + bool is_initialized() const { return initialized_flag == 1; } + virtual double memory_usage() { return 0.0; } virtual void pair_setup_callback(int, int) {} diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 05526494c0..e68062b73e 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -82,10 +82,8 @@ void ComputeAggregateAtom::init() neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "aggregate/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute aggregate/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index ae6ef4901f..10d2a79c45 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -93,14 +93,12 @@ void ComputeCentroAtom::init() if (force->pair == nullptr) error->all(FLERR, "Compute centro/atom requires a pair style be defined"); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "centro/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute centro/atom"); - // need an occasional full neighbor list neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); + + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ @@ -338,7 +336,7 @@ void ComputeCentroAtom::select(int k, int n, double *arr) arr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l + 1) { if (ir == l + 1 && arr[ir] < arr[l]) { SWAP(arr[l], arr[ir]) } return; @@ -351,7 +349,7 @@ void ComputeCentroAtom::select(int k, int n, double *arr) i = l + 1; j = ir; a = arr[l + 1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; @@ -378,7 +376,7 @@ void ComputeCentroAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l + 1) { if (ir == l + 1 && arr[ir] < arr[l]) { SWAP(arr[l], arr[ir]) @@ -405,7 +403,7 @@ void ComputeCentroAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l + 1]; ia = iarr[l + 1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 933cf0af0c..53b8517c22 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -106,7 +106,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : } else if (val.which == ArgInfo::FIX) { auto ifix = modify->get_fix_by_id(val.id); - if (ifix) + if (!ifix) error->all(FLERR,"Fix ID {} for compute chunk/spread/atom does not exist", val.id); if (val.argindex == 0) { if (!ifix->vector_flag) diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 0a0a36debd..ae44fbcd37 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -69,10 +69,8 @@ void ComputeClusterAtom::init() neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "cluster/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute cluster/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index ccb4183707..a09a671c07 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -76,19 +76,15 @@ void ComputeCNAAtom::init() // cannot use neighbor->cutneighmax b/c neighbor has not yet been init - if (2.0 * sqrt(cutsq) > force->pair->cutforce + neighbor->skin && comm->me == 0) - error->warning(FLERR, - "Compute cna/atom cutoff may be too large to find " - "ghost atom neighbors"); - - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "cna/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute cna/atom defined"); + if ((2.0 * sqrt(cutsq)) > (force->pair->cutforce + neighbor->skin) && (comm->me == 0)) + error->warning(FLERR, "Compute cna/atom cutoff may be too large to find ghost atom neighbors"); // need an occasional full neighbor list neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); + + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index 0d56ea6573..ea19f01b91 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -82,10 +82,11 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : id_orientorder = utils::strdup(arg[4]); - int iorientorder = modify->find_compute(id_orientorder); - if (iorientorder < 0) error->all(FLERR, "Could not find compute coord/atom compute ID"); - if (!utils::strmatch(modify->compute[iorientorder]->style, "^orientorder/atom")) - error->all(FLERR, "Compute coord/atom compute ID is not orientorder/atom"); + auto iorientorder = modify->get_compute_by_id(id_orientorder); + if (!iorientorder) + error->all(FLERR, "Could not find compute coord/atom compute ID {}", id_orientorder); + if (!utils::strmatch(iorientorder->style, "^orientorder/atom")) + error->all(FLERR, "Compute coord/atom compute ID {} is not orientorder/atom", id_orientorder); threshold = utils::numeric(FLERR, arg[5], false, lmp); if (threshold <= -1.0 || threshold >= 1.0) @@ -128,8 +129,11 @@ ComputeCoordAtom::~ComputeCoordAtom() void ComputeCoordAtom::init() { if (cstyle == ORIENT) { - int iorientorder = modify->find_compute(id_orientorder); - c_orientorder = dynamic_cast(modify->compute[iorientorder]); + c_orientorder = + dynamic_cast(modify->get_compute_by_id(id_orientorder)); + if (!c_orientorder) + error->all(FLERR, "Could not find compute coord/atom compute ID {}", id_orientorder); + cutsq = c_orientorder->cutsq; l = c_orientorder->qlcomp; // communicate real and imaginary 2*l+1 components of the normalized vector diff --git a/src/compute_count_type.cpp b/src/compute_count_type.cpp index 3cb2e6bc3a..3d4815f9ff 100644 --- a/src/compute_count_type.cpp +++ b/src/compute_count_type.cpp @@ -159,6 +159,8 @@ void ComputeCountType::compute_vector() nvec = count_dihedrals(); else if (mode == IMPROPER) nvec = count_impropers(); + else + nvec = 0; // sum across procs as bigint, then convert to double // correct for multiple counting if newton_bond off diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index 9bfa0afaea..3ec0f402a8 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -57,11 +57,8 @@ ComputeErotateSphereAtom::~ComputeErotateSphereAtom() void ComputeErotateSphereAtom::init() { - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style,"erotate/sphere/atom") == 0) count++; - if (count > 1 && comm->me == 0) - error->warning(FLERR,"More than one compute erotate/sphere/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); pfactor = 0.5 * force->mvv2e * INERTIA; } diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 810ffa4d66..035f554c8d 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -84,11 +84,8 @@ void ComputeFragmentAtom::init() if (atom->molecular != Atom::MOLECULAR) error->all(FLERR,"Compute fragment/atom requires a molecular system"); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style,"fragment/atom") == 0) count++; - if (count > 1 && comm->me == 0) - error->warning(FLERR,"More than one compute fragment/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index aab687755e..9a329232b3 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -47,10 +47,8 @@ ComputeKEAtom::~ComputeKEAtom() void ComputeKEAtom::init() { - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "ke/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute ke/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 5682432c8e..6f1b2b4036 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -370,7 +370,7 @@ void ComputeOrientOrderAtom::select3(int k, int n, double *arr, int *iarr, doubl arr3--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l + 1) { if (ir == l + 1 && arr[ir] < arr[l]) { SWAP(arr[l], arr[ir]); @@ -405,7 +405,7 @@ void ComputeOrientOrderAtom::select3(int k, int n, double *arr, int *iarr, doubl a3[0] = arr3[l + 1][0]; a3[1] = arr3[l + 1][1]; a3[2] = arr3[l + 1][2]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index fc7089fa01..c3c101b995 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -376,7 +376,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : index[i] = atom->avec->property_atom(arg[iarg]); if (index[i] < 0) error->all(FLERR,"Invalid keyword {} for atom style {} in compute property/atom command ", - atom->get_style(), arg[iarg]); + arg[iarg], atom->get_style()); pack_choice[i] = &ComputePropertyAtom::pack_atom_style; } } @@ -1268,7 +1268,7 @@ void ComputePropertyAtom::pack_shapex(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = 2.0*bonus[ellipsoid[i]].shape[0]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } } @@ -1285,7 +1285,7 @@ void ComputePropertyAtom::pack_shapey(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = 2.0*bonus[ellipsoid[i]].shape[1]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } } @@ -1302,7 +1302,7 @@ void ComputePropertyAtom::pack_shapez(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = 2.0*bonus[ellipsoid[i]].shape[2]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } } @@ -1320,7 +1320,7 @@ void ComputePropertyAtom::pack_quatw(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = bonus[ellipsoid[i]].quat[0]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 5355ce2b7c..13a99a182f 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -49,7 +49,7 @@ void CreateBonds::command(int narg, char **arg) if (atom->molecular != Atom::MOLECULAR) error->all(FLERR, "Cannot use create_bonds with non-molecular system"); - if (narg < 4) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "create_bonds", error); // parse args @@ -58,38 +58,38 @@ void CreateBonds::command(int narg, char **arg) int iarg = 0; if (strcmp(arg[0], "many") == 0) { style = MANY; - if (narg != 6) error->all(FLERR, "Illegal create_bonds command"); + if (narg != 6) error->all(FLERR, "No optional keywords allowed with create_bonds many"); igroup = group->find(arg[1]); - if (igroup == -1) error->all(FLERR, "Cannot find create_bonds group ID"); + if (igroup == -1) error->all(FLERR, "Cannot find create_bonds first group ID {}", arg[1]); group1bit = group->bitmask[igroup]; igroup = group->find(arg[2]); - if (igroup == -1) error->all(FLERR, "Cannot find create_bonds group ID"); + if (igroup == -1) error->all(FLERR, "Cannot find create_bonds second group ID {}", arg[2]); group2bit = group->bitmask[igroup]; btype = utils::inumeric(FLERR, arg[3], false, lmp); rmin = utils::numeric(FLERR, arg[4], false, lmp); rmax = utils::numeric(FLERR, arg[5], false, lmp); - if (rmin > rmax) error->all(FLERR, "Illegal create_bonds command"); + if (rmin > rmax) error->all(FLERR, "Inconsistent cutoffs for create_bonds many"); iarg = 6; } else if (strcmp(arg[0], "single/bond") == 0) { style = SBOND; btype = utils::inumeric(FLERR, arg[1], false, lmp); batom1 = utils::tnumeric(FLERR, arg[2], false, lmp); batom2 = utils::tnumeric(FLERR, arg[3], false, lmp); - if (batom1 == batom2) error->all(FLERR, "Illegal create_bonds command"); + if (batom1 == batom2) error->all(FLERR, "Bond atoms must be different"); iarg = 4; } else if (strcmp(arg[0], "single/angle") == 0) { style = SANGLE; - if (narg < 5) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 5) utils::missing_cmd_args(FLERR, "create_bonds single/angle", error); atype = utils::inumeric(FLERR, arg[1], false, lmp); aatom1 = utils::tnumeric(FLERR, arg[2], false, lmp); aatom2 = utils::tnumeric(FLERR, arg[3], false, lmp); aatom3 = utils::tnumeric(FLERR, arg[4], false, lmp); if ((aatom1 == aatom2) || (aatom1 == aatom3) || (aatom2 == aatom3)) - error->all(FLERR, "Illegal create_bonds command"); + error->all(FLERR, "Angle atoms must be different"); iarg = 5; } else if (strcmp(arg[0], "single/dihedral") == 0) { style = SDIHEDRAL; - if (narg < 6) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "create_bonds single/dihedral", error); dtype = utils::inumeric(FLERR, arg[1], false, lmp); datom1 = utils::tnumeric(FLERR, arg[2], false, lmp); datom2 = utils::tnumeric(FLERR, arg[3], false, lmp); @@ -101,7 +101,7 @@ void CreateBonds::command(int narg, char **arg) iarg = 6; } else if (strcmp(arg[0], "single/improper") == 0) { style = SIMPROPER; - if (narg < 6) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "create_bonds single/improper", error); dtype = utils::inumeric(FLERR, arg[1], false, lmp); datom1 = utils::tnumeric(FLERR, arg[2], false, lmp); datom2 = utils::tnumeric(FLERR, arg[3], false, lmp); @@ -197,6 +197,11 @@ void CreateBonds::many() if (rmax > neighbor->cutneighmin && comm->me == 0) error->warning(FLERR, "Create_bonds max distance > minimum neighbor cutoff"); + if ((domain->xperiodic && (rmax > domain->xprd)) || + (domain->yperiodic && (rmax > domain->yprd)) || + ((domain->dimension == 3) && domain->zperiodic && (rmax > domain->zprd))) + error->all(FLERR, "Bond creation cutoff is larger than periodic domain"); + // require special_bonds 1-2 weights = 0.0 and KSpace = nullptr // so that already bonded atom pairs do not appear in neighbor list // otherwise with newton_bond = 1, @@ -205,7 +210,7 @@ void CreateBonds::many() if (force->special_lj[1] != 0.0 || force->special_coul[1] != 0.0) error->all(FLERR, "Create_bonds command requires special_bonds 1-2 weights be 0.0"); - if (force->kspace) error->all(FLERR, "Create_bonds command requires no kspace_style be defined"); + if (force->kspace) error->all(FLERR, "Create_bonds command is incompatible with Kspace styles"); // setup domain, communication and neighboring // acquire ghosts and build standard neighbor lists diff --git a/src/domain.cpp b/src/domain.cpp index edca633508..3627af26cf 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1432,6 +1432,29 @@ void Domain::remap_near(double *xnew, double *xold) if (triclinic) lamda2x(coordnew,xnew); } +/* ---------------------------------------------------------------------- + remap the point to specific image flags + x overwritten with result, reset image flag + for triclinic, use h[] to add in tilt factors in other dims as needed +------------------------------------------------------------------------- */ + +void Domain::unmap_inv(double *x, imageint image) +{ + int xbox = (image & IMGMASK) - IMGMAX; + int ybox = (image >> IMGBITS & IMGMASK) - IMGMAX; + int zbox = (image >> IMG2BITS) - IMGMAX; + + if (triclinic == 0) { + x[0] -= xbox*xprd; + x[1] -= ybox*yprd; + x[2] -= zbox*zprd; + } else { + x[0] -= h[0]*xbox + h[5]*ybox + h[4]*zbox; + x[1] -= h[1]*ybox + h[3]*zbox; + x[2] -= h[2]*zbox; + } +} + /* ---------------------------------------------------------------------- unmap the point via image flags x overwritten with result, don't reset image flag diff --git a/src/domain.h b/src/domain.h index da574bd46f..ab054f1b50 100644 --- a/src/domain.h +++ b/src/domain.h @@ -125,6 +125,7 @@ class Domain : protected Pointers { void remap(double *, imageint &); void remap(double *); void remap_near(double *, double *); + void unmap_inv(double *x, imageint); void unmap(double *, imageint); void unmap(const double *, imageint, double *); void image_flip(int, int, int); diff --git a/src/dump.cpp b/src/dump.cpp index 372773bbb2..39d8989c41 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -41,14 +41,20 @@ Dump *Dump::dumpptr; #define BIG 1.0e20 #define EPSILON 1.0e-6 -enum{ASCEND,DESCEND}; +enum { ASCEND, DESCEND }; /* ---------------------------------------------------------------------- */ -Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) +Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : + Pointers(lmp), multiname(nullptr), refresh(nullptr), skipvar(nullptr), format(nullptr), + format_default(nullptr), format_line_user(nullptr), format_float_user(nullptr), + format_int_user(nullptr), format_bigint_user(nullptr), format_column_user(nullptr), fp(nullptr), + nameslist(nullptr), buf(nullptr), sbuf(nullptr), ids(nullptr), bufsort(nullptr), + idsort(nullptr), index(nullptr), proclist(nullptr), xpbc(nullptr), vpbc(nullptr), + imagepbc(nullptr), irregular(nullptr) { - MPI_Comm_rank(world,&me); - MPI_Comm_size(world,&nprocs); + MPI_Comm_rank(world, &me); + MPI_Comm_size(world, &nprocs); id = utils::strdup(arg[0]); @@ -64,17 +70,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) first_flag = 0; flush_flag = 1; - format = nullptr; - format_default = nullptr; - - format_line_user = nullptr; - format_float_user = nullptr; - format_int_user = nullptr; - format_bigint_user = nullptr; - format_column_user = nullptr; - refreshflag = 0; - refresh = nullptr; clearstep = 0; sort_flag = 0; @@ -92,25 +88,15 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) has_id = 1; skipflag = 0; - skipvar = nullptr; maxfiles = -1; numfiles = 0; fileidx = 0; - nameslist = nullptr; maxbuf = maxids = maxsort = maxproc = 0; - buf = bufsort = nullptr; - ids = idsort = nullptr; - index = proclist = nullptr; - irregular = nullptr; - maxsbuf = 0; - sbuf = nullptr; maxpbc = -1; - xpbc = vpbc = nullptr; - imagepbc = nullptr; // parse filename for special syntax // if contains '%', write one file per proc and replace % with proc-ID @@ -120,18 +106,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // else if ends in .gz or other known extensions -> compressed text file // else ASCII text file - fp = nullptr; singlefile_opened = 0; compressed = 0; binary = 0; multifile = 0; + size_one = 0; multiproc = 0; nclusterprocs = nprocs; filewriter = 0; if (me == 0) filewriter = 1; fileproc = 0; - multiname = nullptr; char *ptr; if ((ptr = strchr(filename,'%'))) { diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 1d3862ab26..2d047dc0a0 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -29,7 +29,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) +DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : + Dump(lmp, narg, arg), header_choice(nullptr), pack_choice(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump atom command"); @@ -146,6 +147,8 @@ int DumpAtom::modify_param(int narg, char **arg) void DumpAtom::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } @@ -154,6 +157,8 @@ void DumpAtom::write_header(bigint ndump) void DumpAtom::pack(tagint *ids) { + if (!pack_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*pack_choice)(ids); } diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 517956caf1..1e60295bbe 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -53,20 +53,21 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; /* ---------------------------------------------------------------------- */ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : - Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), - thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), - thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), - columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), - field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), - fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), - custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr) + Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), + thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), + thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), + columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), + field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), + fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), + custom(nullptr), custom_flag(nullptr), typenames(nullptr), header_choice(nullptr), + pack_choice(nullptr) { - if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); + if (narg == 5) error->all(FLERR,"No dump {} arguments specified", style); clearstep = 1; nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal dump custom command"); + if (nevery <= 0) error->all(FLERR,"Illegal dump {} command: output frequency must be > 0", style); // expand args if any have wildcard character "*" // ok to include trailing optional args, @@ -141,7 +142,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : else if (vtype[i] == Dump::BIGINT) cols += BIGINT_FORMAT " "; vformat[i] = nullptr; } - cols.resize(cols.size()-1); + if (nfield > 0) cols.resize(cols.size()-1); format_default = utils::strdup(cols); format_column_user = new char*[nfield]; @@ -309,20 +310,20 @@ void DumpCustom::init_style() for (i = 0; i < ncompute; i++) { compute[i] = modify->get_compute_by_id(id_compute[i]); - if (!compute[i]) error->all(FLERR,"Could not find dump custom compute ID {}",id_compute[i]); + if (!compute[i]) error->all(FLERR,"Could not find dump {} compute ID {}",style,id_compute[i]); } for (i = 0; i < nfix; i++) { fix[i] = modify->get_fix_by_id(id_fix[i]); - if (!fix[i]) error->all(FLERR,"Could not find dump custom fix ID {}", id_fix[i]); + if (!fix[i]) error->all(FLERR,"Could not find dump {} fix ID {}", style, id_fix[i]); if (nevery % fix[i]->peratom_freq) - error->all(FLERR,"Dump custom and fix not computed at compatible times"); + error->all(FLERR,"Dump {} and fix not computed at compatible times", style); } for (i = 0; i < nvariable; i++) { int ivariable = input->variable->find(id_variable[i]); if (ivariable < 0) - error->all(FLERR,"Could not find dump custom variable name {}", id_variable[i]); + error->all(FLERR,"Could not find dump {} variable name {}", style, id_variable[i]); variable[i] = ivariable; } @@ -330,7 +331,7 @@ void DumpCustom::init_style() for (int i = 0; i < ncustom; i++) { icustom = atom->find_custom(id_custom[i],flag,cols); if (icustom < 0) - error->all(FLERR,"Could not find dump custom atom property name"); + error->all(FLERR,"Could not find dump {} atom property name", style); custom[i] = icustom; if (!flag && !cols) custom_flag[i] = IVEC; else if (flag && !cols) custom_flag[i] = DVEC; @@ -341,7 +342,7 @@ void DumpCustom::init_style() // check validity of region if (idregion && !domain->get_region_by_id(idregion)) - error->all(FLERR,"Region {} for dump custom does not exist", idregion); + error->all(FLERR,"Region {} for dump {} does not exist", idregion, style); // open single file, one time only @@ -352,6 +353,8 @@ void DumpCustom::init_style() void DumpCustom::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } @@ -559,9 +562,10 @@ int DumpCustom::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { compute[i]->compute_peratom(); compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1461,7 +1465,12 @@ int DumpCustom::parse_fields(int narg, char **arg) switch (argi.get_type()) { case ArgInfo::UNKNOWN: - error->all(FLERR,"Invalid attribute in dump custom command"); + error->all(FLERR,"Invalid attribute {} in dump {} command",arg[iarg],style); + break; + + case ArgInfo::NONE: + // ignore because this may be a valid argument for a derived dump style class + return iarg; break; // compute value = c_ID @@ -1472,15 +1481,15 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; icompute = modify->get_compute_by_id(name); - if (!icompute) error->all(FLERR,"Could not find dump custom compute ID: {}",name); + if (!icompute) error->all(FLERR,"Could not find dump {} compute ID: {}", style, name); if (icompute->peratom_flag == 0) - error->all(FLERR,"Dump custom compute {} does not compute per-atom info",name); + error->all(FLERR,"Dump {} compute {} does not compute per-atom info", style, name); if (argi.get_dim() == 0 && icompute->size_peratom_cols > 0) - error->all(FLERR,"Dump custom compute {} does not calculate per-atom vector",name); + error->all(FLERR,"Dump {} compute {} does not calculate per-atom vector", style, name); if (argi.get_dim() > 0 && icompute->size_peratom_cols == 0) - error->all(FLERR,"Dump custom compute {} does not calculate per-atom array",name); + error->all(FLERR,"Dump {} compute {} does not calculate per-atom array", style, name); if (argi.get_dim() > 0 && argi.get_index1() > icompute->size_peratom_cols) - error->all(FLERR,"Dump custom compute {} vector is accessed out-of-range",name); + error->all(FLERR,"Dump {} compute {} vector is accessed out-of-range", style, name); field2index[iarg] = add_compute(name); break; @@ -1493,15 +1502,15 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; ifix = modify->get_fix_by_id(name); - if (!ifix) error->all(FLERR,"Could not find dump custom fix ID: {}",name); + if (!ifix) error->all(FLERR,"Could not find dump {} fix ID: {}", style, name); if (ifix->peratom_flag == 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom info",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom info", style, name); if (argi.get_dim() == 0 && ifix->size_peratom_cols > 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom vector",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom vector", style, name); if (argi.get_dim() > 0 && ifix->size_peratom_cols == 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom array",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom array", style, name); if (argi.get_dim() > 0 && argi.get_index1() > ifix->size_peratom_cols) - error->all(FLERR,"Dump custom fix {} vector is accessed out-of-range",name); + error->all(FLERR,"Dump {} fix {} vector is accessed out-of-range", style, name); field2index[iarg] = add_fix(name); break; @@ -1513,9 +1522,9 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; n = input->variable->find(name); - if (n < 0) error->all(FLERR,"Could not find dump custom variable name {}",name); + if (n < 0) error->all(FLERR,"Could not find dump {} variable name {}", style, name); if (input->variable->atomstyle(n) == 0) - error->all(FLERR,"Dump custom variable {} is not atom-style variable",name); + error->all(FLERR,"Dump {} variable {} is not atom-style variable", style, name); field2index[iarg] = add_variable(name); break; @@ -1532,12 +1541,12 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[iarg] == 0) { if (!flag || cols) - error->all(FLERR,"Property double vector {} for dump custom does not exist",name); + error->all(FLERR,"Property double vector {} for dump {} does not exist", name, style); } else { if (!flag || !cols) - error->all(FLERR,"Property double array {} for dump custom does not exist",name); + error->all(FLERR,"Property double array {} for dump {} does not exist", name, style); if (argindex[iarg] > atom->dcols[n]) - error->all(FLERR,"Dump custom property array {} is accessed out-of-range",name); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); } field2index[iarg] = add_custom(name,1); @@ -1555,12 +1564,12 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[iarg] == 0) { if (flag || cols) - error->all(FLERR,"Property integer vector {} for dump custom does not exist",name); + error->all(FLERR,"Property integer vector {} for dump {} does not exist", name, style); } else { if (flag || !cols) - error->all(FLERR,"Property integer array {} for dump custom does not exist",name); + error->all(FLERR,"Property integer array {} for dump {} does not exist", name, style); if (argindex[iarg] > atom->icols[n]) - error->all(FLERR,"Dump custom property array {} is accessed out-of-range",name); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); } field2index[iarg] = add_custom(name,0); @@ -1945,9 +1954,9 @@ int DumpCustom::modify_param(int narg, char **arg) case ArgInfo::VARIABLE: thresh_array[nthresh] = VARIABLE; n = input->variable->find(name); - if (n < 0) error->all(FLERR,"Could not find dump modify variable name: {}",name); + if (n < 0) error->all(FLERR,"Could not find dump modify variable name: {}", name); if (input->variable->atomstyle(n) == 0) - error->all(FLERR,"Dump modify variable {} is not atom-style variable",name); + error->all(FLERR,"Dump modify variable {} is not atom-style variable", name); field2index[nfield+nthresh] = add_variable(name); break; @@ -1961,13 +1970,13 @@ int DumpCustom::modify_param(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[nfield+nthresh] == 0) { if (!flag || cols) - error->all(FLERR,"Property double vector for dump custom does not exist"); + error->all(FLERR,"Property double vector {} for dump {} does not exist", name, style); thresh_array[nthresh] = DVEC; } else { if (!flag || !cols) - error->all(FLERR,"Property double array for dump custom does not exist"); + error->all(FLERR,"Property double array {} for dump {} does not exist", name, style); if (argindex[nfield+nthresh] > atom->dcols[n]) - error->all(FLERR,"Dump custom property array is accessed out-of-range"); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); thresh_array[nthresh] = DARRAY; } @@ -1983,13 +1992,13 @@ int DumpCustom::modify_param(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[nfield+nthresh] == 0) { if (flag || cols) - error->all(FLERR,"Property integer vector for dump custom does not exist"); + error->all(FLERR,"Property integer vector {} for dump {} does not exist", name, style); thresh_array[nthresh] = IVEC; } else { if (flag || !cols) - error->all(FLERR,"Property integer array for dump custom does not exist"); + error->all(FLERR,"Property integer array {} for dump {} does not exist", name, style); if (argindex[nfield+nthresh] > atom->icols[n]) - error->all(FLERR,"Dump custom property array is accessed out-of-range"); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); thresh_array[nthresh] = IARRAY; } @@ -1999,7 +2008,7 @@ int DumpCustom::modify_param(int narg, char **arg) // no match default: - error->all(FLERR,"Invalid dump_modify thresh attribute: {}",name); + error->all(FLERR,"Invalid dump_modify thresh attribute: {}", name); break; } } diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 056cac1095..3c10aa9083 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -311,6 +311,8 @@ void DumpGrid::init_style() void DumpGrid::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } @@ -525,9 +527,10 @@ int DumpGrid::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERGRID)) { compute[i]->compute_pergrid(); compute[i]->invoked_flag |= Compute::INVOKED_PERGRID; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index ff1c540d3f..1ba433f93f 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -201,7 +201,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (iflag == ArgInfo::COMPUTE) id_grid_compute = utils::strdup(id); else if (iflag == ArgInfo::FIX) id_grid_fix = utils::strdup(id); - delete [] id; + delete[] id; grid_igrid = igrid; grid_idata = idata; grid_index = index; @@ -461,18 +461,18 @@ DumpImage::~DumpImage() { delete image; - delete [] diamtype; - delete [] diamelement; - delete [] colortype; - delete [] colorelement; - delete [] bdiamtype; - delete [] bcolortype; + delete[] diamtype; + delete[] diamelement; + delete[] colortype; + delete[] colorelement; + delete[] bdiamtype; + delete[] bcolortype; memory->destroy(chooseghost); memory->destroy(bufcopy); memory->destroy(gbuf); - delete [] id_grid_compute; - delete [] id_grid_fix; + delete[] id_grid_compute; + delete[] id_grid_fix; } /* ---------------------------------------------------------------------- */ @@ -667,8 +667,9 @@ void DumpImage::write() // cannot invoke before first run, otherwise invoke if necessary if (grid_compute) { - if (update->first_update == 0) - error->all(FLERR,"Grid compute used in dump image cannot be invoked before first run"); + if (!grid_compute->is_initialized()) + error->all(FLERR,"Grid compute ID {} used in dump image cannot be invoked " + "before initialization by a run", grid_compute->id); if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) { grid_compute->compute_pergrid(); grid_compute->invoked_flag |= Compute::INVOKED_PERGRID; diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 097589ea41..9695e152b2 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -328,9 +328,10 @@ int DumpLocal::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_LOCAL)) { compute[i]->compute_local(); compute[i]->invoked_flag |= Compute::INVOKED_LOCAL; diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 83c4d180d6..241ec1c059 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -130,6 +130,8 @@ int DumpXYZ::modify_param(int narg, char **arg) void DumpXYZ::write_header(bigint n) { if (me == 0) { + if (!fp) error->one(FLERR, "Must not use 'run pre no' after creating a new dump"); + auto header = fmt::format("{}\n Atoms. Timestep: {}", n, update->ntimestep); if (time_flag) header += fmt::format(" Time: {:.6f}", compute_time()); header += "\n"; @@ -177,9 +179,8 @@ int DumpXYZ::convert_string(int n, double *mybuf) memory->grow(sbuf,maxsbuf,"dump:sbuf"); } - offset += sprintf(&sbuf[offset],format, - typenames[static_cast (mybuf[m+1])], - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + offset += sprintf(&sbuf[offset], format, typenames[static_cast (mybuf[m+1])], + mybuf[m+2], mybuf[m+3], mybuf[m+4]); m += size_one; } diff --git a/src/fix.cpp b/src/fix.cpp index 82389ba433..70e4133cdd 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -79,6 +79,7 @@ Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) : maxexchange_dynamic = 0; pre_exchange_migrate = 0; stores_ids = 0; + diam_flag = 0; scalar_flag = vector_flag = array_flag = 0; peratom_flag = local_flag = pergrid_flag = 0; diff --git a/src/fix.h b/src/fix.h index 30373ab6f2..5d55048c28 100644 --- a/src/fix.h +++ b/src/fix.h @@ -79,6 +79,7 @@ class Fix : protected Pointers { int maxexchange_dynamic; // 1 if fix sets maxexchange dynamically int pre_exchange_migrate; // 1 if fix migrates atoms in pre_exchange() int stores_ids; // 1 if fix stores atom IDs + int diam_flag; // 1 if fix may change partical diameter int scalar_flag; // 0/1 if compute_scalar() function exists int vector_flag; // 0/1 if compute_vector() function exists diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 0b4ec9a638..660e3f6107 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -90,7 +90,6 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : // parse keywords nadapt = 0; - diamflag = 0; chgflag = 0; iarg = 4; @@ -149,7 +148,7 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"diameter") == 0 || strcmp(arg[iarg+1],"diameter/disc") == 0) { adapt[nadapt].atomparam = DIAMETER; - diamflag = 1; + diam_flag = 1; discflag = 0; if (strcmp(arg[iarg+1],"diameter/disc") == 0) discflag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { @@ -190,7 +189,7 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : // then previous step scale factors are written to restart file // initialize them here in case one is used and other is never defined - if (scaleflag && (diamflag || chgflag)) restart_global = 1; + if (scaleflag && (diam_flag || chgflag)) restart_global = 1; previous_diam_scale = previous_chg_scale = 1.0; // allocate pair style arrays @@ -260,7 +259,7 @@ int FixAdapt::setmask() void FixAdapt::post_constructor() { if (!resetflag) return; - if (!diamflag && !chgflag) return; + if (!diam_flag && !chgflag) return; // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix @@ -268,7 +267,7 @@ void FixAdapt::post_constructor() id_fix_diam = nullptr; id_fix_chg = nullptr; - if (diamflag && atom->radius_flag) { + if (diam_flag && atom->radius_flag) { id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM")); fix_diam = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE/ATOM 1 0 0 1", id_fix_diam,group->names[igroup]))); @@ -707,7 +706,7 @@ void FixAdapt::restore_settings() *kspace_scale = 1.0; } else if (ad->which == ATOM) { - if (diamflag) { + if (diam_flag) { double scale; double *vec = fix_diam->vstore; diff --git a/src/fix_adapt.h b/src/fix_adapt.h index f8477f7259..20964a8b12 100644 --- a/src/fix_adapt.h +++ b/src/fix_adapt.h @@ -26,7 +26,6 @@ namespace LAMMPS_NS { class FixAdapt : public Fix { public: - int diamflag; // 1 if atom diameters will vary, for AtomVecGranular int chgflag; FixAdapt(class LAMMPS *, int, char **); diff --git a/src/fix_ave_grid.cpp b/src/fix_ave_grid.cpp index 524def73a4..039c656fab 100644 --- a/src/fix_ave_grid.cpp +++ b/src/fix_ave_grid.cpp @@ -931,7 +931,7 @@ void FixAveGrid::atom2grid() vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; if (rmass) one = rmass[i]; else one = mass[type[i]]; - array2d[bin[i][0]][bin[i][1]][m] += one*vsq;; + array2d[bin[i][0]][bin[i][1]][m] += one*vsq; } } } else { diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 157e43610a..0a2975bb2e 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -590,7 +590,7 @@ void FixAveHisto::end_of_step() } else if (kind == PERATOM) { if (j == 0) bin_atoms(val.val.f->vector_atom,1); else if (val.val.f->array_atom) - bin_atoms(val.val.f->array_atom[j-1],val.val.f->size_peratom_cols); + bin_atoms(&val.val.f->array_atom[0][j-1],val.val.f->size_peratom_cols); } else if (kind == LOCAL) { if (j == 0) bin_vector(val.val.f->size_local_rows,val.val.f->vector_local,1); diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 17dd00440e..181aa2a79d 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -212,7 +212,7 @@ void FixAveHistoWeight::end_of_step() weights = val.val.f->vector_atom; stride = 1; } else if (val.val.f->array_atom) { - weights = val.val.f->array_atom[j-1]; + weights = &val.val.f->array_atom[0][j-1]; stride = val.val.f->size_peratom_cols; } } else if (kind == LOCAL) { @@ -339,7 +339,7 @@ void FixAveHistoWeight::end_of_step() if (j == 0) bin_atoms_weights(val.val.f->vector_atom,1,weights,stride); else if (val.val.f->array_atom) - bin_atoms_weights(val.val.f->array_atom[j-1],val.val.f->size_peratom_cols, + bin_atoms_weights(&val.val.f->array_atom[0][j-1],val.val.f->size_peratom_cols, weights,stride); diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index 7880655973..d01a498d39 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -41,7 +41,7 @@ using namespace FixConst; FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), - idregion(nullptr), region(nullptr), efield(nullptr) + pstr(nullptr), idregion(nullptr), region(nullptr), efield(nullptr) { if (narg < 6) utils::missing_cmd_args(FLERR, std::string("fix ") + style, error); @@ -58,7 +58,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : virial_global_flag = virial_peratom_flag = 1; qe2f = force->qe2f; - xstr = ystr = zstr = nullptr; + xstyle = ystyle = zstyle = estyle = pstyle = NONE; if (utils::strmatch(arg[3], "^v_")) { xstr = utils::strdup(arg[3] + 2); @@ -100,11 +100,22 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR, "Unsupported argument for fix {} energy command: {}", style, arg[iarg]); iarg += 2; + } else if (strcmp(arg[iarg], "potential") == 0) { + if (iarg + 2 > narg) + utils::missing_cmd_args(FLERR, std::string("fix ") + style + "potential", error); + if (utils::strmatch(arg[iarg + 1], "^v_")) { + pstr = utils::strdup(arg[iarg + 1] + 2); + } else + error->all(FLERR, "Unsupported argument for fix {} energy command: {}", style, arg[iarg]); + iarg += 2; } else { error->all(FLERR, "Unknown keyword for fix {} command: {}", style, arg[iarg]); } } + if (estr && pstr) + error->all(FLERR, "Must not use energy and potential keywords at the same time with fix efield"); + force_flag = 0; fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0; @@ -122,6 +133,7 @@ FixEfield::~FixEfield() delete[] ystr; delete[] zstr; delete[] estr; + delete[] pstr; delete[] idregion; memory->destroy(efield); } @@ -157,43 +169,54 @@ void FixEfield::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", xstr, style); + if (xvar < 0) error->all(FLERR, "Variable {} for x-field in fix {} does not exist", xstr, style); if (input->variable->equalstyle(xvar)) xstyle = EQUAL; else if (input->variable->atomstyle(xvar)) xstyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", xstr, style); + error->all(FLERR, "Variable {} for x-field in fix {} is invalid style", xstr, style); } + if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", ystr, style); + if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style); if (input->variable->equalstyle(yvar)) ystyle = EQUAL; else if (input->variable->atomstyle(yvar)) ystyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", ystr, style); + error->all(FLERR, "Variable {} for y-field in fix {} is invalid style", ystr, style); } + if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", zstr, style); + if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style); if (input->variable->equalstyle(zvar)) zstyle = EQUAL; else if (input->variable->atomstyle(zvar)) zstyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", zstr, style); + error->all(FLERR, "Variable {} for z-field in fix {} is invalid style", zstr, style); } + if (estr) { evar = input->variable->find(estr); - if (evar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", estr, style); + if (evar < 0) error->all(FLERR, "Variable {} for energy in fix {} does not exist", estr, style); if (input->variable->atomstyle(evar)) estyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", estr, style); - } else - estyle = NONE; + error->all(FLERR, "Variable {} for energy in fix {} must be atom-style", estr, style); + } + + if (pstr) { + pvar = input->variable->find(pstr); + if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style); + if (input->variable->atomstyle(pvar)) + pstyle = ATOM; + else + error->all(FLERR, "Variable {} for potential in fix {} must be atom-style", pstr, style); + } // set index and check validity of region @@ -217,8 +240,10 @@ void FixEfield::init() if (varflag == CONSTANT && estyle != NONE) error->all(FLERR, "Cannot use variable energy with constant efield in fix {}", style); - if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE) - error->all(FLERR, "Must use variable energy with fix {}", style); + if (varflag == CONSTANT && pstyle != NONE) + error->all(FLERR, "Cannot use variable potential with constant efield in fix {}", style); + if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE && pstyle == NONE) + error->all(FLERR, "Must use variable energy or potential with fix {} during minimization", style); if (utils::strmatch(update->integrate_style, "^respa")) { ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; @@ -346,26 +371,7 @@ void FixEfield::post_force(int vflag) } else { - modify->clearstep_compute(); - - if (xstyle == EQUAL) { - ex = qe2f * input->variable->compute_equal(xvar); - } else if (xstyle == ATOM) { - input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); - } - if (ystyle == EQUAL) { - ey = qe2f * input->variable->compute_equal(yvar); - } else if (ystyle == ATOM) { - input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); - } - if (zstyle == EQUAL) { - ez = qe2f * input->variable->compute_equal(zvar); - } else if (zstyle == ATOM) { - input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); - } - if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); - - modify->addstep_compute(update->ntimestep + 1); + update_efield_variables(); // charge interactions // force = qE @@ -395,7 +401,8 @@ void FixEfield::post_force(int vflag) } f[i][2] += fz; fsum[3] += fz; - if (estyle == ATOM) fsum[0] += efield[i][3]; + if (pstyle == ATOM) fsum[0] += qe2f * q[i] * efield[i][3]; + else if (estyle == ATOM) fsum[0] += efield[i][3]; } } @@ -470,3 +477,33 @@ double FixEfield::compute_vector(int n) } return fsum_all[n + 1]; } + +/* ---------------------------------------------------------------------- + update efield variables without doing anything else + called by fix_qeq_reaxff +------------------------------------------------------------------------- */ + +void FixEfield::update_efield_variables() +{ + modify->clearstep_compute(); + + if (xstyle == EQUAL) { + ex = qe2f * input->variable->compute_equal(xvar); + } else if (xstyle == ATOM) { + input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); + } + if (ystyle == EQUAL) { + ey = qe2f * input->variable->compute_equal(yvar); + } else if (ystyle == ATOM) { + input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); + } + if (zstyle == EQUAL) { + ez = qe2f * input->variable->compute_equal(zvar); + } else if (zstyle == ATOM) { + input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); + } + if (pstyle == ATOM) input->variable->compute_atom(pvar, igroup, &efield[0][3], 4, 0); + else if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); + + modify->addstep_compute(update->ntimestep + 1); +} diff --git a/src/fix_efield.h b/src/fix_efield.h index 52c827bb50..72fd204898 100644 --- a/src/fix_efield.h +++ b/src/fix_efield.h @@ -46,10 +46,11 @@ class FixEfield : public Fix { protected: double ex, ey, ez; int varflag; - char *xstr, *ystr, *zstr, *estr; + char *xstr, *ystr, *zstr, *estr, *pstr; char *idregion; class Region *region; - int xvar, yvar, zvar, evar, xstyle, ystyle, zstyle, estyle; + int xvar, yvar, zvar, xstyle, ystyle, zstyle; + int evar, pvar, estyle, pstyle; int ilevel_respa; double qe2f; int qflag, muflag; @@ -59,6 +60,7 @@ class FixEfield : public Fix { int force_flag; double fsum[4], fsum_all[4]; + void update_efield_variables(); }; } // namespace LAMMPS_NS #endif diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 0e083ce012..35bffb24fa 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -203,7 +203,7 @@ FixLangevin::~FixLangevin() if (gjfflag) { memory->destroy(franprev); memory->destroy(lv); - atom->delete_callback(id, Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); } } diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index 81e62ba966..66212684a8 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -283,11 +283,14 @@ void FixPair::post_force(int /*vflag*/) } else { double **parray = (double **) pvoid; - for (int i = 0; i < nlocal; i++) + int icoltmp = icol; + for (int i = 0; i < nlocal; i++) { + icol = icoltmp; for (int m = 0; m < columns; m++) { array[i][icol] = parray[i][m]; icol++; } + } } } diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index da49b3dbdb..e27a4560f0 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -491,7 +491,7 @@ int FixPressBerendsen::modify_param(int narg, char **arg) id_press = utils::strdup(arg[1]); pressure = modify->get_compute_by_id(arg[1]); - if (pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); + if (!pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); if (pressure->pressflag == 0) error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); return 2; diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index 60a055fbd6..00ef968828 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -176,12 +176,11 @@ void FixWallReflect::init() } int nrigid = 0; - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->rigid_flag) nrigid++; + for (const auto &ifix : modify->get_fix_list()) + if (ifix->rigid_flag) nrigid++; - if (nrigid && comm->me == 0) - error->warning(FLERR,"Should not allow rigid bodies to bounce off " - "relecting walls"); + if (nrigid && (comm->me == 0)) + error->warning(FLERR,"Should not use reflecting walls with rigid bodies"); } /* ---------------------------------------------------------------------- */ diff --git a/src/grid2d.h b/src/grid2d.h index bb1bfb25e1..6c1cca5f9d 100644 --- a/src/grid2d.h +++ b/src/grid2d.h @@ -53,7 +53,7 @@ class Grid2d : protected Pointers { void read_file(int, void *, FILE *, int, int); void write_file(int, void *, int, int, int, MPI_Datatype); -protected: + protected: int me, nprocs; int layout; // not TILED or TILED, same as Comm class MPI_Comm gridcomm; // communicator for this class @@ -61,18 +61,18 @@ protected: // inputs from caller via constructor - int nx, ny; // size of global grid in both dims - double maxdist; // distance owned atoms can move outside subdomain - int stencil_atom_lo,stencil_atom_hi; // grid cells accessed beyond atom's cell - int stencil_grid_lo,stencil_grid_hi; // grid cells accessed beyond owned cell - double shift_grid; // location of grid point within grid cell - // only affects which proc owns grid cell - double shift_atom_lo,shift_atom_hi;; // max shift applied to atoms - // when mapped to grid cell by caller - // can be different in lo/hi directions - // only affects extent of ghost cells - int yextra; // 1 if extra grid cells in Y, 0 if not - double yfactor; // multiplier on extent of grid in Y direction + int nx, ny; // size of global grid in both dims + double maxdist; // distance owned atoms can move outside subdomain + int stencil_atom_lo, stencil_atom_hi; // grid cells accessed beyond atom's cell + int stencil_grid_lo, stencil_grid_hi; // grid cells accessed beyond owned cell + double shift_grid; // location of grid point within grid cell + // only affects which proc owns grid cell + double shift_atom_lo, shift_atom_hi; // max shift applied to atoms + // when mapped to grid cell by caller + // can be different in lo/hi directions + // only affects extent of ghost cells + int yextra; // 1 if extra grid cells in Y, 0 if not + double yfactor; // multiplier on extent of grid in Y direction // extent of my owned and ghost cells @@ -190,11 +190,11 @@ protected: // internal variables for OVERLAP operation // ------------------------------------------- - int *overlap_procs; // length of Nprocs in communicator + int *overlap_procs; // length of Nprocs in communicator // BRICK decomposition - double *xsplit,*ysplit,*zsplit; + double *xsplit, *ysplit, *zsplit; int ***grid2proc; // TILED decomposition diff --git a/src/grid3d.h b/src/grid3d.h index 97fcf5992a..e4a8e276f5 100644 --- a/src/grid3d.h +++ b/src/grid3d.h @@ -23,8 +23,8 @@ class Grid3d : protected Pointers { enum { KSPACE = 0, PAIR = 1, FIX = 2 }; // calling classes Grid3d(class LAMMPS *, MPI_Comm, int, int, int); - Grid3d(class LAMMPS *, MPI_Comm, int, int, int, - int, int, int, int, int, int, int, int, int, int, int, int); + Grid3d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, int, int, int, + int, int); ~Grid3d(); void set_distance(double); @@ -41,8 +41,8 @@ class Grid3d : protected Pointers { void get_bounds_owned(int &, int &, int &, int &, int &, int &); void get_bounds_ghost(int &, int &, int &, int &, int &, int &); - void setup_grid(int &, int &, int &, int &, int &, int &, - int &, int &, int &, int &, int &, int &); + void setup_grid(int &, int &, int &, int &, int &, int &, int &, int &, int &, int &, int &, + int &); void setup_comm(int &, int &); int ghost_adjacent(); @@ -63,18 +63,18 @@ class Grid3d : protected Pointers { // input from caller - int nx, ny, nz; // size of global grid in all 3 dims - double maxdist; // distance owned atoms can move outside subdomain - int stencil_atom_lo,stencil_atom_hi; // grid cells accessed beyond atom's cell - int stencil_grid_lo,stencil_grid_hi; // grid cells accessed beyond owned cell - double shift_grid; // location of grid point within grid cell - // only affects which proc owns grid cell - double shift_atom_lo,shift_atom_hi;; // max shift applied to atoms - // when mapped to grid cell by caller - // can be different in lo/hi directions - // only affects extent of ghost cells - int zextra; // 1 if extra grid cells in Z, 0 if not - double zfactor; // multiplier on extent of grid in Z direction + int nx, ny, nz; // size of global grid in all 3 dims + double maxdist; // distance owned atoms can move outside subdomain + int stencil_atom_lo, stencil_atom_hi; // grid cells accessed beyond atom's cell + int stencil_grid_lo, stencil_grid_hi; // grid cells accessed beyond owned cell + double shift_grid; // location of grid point within grid cell + // only affects which proc owns grid cell + double shift_atom_lo, shift_atom_hi; // max shift applied to atoms + // when mapped to grid cell by caller + // can be different in lo/hi directions + // only affects extent of ghost cells + int zextra; // 1 if extra grid cells in Z, 0 if not + double zfactor; // multiplier on extent of grid in Z direction // extent of my owned and ghost cells @@ -196,11 +196,11 @@ class Grid3d : protected Pointers { // internal variables for OVERLAP operation // ------------------------------------------- - int *overlap_procs; // length of Nprocs in communicator + int *overlap_procs; // length of Nprocs in communicator // BRICK decomposition - double *xsplit,*ysplit,*zsplit; + double *xsplit, *ysplit, *zsplit; int ***grid2proc; // TILED decomposition diff --git a/src/input.cpp b/src/input.cpp index 1dc2b00ebc..dbbc62df59 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -567,7 +567,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // else $x becomes x followed by null char // beyond = points to text following variable - int i,n,paren_count,nchars;; + int i,n,paren_count,nchars; char immediate[256]; char *var,*value,*beyond; int quoteflag = 0; diff --git a/src/lammps.cpp b/src/lammps.cpp index 1c7d12f79c..9ac4c98bc3 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -132,6 +132,12 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : num_ver = utils::date2num(version); restart_ver = -1; + // append git descriptor info to update string when compiling development or maintenance version + + std::string update_string = UPDATE_STRING; + if (has_git_info() && ((update_string == " - Development") || (update_string == " - Maintenance"))) + update_string += fmt::format(" - {}", git_descriptor()); + external_comm = 0; mdicomm = nullptr; @@ -524,7 +530,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (infile == nullptr) error->one(FLERR,"Cannot open input script {}: {}", arg[inflag], utils::getsyserror()); if (!helpflag) - utils::logmesg(this,fmt::format("LAMMPS ({}{})\n",version,UPDATE_STRING)); + utils::logmesg(this,fmt::format("LAMMPS ({}{})\n", version, update_string)); // warn against using I/O redirection in parallel runs if ((inflag == 0) && (universe->nprocs > 1)) diff --git a/src/library.cpp b/src/library.cpp index cc4e748f57..8cec7c4505 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -247,6 +247,8 @@ void *lammps_open_no_mpi(int argc, char **argv, void **ptr) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function is a version of :cpp:func:`lammps_open`, that uses an integer for the MPI communicator as the MPI Fortran interface does. It is used in the :f:func:`lammps` constructor of the LAMMPS Fortran @@ -257,8 +259,6 @@ communicator with ``MPI_Comm_f2c()`` and then calls If for some reason the creation or initialization of the LAMMPS instance fails a null pointer is returned. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_open_fortran`, :cpp:func:`lammps_open_no_mpi` @@ -304,13 +304,13 @@ void lammps_close(void *handle) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + The MPI standard requires that any MPI application must call ``MPI_Init()`` exactly once before performing any other MPI function calls. This function checks, whether MPI is already initialized and calls ``MPI_Init()`` in case it is not. -.. versionadded:: 18Sep2020 - \endverbatim */ void lammps_mpi_init() @@ -333,6 +333,8 @@ void lammps_mpi_init() * \verbatim embed:rst +.. versionadded:: 18Sep2020 + The MPI standard requires that any MPI application calls ``MPI_Finalize()`` before exiting. Even if a calling program does not do any MPI calls, MPI is still initialized internally to avoid errors @@ -341,8 +343,6 @@ before exiting the program to wait until all (parallel) tasks are completed and then MPI is cleanly shut down. After calling this function no more MPI calls may be made. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_python_finalize` \endverbatim */ @@ -366,6 +366,8 @@ void lammps_mpi_finalize() * \verbatim embed:rst +.. versionadded:: 2Jul2021 + The Kokkos library may only be initialized once during the execution of a process. This is done automatically the first time Kokkos functionality is used. This requires that the Kokkos environment @@ -373,8 +375,6 @@ must be explicitly shut down after any LAMMPS instance using it is closed (to release associated resources). After calling this function no Kokkos functionality may be used. -.. versionadded:: 2Jul2021 - *See also* :cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_python_finalize` \endverbatim */ @@ -390,6 +390,8 @@ void lammps_kokkos_finalize() * \verbatim embed:rst +.. versionadded:: 20Sep2021 + This function resets and clears an embedded Python environment by calling the `Py_Finalize() function `_ @@ -409,8 +411,6 @@ after calling Py_Finalize(). This function can be called to explicitly clear the Python environment in case it is safe to do so. -.. versionadded:: 20Sep2021 - *See also* :cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize` \endverbatim */ @@ -427,6 +427,8 @@ void lammps_python_finalize() * \verbatim embed:rst +.. versionadded:: 3Nov2022 + This function is a wrapper around functions in the ``Error`` to print an error message and then stop LAMMPS. @@ -435,8 +437,6 @@ of constants from :cpp:enum:`_LMP_ERROR_CONST`. If the value does not match any valid combination of constants a warning is printed and the function returns. -.. versionadded:: 3Nov2022 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -719,14 +719,16 @@ double lammps_get_natoms(void *handle) /* ---------------------------------------------------------------------- */ -/** Get current value of a thermo keyword. +/** Evaluate a thermo keyword. * \verbatim embed:rst -This function returns the current value of a :doc:`thermo keyword -`. Unlike :cpp:func:`lammps_extract_global` it does not -give access to the storage of the desired data but returns its value as -a ``double``, so it can also return information that is computed on-the-fly. +This function returns the current value of a :doc:`thermo keyword `. +Unlike :cpp:func:`lammps_extract_global` it does not give access to the +storage of the desired data but returns its value as a ``double``, so it +can also return information that is computed on-the-fly. +Use :cpp:func:`lammps_last_thermo` to get access to the cached data from +the last thermo output. \endverbatim * @@ -750,6 +752,106 @@ double lammps_get_thermo(void *handle, const char *keyword) /* ---------------------------------------------------------------------- */ +/** Access cached data from last thermo output + * +\verbatim embed:rst + +.. versionadded:: 15Jun2023 + +This function provides access to cached data from the last thermo output. +This differs from :cpp:func:`lammps_get_thermo` in that it does not trigger +an evaluation. Instead it provides direct access to a read-only location +of the last thermo output data and the corresponding keyword strings. +The how to handle the return value depends on the value of the *what* +argument string. + +.. note:: + + The *type* property points to a static location that is reassigned + with every call, so the returned pointer should be recast, + dereferenced, and assigned immediately. Otherwise, its value may be + changed with the next invocation of the function. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Value of *what* + - Description of return value + - Data type + - Uses index + * - step + - timestep when the last thermo output was generated or -1 + - pointer to bigint + - no + * - num + - number of fields in thermo output + - pointer to int + - no + * - keyword + - column keyword for thermo output + - pointer to 0-terminated const char array + - yes + * - type + - data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST` + - pointer to int + - yes + * - data + - actual field data for column + - pointer to int, int64_t or double + - yes + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param what string with the kind of data requested + * \param index integer with index into data arrays, ignored for scalar data + * \return pointer to location of requested data cast to void or NULL */ + +void *lammps_last_thermo(void *handle, const char *what, int index) +{ + auto lmp = (LAMMPS *) handle; + void *val = nullptr; + Thermo *th = lmp->output->thermo; + if (!th) return nullptr; + const int nfield = *th->get_nfield(); + + BEGIN_CAPTURE + { + if (strcmp(what, "step") == 0) { + val = (void *) th->get_timestep(); + + } else if (strcmp(what, "num") == 0) { + val = (void *) th->get_nfield(); + + } else if (strcmp(what, "keyword") == 0) { + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &keywords = th->get_keywords(); + val = (void *) keywords[index].c_str(); + + } else if (strcmp(what, "type") == 0) { + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &field = th->get_fields()[index]; + val = (void *) &field.type; + } else if (strcmp(what, "data") == 0) { + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &field = th->get_fields()[index]; + if (field.type == multitype::LAMMPS_INT) { + val = (void *) &field.data.i; + } else if (field.type == multitype::LAMMPS_INT64) { + val = (void *) &field.data.b; + } else if (field.type == multitype::LAMMPS_DOUBLE) { + val = (void *) &field.data.d; + } + + } else val = nullptr; + } + END_CAPTURE + return val; +} + +/* ---------------------------------------------------------------------- */ + /** Extract simulation box parameters. * \verbatim embed:rst @@ -877,6 +979,8 @@ void lammps_reset_box(void *handle, double *boxlo, double *boxhi, * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function will retrieve memory usage information for the current LAMMPS instance or process. The *meminfo* buffer will be filled with 3 different numbers (if supported by the operating system). The first @@ -889,8 +993,6 @@ third number is the maximum amount of RAM (not swap) used by the process so far. If any of the two latter parameters is not supported by the operating system it will be set to zero. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -910,6 +1012,8 @@ void lammps_memory_usage(void *handle, double *meminfo) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This will take the LAMMPS "world" communicator and convert it to an integer using ``MPI_Comm_c2f()``, so it is equivalent to the corresponding MPI communicator in Fortran. This way it can be safely @@ -918,8 +1022,6 @@ to the C language representation use ``MPI_Comm_f2c()``. If LAMMPS was compiled with MPI_STUBS, this function returns -1. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_open_fortran` @@ -1182,13 +1284,13 @@ int lammps_extract_setting(void *handle, const char *keyword) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function returns an integer that encodes the data type of the global property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid values. Callers of :cpp:func:`lammps_extract_global` can use this information to then decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance (unused) @@ -1238,6 +1340,13 @@ int lammps_extract_global_datatype(void * /*handle*/, const char *name) if (strcmp(name,"q_flag") == 0) return LAMMPS_INT; if (strcmp(name,"units") == 0) return LAMMPS_STRING; + if (strcmp(name,"atom_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"pair_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"bond_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"angle_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"dihedral_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"improper_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"kspace_style") == 0) return LAMMPS_STRING; if (strcmp(name,"boltz") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"hplanck") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"mvv2e") == 0) return LAMMPS_DOUBLE; @@ -1484,6 +1593,34 @@ report the "native" data type. The following tables are provided: - int - 1 - **deprecated**. Use :cpp:func:`lammps_extract_setting` instead. + * - atom_style + - char \* + - 1 + - string with the current atom style. + * - pair_style + - char \* + - 1 + - string with the current pair style. + * - bond_style + - char \* + - 1 + - string with the current bond style. + * - angle_style + - char \* + - 1 + - string with the current angle style. + * - dihedral_style + - char \* + - 1 + - string with the current dihedral style. + * - improper_style + - char \* + - 1 + - string with the current improper style. + * - kspace_style + - char \* + - 1 + - string with the current KSpace style. .. _extract_unit_settings: @@ -1590,6 +1727,13 @@ void *lammps_extract_global(void *handle, const char *name) auto lmp = (LAMMPS *) handle; if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; + if (strcmp(name,"atom_style") == 0) return (void *) lmp->atom->atom_style; + if (strcmp(name,"pair_style") == 0) return (void *) lmp->force->pair_style; + if (strcmp(name,"bond_style") == 0) return (void *) lmp->force->bond_style; + if (strcmp(name,"angle_style") == 0) return (void *) lmp->force->angle_style; + if (strcmp(name,"dihedral_style") == 0) return (void *) lmp->force->dihedral_style; + if (strcmp(name,"improper_style") == 0) return (void *) lmp->force->improper_style; + if (strcmp(name,"kspace_style") == 0) return (void *) lmp->force->kspace_style; if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt; if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep; // update->atime can be referenced as a pointer @@ -1671,13 +1815,13 @@ void *lammps_extract_global(void *handle, const char *name) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function returns an integer that encodes the data type of the per-atom property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid values. Callers of :cpp:func:`lammps_extract_atom` can use this information to then decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -2184,7 +2328,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) } else if (lmp->input->variable->vectorstyle(ivar)) { double *values = nullptr; int nvector = lmp->input->variable->compute_vector(ivar, &values); - if ( group != nullptr && strcmp(group,"LMP_SIZE_VECTOR") == 0 ) { + if (group != nullptr && strcmp(group,"LMP_SIZE_VECTOR") == 0) { int* nvecptr = (int *) malloc(sizeof(int)); *nvecptr = nvector; return (void *) nvecptr; @@ -2206,13 +2350,13 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) * \verbatim embed:rst +.. versionadded:: 3Nov2022 + This function returns an integer that encodes the data type of the variable with the specified name. See :cpp:enum:`_LMP_VAR_CONST` for valid values. Callers of :cpp:func:`lammps_extract_variable` can use this information to decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 3Nov2022 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -2228,7 +2372,7 @@ int lammps_extract_variable_datatype(void *handle, const char *name) BEGIN_CAPTURE { int ivar = lmp->input->variable->find(name); - if ( ivar < 0 ) return -1; + if (ivar < 0) return -1; if (lmp->input->variable->equalstyle(ivar)) return LMP_VAR_EQUAL; @@ -3064,6 +3208,8 @@ void lammps_scatter_atoms_subset(void *handle, const char *name, int type, * \verbatim embed:rst +.. versionadded:: 28Jul2021 + This function copies the list of all bonds into a buffer provided by the calling code. The buffer will be filled with bond type, bond atom 1, bond atom 2 for each bond. Thus the buffer has to be allocated to the @@ -3078,8 +3224,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** bonds in the system. -.. versionadded:: 28Jul2021 - Below is a brief C code demonstrating accessing this collected bond information. .. code-block:: c @@ -3159,7 +3303,8 @@ void lammps_gather_bonds(void *handle, void *data) } tagint **bonds; - lmp->memory->create(bonds, localbonds, 3, "library:gather_bonds:localbonds"); + // add 1 to localbonds, so "bonds" does not become a NULL pointer + lmp->memory->create(bonds, localbonds+1, 3, "library:gather_bonds:localbonds"); lmp->atom->avec->pack_bond(bonds); MPI_Allgatherv(&bonds[0][0], 3*localbonds, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3174,6 +3319,8 @@ void lammps_gather_bonds(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all angles into a buffer provided by the calling code. The buffer will be filled with angle type, angle atom 1, angle atom 2, angle atom 3 for each angle. Thus the buffer has to be allocated to the @@ -3188,8 +3335,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** angles in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected angle information. .. code-block:: c @@ -3269,7 +3414,8 @@ void lammps_gather_angles(void *handle, void *data) } tagint **angles; - lmp->memory->create(angles, localangles, 4, "library:gather_angles:localangles"); + // add 1 to localangles, so "angles" does not become a NULL pointer + lmp->memory->create(angles, localangles+1, 4, "library:gather_angles:localangles"); lmp->atom->avec->pack_angle(angles); MPI_Allgatherv(&angles[0][0], 4*localangles, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3284,6 +3430,8 @@ void lammps_gather_angles(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all dihedrals into a buffer provided by the calling code. The buffer will be filled with dihedral type, dihedral atom 1, dihedral atom 2, dihedral atom 3, dihedral atom 4 for each dihedral. @@ -3299,8 +3447,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** dihedrals in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected dihedral information. .. code-block:: c @@ -3380,7 +3526,8 @@ void lammps_gather_dihedrals(void *handle, void *data) } tagint **dihedrals; - lmp->memory->create(dihedrals, localdihedrals, 5, "library:gather_dihedrals:localdihedrals"); + // add 1 to localdihedrals, so "dihedrals" does not become a NULL pointer + lmp->memory->create(dihedrals, localdihedrals+1, 5, "library:gather_dihedrals:localdihedrals"); lmp->atom->avec->pack_dihedral(dihedrals); MPI_Allgatherv(&dihedrals[0][0], 5*localdihedrals, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3395,6 +3542,8 @@ void lammps_gather_dihedrals(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all impropers into a buffer provided by the calling code. The buffer will be filled with improper type, improper atom 1, improper atom 2, improper atom 3, improper atom 4 for each improper. @@ -3410,8 +3559,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** impropers in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected improper information. .. code-block:: c @@ -3491,7 +3638,8 @@ void lammps_gather_impropers(void *handle, void *data) } tagint **impropers; - lmp->memory->create(impropers, localimpropers, 5, "library:gather_impropers:localimpropers"); + // add 1 to localimpropers, so "impropers" does not become a NULL pointer + lmp->memory->create(impropers, localimpropers+1, 5, "library:gather_impropers:localimpropers"); lmp->atom->avec->pack_improper(impropers); MPI_Allgatherv(&impropers[0][0], 5*localimpropers, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -5051,7 +5199,7 @@ int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int n // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList *list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::PAIR) + if ((list->requestor_type == NeighList::PAIR) && (pair == list->requestor) && (list->id == reqid) ) return i; } @@ -5081,7 +5229,7 @@ int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList *list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::FIX) + if ((list->requestor_type == NeighList::FIX) && (fix == list->requestor) && (list->id == reqid) ) return i; } @@ -5110,7 +5258,7 @@ int lammps_find_compute_neighlist(void *handle, const char *id, int reqid) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::COMPUTE) + if ((list->requestor_type == NeighList::COMPUTE) && (compute == list->requestor) && (list->id == reqid) ) return i; } @@ -5204,6 +5352,8 @@ int lammps_version(void *handle) * \verbatim embed:rst +.. versionadded:: 9Oct2020 + The :cpp:func:`lammps_get_os_info` function can be used to retrieve detailed information about the hosting operating system and compiler/runtime. @@ -5212,8 +5362,6 @@ A suitable buffer for a C-style string has to be provided and its length. The assembled text will be truncated to not overflow this buffer. The string is typically a few hundred bytes long. -.. versionadded:: 9Oct2020 - \endverbatim * * \param buffer string buffer to copy the information to @@ -5442,6 +5590,8 @@ int lammps_config_accelerator(const char *package, * \verbatim embed:rst +.. versionadded:: 14May2021 + The :cpp:func:`lammps_has_gpu_device` function checks at runtime if an accelerator device is present that can be used with the :doc:`GPU package `. If at least one suitable device is @@ -5451,8 +5601,6 @@ More detailed information about the available device or devices can be obtained by calling the :cpp:func:`lammps_get_gpu_device_info` function. -.. versionadded:: 14May2021 - \endverbatim * * \return 1 if viable device is available, 0 if not. */ @@ -5466,6 +5614,8 @@ int lammps_has_gpu_device() * \verbatim embed:rst +.. versionadded:: 14May2021 + The :cpp:func:`lammps_get_gpu_device_info` function can be used to retrieve detailed information about any accelerator devices that are viable for use with the :doc:`GPU package `. It will produce a string that is @@ -5477,8 +5627,6 @@ A suitable buffer for a C-style string has to be provided and its length. The assembled text will be truncated to not overflow this buffer. This string can be several kilobytes long, if multiple devices are present. -.. versionadded:: 14May2021 - \endverbatim * * \param buffer string buffer to copy the information to @@ -5561,7 +5709,7 @@ int lammps_style_name(void *handle, const char *category, int idx, Info info(lmp); auto styles = info.get_available_styles(category); - if ((idx >=0) && (idx < (int) styles.size())) { + if ((idx >= 0) && (idx < (int) styles.size())) { strncpy(buffer, styles[idx].c_str(), buf_size); return 1; } @@ -5575,12 +5723,13 @@ int lammps_style_name(void *handle, const char *category, int idx, /** Check if a specific ID exists in the current LAMMPS instance * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function checks if the current LAMMPS instance a *category* ID of the given *name* exists. Valid categories are: *compute*\ , *dump*\ , *fix*\ , *group*\ , *molecule*\ , *region*\ , and *variable*\ . -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5614,13 +5763,14 @@ int lammps_has_id(void *handle, const char *category, const char *name) { /** Count the number of IDs of a category. * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function counts how many IDs in the provided *category* are defined in the current LAMMPS instance. Please see :cpp:func:`lammps_has_id` for a list of valid categories. -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5652,6 +5802,9 @@ int lammps_id_count(void *handle, const char *category) { /** Look up the name of an ID by index in the list of IDs of a given category. * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function copies the name of the *category* ID with the index *idx* into the provided C-style string buffer. The length of the buffer must be provided as *buf_size* argument. If the name of the style @@ -5659,8 +5812,6 @@ exceeds the length of the buffer, it will be truncated accordingly. If the index is out of range, the function returns 0 and *buffer* is set to an empty string, otherwise 1. -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5693,23 +5844,23 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in return 1; } } else if (strcmp(category,"group") == 0) { - if ((idx >=0) && (idx < lmp->group->ngroup)) { + if ((idx >= 0) && (idx < lmp->group->ngroup)) { strncpy(buffer, lmp->group->names[idx], buf_size); return 1; } } else if (strcmp(category,"molecule") == 0) { - if ((idx >=0) && (idx < lmp->atom->nmolecule)) { + if ((idx >= 0) && (idx < lmp->atom->nmolecule)) { strncpy(buffer, lmp->atom->molecules[idx]->id, buf_size); return 1; } } else if (strcmp(category,"region") == 0) { auto regions = lmp->domain->get_region_list(); - if ((idx >=0) && (idx < (int) regions.size())) { + if ((idx >= 0) && (idx < (int) regions.size())) { strncpy(buffer, regions[idx]->id, buf_size); return 1; } } else if (strcmp(category,"variable") == 0) { - if ((idx >=0) && (idx < lmp->input->variable->nvar)) { + if ((idx >= 0) && (idx < lmp->input->variable->nvar)) { strncpy(buffer, lmp->input->variable->names[idx], buf_size); return 1; } @@ -5723,10 +5874,11 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in /** Count the number of loaded plugins * \verbatim embed:rst -This function counts how many plugins are currently loaded. .. versionadded:: 10Mar2021 +This function counts how many plugins are currently loaded. + \endverbatim * * \return number of loaded plugins @@ -5745,6 +5897,9 @@ int lammps_plugin_count() /** Look up the info of a loaded plugin by its index in the list of plugins * \verbatim embed:rst + +.. versionadded:: 10Mar2021 + This function copies the name of the *style* plugin with the index *idx* into the provided C-style string buffer. The length of the buffer must be provided as *buf_size* argument. If the name of the style @@ -5752,8 +5907,6 @@ exceeds the length of the buffer, it will be truncated accordingly. If the index is out of range, the function returns 0 and *buffer* is set to an empty string, otherwise 1. -.. versionadded:: 10Mar2021 - \endverbatim * * \param idx index of the plugin in the list all or *style* plugins @@ -5912,9 +6065,11 @@ void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalF \verbatim embed:rst -Fix :doc:`external ` allows programs that are running LAMMPS through -its library interface to add or modify certain LAMMPS properties on specific -timesteps, similar to the way other fixes do. +.. versionadded:: 28Jul2021 + +Fix :doc:`external ` allows programs that are running +LAMMPS through its library interface to add or modify certain LAMMPS +properties on specific timesteps, similar to the way other fixes do. This function provides access to the per-atom force storage in a fix external instance with the given fix-ID to be added to the individual @@ -5927,12 +6082,12 @@ data structures can change as well as the order of atom as they migrate between MPI processes because of the domain decomposition parallelization, this function should be always called immediately before the forces are going to be set to get an up-to-date pointer. -You can use, for example, :cpp:func:`lammps_extract_setting` to obtain the -number of local atoms `nlocal` and then assume the dimensions of the returned -force array as ``double force[nlocal][3]``. +You can use, for example, :cpp:func:`lammps_extract_setting` to obtain +the number of local atoms `nlocal` and then assume the dimensions of +the returned force array as ``double force[nlocal][3]``. -This is an alternative to the callback mechanism in fix external set up by -:cpp:func:`lammps_set_fix_external_callback`. The main difference is +This is an alternative to the callback mechanism in fix external set up +by :cpp:func:`lammps_set_fix_external_callback`. The main difference is that this mechanism can be used when forces are be pre-computed and the control alternates between LAMMPS and the external code, while the callback mechanism can call the external code to compute the force when @@ -5942,8 +6097,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5974,6 +6127,8 @@ double **lammps_fix_external_get_force(void *handle, const char *id) \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to also set the contribution to the global energy from the external code. The value of the *eng* @@ -5990,8 +6145,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6020,6 +6173,8 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the contribution to the global virial from the external code. @@ -6038,8 +6193,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6068,6 +6221,8 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom energy contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the @@ -6086,8 +6241,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6116,6 +6269,8 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom virial contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the @@ -6137,8 +6292,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6167,6 +6320,8 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the length of a global vector of properties that will be stored with the fix via @@ -6181,8 +6336,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6211,6 +6364,8 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the values of a global vector of properties that will be stored with the fix. And can be accessed from @@ -6234,8 +6389,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6407,12 +6560,13 @@ int lammps_get_last_error_message(void *handle, char *buffer, int buf_size) { /** Return API version of embedded Python interpreter \verbatim embed:rst + +.. versionadded:: 3Nov2022 + This function is used by the ML-IAP python code (mliappy) to verify the API version of the embedded python interpreter of the PYTHON package. It returns -1 if the PYTHON package is not enabled. -.. versionadded:: 3Nov2022 - \endverbatim * * \return PYTHON_API_VERSION constant of the python interpreter or -1 */ diff --git a/src/library.h b/src/library.h index 340b0edb7b..30a12ebdef 100644 --- a/src/library.h +++ b/src/library.h @@ -41,10 +41,11 @@ /** Data type constants for extracting data from atoms, computes and fixes * * Must be kept in sync with the equivalent constants in ``python/lammps/constants.py``, - * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, and + * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, ``src/lmptype.h``, and *``examples/COUPLE/plugin/liblammpsplugin.h`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ @@ -148,6 +149,7 @@ void lammps_commands_string(void *handle, const char *str); double lammps_get_natoms(void *handle); double lammps_get_thermo(void *handle, const char *keyword); +void *lammps_last_thermo(void *handle, const char *what, int index); void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); diff --git a/src/lmptype.h b/src/lmptype.h index ecd6ee5761..2089350f48 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -95,7 +95,7 @@ typedef int64_t bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT_MAX #define MAXBIGINT INT64_MAX -#define MAXDOUBLEINT 9007199254740992 // 2^53 +#define MAXDOUBLEINT 9007199254740992 // 2^53 #define MPI_LMP_TAGINT MPI_INT #define MPI_LMP_IMAGEINT MPI_INT @@ -133,7 +133,7 @@ typedef int64_t bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT64_MAX #define MAXBIGINT INT64_MAX -#define MAXDOUBLEINT 9007199254740992 // 2^53 +#define MAXDOUBLEINT 9007199254740992 // 2^53 #define MPI_LMP_TAGINT MPI_LL #define MPI_LMP_IMAGEINT MPI_LL @@ -232,6 +232,98 @@ union ubuf { ubuf(const int64_t &arg) : i(arg) {} ubuf(const int &arg) : i(arg) {} }; + +/** Data structure for dynamic typing of int, bigint, and double + * + * Using this union allows to store any of the supported data types + * in the same container and allows to "see" its current type. +\verbatim embed:rst + +**Usage:** + +.. code-block:: c++ + :caption: To store data in multitype array: + + multitype m[5]; + int foo = 1; + double bar = 2.5; + bigint baz = 1<<40 - 1; + m[0] = foo; + m[1] = bar; + m[2] = -1; + m[3] = 2.0; + m[4] = baz; + +.. code-block:: c++ + :caption: To format data from multitype array into a space separated string: + + std::string str; + for (int i = 0; i < 5; ++i) { + switch (m[i].type) { + case multitype::DOUBLE: + str += std::to_string(m[i].data.d) + ' '; + break; + case multitype::INT: + str += std::to_string(m[i].data.i) + ' '; + break; + case multitype::BIGINT: + str += std::to_string(m[i].data.b) + ' '; + break; + default: + break; + } + } +\endverbatim + */ +struct multitype { + /** Data type constants for extracting data from atoms, computes and fixes + * + * This enum must be kept in sync with the corresponding enum or constants + * in ``python/lammps/constants.py``, ``fortran/lammps.f90``, ``tools/swig/lammps.i``, + * ``src/library.h``, and ``examples/COUPLE/plugin/liblammpsplugin.h`` */ + enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ + LAMMPS_INT = 0, /*!< 32-bit integer (array) */ + LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ + LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ + LAMMPS_DOUBLE_2D = 3, /*!< two-dimensional 64-bit double array */ + LAMMPS_INT64 = 4, /*!< 64-bit integer (array) */ + LAMMPS_INT64_2D = 5, /*!< two-dimensional 64-bit integer array */ + LAMMPS_STRING = 6 /*!< C-String */ + }; + + int type; + union { + double d; + int i; + int64_t b; + } data; + + multitype() : type(LAMMPS_NONE) { data.d = 0.0; } + multitype(const multitype &) = default; + multitype(multitype &&) = default; + ~multitype() = default; + + multitype &operator=(const double &_d) + { + type = LAMMPS_DOUBLE; + data.d = _d; + return *this; + } + multitype &operator=(const int &_i) + { + type = LAMMPS_INT; + data.i = _i; + return *this; + } + multitype &operator=(const int64_t &_b) + { + type = LAMMPS_INT64; + data.b = _b; + return *this; + } +}; + } // namespace LAMMPS_NS // preprocessor macros for compiler specific settings diff --git a/src/modify.cpp b/src/modify.cpp index d0656d3895..427c4e259b 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -191,11 +191,7 @@ void Modify::init() for (i = 0; i < ncompute; i++) { compute[i]->init(); - compute[i]->invoked_scalar = -1; - compute[i]->invoked_vector = -1; - compute[i]->invoked_array = -1; - compute[i]->invoked_peratom = -1; - compute[i]->invoked_local = -1; + compute[i]->init_flags(); } addstep_compute_all(update->ntimestep); diff --git a/src/my_page.h b/src/my_page.h index 6c06abd71e..ea19dc8e74 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -104,6 +104,9 @@ template class MyPage { int errorflag; // flag > 0 if error has occurred // 1 = chunk size exceeded maxchunk // 2 = memory allocation error +#if defined(_OPENMP) + char pad[64]; // to avoid false sharing with multi-threading +#endif void allocate(); void deallocate(); }; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 006101da64..df1547e5eb 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -837,10 +837,20 @@ int Neighbor::init_pair() // similar to what vanilla Nbin::coord2atom() does now in atom2bin if (style == Neighbor::BIN) { - for (i = 0; i < nrequest; i++) + for (i = 0; i < nrequest; ++i) if (requests[i]->occasional && requests[i]->ghost) - error->all(FLERR,"Cannot request an occasional binned neighbor list " - "with ghost info"); + error->all(FLERR, "Cannot request an occasional binned neighbor list with ghost info"); + } + + // check requests with a custom neighbor list cutoff to make sure the cutoff is within + // the communication cutoff. For perpetual lists, neighbor list skin is added later. + + const double comm_cutoff = comm->get_comm_cutoff(); + for (i = 0; i < nrequest; ++i) { + if (requests[i]->cut) { + if (comm_cutoff < (requests[i]->cutoff + (requests[i]->occasional ? 0.0 : skin))) + error->all(FLERR, "Custom neighbor list cutoff too large for communication cutoff"); + } } // morph requests in various ways @@ -2672,8 +2682,7 @@ void Neighbor::modify_params(int narg, char **arg) strcmp(arg[iarg+1],"molecule/intra") == 0) { if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "neigh_modify exclude molecule", error); if (atom->molecule_flag == 0) - error->all(FLERR,"Neigh_modify exclude molecule " - "requires atom attribute molecule"); + error->all(FLERR,"Neigh_modify exclude molecule requires atom attribute molecule"); if (nex_mol == maxex_mol) { maxex_mol += EXDELTA; memory->grow(ex_mol_group,maxex_mol,"neigh:ex_mol_group"); diff --git a/src/npair_half_respa_nsq_newton.cpp b/src/npair_half_respa_nsq_newton.cpp index 77d6af141f..d231cddb87 100644 --- a/src/npair_half_respa_nsq_newton.cpp +++ b/src/npair_half_respa_nsq_newton.cpp @@ -38,9 +38,9 @@ NPairHalfRespaNsqNewton::NPairHalfRespaNsqNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfRespaNsqNewton::build(NeighList *list) { - int i,j,n,itype,jtype,itag,jtag,n_inner,n_middle,bitmask; + int i,j,n,itype,jtype,n_inner,n_middle,bitmask; int imol,iatom,moltemplate; - tagint tagprev; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *neighptr,*neighptr_inner,*neighptr_middle; diff --git a/src/npair_half_size_nsq_newton.cpp b/src/npair_half_size_nsq_newton.cpp index 8b596e6968..93d65c7a45 100644 --- a/src/npair_half_size_nsq_newton.cpp +++ b/src/npair_half_size_nsq_newton.cpp @@ -39,8 +39,8 @@ NPairHalfSizeNsqNewton::NPairHalfSizeNsqNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeNsqNewton::build(NeighList *list) { - int i,j,jh,n,itag,jtag,bitmask,which,imol,iatom,moltemplate; - tagint tagprev; + int i,j,jh,n,bitmask,which,imol,iatom,moltemplate; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; diff --git a/src/npair_skip_size_off2on_oneside.cpp b/src/npair_skip_size_off2on_oneside.cpp index eecf293755..3300ef1526 100644 --- a/src/npair_skip_size_off2on_oneside.cpp +++ b/src/npair_skip_size_off2on_oneside.cpp @@ -36,7 +36,7 @@ NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : void NPairSkipSizeOff2onOneside::build(NeighList *list) { - int i,j,ii,jj,n,itype,jnum,joriginal,flip,tmp; + int i,j,ii,jj,itype,jnum,joriginal,flip,tmp; int *surf,*jlist; int *type = atom->type; @@ -76,8 +76,6 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list) itype = type[i]; if (iskip[itype]) continue; - n = 0; - // loop over parent non-skip size list jlist = firstneigh_skip[i]; @@ -108,8 +106,7 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list) for (i = 0; i < nlocal; i++) { if (numneigh[i] == 0) continue; - n = numneigh[i]; - firstneigh[i] = ipage->get(n); + firstneigh[i] = ipage->get(numneigh[i]); if (ipage->status()) error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); } diff --git a/src/output.cpp b/src/output.cpp index 6282b85b76..6e57122ffe 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -190,6 +190,32 @@ void Output::setup(int memflag) { bigint ntimestep = update->ntimestep; + // print memory usage unless being called between multiple runs + + if (memflag) memory_usage(); + + // set next_thermo to multiple of every or variable eval if var defined + // ensure thermo output on last step of run + // thermo may invoke computes so wrap with clear/add + + modify->clearstep_compute(); + + thermo->header(); + thermo->compute(0); + last_thermo = ntimestep; + + if (var_thermo) { + next_thermo = static_cast + (input->variable->compute_equal(ivar_thermo)); + if (next_thermo <= ntimestep) + error->all(FLERR,"Thermo every variable returned a bad timestep"); + } else if (thermo_every) { + next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every; + next_thermo = MIN(next_thermo,update->laststep); + } else next_thermo = update->laststep; + + modify->addstep_compute(next_thermo); + // consider all dumps // decide whether to write snapshot and/or calculate next step for dump @@ -257,7 +283,7 @@ void Output::setup(int memflag) next_dump_any = MIN(next_dump_any,next_dump[idump]); } - // if no dumps, set next_dump_any to last+1 so will not influence next + // if no dumps, set next_dump_any to last+1 so will not influence next } else next_dump_any = update->laststep + 1; @@ -276,7 +302,8 @@ void Output::setup(int memflag) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_single = nextrestart; } } else next_restart_single = update->laststep + 1; @@ -289,39 +316,14 @@ void Output::setup(int memflag) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_double = nextrestart; } } else next_restart_double = update->laststep + 1; next_restart = MIN(next_restart_single,next_restart_double); } else next_restart = update->laststep + 1; - // print memory usage unless being called between multiple runs - - if (memflag) memory_usage(); - - // set next_thermo to multiple of every or variable eval if var defined - // ensure thermo output on last step of run - // thermo may invoke computes so wrap with clear/add - - modify->clearstep_compute(); - - thermo->header(); - thermo->compute(0); - last_thermo = ntimestep; - - if (var_thermo) { - next_thermo = static_cast - (input->variable->compute_equal(ivar_thermo)); - if (next_thermo <= ntimestep) - error->all(FLERR,"Thermo every variable returned a bad timestep"); - } else if (thermo_every) { - next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every; - next_thermo = MIN(next_thermo,update->laststep); - } else next_thermo = update->laststep; - - modify->addstep_compute(next_thermo); - // next = next timestep any output will be done next = MIN(next_dump_any,next_restart); @@ -336,6 +338,24 @@ void Output::setup(int memflag) void Output::write(bigint ntimestep) { + // ensure next_thermo forces output on last step of run + // thermo may invoke computes so wrap with clear/add + + if (next_thermo == ntimestep) { + modify->clearstep_compute(); + if (last_thermo != ntimestep) thermo->compute(1); + last_thermo = ntimestep; + if (var_thermo) { + next_thermo = static_cast + (input->variable->compute_equal(ivar_thermo)); + if (next_thermo <= ntimestep) + error->all(FLERR,"Thermo every variable returned a bad timestep"); + } else if (thermo_every) next_thermo += thermo_every; + else next_thermo = update->laststep; + next_thermo = MIN(next_thermo,update->laststep); + modify->addstep_compute(next_thermo); + } + // perform dump if its next_dump = current ntimestep // but not if it was already written on this step // set next_dump and also next_time_dump for mode_dump = 1 @@ -401,7 +421,8 @@ void Output::write(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_single = nextrestart; modify->addstep_compute(next_restart_single); } @@ -424,7 +445,8 @@ void Output::write(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); next_restart_double = nextrestart; modify->addstep_compute(next_restart_double); } @@ -433,24 +455,6 @@ void Output::write(bigint ntimestep) next_restart = MIN(next_restart_single,next_restart_double); } - // ensure next_thermo forces output on last step of run - // thermo may invoke computes so wrap with clear/add - - if (next_thermo == ntimestep) { - modify->clearstep_compute(); - if (last_thermo != ntimestep) thermo->compute(1); - last_thermo = ntimestep; - if (var_thermo) { - next_thermo = static_cast - (input->variable->compute_equal(ivar_thermo)); - if (next_thermo <= ntimestep) - error->all(FLERR,"Thermo every variable returned a bad timestep"); - } else if (thermo_every) next_thermo += thermo_every; - else next_thermo = update->laststep; - next_thermo = MIN(next_thermo,update->laststep); - modify->addstep_compute(next_thermo); - } - // next = next timestep any output will be done next = MIN(next_dump_any,next_restart); @@ -647,7 +651,8 @@ void Output::reset_timestep(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart < ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); update->ntimestep++; next_restart_single = nextrestart; modify->addstep_compute(next_restart_single); @@ -666,7 +671,8 @@ void Output::reset_timestep(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart < ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); update->ntimestep++; next_restart_double = nextrestart; modify->addstep_compute(next_restart_double); diff --git a/src/read_data.cpp b/src/read_data.cpp index 2fea75f7c0..e3087ae215 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -2021,9 +2021,7 @@ void ReadData::pairIJcoeffs() if (eof) error->all(FLERR, "Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR,"Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (i = 0; i < ntypes; i++) @@ -2032,10 +2030,7 @@ void ReadData::pairIJcoeffs() *next = '\0'; parse_coeffs(buf, nullptr, 0, 2, toffset, tlabelflag, lmap->lmap2lmap.atom); if (ncoeffarg == 0) - error->all(FLERR, - "Unexpected empty line in PairIJCoeffs section. " - "Expected {} lines.", - (ntypes - 1) * ntypes); + error->all(FLERR, "Unexpected empty line in PairIJCoeffs section. Expected {} lines.", nsq); force->pair->coeff(ncoeffarg, coeffarg); buf = next + 1; } @@ -2055,9 +2050,7 @@ void ReadData::bondcoeffs() if (eof) error->all(FLERR, "Unexpected end of data file"); if (blabelflag && !lmap->is_complete(Atom::BOND)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nbondtypes; i++) { @@ -2086,9 +2079,7 @@ void ReadData::anglecoeffs(int which) if (eof) error->all(FLERR, "Unexpected end of data file"); if (alabelflag && !lmap->is_complete(Atom::ANGLE)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nangletypes; i++) { @@ -2122,9 +2113,7 @@ void ReadData::dihedralcoeffs(int which) if (eof) error->all(FLERR, "Unexpected end of data file"); if (dlabelflag && !lmap->is_complete(Atom::DIHEDRAL)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < ndihedraltypes; i++) { diff --git a/src/read_restart.cpp b/src/read_restart.cpp index aa9f5fe8ee..0de36ebe1e 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -768,7 +768,7 @@ void ReadRestart::header() for (int i = 0; i < nargcopy; i++) argcopy[i] = read_string(); atom->create_avec(style,nargcopy,argcopy,1); - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring atom style {} from restart\n",atom->atom_style); for (int i = 0; i < nargcopy; i++) delete[] argcopy[i]; delete[] argcopy; @@ -921,14 +921,14 @@ void ReadRestart::force_fields() style = read_string(); force->create_pair(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring pair style {} from restart\n", force->pair_style); force->pair->read_restart(fp); } else if (flag == NO_PAIR) { style = read_string(); - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," pair style {} stores no restart info\n", style); force->create_pair("none",0); force->pair_restart = style; @@ -937,7 +937,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_bond(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring bond style {} from restart\n", force->bond_style); force->bond->read_restart(fp); @@ -946,7 +946,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_angle(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring angle style {} from restart\n", force->angle_style); force->angle->read_restart(fp); @@ -955,7 +955,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_dihedral(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring dihedral style {} from restart\n", force->dihedral_style); force->dihedral->read_restart(fp); @@ -964,7 +964,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_improper(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring improper style {} from restart\n", force->improper_style); force->improper->read_restart(fp); diff --git a/src/reset_atoms_id.cpp b/src/reset_atoms_id.cpp index c0fce95326..9e8ba3630d 100644 --- a/src/reset_atoms_id.cpp +++ b/src/reset_atoms_id.cpp @@ -55,9 +55,9 @@ void ResetAtomsID::command(int narg, char **arg) error->all(FLERR, "Reset_atoms id command before simulation box is defined"); if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms id unless atoms have IDs"); - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->stores_ids) - error->all(FLERR, "Cannot use reset_atoms id when a fix exists that stores atom IDs"); + for (const auto &ifix : modify->get_fix_list()) + if (ifix->stores_ids) + error->all(FLERR, "Cannot use reset_atoms id with a fix {} storing atom IDs", ifix->style); if (comm->me == 0) utils::logmesg(lmp, "Resetting atom IDs ...\n"); diff --git a/src/reset_atoms_image.cpp b/src/reset_atoms_image.cpp index d39ea0fec1..84df5bf746 100644 --- a/src/reset_atoms_image.cpp +++ b/src/reset_atoms_image.cpp @@ -61,6 +61,22 @@ void ResetAtomsImage::command(int narg, char **arg) MPI_Barrier(world); double time1 = platform::walltime(); + // create computes and variables + // must come before lmp->init so the computes are properly initialized + + auto frags = modify->add_compute("frags_r_i_f all fragment/atom single yes"); + auto chunk = modify->add_compute("chunk_r_i_f all chunk/atom c_frags_r_i_f compress yes"); + auto flags = modify->add_compute("flags_r_i_f all property/atom ix iy iz"); + input->variable->set("ix_r_i_f atom c_flags_r_i_f[1]"); + input->variable->set("iy_r_i_f atom c_flags_r_i_f[2]"); + input->variable->set("iz_r_i_f atom c_flags_r_i_f[3]"); + auto ifmin = modify->add_compute("ifmin_r_i_f all reduce/chunk chunk_r_i_f min " + "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); + auto ifmax = modify->add_compute("ifmax_r_i_f all reduce/chunk chunk_r_i_f max " + "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); + auto cdist = modify->add_compute("cdist_r_i_f all chunk/spread/atom chunk_r_i_f " + "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); + // initialize system since comm->borders() will be invoked lmp->init(); @@ -77,30 +93,7 @@ void ResetAtomsImage::command(int narg, char **arg) comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); - // create computes and variables - - auto frags = modify->add_compute("frags_r_i_f all fragment/atom single yes"); - auto chunk = modify->add_compute("chunk_r_i_f all chunk/atom c_frags_r_i_f compress yes"); - auto flags = modify->add_compute("flags_r_i_f all property/atom ix iy iz"); - input->variable->set("ix_r_i_f atom c_flags_r_i_f[1]"); - input->variable->set("iy_r_i_f atom c_flags_r_i_f[2]"); - input->variable->set("iz_r_i_f atom c_flags_r_i_f[3]"); - auto ifmin = modify->add_compute("ifmin_r_i_f all reduce/chunk chunk_r_i_f min " - "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); - auto ifmax = modify->add_compute("ifmax_r_i_f all reduce/chunk chunk_r_i_f max " - "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); - auto cdist = modify->add_compute("cdist_r_i_f all chunk/spread/atom chunk_r_i_f " - "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); - // trigger computes - // need to ensure update->first_update = 1 - // to allow this input script command prior to first run/minimize - // this is b/c internal variables are evaulated which invoke computes - // that will trigger an error unless first_update = 1 - // reset update->first_update when done - - int first_update_saved = update->first_update; - update->first_update = 1; frags->compute_peratom(); chunk->compute_peratom(); @@ -109,8 +102,6 @@ void ResetAtomsImage::command(int narg, char **arg) ifmax->compute_array(); cdist->compute_peratom(); - update->first_update = first_update_saved; - // reset image flags for atoms in group const int *const mask = atom->mask; diff --git a/src/special.cpp b/src/special.cpp index a210b6a82a..7e15ec9e80 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -958,7 +958,7 @@ void Special::combine() void Special::angle_trim() { - int i,j,k,m;; + int i,j,k,m; int *num_angle = atom->num_angle; int *num_dihedral = atom->num_dihedral; diff --git a/src/thermo.cpp b/src/thermo.cpp index 0503018a3a..a8442d42db 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -111,6 +111,7 @@ Thermo::Thermo(LAMMPS *_lmp, int narg, char **arg) : lostflag = lostbond = Thermo::ERROR; lostbefore = warnbefore = 0; flushflag = 0; + ntimestep = -1; // set style and corresponding lineflag // custom style builds its own line of keywords, including wildcard expansion @@ -201,6 +202,8 @@ void Thermo::init() ValueTokenizer *format_line = nullptr; if (format_line_user.size()) format_line = new ValueTokenizer(format_line_user); + field_data.clear(); + field_data.resize(nfield); std::string format_this, format_line_user_def; for (int i = 0; i < nfield; i++) { @@ -208,6 +211,14 @@ void Thermo::init() format_this.clear(); format_line_user_def.clear(); + if (vtype[i] == FLOAT) { + field_data[i] = (double) 0.0; + } else if (vtype[i] == INT) { + field_data[i] = (int) 0; + } else if (vtype[i] == BIGINT) { + field_data[i] = (bigint) 0; + } + if ((lineflag == MULTILINE) && ((i % 3) == 0)) format[i] += "\n"; if ((lineflag == YAMLLINE) && (i == 0)) format[i] += " - ["; if (format_line) format_line_user_def = format_line->next_string(); @@ -361,7 +372,7 @@ void Thermo::compute(int flag) int i; firststep = flag; - bigint ntimestep = update->ntimestep; + ntimestep = update->ntimestep; // check for lost atoms // turn off normflag if natoms = 0 to avoid divide by 0 @@ -405,18 +416,23 @@ void Thermo::compute(int flag) } // add each thermo value to line with its specific format + field_data.clear(); + field_data.resize(nfield); for (ifield = 0; ifield < nfield; ifield++) { (this->*vfunc[ifield])(); if (vtype[ifield] == FLOAT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), dvalue); line += fmtbuf; + field_data[ifield] = dvalue; } else if (vtype[ifield] == INT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), ivalue); line += fmtbuf; + field_data[ifield] = ivalue; } else if (vtype[ifield] == BIGINT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), bivalue); line += fmtbuf; + field_data[ifield] = bivalue; } } @@ -433,16 +449,6 @@ void Thermo::compute(int flag) firststep = 1; } -/* ---------------------------------------------------------------------- - call function to compute property -------------------------------------------------------------------------- */ - -void Thermo::call_vfunc(int ifield_in) -{ - ifield = ifield_in; - (this->*vfunc[ifield])(); -} - /* ---------------------------------------------------------------------- check for lost atoms, return current number of atoms also could number of warnings across MPI ranks and update total @@ -1062,6 +1068,8 @@ void Thermo::parse_fields(const std::string &str) } } } + field_data.clear(); + field_data.resize(nfield); } /* ---------------------------------------------------------------------- @@ -1126,8 +1134,8 @@ void Thermo::check_temp(const std::string &keyword) if (!temperature) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init temperature", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!temperature->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) { temperature->compute_scalar(); temperature->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1145,8 +1153,8 @@ void Thermo::check_pe(const std::string &keyword) if (!pe) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init potential energy", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!pe->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(pe->invoked_flag & Compute::INVOKED_SCALAR)) { pe->compute_scalar(); pe->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1161,8 +1169,8 @@ void Thermo::check_press_scalar(const std::string &keyword) { if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!pressure->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) { pressure->compute_scalar(); pressure->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1177,8 +1185,8 @@ void Thermo::check_press_vector(const std::string &keyword) { if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!pressure->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) { pressure->compute_vector(); pressure->invoked_flag |= Compute::INVOKED_VECTOR; diff --git a/src/thermo.h b/src/thermo.h index eaec3eb9f8..333a282ca0 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -21,9 +21,6 @@ namespace LAMMPS_NS { class Thermo : protected Pointers { friend class MinCG; // accesses compute_pe - friend class DumpNetCDF; // accesses thermo properties - friend class DumpNetCDFMPIIO; // accesses thermo properties - friend class DumpYAML; // accesses thermo properties public: char *style; @@ -45,6 +42,12 @@ class Thermo : protected Pointers { void compute(int); int evaluate_keyword(const std::string &, double *); + // for accessing cached thermo data + const int *get_nfield() const { return &nfield; } + const bigint *get_timestep() const { return &ntimestep; } + const std::vector &get_fields() const { return field_data; } + const std::vector &get_keywords() const { return keyword; } + private: int nfield, nfield_initial; int *vtype; @@ -52,6 +55,7 @@ class Thermo : protected Pointers { std::vector keyword, format, format_column_user, keyword_user; std::string format_line_user, format_float_user, format_int_user, format_bigint_user; std::map key2col; + std::vector field_data; int normvalue; // use this for normflag unless natoms = 0 int normuserflag; // 0 if user has not set, 1 if has @@ -66,6 +70,7 @@ class Thermo : protected Pointers { bigint last_step; bigint natoms; + bigint ntimestep; // data used by routines that compute single values int ivalue; // integer value to print @@ -114,7 +119,6 @@ class Thermo : protected Pointers { typedef void (Thermo::*FnPtr)(); void addfield(const char *, FnPtr, int); FnPtr *vfunc; // list of ptrs to functions - void call_vfunc(int ifield); void compute_compute(); // functions that compute a single value void compute_fix(); // via calls to Compute,Fix,Variable classes diff --git a/src/utils.cpp b/src/utils.cpp index bc4eee7385..dd18c4406d 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -272,6 +272,7 @@ int utils::read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, in { char *ptr = buffer; *ptr = '\0'; + int mylines = 0; if (me == 0) { if (fp) { @@ -282,11 +283,14 @@ int utils::read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, in ptr += strlen(ptr); // ensure buffer is null terminated. null char is start of next line. *ptr = '\0'; + // count line + ++mylines; } } } int n = strlen(buffer); + if (nlines != mylines) n = 0; MPI_Bcast(&n, 1, MPI_INT, 0, comm); if (n == 0) return 1; MPI_Bcast(buffer, n + 1, MPI_CHAR, 0, comm); @@ -879,8 +883,8 @@ char *utils::expand_type(const char *file, int line, const std::string &str, int caller decides what to do if arg is not a COMPUTE or FIX reference ------------------------------------------------------------------------- */ -int utils::check_grid_reference(char *errstr, char *ref, int nevery, - char *&id, int &igrid, int &idata, int &index, LAMMPS *lmp) +int utils::check_grid_reference(char *errstr, char *ref, int nevery, char *&id, int &igrid, + int &idata, int &index, LAMMPS *lmp) { ArgInfo argi(ref, ArgInfo::COMPUTE | ArgInfo::FIX); index = argi.get_index1(); @@ -889,80 +893,85 @@ int utils::check_grid_reference(char *errstr, char *ref, int nevery, switch (argi.get_type()) { case ArgInfo::UNKNOWN: { - lmp->error->all(FLERR,"%s grid reference %s is invalid",errstr,ref); + lmp->error->all(FLERR, "%s grid reference %s is invalid", errstr, ref); } break; - // compute value = c_ID + // compute value = c_ID case ArgInfo::COMPUTE: { // split name = idcompute:gname:dname into 3 strings - auto words = parse_grid_id(FLERR,name,lmp->error); + auto words = parse_grid_id(FLERR, name, lmp->error); const auto &idcompute = words[0]; const auto &gname = words[1]; const auto &dname = words[2]; auto icompute = lmp->modify->get_compute_by_id(idcompute); - if (!icompute) lmp->error->all(FLERR,"{} compute ID {} not found",errstr,idcompute); + if (!icompute) lmp->error->all(FLERR, "{} compute ID {} not found", errstr, idcompute); if (icompute->pergrid_flag == 0) - lmp->error->all(FLERR,"{} compute {} does not compute per-grid info",errstr,idcompute); + lmp->error->all(FLERR, "{} compute {} does not compute per-grid info", errstr, idcompute); int dim; - igrid = icompute->get_grid_by_name(gname,dim); + igrid = icompute->get_grid_by_name(gname, dim); if (igrid < 0) - lmp->error->all(FLERR,"{} compute {} does not recognize grid name {}",errstr,idcompute,gname); + lmp->error->all(FLERR, "{} compute {} does not recognize grid name {}", errstr, idcompute, + gname); int ncol; - idata = icompute->get_griddata_by_name(igrid,dname,ncol); + idata = icompute->get_griddata_by_name(igrid, dname, ncol); if (idata < 0) - lmp->error->all(FLERR,"{} compute {} does not recognize data name {}",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} does not recognize data name {}", errstr, idcompute, + dname); if (argi.get_dim() == 0 && ncol) - lmp->error->all(FLERR,"{} compute {} data {} is not per-grid vector",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} data {} is not per-grid vector", errstr, idcompute, + dname); if (argi.get_dim() && ncol == 0) - lmp->error->all(FLERR,"{} compute {} data {} is not per-grid array",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} data {} is not per-grid array", errstr, idcompute, + dname); if (argi.get_dim() && argi.get_index1() > ncol) - lmp->error->all(FLERR,"{} compute {} array {} is accessed out-of-range",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} array {} is accessed out-of-range", errstr, idcompute, + dname); id = utils::strdup(idcompute); return ArgInfo::COMPUTE; } break; - // fix value = f_ID + // fix value = f_ID case ArgInfo::FIX: { // split name = idfix:gname:dname into 3 strings - auto words = parse_grid_id(FLERR,name,lmp->error); + auto words = parse_grid_id(FLERR, name, lmp->error); const auto &idfix = words[0]; const auto &gname = words[1]; const auto &dname = words[2]; auto ifix = lmp->modify->get_fix_by_id(idfix); - if (!ifix) lmp->error->all(FLERR,"{} fix ID {} not found",errstr,idfix); + if (!ifix) lmp->error->all(FLERR, "{} fix ID {} not found", errstr, idfix); if (ifix->pergrid_flag == 0) - lmp->error->all(FLERR,"{} fix {} does not compute per-grid info",errstr,idfix); + lmp->error->all(FLERR, "{} fix {} does not compute per-grid info", errstr, idfix); if (nevery % ifix->pergrid_freq) - lmp->error->all(FLERR,"{} fix {} not computed at compatible time",errstr,idfix); + lmp->error->all(FLERR, "{} fix {} not computed at compatible time", errstr, idfix); int dim; - igrid = ifix->get_grid_by_name(gname,dim); + igrid = ifix->get_grid_by_name(gname, dim); if (igrid < 0) - lmp->error->all(FLERR,"{} fix {} does not recognize grid name {}",errstr,idfix,gname); + lmp->error->all(FLERR, "{} fix {} does not recognize grid name {}", errstr, idfix, gname); int ncol; - idata = ifix->get_griddata_by_name(igrid,dname,ncol); + idata = ifix->get_griddata_by_name(igrid, dname, ncol); if (idata < 0) - lmp->error->all(FLERR,"{} fix {} does not recognize data name {}",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} does not recognize data name {}", errstr, idfix, dname); if (argi.get_dim() == 0 && ncol) - lmp->error->all(FLERR,"{} fix {} data {} is not per-grid vector",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} data {} is not per-grid vector", errstr, idfix, dname); if (argi.get_dim() > 0 && ncol == 0) - lmp->error->all(FLERR,"{} fix {} data {} is not per-grid array",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} data {} is not per-grid array", errstr, idfix, dname); if (argi.get_dim() > 0 && argi.get_index1() > ncol) - lmp->error->all(FLERR,"{} fix {} array {} is accessed out-of-range",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} array {} is accessed out-of-range", errstr, idfix, dname); id = utils::strdup(idfix); return ArgInfo::FIX; @@ -1360,8 +1369,9 @@ bool utils::is_double(const std::string &str) { if (str.empty()) return false; - return strmatch(str, "^[+-]?\\d+\\.?\\d*$") || strmatch(str, "^[+-]?\\d+\\.?\\d*[eE][+-]?\\d+$") || - strmatch(str, "^[+-]?\\d*\\.?\\d+$") || strmatch(str, "^[+-]?\\d*\\.?\\d+[eE][+-]?\\d+$"); + return strmatch(str, "^[+-]?\\d+\\.?\\d*$") || + strmatch(str, "^[+-]?\\d+\\.?\\d*[eE][+-]?\\d+$") || strmatch(str, "^[+-]?\\d*\\.?\\d+$") || + strmatch(str, "^[+-]?\\d*\\.?\\d+[eE][+-]?\\d+$"); } /* ---------------------------------------------------------------------- diff --git a/src/variable.cpp b/src/variable.cpp index e11eff2870..cf2e5c3b6f 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -224,7 +224,7 @@ void Variable::set(int narg, char **arg) if (narg == 5 && strcmp(arg[4],"pad") == 0) { pad[nvar] = fmt::format("{}",nlast).size(); } else pad[nvar] = 0; - } else error->all(FLERR,"Illegal variable loop command: too much arguments"); + } else error->all(FLERR,"Illegal variable loop command: too many arguments"); num[nvar] = nlast; which[nvar] = nfirst-1; data[nvar] = new char*[1]; @@ -1052,7 +1052,7 @@ char *Variable::retrieve(const char *name) if (vecs[ivar].dynamic || vecs[ivar].currentstep != update->ntimestep) { eval_in_progress[ivar] = 0; double *result; - int nvec = compute_vector(ivar,&result); + compute_vector(ivar,&result); delete[] data[ivar][1]; std::vector vectmp(vecs[ivar].values,vecs[ivar].values + vecs[ivar].n); std::string str = fmt::format("[{}]", fmt::join(vectmp,",")); @@ -1505,8 +1505,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (nbracket == 0 && compute->scalar_flag && lowercase) { - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) { compute->compute_scalar(); compute->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1527,8 +1528,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index1 > compute->size_vector && compute->size_vector_variable == 0) print_var_error(FLERR,"Variable formula compute vector is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -1553,8 +1555,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (index2 > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; @@ -1580,8 +1583,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Compute global vector in atom-style variable formula",ivar); if (compute->size_vector == 0) print_var_error(FLERR,"Variable formula compute vector is zero length",ivar); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -1604,8 +1608,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Compute global vector in atom-style variable formula",ivar); if (compute->size_array_rows == 0) print_var_error(FLERR,"Variable formula compute array is zero length",ivar); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; @@ -1623,8 +1628,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->peratom_flag && compute->size_peratom_cols == 0) { - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1640,8 +1646,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index2 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1663,8 +1670,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Per-atom compute in equal-style variable formula",ivar); if (treetype == VECTOR) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1687,8 +1695,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); if (index1 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -2726,7 +2735,7 @@ double Variable::collapse_tree(Tree *tree) if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; - if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) + if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) tree->value = ivalue1; else { @@ -3097,7 +3106,7 @@ double Variable::eval_tree(Tree *tree, int i) auto ivalue1 = static_cast (eval_tree(tree->first,i)); auto ivalue2 = static_cast (eval_tree(tree->second,i)); auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); - if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) + if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; else { @@ -3628,7 +3637,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree auto ivalue1 = static_cast (value1); auto ivalue2 = static_cast (value2); auto ivalue3 = static_cast (values[0]); - if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) + if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; if (update->ntimestep < ivalue1) value = ivalue1; @@ -3658,7 +3667,6 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; if (update->ntimestep < ivalue1) value = ivalue1; - //else if (update->ntimestep <= ivalue3) { else { value = ivalue1; double logsp = ivalue1; @@ -4164,8 +4172,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t print_var_error(FLERR,mesg,ivar); } if (index == 0 && compute->vector_flag) { - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -4175,8 +4184,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t } else if (index && compute->array_flag) { if (index > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; diff --git a/src/version.h b/src/version.h index 2d0eb0480e..2a1c8a9a37 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -#define LAMMPS_VERSION "28 Mar 2023" +#define LAMMPS_VERSION "15 Jun 2023" #define LAMMPS_UPDATE "Development" diff --git a/tools/coding_standard/versiontags.py b/tools/coding_standard/versiontags.py index 0b4597046f..ec512a3fad 100644 --- a/tools/coding_standard/versiontags.py +++ b/tools/coding_standard/versiontags.py @@ -21,7 +21,7 @@ DEFAULT_CONFIG = """ recursive: true include: - doc/src/** - - python + - python/** - src/** exclude: - src/Make.sh diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index b7414573ba..91a6866107 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -28,9 +28,10 @@ * * Must be kept in sync with the equivalent constants in ``src/library.h``, * ``python/lammps/constants.py``, ``examples/COUPLE/plugin/liblammpsplugin.h``, - * and ``fortran/lammps.f90`` */ + * ``src/lmptype.h``, and ``fortran/lammps.f90`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE =-1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ @@ -113,6 +114,7 @@ extern void lammps_commands_string(void *handle, const char *str); extern double lammps_get_natoms(void *handle); extern double lammps_get_thermo(void *handle, const char *keyword); +extern void *lammps_last_thermo(void *handle, const char *what, int index); extern void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); @@ -295,6 +297,7 @@ extern void lammps_commands_string(void *handle, const char *str); extern double lammps_get_natoms(void *handle); extern double lammps_get_thermo(void *handle, const char *keyword); +extern void *lammps_last_thermo(void *handle, const char *what, int index); extern void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); diff --git a/tools/vim/lammps.vim b/tools/vim/lammps.vim index 008ae1ee3f..9565d0a86e 100644 --- a/tools/vim/lammps.vim +++ b/tools/vim/lammps.vim @@ -1,23 +1,27 @@ " Vim syntax file -" Language: Lammps Simulation Script File +" Language: Lammps Simulation Script File " Maintainer: Gerolf Ziegenhain " Updates: Axel Kohlmeyer , Sam Bateman , Daniel Möller Montull , Eryk Skalinski -" Latest Revision: 2022-08-17 +" Latest Revision: 2023-07-15 syn clear -syn keyword lammpsOutput log write_data write_dump info shell write_restart restart dump undump thermo thermo_modify thermo_style print timer +" Add '/' to list of valid keyword characters +set iskeyword+=/ + +syn keyword lammpsOutput log write_data write_dump write_coeff info shell write_restart restart dump undump thermo thermo_modify +syn keyword lammpsOutput thermo_style print timer syn keyword lammpsRead include read_restart read_data read_dump molecule syn keyword lammpsLattice boundary units atom_style lattice region create_box create_atoms dielectric syn keyword lammpsLattice delete_atoms displace_atoms change_box dimension replicate -syn keyword lammpsParticle pair_coeff pair_style pair_modify pair_write mass velocity angle_coeff angle_style +syn keyword lammpsParticle pair_coeff pair_style pair_modify pair_write mass velocity angle_coeff angle_style angle_write syn keyword lammpsParticle atom_modify atom_style bond_coeff bond_style bond_write create_bonds delete_bonds kspace_style -syn keyword lammpsParticle kspace_modify dihedral_style dihedral_coeff improper_style improper_coeff -syn keyword lammpsSetup min_style fix_modify run_style timestep neighbor neigh_modify fix unfix suffix special_bonds -syn keyword lammpsSetup balance box clear comm_modify comm_style newton package processors reset_ids reset_timestep -syn keyword lammpsRun minimize run rerun tad neb prd quit server temper temper/grem temper/npt -syn keyword lammpsRun min/spin message hyper dynamical_matrix -syn keyword lammpsDefine variable group compute python set uncompute kim_query +syn keyword lammpsParticle kspace_modify dihedral_style dihedral_coeff dihedral_write improper_style improper_coeff labelmap +syn keyword lammpsSetup min_style min_modify fix_modify run_style timestep neighbor neigh_modify fix unfix suffix special_bonds +syn keyword lammpsSetup balance box clear comm_modify comm_style newton package processors reset_atoms reset_ids reset_timestep +syn keyword lammpsRun minimize minimize/kk run rerun tad neb neb/spin prd quit server temper/npt temper/grem temper +syn keyword lammpsRun message hyper dynamical_matrix dynamical_matrix/kk third_order third_order/kk fitpod +syn keyword lammpsDefine variable group compute python set uncompute kim_query kim group2ndx ndx2group mdi syn keyword lammpsRepeat jump next loop diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index f41e8a2878..f7be54f9ae 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -54,7 +54,7 @@ add_test(NAME RunLammps COMMAND $ -log none -echo none -in in.empty) set_tests_properties(RunLammps PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") # check if the compiled executable will print the help message add_test(NAME HelpMessage diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 21b00b5c03..3e5b7a8cc0 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -80,7 +80,7 @@ if(BUILD_MPI) COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/plugin/in.lj $) set_tests_properties(RunCoupleSimplePlugin PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() add_subdirectory(${LAMMPS_DIR}/examples/COUPLE/simple ${CMAKE_BINARY_DIR}/build-simple) add_test(NAME RunCoupleSimpleC @@ -88,15 +88,15 @@ if(BUILD_MPI) add_test(NAME RunCoupleSimpleCC COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) - if($) + if(TARGET simpleF90) add_test(NAME RunCoupleSimpleF90 COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) set_tests_properties(RunCoupleSimpleF90 PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() set_tests_properties(RunCoupleSimpleC RunCoupleSimpleCC PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index d6dd55f75e..14eab06213 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -14,6 +14,7 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val +using ::LAMMPS_NS::bigint; using ::LAMMPS_NS::tagint; using ::LAMMPS_NS::platform::path_join; using ::testing::HasSubstr; @@ -93,6 +94,9 @@ TEST_F(LibraryProperties, natoms) TEST_F(LibraryProperties, thermo) { + bigint bval = *(bigint *)lammps_last_thermo(lmp, "step", 0); + EXPECT_EQ(bval, -1); + if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); std::string input = path_join(INPUT_DIR, "in.fourmol"); ::testing::internal::CaptureStdout(); @@ -105,6 +109,59 @@ TEST_F(LibraryProperties, thermo) EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "vol"), 3375.0); EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "density"), 0.12211250945013695); EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "cellalpha"), 90.0); + + bval = *(bigint *)lammps_last_thermo(lmp, "step", 0); + EXPECT_EQ(bval, 2); + int ival = *(int *)lammps_last_thermo(lmp, "num", 0); + EXPECT_EQ(ival, 6); + + const char *key = (const char *)lammps_last_thermo(lmp, "keyword", 0); + EXPECT_THAT(key, StrEq("Step")); + ival = *(int *)lammps_last_thermo(lmp, "type", 0); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(ival, LAMMPS_INT); + ival = *(int *)lammps_last_thermo(lmp, "data", 0); + EXPECT_EQ(ival, 2); +#else + EXPECT_EQ(ival, LAMMPS_INT64); + bval = *(bigint *)lammps_last_thermo(lmp, "data", 0); + EXPECT_EQ(bval, 2); +#endif + + key = (const char *)lammps_last_thermo(lmp, "keyword", 1); + EXPECT_THAT(key, StrEq("Temp")); + ival = *(int *)lammps_last_thermo(lmp, "type", 1); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + double dval = *(double *)lammps_last_thermo(lmp, "data", 1); + EXPECT_DOUBLE_EQ(dval, 28.042780385852982); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 2); + EXPECT_THAT(key, StrEq("E_pair")); + ival = *(int *)lammps_last_thermo(lmp, "type", 2); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 2); + EXPECT_DOUBLE_EQ(dval, 0.0); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 3); + EXPECT_THAT(key, StrEq("E_mol")); + ival = *(int *)lammps_last_thermo(lmp, "type", 3); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 3); + EXPECT_DOUBLE_EQ(dval, 0.0); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 4); + EXPECT_THAT(key, StrEq("TotEng")); + ival = *(int *)lammps_last_thermo(lmp, "type", 4); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 4); + EXPECT_DOUBLE_EQ(dval, 2.3405256449146163); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 5); + EXPECT_THAT(key, StrEq("Press")); + ival = *(int *)lammps_last_thermo(lmp, "type", 5); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 5); + EXPECT_DOUBLE_EQ(dval, 31.700964689115658); }; TEST_F(LibraryProperties, box) @@ -325,8 +382,8 @@ TEST_F(LibraryProperties, global) EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_lj"), LAMMPS_DOUBLE); EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_coul"), LAMMPS_DOUBLE); - double *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); - double *special_coul= (double *)lammps_extract_global(lmp, "special_coul"); + double *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); + double *special_coul = (double *)lammps_extract_global(lmp, "special_coul"); EXPECT_DOUBLE_EQ(special_lj[0], 1.0); EXPECT_DOUBLE_EQ(special_lj[1], 0.0); EXPECT_DOUBLE_EQ(special_lj[2], 0.5); diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index 6c365c8c2b..04913f51b5 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -169,7 +169,7 @@ TEST_F(ComputeGlobalTest, Geometry) command("compute mom1 all momentum"); command("compute mom2 allwater momentum"); command("compute mop1 all stress/mop x 0.0 total"); - command("compute mop2 all stress/mop/profile z lower 0.5 kin conf"); + command("compute mop2 all stress/mop/profile z lower 0.5 kin pair"); thermo_style += " c_mu1 c_mu2 c_mop1[*] c_mop2[1][1]"; } @@ -225,9 +225,9 @@ TEST_F(ComputeGlobalTest, Geometry) EXPECT_DOUBLE_EQ(mom2[0], -0.022332069630161717); EXPECT_DOUBLE_EQ(mom2[1], -0.056896553865696115); EXPECT_DOUBLE_EQ(mom2[2], 0.069179891052881484); - EXPECT_DOUBLE_EQ(mop1[0], 3522311.3572200728); - EXPECT_DOUBLE_EQ(mop1[1], 2871104.9055934539); - EXPECT_DOUBLE_EQ(mop1[2], -4136077.5224247416); + EXPECT_DOUBLE_EQ(mop1[0], 3536584.0880458541); + EXPECT_DOUBLE_EQ(mop1[1], 2887485.033995091); + EXPECT_DOUBLE_EQ(mop1[2], -4154145.8952306858); EXPECT_DOUBLE_EQ(mop2[0][0], -8.0869239999999998); EXPECT_DOUBLE_EQ(mop2[0][1], 0.0); EXPECT_DOUBLE_EQ(mop2[0][2], 0.0); diff --git a/unittest/fortran/test_fortran_gather_scatter.f90 b/unittest/fortran/test_fortran_gather_scatter.f90 index 1f8d4f0905..8741bba485 100644 --- a/unittest/fortran/test_fortran_gather_scatter.f90 +++ b/unittest/fortran/test_fortran_gather_scatter.f90 @@ -207,7 +207,7 @@ END SUBROUTINE f_lammps_scatter_atoms_subset_mask SUBROUTINE f_lammps_setup_gather_topology() BIND(C) USE LIBLAMMPS - USE keepstuff, ONLY : lmp, cont_input, more_input, pair_input + USE keepstuff, ONLY : lmp IMPLICIT NONE CALL lmp%command('include ${input_dir}/in.fourmol') @@ -232,7 +232,7 @@ FUNCTION f_lammps_test_gather_bonds_small() BIND(C) RESULT(count) nbonds = nbonds_small ELSE nbonds_big = lmp%extract_global('nbonds') - nbonds = nbonds_big + nbonds = INT(nbonds_big) END IF CALL lmp%gather_bonds(bonds) @@ -280,7 +280,7 @@ FUNCTION f_lammps_test_gather_bonds_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nbonds_big nbonds_big = lmp%extract_global('nbonds') - nbonds = nbonds_big + nbonds = INT(nbonds_big) CALL lmp%gather_bonds(bonds) bonds_array(1:3,1:SIZE(bonds)/3) => bonds count = 0 @@ -332,7 +332,7 @@ FUNCTION f_lammps_test_gather_angles_small() BIND(C) RESULT(count) nangles = nangles_small ELSE nangles_big = lmp%extract_global('nangles') - nangles = nangles_big + nangles = INT(nangles_big) END IF CALL lmp%gather_angles(angles) @@ -380,7 +380,7 @@ FUNCTION f_lammps_test_gather_angles_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nangles_big nangles_big = lmp%extract_global('nangles') - nangles = nangles_big + nangles = INT(nangles_big) CALL lmp%gather_angles(angles) angles_array(1:4,1:SIZE(angles)/4) => angles count = 0 @@ -432,7 +432,7 @@ FUNCTION f_lammps_test_gather_dihedrals_small() BIND(C) RESULT(count) ndihedrals = ndihedrals_small ELSE ndihedrals_big = lmp%extract_global('ndihedrals') - ndihedrals = ndihedrals_big + ndihedrals = INT(ndihedrals_big) END IF CALL lmp%gather_dihedrals(dihedrals) @@ -478,7 +478,7 @@ FUNCTION f_lammps_test_gather_dihedrals_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: ndihedrals_big ndihedrals_big = lmp%extract_global('ndihedrals') - ndihedrals = ndihedrals_big + ndihedrals = INT(ndihedrals_big) CALL lmp%gather_dihedrals(dihedrals) dihedrals_array(1:5,1:SIZE(dihedrals)/5) => dihedrals count = 0 @@ -528,7 +528,7 @@ FUNCTION f_lammps_test_gather_impropers_small() BIND(C) RESULT(count) nimpropers = nimpropers_small ELSE nimpropers_big = lmp%extract_global('nimpropers') - nimpropers = nimpropers_big + nimpropers = INT(nimpropers_big) END IF CALL lmp%gather_impropers(impropers) @@ -566,7 +566,7 @@ FUNCTION f_lammps_test_gather_impropers_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nimpropers_big nimpropers_big = lmp%extract_global('nimpropers') - nimpropers = nimpropers_big + nimpropers = INT(nimpropers_big) CALL lmp%gather_impropers(impropers) impropers_array(1:5,1:SIZE(impropers)/5) => impropers count = 0 diff --git a/unittest/fortran/test_fortran_get_thermo.f90 b/unittest/fortran/test_fortran_get_thermo.f90 index 7911ab07d5..965e6d58f7 100644 --- a/unittest/fortran/test_fortran_get_thermo.f90 +++ b/unittest/fortran/test_fortran_get_thermo.f90 @@ -152,3 +152,111 @@ FUNCTION f_lammps_get_thermo_zhi() BIND(C) f_lammps_get_thermo_zhi = lmp%get_thermo('zhi') END FUNCTION f_lammps_get_thermo_zhi + +SUBROUTINE f_lammps_last_thermo_setup() BIND(C) + USE liblammps + USE keepstuff, ONLY : lmp, big_input, cont_input, pair_input + IMPLICIT NONE + + CALL lmp%commands_list(big_input) + CALL lmp%commands_list(cont_input) + CALL lmp%commands_list(pair_input) + CALL lmp%command('thermo 10') + CALL lmp%command('run 15 post no') +END SUBROUTINE f_lammps_last_thermo_setup + +FUNCTION f_lammps_last_thermo_step() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_step + INTEGER :: size_bigint + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(ival) + ELSE + bval = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_step + +FUNCTION f_lammps_last_thermo_num() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_num + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('num',1) + f_lammps_last_thermo_num = ival +END FUNCTION f_lammps_last_thermo_num + +FUNCTION f_lammps_last_thermo_type(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int) :: f_lammps_last_thermo_type + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('type',idx) + f_lammps_last_thermo_type = ival +END FUNCTION f_lammps_last_thermo_type + +FUNCTION f_lammps_last_thermo_string(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_ptr, c_null_ptr + USE liblammps + USE keepstuff, ONLY : lmp, f2c_string + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + TYPE(c_ptr) :: f_lammps_last_thermo_string + CHARACTER(LEN=12) :: buffer + + buffer = lmp%last_thermo('keyword',idx) + IF (LEN_TRIM(buffer) > 0) THEN + f_lammps_last_thermo_string = f2c_string(buffer) + ELSE + f_lammps_last_thermo_string = c_null_ptr + END IF +END FUNCTION f_lammps_last_thermo_string + +FUNCTION f_lammps_last_thermo_int(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + INTEGER(c_int) :: f_lammps_last_thermo_int + INTEGER :: size_bigint + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(ival) + ELSE + bval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_int + +FUNCTION f_lammps_last_thermo_double(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_double + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + REAL(c_double), POINTER :: dval + REAL(c_double) :: f_lammps_last_thermo_double + + dval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_double = dval +END FUNCTION f_lammps_last_thermo_double diff --git a/unittest/fortran/wrap_get_thermo.cpp b/unittest/fortran/wrap_get_thermo.cpp index 71b51609eb..e18697ba9b 100644 --- a/unittest/fortran/wrap_get_thermo.cpp +++ b/unittest/fortran/wrap_get_thermo.cpp @@ -1,6 +1,7 @@ // unit tests for getting thermodynamic output from a LAMMPS instance through the Fortran wrapper #include "lammps.h" +#include "lmptype.h" #include #include @@ -23,8 +24,18 @@ double f_lammps_get_thermo_ylo(); double f_lammps_get_thermo_yhi(); double f_lammps_get_thermo_zlo(); double f_lammps_get_thermo_zhi(); + +void f_lammps_last_thermo_setup(); +int f_lammps_last_thermo_step(); +int f_lammps_last_thermo_num(); +int f_lammps_last_thermo_type(int); +const char *f_lammps_last_thermo_string(int); +int f_lammps_last_thermo_int(int); +double f_lammps_last_thermo_double(int); } +using LAMMPS_NS::multitype; + class LAMMPS_thermo : public ::testing::Test { protected: LAMMPS_NS::LAMMPS *lmp; @@ -65,3 +76,33 @@ TEST_F(LAMMPS_thermo, get_thermo) EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zlo(), 0.0); EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zhi(), 4.0); }; + +TEST_F(LAMMPS_thermo, last_thermo) +{ + EXPECT_EQ(f_lammps_last_thermo_step(), -1); + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_NONE); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_NONE); + f_lammps_last_thermo_setup(); + EXPECT_EQ(f_lammps_last_thermo_step(), 15); + EXPECT_EQ(f_lammps_last_thermo_num(), 6); + EXPECT_STREQ(f_lammps_last_thermo_string(1), "Step"); + EXPECT_STREQ(f_lammps_last_thermo_string(2), "Temp"); + EXPECT_STREQ(f_lammps_last_thermo_string(3), "E_pair"); + EXPECT_STREQ(f_lammps_last_thermo_string(6), "Press"); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT); +#else + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT64); +#endif + EXPECT_EQ(f_lammps_last_thermo_int(1), 15); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(3), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(4), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(5), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(6), multitype::LAMMPS_DOUBLE); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(2), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(3), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(4), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(5), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(6), -0.022421073321023492); +}; diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 33b19ba4f0..1c25751191 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -533,6 +533,33 @@ create_atoms 1 single & result = self.lmp.get_thermo(key) self.assertEqual(value, result, key) + + def test_last_thermo(self): + self.lmp.command("units lj") + self.lmp.command("atom_style atomic") + self.lmp.command("atom_modify map array") + self.lmp.command("boundary f f f") + self.lmp.command("region box block 0 2 0 2 0 2") + self.lmp.command("create_box 1 box") + self.lmp.command("mass * 1") + + x = [ + 0.5, 0.5, 0.5, + 1.5, 1.5, 1.5 + ] + types = [1, 1] + self.lmp.create_atoms(2, id=None, type=types, x=x) + + self.assertEqual(self.lmp.last_thermo(), None) + self.lmp.command("run 2 post no") + ref = { "Step" : 2, + "Temp" : 0.0, + "E_pair" : 0.0, + "E_mol" : 0.0, + "TotEng" : 0.0, + "Press" : 0.0} + self.assertDictEqual(self.lmp.last_thermo(), ref) + def test_extract_global(self): self.lmp.command("region box block -1 1 -2 2 -3 3") self.lmp.command("create_box 1 box") diff --git a/unittest/python/python-pylammps.py b/unittest/python/python-pylammps.py index 2b92f82248..9e691b1b8c 100644 --- a/unittest/python/python-pylammps.py +++ b/unittest/python/python-pylammps.py @@ -82,14 +82,26 @@ class PythonPyLammps(unittest.TestCase): self.pylmp.variable("fx atom fx") self.pylmp.run(10) - self.assertEqual(len(self.pylmp.runs), 1) - self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) - self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2) + # thermo data is only captured during a run if PYTHON package is enabled + # without it, it will only capture the final thermo at completion + if self.pylmp.lmp.has_package("PYTHON"): + self.assertEqual(len(self.pylmp.runs), 1) + self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) + self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2) + else: + self.assertEqual(len(self.pylmp.runs), 1) + self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) + self.assertEqual(len(self.pylmp.last_run.thermo.Step), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.Press), 1) def test_info_queries(self): self.pylmp.lattice("fcc", 0.8442), diff --git a/unittest/utils/CMakeLists.txt b/unittest/utils/CMakeLists.txt index a6d5545873..8c1a5a3f6a 100644 --- a/unittest/utils/CMakeLists.txt +++ b/unittest/utils/CMakeLists.txt @@ -7,6 +7,10 @@ add_executable(test_mempool test_mempool.cpp) target_link_libraries(test_mempool PRIVATE lammps GTest::GMockMain) add_test(NAME MemPool COMMAND test_mempool) +add_executable(test_lmptype test_lmptype.cpp) +target_link_libraries(test_lmptype PRIVATE lammps GTest::GMockMain) +add_test(NAME LmpType COMMAND test_lmptype) + add_executable(test_argutils test_argutils.cpp) target_link_libraries(test_argutils PRIVATE lammps GTest::GMockMain) add_test(NAME ArgUtils COMMAND test_argutils) diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp new file mode 100644 index 0000000000..383c9d4b2c --- /dev/null +++ b/unittest/utils/test_lmptype.cpp @@ -0,0 +1,79 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS Development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "lmptype.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include + +using namespace LAMMPS_NS; + +TEST(Types, ubuf) +{ + double buf[3]; + double d1 = 0.1; + int i1 = -10; +#if defined(LAMMPS_SMALLSMALL) + bigint b1 = 2048; +#else + bigint b1 = (1L << 58) + (1L << 50); +#endif + buf[0] = d1; + buf[1] = ubuf(i1).d; + buf[2] = ubuf(b1).d; + + EXPECT_EQ(d1, buf[0]); + EXPECT_EQ(i1, (int)ubuf(buf[1]).i); + EXPECT_EQ(b1, (bigint)ubuf(buf[2]).i); +} + +TEST(Types, multitype) +{ + multitype m[7]; + int64_t b1 = (3L << 48) - 1; + int i1 = 20; + double d1 = 0.1; + + m[0] = b1; + m[1] = i1; + m[2] = d1; + + m[3] = (bigint) -((1L << 40) + (1L << 50)); + m[4] = -1023; + m[5] = -2.225; + + EXPECT_EQ(m[0].type, multitype::LAMMPS_INT64); + EXPECT_EQ(m[1].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[2].type, multitype::LAMMPS_DOUBLE); + +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT); +#else + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT64); +#endif + EXPECT_EQ(m[4].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[5].type, multitype::LAMMPS_DOUBLE); + EXPECT_EQ(m[6].type, multitype::LAMMPS_NONE); + + EXPECT_EQ(m[0].data.b, b1); + EXPECT_EQ(m[1].data.i, i1); + EXPECT_EQ(m[2].data.d, d1); + +#if !defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50))); +#endif + EXPECT_EQ(m[4].data.i, -1023); + EXPECT_EQ(m[5].data.d, -2.225); +}