Merge branch 'amoeba' of github.com:lammps/lammps into amoeba
This commit is contained in:
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
@ -5,8 +5,8 @@ Thank your for considering to contribute to the LAMMPS software project.
|
||||
The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project.
|
||||
|
||||
Thus please also have a look at:
|
||||
* [The guide for submitting new features in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||
* [The guide on programming style and requirement in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||
* [The guide for submitting new features in the LAMMPS manual](https://www.lammps.org/doc/Modify_contribute.html)
|
||||
* [The guide on programming style and requirement in the LAMMPS manual](https://www.lammps.org/doc/Modify_style.html)
|
||||
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
615
cmake/CMakeLists.jpeg
Normal file
615
cmake/CMakeLists.jpeg
Normal file
@ -0,0 +1,615 @@
|
||||
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
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} $<TARGET_OBJECTS:simd>
|
||||
${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} $<TARGET_OBJECTS:simd> ${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} $<TARGET_OBJECTS:simd>
|
||||
${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()
|
||||
741
cmake/CMakeLists.png
Normal file
741
cmake/CMakeLists.png
Normal file
@ -0,0 +1,741 @@
|
||||
# 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 $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||
else()
|
||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${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 $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/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 $<TARGET_LINKER_FILE_DIR:png_static>/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
|
||||
@ -105,8 +105,28 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# silence excessive warnings for new Intel Compilers
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||
set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare -Wno-unused-command-line-argument")
|
||||
endif()
|
||||
|
||||
# silence excessive warnings for PGI/NVHPC compilers
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "PGI"))
|
||||
set(CMAKE_TUNE_DEFAULT "-Minform=severe")
|
||||
endif()
|
||||
|
||||
# silence nvcc warnings
|
||||
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma")
|
||||
endif()
|
||||
|
||||
# we require C++11 without extensions. Kokkos requires at least C++14 (currently)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
if(CMAKE_CXX_STANDARD LESS 11)
|
||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||
endif()
|
||||
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14))
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
endif()
|
||||
@ -141,10 +161,12 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared lib
|
||||
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
||||
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
||||
|
||||
# allow enabling clang-tidy for C++ files
|
||||
# Support using clang-tidy for C++ files with selected options
|
||||
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*-header-filter=.*" CACHE STRING "")
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings")
|
||||
else()
|
||||
unset(CMAKE_CXX_CLANG_TIDY CACHE)
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
@ -190,6 +212,7 @@ set(STANDARD_PACKAGES
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
EFF
|
||||
ELECTRODE
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
EXTRA-FIX
|
||||
@ -308,7 +331,9 @@ string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||
target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES})
|
||||
|
||||
# posix_memalign is not available on Windows
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
# with INTEL package and Intel compilers we use TBB's aligned malloc
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
AND NOT (PKG_INTEL AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM"))))
|
||||
set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE)
|
||||
else()
|
||||
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
|
||||
@ -329,10 +354,12 @@ pkg_depends(MPIIO MPI)
|
||||
pkg_depends(ATC MANYBODY)
|
||||
pkg_depends(LATBOLTZ MPI)
|
||||
pkg_depends(SCAFACOS MPI)
|
||||
pkg_depends(AMOEBA KSPACE)
|
||||
pkg_depends(DIELECTRIC KSPACE)
|
||||
pkg_depends(DIELECTRIC EXTRA-PAIR)
|
||||
pkg_depends(CG-DNA MOLECULE)
|
||||
pkg_depends(CG-DNA ASPHERE)
|
||||
pkg_depends(ELECTRODE KSPACE)
|
||||
|
||||
# detect if we may enable OpenMP support by default
|
||||
set(BUILD_OMP_DEFAULT OFF)
|
||||
@ -370,7 +397,7 @@ if(BUILD_OMP)
|
||||
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
|
||||
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE)
|
||||
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE)
|
||||
enable_language(C)
|
||||
find_package(LAPACK)
|
||||
find_package(BLAS)
|
||||
@ -393,9 +420,23 @@ endif()
|
||||
# tweak jpeg library names to avoid linker errors with MinGW cross-compilation
|
||||
set(JPEG_NAMES libjpeg libjpeg-62)
|
||||
find_package(JPEG QUIET)
|
||||
if((NOT JPEG_FOUND) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16))
|
||||
set(LIBJPEG_URL https://sourceforge.net/projects/libjpeg-turbo/files/2.1.3/libjpeg-turbo-2.1.3.tar.gz)
|
||||
set(LIBJPEG_MD5 85244dedeaf06f636a9e7ddea6d236d8)
|
||||
mark_as_advanced(LIBJPEG_URL)
|
||||
mark_as_advanced(LIBJPEG_MD5)
|
||||
include(ExternalCMakeProject)
|
||||
ExternalCmakeProject(libjpeg ${LIBJPEG_URL} ${LIBJPEG_MD5} libjpeg-turbo . CMakeLists.jpeg)
|
||||
add_library(JPEG::JPEG ALIAS jpeg-static)
|
||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libjpeg-src")
|
||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libjpeg-build")
|
||||
set(JPEG_FOUND TRUE)
|
||||
endif()
|
||||
option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
||||
if(WITH_JPEG)
|
||||
find_package(JPEG REQUIRED)
|
||||
if(NOT JPEG_FOUND)
|
||||
find_package(JPEG REQUIRED)
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
|
||||
@ -407,14 +448,43 @@ endif()
|
||||
|
||||
find_package(PNG QUIET)
|
||||
find_package(ZLIB QUIET)
|
||||
if((NOT ZLIB_FOUND) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16))
|
||||
set(LIBZ_URL http://prdownloads.sourceforge.net/libpng/zlib-1.2.11.tar.gz)
|
||||
set(LIBZ_MD5 1c9f62f0778697a09d36121ead88e08e)
|
||||
mark_as_advanced(LIBZ_URL)
|
||||
mark_as_advanced(LIBZ_MD5)
|
||||
include(ExternalCMakeProject)
|
||||
ExternalCmakeProject(libz ${LIBZ_URL} ${LIBZ_MD5} zlib . CMakeLists.zlib)
|
||||
add_library(ZLIB::ZLIB ALIAS zlibstatic)
|
||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libz-src")
|
||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libz-build")
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_BINARY_DIR}/_deps/libz-src;${CMAKE_BINARY_DIR}/_deps/libz-build")
|
||||
endif()
|
||||
if((NOT PNG_FOUND) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16))
|
||||
set(LIBPNG_URL http://prdownloads.sourceforge.net/libpng/libpng-1.6.37.tar.gz)
|
||||
set(LIBPNG_MD5 6c7519f6c75939efa0ed3053197abd54)
|
||||
mark_as_advanced(LIBPNG_URL)
|
||||
mark_as_advanced(LIBPNG_MD5)
|
||||
include(ExternalCMakeProject)
|
||||
ExternalCmakeProject(libpng ${LIBPNG_URL} ${LIBPNG_MD5} libpng . CMakeLists.png)
|
||||
add_library(PNG::PNG ALIAS png_static)
|
||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libpng-src")
|
||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libpng-build")
|
||||
set(PNG_FOUND TRUE)
|
||||
endif()
|
||||
if(PNG_FOUND AND ZLIB_FOUND)
|
||||
option(WITH_PNG "Enable PNG support" ON)
|
||||
else()
|
||||
option(WITH_PNG "Enable PNG support" OFF)
|
||||
endif()
|
||||
if(WITH_PNG)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
if(NOT PNG_FOUND)
|
||||
find_package(PNG REQUIRED)
|
||||
endif()
|
||||
if(NOT ZLIB_FOUND)
|
||||
find_package(ZLIB REQUIRED)
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE PNG::PNG ZLIB::ZLIB)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_PNG)
|
||||
endif()
|
||||
@ -469,6 +539,7 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine
|
||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||
target_compile_options(lmp PRIVATE ${_FLAG})
|
||||
endforeach()
|
||||
########################################################################
|
||||
# Basic system tests (standard libraries, headers, functions, types) #
|
||||
@ -573,6 +644,10 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(PKG_ELECTRODE)
|
||||
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(PKG_AWPMD)
|
||||
target_link_libraries(awpmd PRIVATE ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
@ -921,6 +996,12 @@ if(PKG_KSPACE)
|
||||
else()
|
||||
message(STATUS "Kokkos FFT: cuFFT")
|
||||
endif()
|
||||
elseif(Kokkos_ENABLE_HIP)
|
||||
if(FFT STREQUAL "KISS")
|
||||
message(STATUS "Kokkos FFT: KISS")
|
||||
else()
|
||||
message(STATUS "Kokkos FFT: hipFFT")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Kokkos FFT: ${FFT}")
|
||||
endif()
|
||||
|
||||
195
cmake/CMakeLists.zlib
Normal file
195
cmake/CMakeLists.zlib
Normal file
@ -0,0 +1,195 @@
|
||||
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()
|
||||
@ -8,7 +8,7 @@
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": [
|
||||
{
|
||||
@ -26,11 +26,6 @@
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
@ -46,7 +41,7 @@
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": [
|
||||
{
|
||||
@ -64,11 +59,6 @@
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
@ -102,11 +92,6 @@
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
@ -122,7 +107,7 @@
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||
"variables": [
|
||||
{
|
||||
@ -141,7 +126,40 @@
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "PKG_PYTHON",
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug-IntelLLVM",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [],
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-llvm.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"variables": [
|
||||
{
|
||||
"name": "PKG_ELECTRODE",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_SHARED_LIBS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_TOOLS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "LAMMPS_EXCEPTIONS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
@ -149,8 +167,142 @@
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "FFT",
|
||||
"value": "MKL",
|
||||
"type": "STRING"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release-IntelLLVM",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-llvm.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [],
|
||||
"variables": [
|
||||
{
|
||||
"name": "PKG_ELECTRODE",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_SHARED_LIBS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_TOOLS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "LAMMPS_EXCEPTIONS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "FFT",
|
||||
"value": "MKL",
|
||||
"type": "STRING"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug-Intel-Classic",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-classic.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [],
|
||||
"variables": [
|
||||
{
|
||||
"name": "PKG_ELECTRODE",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_SHARED_LIBS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_TOOLS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "LAMMPS_EXCEPTIONS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "False",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "FFT",
|
||||
"value": "MKL",
|
||||
"type": "STRING"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release-Intel-Classic",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-classic.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [],
|
||||
"variables": [
|
||||
{
|
||||
"name": "PKG_ELECTRODE",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_SHARED_LIBS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_TOOLS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "LAMMPS_EXCEPTIONS",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "False",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "FFT",
|
||||
"value": "MKL",
|
||||
"type": "STRING"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,13 +7,13 @@ if(BUILD_DOC)
|
||||
# Sphinx 3.x requires at least Python 3.5
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
find_package(PythonInterp 3.5 REQUIRED)
|
||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv -p ${PYTHON_EXECUTABLE})
|
||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv)
|
||||
else()
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
if(Python3_VERSION VERSION_LESS 3.5)
|
||||
message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation")
|
||||
endif()
|
||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m virtualenv -p ${Python3_EXECUTABLE})
|
||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
||||
endif()
|
||||
find_package(Doxygen 1.8.10 REQUIRED)
|
||||
|
||||
|
||||
@ -19,6 +19,10 @@ endif()
|
||||
|
||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||
target_compile_definitions(colvars PRIVATE -DCOLVARS_LAMMPS)
|
||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(colvars PRIVATE ${_FLAG})
|
||||
endforeach()
|
||||
set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE})
|
||||
target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||
# The line below is needed to locate math_eigen_impl.h
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
find_package(ZLIB REQUIRED)
|
||||
if(NOT ZLIB_FOUND)
|
||||
find_package(ZLIB REQUIRED)
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
@ -38,7 +38,7 @@ if(INTEL_LRT_MODE STREQUAL "C++11")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM"))
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
||||
message(FATAL_ERROR "INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
@ -46,12 +46,12 @@ else()
|
||||
message(WARNING "INTEL gives best performance with Intel compilers")
|
||||
endif()
|
||||
|
||||
find_package(TBB_MALLOC QUIET)
|
||||
find_package(TBB_MALLOC)
|
||||
if(TBB_MALLOC_FOUND)
|
||||
target_link_libraries(lammps PRIVATE TBB::TBB_MALLOC)
|
||||
else()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_NO_TBB)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM"))
|
||||
message(WARNING "INTEL with Intel compilers should use TBB malloc libraries")
|
||||
endif()
|
||||
endif()
|
||||
@ -112,5 +112,9 @@ if(PKG_KSPACE)
|
||||
RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
||||
endif()
|
||||
|
||||
if(PKG_ELECTRODE)
|
||||
list(APPEND INTEL_SOURCES ${INTEL_SOURCES_DIR}/electrode_accel_intel.cpp)
|
||||
endif()
|
||||
|
||||
target_sources(lammps PRIVATE ${INTEL_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR})
|
||||
|
||||
@ -47,8 +47,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.5.00.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||
set(KOKKOS_MD5 "079323d973ae0e1c38c0a54a150c674e" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.6.00.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||
set(KOKKOS_MD5 "b5c44ea961031795f434002cd7b31c20" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||
mark_as_advanced(KOKKOS_URL)
|
||||
mark_as_advanced(KOKKOS_MD5)
|
||||
ExternalProject_Add(kokkos_build
|
||||
@ -72,7 +72,7 @@ if(DOWNLOAD_KOKKOS)
|
||||
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
||||
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
||||
elseif(EXTERNAL_KOKKOS)
|
||||
find_package(Kokkos 3.5.00 REQUIRED CONFIG)
|
||||
find_package(Kokkos 3.6.00 REQUIRED CONFIG)
|
||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
|
||||
else()
|
||||
@ -130,6 +130,11 @@ if(PKG_KSPACE)
|
||||
target_compile_definitions(lammps PRIVATE -DFFT_CUFFT)
|
||||
target_link_libraries(lammps PRIVATE cufft)
|
||||
endif()
|
||||
elseif(Kokkos_ENABLE_HIP)
|
||||
if(NOT (FFT STREQUAL "KISS"))
|
||||
target_compile_definitions(lammps PRIVATE -DFFT_HIPFFT)
|
||||
target_link_libraries(lammps PRIVATE hipfft)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@ -36,3 +36,5 @@ endif()
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))
|
||||
target_compile_definitions(lammps PRIVATE -DEIGEN_DONT_VECTORIZE)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DEIGEN_NO_CUDA)
|
||||
|
||||
@ -50,6 +50,7 @@ if(DOWNLOAD_MDI)
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-Dlanguage=C
|
||||
-Dlibtype=STATIC
|
||||
-Dmpi=${MDI_USE_MPI}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
|
||||
set(PACELIB_MD5 "a2ac3315c41a1a4a5c912bcb1bc9c5cc" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
set(PACELIB_MD5 "e0572de57039d4afedefb25707b6ceae" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
mark_as_advanced(PACELIB_URL)
|
||||
mark_as_advanced(PACELIB_MD5)
|
||||
|
||||
@ -15,6 +15,10 @@ execute_process(
|
||||
)
|
||||
|
||||
file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*)
|
||||
# enforce building libyaml-cpp as static library and turn off optional features
|
||||
set(YAML_BUILD_SHARED_LIBS OFF)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF)
|
||||
set(YAML_CPP_BUILD_TOOLS OFF)
|
||||
add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp)
|
||||
set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include)
|
||||
|
||||
|
||||
@ -3,6 +3,9 @@ if(BUILD_TOOLS)
|
||||
target_compile_definitions(binary2txt PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
add_executable(stl_bin2txt ${LAMMPS_TOOLS_DIR}/stl_bin2txt.cpp)
|
||||
install(TARGETS stl_bin2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
include(CheckGeneratorSupport)
|
||||
if(CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||
include(CheckLanguage)
|
||||
|
||||
@ -26,6 +26,7 @@ set(ALL_PACKAGES
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
ELECTRODE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
|
||||
@ -28,6 +28,7 @@ set(ALL_PACKAGES
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
ELECTRODE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
# that is compatible with all higher CC, but not the default CC 3.5
|
||||
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE)
|
||||
set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE)
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
20
cmake/presets/kokkos-hip.cmake
Normal file
20
cmake/presets/kokkos-hip.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# preset that enables KOKKOS and selects HIP compilation with OpenMP
|
||||
# enabled as well. Also sets some performance related compiler flags.
|
||||
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_HIP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_VEGA90A on CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(CMAKE_CXX_COMPILER hipcc CACHE STRING "" FORCE)
|
||||
set(CMAKE_TUNE_FLAGS "-munsafe-fp-atomics" CACHE STRING "" FORCE)
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# these flags are needed to build with Cray MPICH on OLCF Crusher
|
||||
#-D CMAKE_CXX_FLAGS="-I/${MPICH_DIR}/include"
|
||||
#-D MPI_CXX_LIBRARIES="-L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa"
|
||||
@ -4,3 +4,6 @@ set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
@ -3,3 +3,6 @@ set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
@ -8,6 +8,9 @@ set(Kokkos_ENABLE_SYCL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE)
|
||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
set(CMAKE_CXX_COMPILER clang++ CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
|
||||
|
||||
@ -22,6 +22,7 @@ set(WIN_PACKAGES
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
ELECTRODE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
|
||||
@ -24,6 +24,7 @@ set(ALL_PACKAGES
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
ELECTRODE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
|
||||
@ -6,6 +6,7 @@ set(PACKAGES_WITH_LIB
|
||||
ATC
|
||||
AWPMD
|
||||
COMPRESS
|
||||
ELECTRODE
|
||||
GPU
|
||||
H5MD
|
||||
KIM
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes)
|
||||
# preset that will enable PGI (Nvidia) compilers with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "pgc++" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "pgcc" CACHE STRING "" FORCE)
|
||||
|
||||
8
cmake/presets/windows-intel-classic.cmake
Normal file
8
cmake/presets/windows-intel-classic.cmake
Normal file
@ -0,0 +1,8 @@
|
||||
# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "icl" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "icl" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "ifort" CACHE STRING "" FORCE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
|
||||
8
cmake/presets/windows-intel-llvm.cmake
Normal file
8
cmake/presets/windows-intel-llvm.cmake
Normal file
@ -0,0 +1,8 @@
|
||||
# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "icx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE)
|
||||
set(INTEL_LRT_MODE "C++11" CACHE STRING "" FORCE)
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(CMAKE_TUNE_FLAGS -Wno-unused-command-line-argument)
|
||||
@ -10,6 +10,7 @@ set(WIN_PACKAGES
|
||||
CLASS2
|
||||
COLLOID
|
||||
COLVARS
|
||||
COMPRESS
|
||||
CORESHELL
|
||||
DIELECTRIC
|
||||
DIFFRACTION
|
||||
@ -44,6 +45,7 @@ set(WIN_PACKAGES
|
||||
PERI
|
||||
PHONON
|
||||
POEMS
|
||||
PLUGIN
|
||||
PTM
|
||||
QEQ
|
||||
QTB
|
||||
|
||||
2
doc/.gitignore
vendored
2
doc/.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
/old
|
||||
/html
|
||||
/html-offline
|
||||
/fasthtml
|
||||
/epub
|
||||
/latex
|
||||
/mathjax
|
||||
|
||||
55
doc/Makefile
55
doc/Makefile
@ -13,35 +13,24 @@ VENV = $(BUILDDIR)/docenv
|
||||
ANCHORCHECK = $(VENV)/bin/rst_anchor_check
|
||||
SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config
|
||||
MATHJAX = $(SPHINXCONFIG)/_static/mathjax
|
||||
MATHJAXTAG = 3.2.1
|
||||
|
||||
PYTHON = $(shell which python3)
|
||||
DOXYGEN = $(shell which doxygen)
|
||||
VIRTUALENV = virtualenv
|
||||
PYTHON = $(word 3,$(shell type python3))
|
||||
DOXYGEN = $(word 3,$(shell type doxygen))
|
||||
HAS_PYTHON3 = NO
|
||||
HAS_VIRTUALENV = NO
|
||||
HAS_DOXYGEN = NO
|
||||
HAS_PDFLATEX = NO
|
||||
|
||||
ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0)
|
||||
ifeq ($(shell type python3 >/dev/null 2>&1; echo $$?), 0)
|
||||
HAS_PYTHON3 = YES
|
||||
endif
|
||||
|
||||
ifeq ($(shell which doxygen >/dev/null 2>&1; echo $$?), 0)
|
||||
ifeq ($(shell type doxygen >/dev/null 2>&1; echo $$?), 0)
|
||||
HAS_DOXYGEN = YES
|
||||
endif
|
||||
|
||||
ifeq ($(shell which virtualenv-3 >/dev/null 2>&1; echo $$?), 0)
|
||||
VIRTUALENV = virtualenv-3
|
||||
HAS_VIRTUALENV = YES
|
||||
endif
|
||||
|
||||
ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0)
|
||||
VIRTUALENV = virtualenv
|
||||
HAS_VIRTUALENV = YES
|
||||
endif
|
||||
|
||||
ifeq ($(shell which pdflatex >/dev/null 2>&1; echo $$?), 0)
|
||||
ifeq ($(shell which latexmk >/dev/null 2>&1; echo $$?), 0)
|
||||
ifeq ($(shell type pdflatex >/dev/null 2>&1; echo $$?), 0)
|
||||
ifeq ($(shell type latexmk >/dev/null 2>&1; echo $$?), 0)
|
||||
HAS_PDFLATEX = YES
|
||||
endif
|
||||
endif
|
||||
@ -58,7 +47,7 @@ SPHINXEXTRA = -E -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiproc
|
||||
# we only want to use explicitly listed files.
|
||||
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
||||
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen fasthtml
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
@ -70,7 +59,8 @@ help:
|
||||
@echo " epub create ePUB format manual for e-book readers"
|
||||
@echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)"
|
||||
@echo " (requires ebook-convert tool from calibre)"
|
||||
@echo " clean remove all intermediate RST files"
|
||||
@echo " fasthtml approximate HTML page creation in fasthtml dir (for development)"
|
||||
@echo " clean remove all intermediate files"
|
||||
@echo " clean-all reset the entire build environment"
|
||||
@echo " anchor_check scan for duplicate anchor labels"
|
||||
@echo " style_check check for complete and consistent style lists"
|
||||
@ -83,7 +73,7 @@ clean-all: clean
|
||||
rm -rf $(BUILDDIR)/docenv $(MATHJAX) $(BUILDDIR)/LAMMPS.mobi $(BUILDDIR)/LAMMPS.epub $(BUILDDIR)/Manual.pdf
|
||||
|
||||
clean: clean-spelling
|
||||
rm -rf $(BUILDDIR)/html $(BUILDDIR)/epub $(BUILDDIR)/latex $(BUILDDIR)/doctrees $(BUILDDIR)/doxygen/xml $(BUILDDIR)/doxygen-warn.log $(BUILDDIR)/doxygen/Doxyfile $(SPHINXCONFIG)/conf.py
|
||||
rm -rf $(BUILDDIR)/html $(BUILDDIR)/epub $(BUILDDIR)/latex $(BUILDDIR)/doctrees $(BUILDDIR)/doxygen/xml $(BUILDDIR)/doxygen-warn.log $(BUILDDIR)/doxygen/Doxyfile $(SPHINXCONFIG)/conf.py $(BUILDDIR)/fasthtml
|
||||
|
||||
clean-spelling:
|
||||
rm -rf $(BUILDDIR)/spelling
|
||||
@ -118,6 +108,23 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
@rm -rf html/PDF/.[sg]*
|
||||
@echo "Build finished. The HTML pages are in doc/html."
|
||||
|
||||
fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@mkdir -p fasthtml
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||
sphinx-build -j 4 -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||
deactivate ;\
|
||||
)
|
||||
@rm -rf fasthtml/_sources
|
||||
@rm -rf fasthtml/PDF
|
||||
@rm -rf fasthtml/USER
|
||||
@rm -rf fasthtml/JPG
|
||||
@cp -r src/PDF fasthtml/PDF
|
||||
@rm -rf fasthtml/PDF/.[sg]*
|
||||
@echo "Fast HTML build finished. The HTML pages are in doc/fasthtml."
|
||||
|
||||
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@(\
|
||||
@ -220,17 +227,17 @@ $(VENV):
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@if [ "$(HAS_PYTHON3)" == "NO" ] ; then echo "python3 was not found! Please see README for further instructions" 1>&2; exit 1; fi
|
||||
@if [ "$(HAS_DOXYGEN)" == "NO" ] ; then echo "doxygen was not found! Please see README for further instructions" 1>&2; exit 1; fi
|
||||
@if [ "$(HAS_VIRTUALENV)" == "NO" ] ; then echo "virtualenv was not found! Please see README for further instructions" 1>&2; exit 1; fi
|
||||
@( \
|
||||
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
|
||||
$(PYTHON) -m venv $(VENV); \
|
||||
. $(VENV)/bin/activate; \
|
||||
pip $(PIP_OPTIONS) install --upgrade pip; \
|
||||
pip $(PIP_OPTIONS) install --upgrade wheel; \
|
||||
pip $(PIP_OPTIONS) install -r $(BUILDDIR)/utils/requirements.txt; \
|
||||
deactivate;\
|
||||
)
|
||||
|
||||
$(MATHJAX):
|
||||
@git clone -b 3.2.0 -c advice.detachedHead=0 --depth 1 https://github.com/mathjax/MathJax.git $@
|
||||
@git clone -b $(MATHJAXTAG) -c advice.detachedHead=0 --depth 1 https://github.com/mathjax/MathJax.git $@
|
||||
|
||||
$(ANCHORCHECK): $(VENV)
|
||||
@( \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "LAMMPS Programmer's Guide"
|
||||
PROJECT_NUMBER = "24 August 2020"
|
||||
PROJECT_NUMBER = "4 May 2022"
|
||||
PROJECT_BRIEF = "Documentation of the LAMMPS library interface and Python wrapper"
|
||||
PROJECT_LOGO = lammps-logo.png
|
||||
CREATE_SUBDIRS = NO
|
||||
@ -437,6 +437,8 @@ INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \
|
||||
@LAMMPS_SOURCE_DIR@/math_eigen.h \
|
||||
@LAMMPS_SOURCE_DIR@/platform.h \
|
||||
@LAMMPS_SOURCE_DIR@/platform.cpp \
|
||||
@LAMMPS_SOURCE_DIR@/math_special.h \
|
||||
@LAMMPS_SOURCE_DIR@/math_special.cpp \
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
.TH LAMMPS "1" "24 March 2022" "2022-3-24"
|
||||
.TH LAMMPS "1" "4 May 2022" "2022-5-4"
|
||||
.SH NAME
|
||||
.B LAMMPS
|
||||
\- Molecular Dynamics Simulator. Version 24 March 2022
|
||||
|
||||
@ -486,14 +486,14 @@ The following options are available.
|
||||
make fix-whitespace # correct whitespace issues in files
|
||||
make check-homepage # search for files with old LAMMPS homepage URLs
|
||||
make fix-homepage # correct LAMMPS homepage URLs in files
|
||||
make check-errordocs # search for deprecated error docs in header files
|
||||
make fix-errordocs # remove error docs in header files
|
||||
make check-permissions # search for files with permissions issues
|
||||
make fix-permissions # correct permissions issues in files
|
||||
make check # run all check targets from above
|
||||
|
||||
These should help to replace all TAB characters with blanks and remove
|
||||
any trailing whitespace. Also all LAMMPS homepage URL references can be
|
||||
updated to the location change from Sandia to the lammps.org domain.
|
||||
And the permission check can remove executable permissions from non-executable
|
||||
files (like source code).
|
||||
These should help to make source and documentation files conforming
|
||||
to some the coding style preferences of the LAMMPS developers.
|
||||
|
||||
Clang-format support
|
||||
--------------------
|
||||
|
||||
@ -641,14 +641,27 @@ This list was last updated for version 3.5.0 of the Kokkos library.
|
||||
|
||||
-D CMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper
|
||||
|
||||
To simplify compilation, four preset files are included in the
|
||||
For AMD or NVIDIA GPUs using HIP, set these variables:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
-D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above
|
||||
-D Kokkos_ARCH_GPUARCH=yes # GPUARCH = GPU from list above
|
||||
-D Kokkos_ENABLE_HIP=yes
|
||||
-D Kokkos_ENABLE_OPENMP=yes
|
||||
|
||||
This will enable FFTs on the GPU, either by the internal KISSFFT library
|
||||
or with the hipFFT wrapper library, which will call out to the
|
||||
platform-appropriate vendor library: rocFFT on AMD GPUs or cuFFT on
|
||||
NVIDIA GPUs.
|
||||
|
||||
To simplify compilation, five preset files are included in the
|
||||
``cmake/presets`` folder, ``kokkos-serial.cmake``,
|
||||
``kokkos-openmp.cmake``, ``kokkos-cuda.cmake``, and
|
||||
``kokkos-sycl.cmake``. They will enable the KOKKOS package and
|
||||
enable some hardware choice. So to compile with OpenMP host
|
||||
parallelization, CUDA device parallelization (for GPUs with CC 5.0
|
||||
and up) with some common packages enabled, you can do the
|
||||
following:
|
||||
``kokkos-openmp.cmake``, ``kokkos-cuda.cmake``,
|
||||
``kokkos-hip.cmake``, and ``kokkos-sycl.cmake``. They will enable
|
||||
the KOKKOS package and enable some hardware choice. So to compile
|
||||
with CUDA device parallelization (for GPUs with CC 5.0 and up)
|
||||
with some common packages enabled, you can do the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -707,6 +720,15 @@ This list was last updated for version 3.5.0 of the Kokkos library.
|
||||
KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd)
|
||||
CC = mpicxx -cxx=$(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper
|
||||
|
||||
For AMD or NVIDIA GPUs using HIP:
|
||||
|
||||
.. code-block:: make
|
||||
|
||||
KOKKOS_DEVICES = HIP
|
||||
KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU
|
||||
# GPUARCH = GPU from list above
|
||||
FFT_INC = -DFFT_HIPFFT # enable use of hipFFT (optional)
|
||||
FFT_LIB = -lhipfft # link to hipFFT library
|
||||
|
||||
Advanced KOKKOS compilation settings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -1252,6 +1274,41 @@ be built for the most part with all major versions of the C++ language.
|
||||
|
||||
----------
|
||||
|
||||
.. _electrode:
|
||||
|
||||
ELECTRODE package
|
||||
-----------------
|
||||
|
||||
This package depends on the KSPACE package.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: CMake build
|
||||
|
||||
No additional settings are needed besides ``-D PKG_KSPACE=yes`` and ``-D
|
||||
PKG_ELECTRODE=yes``.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
The package is activated with ``make yes-KSPACE`` and ``make
|
||||
yes-ELECTRODE``
|
||||
|
||||
|
||||
Note that the ``Makefile.lammps`` file has settings for the BLAS and
|
||||
LAPACK linear algebra libraries. As explained in ``lib/awpmd/README``
|
||||
these can either exist on your system, or you can use the files provided
|
||||
in ``lib/linalg``. In the latter case you also need to build the library
|
||||
in ``lib/linalg`` with a command like these:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-linalg # print help message
|
||||
$ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial")
|
||||
$ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi")
|
||||
$ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||
|
||||
----------
|
||||
|
||||
.. _ml-pace:
|
||||
|
||||
ML-PACE package
|
||||
|
||||
@ -78,11 +78,12 @@ folder. The following ``make`` commands are available:
|
||||
|
||||
make html # generate HTML in html dir using Sphinx
|
||||
make pdf # generate PDF as Manual.pdf using Sphinx and PDFLaTeX
|
||||
make fetch # fetch HTML pages and PDF files from LAMMPS website
|
||||
# and unpack into the html_www folder and Manual_www.pdf
|
||||
make epub # generate LAMMPS.epub in ePUB format using Sphinx
|
||||
make mobi # generate LAMMPS.mobi in MOBI format using ebook-convert
|
||||
|
||||
make fasthtml # generate approximate HTML in fasthtml dir using Sphinx
|
||||
# some Sphinx extensions do not work correctly with this
|
||||
|
||||
make clean # remove intermediate RST files created by HTML build
|
||||
make clean-all # remove entire build folder and any cached data
|
||||
|
||||
@ -193,8 +194,13 @@ folder need to be updated or new files added. These files are written in
|
||||
`reStructuredText <rst_>`_ markup for translation with the Sphinx tool.
|
||||
|
||||
Before contributing any documentation, please check that both the HTML
|
||||
and the PDF format documentation can translate without errors. Please also
|
||||
check the output to the console for any warnings or problems. There will
|
||||
and the PDF format documentation can translate without errors. During
|
||||
testing the html translation, you may use the ``make fasthtml`` command
|
||||
which does an approximate translation (i.e. not all Sphinx features and
|
||||
extensions will work), but runs very fast because it will only translate
|
||||
files that have been changed since the last ``make fasthtml`` command.
|
||||
|
||||
Please also check the output to the console for any warnings or problems. There will
|
||||
be multiple tests run automatically:
|
||||
|
||||
- A test for correctness of all anchor labels and their references
|
||||
|
||||
@ -150,7 +150,7 @@ other files dependent on that package are also excluded.
|
||||
.. _cmake_presets:
|
||||
|
||||
CMake presets for installing many packages
|
||||
""""""""""""""""""""""""""""""""""""""""""
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Instead of specifying all the CMake options via the command-line,
|
||||
CMake allows initializing its settings cache using script files.
|
||||
@ -178,6 +178,11 @@ one of them as a starting point and customize it to your needs.
|
||||
cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages
|
||||
mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers
|
||||
|
||||
Presets that have names starting with "windows" are specifically for
|
||||
compiling LAMMPS :doc:`natively on Windows <Build_windows>` and
|
||||
presets that have names starting with "kokkos" are specifically for
|
||||
selecting configurations for compiling LAMMPS with :ref:`KOKKOS <kokkos>`.
|
||||
|
||||
.. note::
|
||||
|
||||
Running cmake this way manipulates the CMake settings cache in your
|
||||
@ -220,7 +225,8 @@ These commands install/un-install sets of packages:
|
||||
.. code-block:: bash
|
||||
|
||||
make yes-all # install all packages
|
||||
make no-all # uninstall all packages
|
||||
make no-all # check for changes and uninstall all packages
|
||||
make no-installed # only check and uninstall installed packages
|
||||
make yes-basic # install a few commonly used packages'
|
||||
make no-basic # remove a few commonly used packages'
|
||||
make yes-most # install most packages w/o libs'
|
||||
|
||||
@ -287,8 +287,8 @@ Output of JPG, PNG, and movie files
|
||||
|
||||
The :doc:`dump image <dump_image>` command has options to output JPEG or
|
||||
PNG image files. Likewise the :doc:`dump movie <dump_image>` command
|
||||
outputs movie files in MPEG format. Using these options requires the
|
||||
following settings:
|
||||
outputs movie files in a variety of movie formats. Using these options
|
||||
requires the following settings:
|
||||
|
||||
.. tabs::
|
||||
|
||||
@ -297,15 +297,15 @@ following settings:
|
||||
.. code-block:: bash
|
||||
|
||||
-D WITH_JPEG=value # yes or no
|
||||
# default = yes if CMake finds JPEG files, else no
|
||||
# default = yes
|
||||
-D WITH_PNG=value # yes or no
|
||||
# default = yes if CMake finds PNG and ZLIB files, else no
|
||||
# default = yes
|
||||
-D WITH_FFMPEG=value # yes or no
|
||||
# default = yes if CMake can find ffmpeg, else no
|
||||
|
||||
Usually these settings are all that is needed. If CMake cannot
|
||||
find the graphics header, library, executable files, you can set
|
||||
these variables:
|
||||
Usually these settings are all that is needed. If those libraries
|
||||
or executables are installed but CMake cannot find the graphics header,
|
||||
library, or executable files, you can set these variables accordingly:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -317,6 +317,9 @@ following settings:
|
||||
-D ZLIB_LIBRARY=path # path to libz.a (.so) file
|
||||
-D FFMPEG_EXECUTABLE=path # path to ffmpeg executable
|
||||
|
||||
Otherwise, CMake will attempt to download, build, and link with
|
||||
jpeg, png, and zlib libraries statically from source code.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
.. code-block:: make
|
||||
@ -328,11 +331,12 @@ following settings:
|
||||
JPG_LIB = -ljpeg -lpng -lz # library names
|
||||
|
||||
As with CMake, you do not need to set ``JPG_INC`` or ``JPG_PATH``,
|
||||
if make can find the graphics header and library files. You must
|
||||
specify ``JPG_LIB`` with a list of graphics libraries to include
|
||||
in the link. You must insure ffmpeg is in a directory where
|
||||
LAMMPS can find it at runtime, that is a directory in your PATH
|
||||
environment variable.
|
||||
if make can find the graphics header and library files in their
|
||||
default system locations. You must specify ``JPG_LIB`` with a
|
||||
list of graphics libraries to include in the link. You must make
|
||||
certain that the ffmpeg executable (or ffmpeg.exe on Windows) is
|
||||
in a directory where LAMMPS can find it at runtime; that is
|
||||
usually a directory list in your ``PATH`` environment variable.
|
||||
|
||||
Using ``ffmpeg`` to output movie files requires that your machine
|
||||
supports the "popen" function in the standard runtime library.
|
||||
|
||||
@ -5,6 +5,7 @@ Notes for building LAMMPS on Windows
|
||||
* :ref:`Running Linux on Windows <linux>`
|
||||
* :ref:`Using GNU GCC ported to Windows <gnu>`
|
||||
* :ref:`Using Visual Studio <msvc>`
|
||||
* :ref:`Using Intel oneAPI compilers and libraries <oneapi>`
|
||||
* :ref:`Using a cross-compiler <cross>`
|
||||
|
||||
----------
|
||||
@ -25,8 +26,10 @@ assistance in resolving portability issues. This is particularly true
|
||||
for compiling LAMMPS on Windows, since this platform has significant
|
||||
differences in some low-level functionality. As of LAMMPS version 14
|
||||
December 2021, large parts of LAMMPS can be compiled natively with the
|
||||
Microsoft Visual C++ Compilers. This is largely facilitated by using
|
||||
the :doc:`Developer_platform` in the ``platform`` namespace.
|
||||
Microsoft Visual C++ Compilers. As of LAMMPS version 31 May 2022, also
|
||||
the Intel oneAPI compilers can compile large parts of LAMMPS natively on
|
||||
Windows. This is mostly facilitated by using the
|
||||
:doc:`Developer_platform` in the ``platform`` namespace and CMake.
|
||||
|
||||
Before trying to build LAMMPS on Windows yourself, please consider the
|
||||
`pre-compiled Windows installer packages <https://packages.lammps.org/windows.html>`_
|
||||
@ -99,6 +102,10 @@ It is possible to use both the integrated CMake support of the Visual
|
||||
Studio IDE or use an external CMake installation (e.g. downloaded from
|
||||
cmake.org) to create build files and compile LAMMPS from the command line.
|
||||
|
||||
Compilation via command line and unit tests are checked automatically
|
||||
for the LAMMPS development branch through
|
||||
`GitHub Actions <https://github.com/lammps/lammps/actions/workflows/compile-msvc.yml>`_.
|
||||
|
||||
.. note::
|
||||
|
||||
Versions of Visual Studio before version 17.1 may scan the entire
|
||||
@ -111,6 +118,10 @@ Please note, that for either approach CMake will create a so-called
|
||||
the command lines for building and testing LAMMPS must be adjusted
|
||||
accordingly.
|
||||
|
||||
The LAMMPS cmake folder contains a ``CMakeSettings.json`` file with
|
||||
build configurations for MSVC compilers and the MS provided Clang
|
||||
compiler package in Debug and Release mode.
|
||||
|
||||
To support running in parallel you can compile with OpenMP enabled using
|
||||
the OPENMP package or install Microsoft MPI (including the SDK) and compile
|
||||
LAMMPS with MPI enabled.
|
||||
@ -121,6 +132,53 @@ LAMMPS with MPI enabled.
|
||||
via GitHub or the `LAMMPS forum at MatSci <https://matsci.org/c/lammps/lammps-development/>`_,
|
||||
if you have questions or LAMMPS specific problems.
|
||||
|
||||
.. _oneapi:
|
||||
|
||||
Using Intel oneAPI Compilers and Libraries
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 31May2022
|
||||
|
||||
After installing the `Intel oneAPI
|
||||
<https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html>`_
|
||||
base toolkit and the HPC toolkit, it is also possible to compile large
|
||||
parts of LAMMPS natively on Windows using Intel compilers. The HPC
|
||||
toolkit provides two sets of C/C++ and Fortran compilers: the so-called
|
||||
"classic" compilers (``icl.exe`` and ``ifort.exe``) and newer, LLVM
|
||||
based compilers (``icx.exe`` and ``ifx.exe``). In addition to the
|
||||
compilers and their dependent modules, also the thread building blocks
|
||||
(TBB) and the math kernel library (MKL) need to be installed. Two
|
||||
presets (``cmake/presets/windows-intel-llvm.cmake`` and
|
||||
``cmake/presets/windows-intel-classic.cmake``) are provided for
|
||||
selecting the LLVM based or classic compilers, respectively. The preset
|
||||
``cmake/presets/windows.cmake`` enables compatible packages that are not
|
||||
dependent on additional features or libraries. You **must** use the
|
||||
CMake based build procedure and use Ninja as build tool. For compiling
|
||||
from the command prompt, thus both `CMake <https://cmake.org>`_ and
|
||||
`Ninja-build <https://ninja-build.org>`_ binaries must be installed. It
|
||||
is also possible to use Visual Studio, if it is started (``devenv.exe``)
|
||||
from a command prompt that has the Intel oneAPI compilers enabled. The
|
||||
Visual Studio settings file in the ``cmake`` folder contains
|
||||
configurations for both compiler variants in debug and release settings.
|
||||
Those will use the CMake and Ninja binaries bundled with Visual Studio,
|
||||
thus a separate installation is not required.
|
||||
|
||||
.. admonition:: Known Limitations
|
||||
:class: note
|
||||
|
||||
In addition to portability issues with several packages and external
|
||||
libraries, the classic Intel compilers are currently not able to
|
||||
compile the googletest libraries and thus enabling the ``-DENABLE_TESTING``
|
||||
option will result in compilation failure. The LLVM based compilers
|
||||
are compatible.
|
||||
|
||||
.. note::
|
||||
|
||||
This is work in progress and you should contact the LAMMPS developers
|
||||
via GitHub or the `LAMMPS forum at MatSci <https://matsci.org/c/lammps/lammps-development/>`_,
|
||||
if you have questions or LAMMPS specific problems.
|
||||
|
||||
|
||||
.. _cross:
|
||||
|
||||
Using a cross-compiler
|
||||
@ -145,14 +203,3 @@ LAMMPS developers. We instead rely on the feedback of the users
|
||||
of these pre-compiled LAMMPS packages for Windows. We will try to resolve
|
||||
issues to the best of our abilities if we become aware of them. However
|
||||
this is subject to time constraints and focus on HPC platforms.
|
||||
|
||||
.. _native:
|
||||
|
||||
Native Visual C++ support
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Support for the Visual C++ compilers is currently not available. The
|
||||
CMake build system is capable of creating suitable a Visual Studio
|
||||
style build environment, but the LAMMPS source code itself is not
|
||||
ported to fully support Visual C++. Volunteers to take on this task
|
||||
are welcome.
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
General commands
|
||||
================
|
||||
|
||||
An alphabetic list of all general LAMMPS commands.
|
||||
An alphabetic list of general LAMMPS commands.
|
||||
|
||||
.. table_from_list::
|
||||
:columns: 5
|
||||
@ -47,35 +47,26 @@ An alphabetic list of all general LAMMPS commands.
|
||||
* :doc:`displace_atoms <displace_atoms>`
|
||||
* :doc:`dump <dump>`
|
||||
* :doc:`dump_modify <dump_modify>`
|
||||
* :doc:`dynamical_matrix (k) <dynamical_matrix>`
|
||||
* :doc:`echo <echo>`
|
||||
* :doc:`fix <fix>`
|
||||
* :doc:`fix_modify <fix_modify>`
|
||||
* :doc:`group <group>`
|
||||
* :doc:`group2ndx <group2ndx>`
|
||||
* :doc:`hyper <hyper>`
|
||||
* :doc:`if <if>`
|
||||
* :doc:`improper_coeff <improper_coeff>`
|
||||
* :doc:`improper_style <improper_style>`
|
||||
* :doc:`include <include>`
|
||||
* :doc:`info <info>`
|
||||
* :doc:`jump <jump>`
|
||||
* :doc:`kim <kim_commands>`
|
||||
* :doc:`kspace_modify <kspace_modify>`
|
||||
* :doc:`kspace_style <kspace_style>`
|
||||
* :doc:`label <label>`
|
||||
* :doc:`lattice <lattice>`
|
||||
* :doc:`log <log>`
|
||||
* :doc:`mass <mass>`
|
||||
* :doc:`mdi <mdi>`
|
||||
* :doc:`minimize <minimize>`
|
||||
* :doc:`min_modify <min_modify>`
|
||||
* :doc:`min_style <min_style>`
|
||||
* :doc:`min_style spin <min_spin>`
|
||||
* :doc:`molecule <molecule>`
|
||||
* :doc:`ndx2group <group2ndx>`
|
||||
* :doc:`neb <neb>`
|
||||
* :doc:`neb/spin <neb_spin>`
|
||||
* :doc:`neigh_modify <neigh_modify>`
|
||||
* :doc:`neighbor <neighbor>`
|
||||
* :doc:`newton <newton>`
|
||||
@ -86,11 +77,8 @@ An alphabetic list of all general LAMMPS commands.
|
||||
* :doc:`pair_style <pair_style>`
|
||||
* :doc:`pair_write <pair_write>`
|
||||
* :doc:`partition <partition>`
|
||||
* :doc:`plugin <plugin>`
|
||||
* :doc:`prd <prd>`
|
||||
* :doc:`print <print>`
|
||||
* :doc:`processors <processors>`
|
||||
* :doc:`python <python>`
|
||||
* :doc:`quit <quit>`
|
||||
* :doc:`read_data <read_data>`
|
||||
* :doc:`read_dump <read_dump>`
|
||||
@ -108,14 +96,9 @@ An alphabetic list of all general LAMMPS commands.
|
||||
* :doc:`shell <shell>`
|
||||
* :doc:`special_bonds <special_bonds>`
|
||||
* :doc:`suffix <suffix>`
|
||||
* :doc:`tad <tad>`
|
||||
* :doc:`temper <temper>`
|
||||
* :doc:`temper/grem <temper_grem>`
|
||||
* :doc:`temper/npt <temper_npt>`
|
||||
* :doc:`thermo <thermo>`
|
||||
* :doc:`thermo_modify <thermo_modify>`
|
||||
* :doc:`thermo_style <thermo_style>`
|
||||
* :doc:`third_order (k) <third_order>`
|
||||
* :doc:`timer <timer>`
|
||||
* :doc:`timestep <timestep>`
|
||||
* :doc:`uncompute <uncompute>`
|
||||
@ -128,3 +111,27 @@ An alphabetic list of all general LAMMPS commands.
|
||||
* :doc:`write_data <write_data>`
|
||||
* :doc:`write_dump <write_dump>`
|
||||
* :doc:`write_restart <write_restart>`
|
||||
|
||||
Additional general LAMMPS commands provided by packages. A few
|
||||
commands have accelerated versions. This is indicated by an
|
||||
additional letter in parenthesis: k = KOKKOS.
|
||||
|
||||
.. table_from_list::
|
||||
:columns: 5
|
||||
|
||||
* :doc:`dynamical_matrix (k) <dynamical_matrix>`
|
||||
* :doc:`group2ndx <group2ndx>`
|
||||
* :doc:`hyper <hyper>`
|
||||
* :doc:`kim <kim_commands>`
|
||||
* :doc:`mdi <mdi>`
|
||||
* :doc:`ndx2group <group2ndx>`
|
||||
* :doc:`neb <neb>`
|
||||
* :doc:`neb/spin <neb_spin>`
|
||||
* :doc:`plugin <plugin>`
|
||||
* :doc:`prd <prd>`
|
||||
* :doc:`python <python>`
|
||||
* :doc:`tad <tad>`
|
||||
* :doc:`temper <temper>`
|
||||
* :doc:`temper/grem <temper_grem>`
|
||||
* :doc:`temper/npt <temper_npt>`
|
||||
* :doc:`third_order (k) <third_order>`
|
||||
|
||||
@ -89,7 +89,7 @@ OPT.
|
||||
* :doc:`dipole (o) <angle_dipole>`
|
||||
* :doc:`fourier (o) <angle_fourier>`
|
||||
* :doc:`fourier/simple (o) <angle_fourier_simple>`
|
||||
* :doc:`gaussian <angle_gaussian>` - multicentered Gaussian-based angle potential
|
||||
* :doc:`gaussian <angle_gaussian>`
|
||||
* :doc:`harmonic (iko) <angle_harmonic>`
|
||||
* :doc:`mm3 <angle_mm3>`
|
||||
* :doc:`quartic (o) <angle_quartic>`
|
||||
|
||||
@ -33,6 +33,7 @@ KOKKOS, o = OPENMP, t = OPT.
|
||||
* :doc:`body/local <compute_body_local>`
|
||||
* :doc:`bond <compute_bond>`
|
||||
* :doc:`bond/local <compute_bond_local>`
|
||||
* :doc:`born/matrix <compute_born_matrix>`
|
||||
* :doc:`centro/atom <compute_centro_atom>`
|
||||
* :doc:`centroid/stress/atom <compute_stress_atom>`
|
||||
* :doc:`chunk/atom <compute_chunk_atom>`
|
||||
|
||||
@ -68,6 +68,9 @@ OPT.
|
||||
* :doc:`edpd/source <fix_dpd_source>`
|
||||
* :doc:`efield <fix_efield>`
|
||||
* :doc:`ehex <fix_ehex>`
|
||||
* :doc:`electrode/conp (i) <fix_electrode_conp>`
|
||||
* :doc:`electrode/conq (i) <fix_electrode_conp>`
|
||||
* :doc:`electrode/thermo (i) <fix_electrode_conp>`
|
||||
* :doc:`electron/stopping <fix_electron_stopping>`
|
||||
* :doc:`electron/stopping/fit <fix_electron_stopping>`
|
||||
* :doc:`enforce2d (k) <fix_enforce2d>`
|
||||
|
||||
@ -27,6 +27,7 @@ OPT.
|
||||
* :doc:`ewald/disp/dipole <kspace_style>`
|
||||
* :doc:`ewald/dipole <kspace_style>`
|
||||
* :doc:`ewald/dipole/spin <kspace_style>`
|
||||
* :doc:`ewald/electrode <kspace_style>`
|
||||
* :doc:`msm (o) <kspace_style>`
|
||||
* :doc:`msm/cg (o) <kspace_style>`
|
||||
* :doc:`msm/dielectric <kspace_style>`
|
||||
@ -41,4 +42,5 @@ OPT.
|
||||
* :doc:`pppm/stagger <kspace_style>`
|
||||
* :doc:`pppm/tip4p (o) <kspace_style>`
|
||||
* :doc:`pppm/dielectric <kspace_style>`
|
||||
* :doc:`pppm/electrode (i) <kspace_style>`
|
||||
* :doc:`scafacos <kspace_style>`
|
||||
|
||||
@ -34,7 +34,7 @@ OPT.
|
||||
*
|
||||
*
|
||||
*
|
||||
* :doc:`adp (o) <pair_adp>`
|
||||
* :doc:`adp (ko) <pair_adp>`
|
||||
* :doc:`agni (o) <pair_agni>`
|
||||
* :doc:`airebo (io) <pair_airebo>`
|
||||
* :doc:`airebo/morse (io) <pair_airebo>`
|
||||
@ -126,8 +126,8 @@ OPT.
|
||||
* :doc:`hbond/dreiding/morse (o) <pair_hbond_dreiding>`
|
||||
* :doc:`hdnnp <pair_hdnnp>`
|
||||
* :doc:`hippo <pair_amoeba>`
|
||||
* :doc:`ilp/graphene/hbn <pair_ilp_graphene_hbn>`
|
||||
* :doc:`ilp/tmd <pair_ilp_tmd>`
|
||||
* :doc:`ilp/graphene/hbn (t) <pair_ilp_graphene_hbn>`
|
||||
* :doc:`ilp/tmd (t) <pair_ilp_tmd>`
|
||||
* :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>`
|
||||
* :doc:`kolmogorov/crespi/z <pair_kolmogorov_crespi_z>`
|
||||
* :doc:`lcbop <pair_lcbop>`
|
||||
@ -233,7 +233,7 @@ OPT.
|
||||
* :doc:`oxrna2/stk <pair_oxrna2>`
|
||||
* :doc:`oxrna2/xstk <pair_oxrna2>`
|
||||
* :doc:`oxrna2/coaxstk <pair_oxrna2>`
|
||||
* :doc:`pace <pair_pace>`
|
||||
* :doc:`pace (k) <pair_pace>`
|
||||
* :doc:`peri/eps <pair_peri>`
|
||||
* :doc:`peri/lps (o) <pair_peri>`
|
||||
* :doc:`peri/pmb (o) <pair_peri>`
|
||||
@ -245,8 +245,10 @@ OPT.
|
||||
* :doc:`reaxff (ko) <pair_reaxff>`
|
||||
* :doc:`rebo (io) <pair_airebo>`
|
||||
* :doc:`resquared (go) <pair_resquared>`
|
||||
* :doc:`saip/metal <pair_saip_metal>`
|
||||
* :doc:`saip/metal (t) <pair_saip_metal>`
|
||||
* :doc:`sdpd/taitwater/isothermal <pair_sdpd_taitwater_isothermal>`
|
||||
* :doc:`smatb <pair_smatb>`
|
||||
* :doc:`smatb/single <pair_smatb>`
|
||||
* :doc:`smd/hertz <pair_smd_hertz>`
|
||||
* :doc:`smd/tlsph <pair_smd_tlsph>`
|
||||
* :doc:`smd/tri_surface <pair_smd_triangulated_surface>`
|
||||
|
||||
@ -77,18 +77,19 @@ LAMMPS:
|
||||
so that you do not have to define (or discard) a temporary variable,
|
||||
"X" in this case.
|
||||
|
||||
Additionally, the "immediate" variable expression may be followed by
|
||||
a colon, followed by a C-style format string, e.g. ":%f" or ":%.10g".
|
||||
The format string must be appropriate for a double-precision
|
||||
floating-point value. The format string is used to output the result
|
||||
of the variable expression evaluation. If a format string is not
|
||||
specified a high-precision "%.20g" is used as the default.
|
||||
Additionally, the entire "immediate" variable expression may be
|
||||
followed by a colon, followed by a C-style format string,
|
||||
e.g. ":%f" or ":%.10g". The format string must be appropriate for
|
||||
a double-precision floating-point value. The format string is used
|
||||
to output the result of the variable expression evaluation. If a
|
||||
format string is not specified, a high-precision "%.20g" is used as
|
||||
the default format.
|
||||
|
||||
This can be useful for formatting print output to a desired precision:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
print "Final energy per atom: $(pe/atoms:%10.3f) eV/atom"
|
||||
print "Final energy per atom: $(v_ke_per_atom+v_pe_per_atom:%10.3f) eV/atom"
|
||||
|
||||
Note that neither the curly-bracket or immediate form of variables
|
||||
can contain nested $ characters for other variables to substitute
|
||||
|
||||
@ -211,6 +211,12 @@ Convenience functions
|
||||
.. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg)
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: errorurl
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: missing_cmd_args
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: flush_buffers(LAMMPS *lmp)
|
||||
:project: progguide
|
||||
|
||||
@ -240,6 +246,44 @@ Customized standard functions
|
||||
|
||||
---------------------------
|
||||
|
||||
Special Math functions
|
||||
----------------------
|
||||
|
||||
The ``MathSpecial`` namespace implements a selection of custom and optimized
|
||||
mathematical functions for a variety of applications.
|
||||
|
||||
.. doxygenfunction:: factorial
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: exp2_x86
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: fm_exp
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: my_erfcx
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: expmsq
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: square
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: cube
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: powsign
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: powint
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: powsinxx
|
||||
:project: progguide
|
||||
|
||||
---------------------------
|
||||
|
||||
Tokenizer classes
|
||||
-----------------
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ them.
|
||||
:maxdepth: 1
|
||||
|
||||
Errors_common
|
||||
Errors_details
|
||||
Errors_bugs
|
||||
Errors_debug
|
||||
Errors_messages
|
||||
|
||||
27
doc/src/Errors_details.rst
Normal file
27
doc/src/Errors_details.rst
Normal file
@ -0,0 +1,27 @@
|
||||
Error and warning details
|
||||
=========================
|
||||
|
||||
Many errors or warnings are self-explanatory and thus straightforward to
|
||||
resolve. However, there are also cases, where there is no single cause
|
||||
and explanation, where LAMMPS can only detect symptoms of an error but
|
||||
not the exact cause, or where the explanation needs to be more detailed than
|
||||
what can be fit into a message printed by the program. The following are
|
||||
discussions of such cases.
|
||||
|
||||
.. _err0001:
|
||||
|
||||
Unknown identifier in data file
|
||||
-------------------------------
|
||||
|
||||
This error happens when LAMMPS encounters a line of text in an unexpected format
|
||||
while reading a data file. This is most commonly cause by inconsistent header and
|
||||
section data. The header section informs LAMMPS how many entries or lines are expected in the
|
||||
various sections (like Atoms, Masses, Pair Coeffs, *etc.*\ ) of the data file.
|
||||
If there is a mismatch, LAMMPS will either keep reading beyond the end of a section
|
||||
or stop reading before the section has ended.
|
||||
|
||||
Such a mismatch can happen unexpectedly when the first line of the data
|
||||
is *not* a comment as required by the format. That would result in
|
||||
LAMMPS expecting, for instance, 0 atoms because the "atoms" header line
|
||||
is treated as a comment.
|
||||
|
||||
@ -239,7 +239,7 @@ is consistent with the 6 moments of inertia: ixx iyy izz ixy ixz iyz =
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
3 1 27
|
||||
3 1 19
|
||||
4
|
||||
1 1 4 0 0 0
|
||||
-0.7071 -0.7071 0
|
||||
|
||||
@ -3,7 +3,6 @@ Bonded particle models
|
||||
|
||||
The BPM package implements bonded particle models which can be used to
|
||||
simulate mesoscale solids. Solids are constructed as a collection of
|
||||
|
||||
particles which each represent a coarse-grained region of space much
|
||||
larger than the atomistic scale. Particles within a solid region are
|
||||
then connected by a network of bonds to provide solid elasticity.
|
||||
@ -47,33 +46,29 @@ this, LAMMPS requires :doc:`newton <newton>` bond off such that all
|
||||
processors containing an atom know when a bond breaks. Additionally,
|
||||
one must do either (A) or (B).
|
||||
|
||||
(A)
|
||||
A) Use the following special bond settings
|
||||
|
||||
Use the following special bond settings
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
special_bonds lj 0 1 1 coul 1 1 1
|
||||
|
||||
special_bonds lj 0 1 1 coul 1 1 1
|
||||
These settings accomplish two goals. First, they turn off 1-3 and 1-4
|
||||
special bond lists, which are not currently supported for BPMs. As
|
||||
BPMs often have dense bond networks, generating 1-3 and 1-4 special
|
||||
bond lists is expensive. By setting the lj weight for 1-2 bonds to
|
||||
zero, this turns off pairwise interactions. Even though there are no
|
||||
charges in BPM models, setting a nonzero coul weight for 1-2 bonds
|
||||
ensures all bonded neighbors are still included in the neighbor list
|
||||
in case bonds break between neighbor list builds.
|
||||
|
||||
These settings accomplish two goals. First, they turn off 1-3 and 1-4
|
||||
special bond lists, which are not currently supported for BPMs. As
|
||||
BPMs often have dense bond networks, generating 1-3 and 1-4 special
|
||||
bond lists is expensive. By setting the lj weight for 1-2 bonds to
|
||||
zero, this turns off pairwise interactions. Even though there are no
|
||||
charges in BPM models, setting a nonzero coul weight for 1-2 bonds
|
||||
ensures all bonded neighbors are still included in the neighbor list
|
||||
in case bonds break between neighbor list builds.
|
||||
B) Alternatively, one can simply overlay pair interactions such that all
|
||||
bonded particles also feel pair interactions. This can be
|
||||
accomplished by using the *overlay/pair* keyword present in all bpm
|
||||
bond styles and by using the following special bond settings
|
||||
|
||||
(B)
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
Alternatively, one can simply overlay pair interactions such that all
|
||||
bonded particles also feel pair interactions. This can be accomplished
|
||||
by using the *overlay/pair* keyword present in all bpm bond styles and
|
||||
by using the following special bond settings
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
special_bonds lj/coul 1 1 1
|
||||
special_bonds lj/coul 1 1 1
|
||||
|
||||
See the :doc:`Howto <Howto_broken_bonds>` page on broken bonds for
|
||||
more information.
|
||||
|
||||
@ -18,23 +18,52 @@ At zero temperature, it is easy to estimate these derivatives by
|
||||
deforming the simulation box in one of the six directions using the
|
||||
:doc:`change_box <change_box>` command and measuring the change in the
|
||||
stress tensor. A general-purpose script that does this is given in the
|
||||
examples/elastic directory described on the :doc:`Examples <Examples>`
|
||||
examples/ELASTIC directory described on the :doc:`Examples <Examples>`
|
||||
doc page.
|
||||
|
||||
Calculating elastic constants at finite temperature is more
|
||||
challenging, because it is necessary to run a simulation that performs
|
||||
time averages of differential properties. One way to do this is to
|
||||
measure the change in average stress tensor in an NVT simulations when
|
||||
time averages of differential properties. There are at least
|
||||
3 ways to do this in LAMMPS. The most reliable way to do this is
|
||||
by exploiting the relationship between elastic constants, stress
|
||||
fluctuations, and the Born matrix, the second derivatives of energy
|
||||
w.r.t. strain :ref:`(Ray) <Ray>`.
|
||||
The Born matrix calculation has been enabled by
|
||||
the :doc:`compute born/matrix <compute_born_matrix>` command,
|
||||
which works for any bonded or non-bonded potential in LAMMPS.
|
||||
The most expensive part of the calculation is the sampling of
|
||||
the stress fluctuations. Several examples of this method are
|
||||
provided in the examples/ELASTIC_T/BORN_MATRIX directory
|
||||
described on the :doc:`Examples <Examples>` doc page.
|
||||
|
||||
A second way is to measure
|
||||
the change in average stress tensor in an NVT simulations when
|
||||
the cell volume undergoes a finite deformation. In order to balance
|
||||
the systematic and statistical errors in this method, the magnitude of
|
||||
the deformation must be chosen judiciously, and care must be taken to
|
||||
fully equilibrate the deformed cell before sampling the stress
|
||||
tensor. Another approach is to sample the triclinic cell fluctuations
|
||||
tensor. An example of this method is provided in the
|
||||
examples/ELASTIC_T/DEFORMATION directory
|
||||
described on the :doc:`Examples <Examples>` doc page.
|
||||
|
||||
Another approach is to sample the triclinic cell fluctuations
|
||||
that occur in an NPT simulation. This method can also be slow to
|
||||
converge and requires careful post-processing :ref:`(Shinoda) <Shinoda1>`
|
||||
converge and requires careful post-processing :ref:`(Shinoda) <Shinoda1>`.
|
||||
We do not provide an example of this method.
|
||||
|
||||
A nice review of the advantages and disadvantages of all of these methods
|
||||
is provided in the paper by Clavier et al. :ref:`(Clavier) <Clavier>`.
|
||||
|
||||
----------
|
||||
|
||||
.. _Ray:
|
||||
|
||||
**(Ray)** J. R. Ray and A. Rahman, J Chem Phys, 80, 4423 (1984).
|
||||
|
||||
.. _Shinoda1:
|
||||
|
||||
**(Shinoda)** Shinoda, Shiga, and Mikami, Phys Rev B, 69, 134103 (2004).
|
||||
|
||||
.. _Clavier:
|
||||
|
||||
**(Clavier)** G. Clavier, N. Desbiens, E. Bourasseau, V. Lachet, N. Brusselle-Dupend and B. Rousseau, Mol Sim, 43, 1413 (2017).
|
||||
|
||||
@ -19,7 +19,7 @@ atoms and the water molecule to run a rigid SPC model.
|
||||
| LJ :math:`\sigma` of OO = 3.166
|
||||
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0
|
||||
| :math:`r_0` of OH bond = 1.0
|
||||
| :math:`\theta` of HOH angle = 109.47\ :math:`^{\circ}`
|
||||
| :math:`\theta_0` of HOH angle = 109.47\ :math:`^{\circ}`
|
||||
|
|
||||
|
||||
Note that as originally proposed, the SPC model was run with a 9
|
||||
|
||||
@ -55,6 +55,9 @@ JSON
|
||||
YAML format thermo_style output
|
||||
===============================
|
||||
|
||||
Extracting data from log file
|
||||
-----------------------------
|
||||
|
||||
.. versionadded:: 24Mar2022
|
||||
|
||||
LAMMPS supports the thermo style "yaml" and for "custom" style
|
||||
@ -66,7 +69,7 @@ the following style:
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
keywords: [Step, Temp, E_pair, E_mol, TotEng, Press, ]
|
||||
keywords: ['Step', 'Temp', 'E_pair', 'E_mol', 'TotEng', 'Press', ]
|
||||
data:
|
||||
- [100, 0.757453103239935, -5.7585054860159, 0, -4.62236133677021, 0.207261053624721, ]
|
||||
- [110, 0.759322359337036, -5.7614668389562, 0, -4.62251889318624, 0.194314975399602, ]
|
||||
@ -80,9 +83,9 @@ This data can be extracted and parsed from a log file using python with:
|
||||
|
||||
import re, yaml
|
||||
try:
|
||||
from yaml import CSafeLoader as Loader, CSafeDumper as Dumper
|
||||
from yaml import CSafeLoader as Loader
|
||||
except ImportError:
|
||||
from yaml import SafeLoader as Loader, SafeDumper as Dumper
|
||||
from yaml import SafeLoader as Loader
|
||||
|
||||
docs = ""
|
||||
with open("log.lammps") as f:
|
||||
@ -109,6 +112,135 @@ of that run:
|
||||
Number of runs: 2
|
||||
TotEng = -4.62140097780047
|
||||
|
||||
.. versionadded:: 4May2022
|
||||
|
||||
YAML format output has been added to multiple commands in LAMMPS,
|
||||
for example :doc:`dump yaml <dump>` or :doc:`fix ave/time <fix_ave_time>`
|
||||
Depending on the kind of data being written, organization of the data
|
||||
or the specific syntax used may change, but the principles are very
|
||||
similar and all files should be readable with a suitable YAML parser.
|
||||
|
||||
Processing scalar data with Python
|
||||
----------------------------------
|
||||
|
||||
.. figure:: JPG/thermo_bondeng.png
|
||||
:figwidth: 33%
|
||||
:align: right
|
||||
|
||||
After reading and parsing the YAML format data, it can be easily
|
||||
imported for further processing and visualization with the `pandas
|
||||
<https://pandas.pydata.org/>`_ and `matplotlib
|
||||
<https://matplotlib.org/>`_ Python modules. Because of the organization
|
||||
of the data in the YAML format thermo output, it needs to be told to
|
||||
process only the 'data' part of the imported data to create a pandas
|
||||
data frame, and one needs to set the column names from the 'keywords'
|
||||
entry. The following Python script code example demonstrates this, and
|
||||
creates the image shown on the right of a simple plot of various bonded
|
||||
energy contributions versus the timestep from a run of the 'peptide'
|
||||
example input after changing the :doc:`thermo style <thermo_style>` to
|
||||
'yaml'. The properties to be used for x and y values can be
|
||||
conveniently selected through the keywords. Please note that those
|
||||
keywords can be changed to custom strings with the :doc:`thermo_modify
|
||||
colname <thermo_modify>` command.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import re, yaml
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
try:
|
||||
from yaml import CSafeLoader as Loader
|
||||
except ImportError:
|
||||
from yaml import SafeLoader as Loader
|
||||
|
||||
docs = ""
|
||||
with open("log.lammps") as f:
|
||||
for line in f:
|
||||
m = re.search(r"^(keywords:.*$|data:$|---$|\.\.\.$| - \[.*\]$)", line)
|
||||
if m: docs += m.group(0) + '\n'
|
||||
|
||||
thermo = list(yaml.load_all(docs, Loader=Loader))
|
||||
|
||||
df = pd.DataFrame(data=thermo[0]['data'], columns=thermo[0]['keywords'])
|
||||
fig = df.plot(x='Step', y=['E_bond', 'E_angle', 'E_dihed', 'E_impro'], ylabel='Energy in kcal/mol')
|
||||
plt.savefig('thermo_bondeng.png')
|
||||
|
||||
Processing vector data with Python
|
||||
----------------------------------
|
||||
|
||||
Global *vector* data as produced by :doc:`fix ave/time <fix_ave_time>`
|
||||
uses a slightly different organization of the data. You still have the
|
||||
dictionary keys 'keywords' and 'data' for the column headers and the
|
||||
data. But the data is a dictionary indexed by the time step and for
|
||||
each step there are multiple rows of values each with a list of the
|
||||
averaged properties. This requires a slightly different processing,
|
||||
since the entire data cannot be directly imported into a single pandas
|
||||
DataFrame class instance. The following Python script example
|
||||
demonstrates how to read such data. The result will combine the data
|
||||
for the different steps into one large "multi-index" table. The pandas
|
||||
IndexSlice class can then be used to select data from this combined data
|
||||
frame.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import re, yaml
|
||||
import pandas as pd
|
||||
|
||||
try:
|
||||
from yaml import CSafeLoader as Loader
|
||||
except ImportError:
|
||||
from yaml import SafeLoader as Loader
|
||||
|
||||
with open("ave.yaml") as f:
|
||||
ave = yaml.load(docs, Loader=Loader)
|
||||
|
||||
keys = ave['keywords']
|
||||
df = {}
|
||||
for k in ave['data'].keys():
|
||||
df[k] = pd.DataFrame(data=ave['data'][k], columns=keys)
|
||||
|
||||
# create multi-index data frame
|
||||
df = pd.concat(df)
|
||||
|
||||
# output only the first 3 value for steps 200 to 300 of the column Pressure
|
||||
idx = pd.IndexSlice
|
||||
print(df['Pressure'].loc[idx[200:300, 0:2]])
|
||||
|
||||
|
||||
Processing scalar data with Perl
|
||||
--------------------------------
|
||||
|
||||
The ease of processing YAML data is not limited to Python. Here is an
|
||||
example for extracting and processing a LAMMPS log file with Perl instead.
|
||||
|
||||
.. code-block:: perl
|
||||
|
||||
use YAML::XS;
|
||||
|
||||
open(LOG, "log.lammps") or die("could not open log.lammps: $!");
|
||||
my $file = "";
|
||||
while(my $line = <LOG>) {
|
||||
if ($line =~ /^(keywords:.*$|data:$|---$|\.\.\.$| - \[.*\]$)/) {
|
||||
$file .= $line;
|
||||
}
|
||||
}
|
||||
close(LOG);
|
||||
|
||||
# convert YAML to perl as nested hash and array references
|
||||
my $thermo = Load $file;
|
||||
|
||||
# convert references to real arrays
|
||||
my @keywords = @{$thermo->{'keywords'}};
|
||||
my @data = @{$thermo->{'data'}};
|
||||
|
||||
# print first two columns
|
||||
print("$keywords[0] $keywords[1]\n");
|
||||
foreach (@data) {
|
||||
print("${$_}[0] ${$_}[1]\n");
|
||||
}
|
||||
|
||||
|
||||
Writing continuous data during a simulation
|
||||
===========================================
|
||||
|
||||
|
||||
BIN
doc/src/JPG/thermo_bondeng.png
Normal file
BIN
doc/src/JPG/thermo_bondeng.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
@ -9,34 +9,34 @@ A new atom style can be created if one of the existing atom styles
|
||||
does not define all the attributes you need to store and communicate
|
||||
with atoms.
|
||||
|
||||
Atom_vec_atomic.cpp is the simplest example of an atom style.
|
||||
The file ``atom_vec_atomic.cpp`` is the simplest example of an atom style.
|
||||
Examining the code for others will make these instructions more clear.
|
||||
|
||||
Note that the :doc:`atom style hybrid <atom_style>` command can be
|
||||
used to define atoms or particles which have the union of properties
|
||||
of individual styles. Also the :doc:`fix property/atom <fix_property_atom>`
|
||||
command can be used to add a single property (e.g. charge
|
||||
or a molecule ID) to a style that does not have it. It can also be
|
||||
used to add custom properties to an atom, with options to communicate
|
||||
them with ghost atoms or read them from a data file. Other LAMMPS
|
||||
commands can access these custom properties, as can new pair, fix,
|
||||
compute styles that are written to work with these properties. For
|
||||
Note that the :doc:`atom style hybrid <atom_style>` command can be used
|
||||
to define atoms or particles which have the union of properties of
|
||||
individual styles. Also the :doc:`fix property/atom
|
||||
<fix_property_atom>` command can be used to add a single property
|
||||
(e.g. charge or a molecule ID) to a style that does not have it. It can
|
||||
also be used to add custom properties to an atom, with options to
|
||||
communicate them with ghost atoms or read them from a data file. Other
|
||||
LAMMPS commands can access these custom properties, as can new pair,
|
||||
fix, compute styles that are written to work with these properties. For
|
||||
example, the :doc:`set <set>` command can be used to set the values of
|
||||
custom per-atom properties from an input script. All of these methods
|
||||
are less work than writing code for a new atom style.
|
||||
are less work than writing and testing(!) code for a new atom style.
|
||||
|
||||
If you follow these directions your new style will automatically work
|
||||
in tandem with others via the :doc:`atom_style hybrid <atom_style>`
|
||||
command.
|
||||
|
||||
The first step is to define a set of strings in the constructor of the
|
||||
new derived class. Each string will have zero or more space-separated
|
||||
variable names which are identical to those used in the atom.h header
|
||||
file for per-atom properties. Note that some represent per-atom
|
||||
The first step is to define a set of string lists in the constructor of
|
||||
the new derived class. Each list will have zero or more comma-separated
|
||||
strings that correspond to the variable names used in the ``atom.h``
|
||||
header file for per-atom properties. Note that some represent per-atom
|
||||
vectors (q, molecule) while other are per-atom arrays (x,v). For all
|
||||
but the last 2 strings you do not need to specify any of
|
||||
but the last two lists you do not need to specify any of
|
||||
(id,type,x,v,f). Those are included automatically as needed in the
|
||||
other strings.
|
||||
other lists.
|
||||
|
||||
.. list-table::
|
||||
|
||||
@ -65,16 +65,16 @@ other strings.
|
||||
* - fields_data_vel
|
||||
- list of properties (in order) in the Velocities section of a data file, as read by :doc:`read_data <read_data>`
|
||||
|
||||
In these strings you can list variable names which LAMMPS already
|
||||
defines (in some other atom style), or you can create new variable
|
||||
names. You should not re-use a LAMMPS variable for something with
|
||||
different meaning in your atom style. If the meaning is related, but
|
||||
interpreted differently by your atom style, then using the same
|
||||
variable name means a user should not use your style and the other
|
||||
style together in a :doc:`atom_style hybrid <atom_style>` command.
|
||||
Because there will only be one value of the variable and different
|
||||
parts of LAMMPS will then likely use it differently. LAMMPS has
|
||||
no way of checking for this.
|
||||
In these lists you can list variable names which LAMMPS already defines
|
||||
(in some other atom style), or you can create new variable names. You
|
||||
should not re-use a LAMMPS variable in your atom style that is used for
|
||||
something with a different meaning in another atom style. If the
|
||||
meaning is related, but interpreted differently by your atom style, then
|
||||
using the same variable name means a user must not use your style and
|
||||
the other style together in a :doc:`atom_style hybrid <atom_style>`
|
||||
command. Because there will only be one value of the variable and
|
||||
different parts of LAMMPS will then likely use it differently. LAMMPS
|
||||
has no way of checking for this.
|
||||
|
||||
If you are defining new variable names then make them descriptive and
|
||||
unique to your new atom style. For example choosing "e" for energy is
|
||||
@ -85,32 +85,31 @@ If any of the variable names in your new atom style do not exist in
|
||||
LAMMPS, you need to add them to the src/atom.h and atom.cpp files.
|
||||
|
||||
Search for the word "customize" or "customization" in these 2 files to
|
||||
see where to add your variable. Adding a flag to the 2nd
|
||||
customization section in atom.h is only necessary if your code (e.g. a
|
||||
pair style) needs to check that a per-atom property is defined. These
|
||||
flags should also be set in the constructor of the atom style child
|
||||
class.
|
||||
see where to add your variable. Adding a flag to the 2nd customization
|
||||
section in ``atom.h`` is only necessary if your code (e.g. a pair style)
|
||||
needs to check that a per-atom property is defined. These flags should
|
||||
also be set in the constructor of the atom style child class.
|
||||
|
||||
In atom.cpp, aside from the constructor and destructor, there are 3
|
||||
In ``atom.cpp``, aside from the constructor and destructor, there are 3
|
||||
methods that a new variable name or flag needs to be added to.
|
||||
|
||||
In Atom::peratom_create() when using the add_peratom() method, a
|
||||
final length argument of 0 is for per-atom vectors, a length > 1 is
|
||||
for per-atom arrays. Note the use of an extra per-thread flag and the
|
||||
add_peratom_vary() method when last dimension of the array is
|
||||
In ``Atom::peratom_create()`` when using the ``Atom::add_peratom()``
|
||||
method, a cols argument of 0 is for per-atom vectors, a length >
|
||||
1 is for per-atom arrays. Note the use of the extra per-thread flag and
|
||||
the add_peratom_vary() method when last dimension of the array is
|
||||
variable-length.
|
||||
|
||||
Adding the variable name to Atom::extract() enable the per-atom data
|
||||
Adding the variable name to Atom::extract() enables the per-atom data
|
||||
to be accessed through the :doc:`LAMMPS library interface
|
||||
<Howto_library>` by a calling code, including from :doc:`Python
|
||||
<Python_head>`.
|
||||
|
||||
The constructor of the new atom style will also typically set a few
|
||||
flags which are defined at the top of atom_vec.h. If these are
|
||||
flags which are defined at the top of ``atom_vec.h``. If these are
|
||||
unclear, see how other atom styles use them.
|
||||
|
||||
The grow_pointers() method is also required to make
|
||||
a copy of peratom data pointers, as explained in the code.
|
||||
The grow_pointers() method is also required to make a copy of peratom
|
||||
data pointers, as explained in the code.
|
||||
|
||||
There are a number of other optional methods which your atom style can
|
||||
implement. These are only needed if you need to do something
|
||||
|
||||
@ -223,6 +223,13 @@ and readable by all and no executable permissions. Executable
|
||||
permissions (0755) should only be on shell scripts or python or similar
|
||||
scripts for interpreted script languages.
|
||||
|
||||
You can check for these issues with the python scripts in the
|
||||
:ref:`"tools/coding_standard" <coding_standard>` folder. When run
|
||||
normally with a source file or a source folder as argument, they will
|
||||
list all non-conforming lines. By adding the `-f` flag to the command
|
||||
line, they will modify the flagged files to try removing the detected
|
||||
issues.
|
||||
|
||||
Indentation and Placement of Braces (strongly preferred)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@ -240,6 +247,53 @@ reformatting from clang-format yields undesirable output may be
|
||||
protected with placing a pair `// clang-format off` and `// clang-format
|
||||
on` comments around that block.
|
||||
|
||||
Error or warning messages and explanations (preferred)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 4May2022
|
||||
|
||||
Starting with LAMMPS version 4 May 2022 the LAMMPS developers have
|
||||
agreed on a new policy for error and warning messages.
|
||||
|
||||
Previously, all error and warning strings were supposed to be listed in
|
||||
the class header files with an explanation. Those would then be
|
||||
regularly "harvested" and transferred to alphabetically sorted lists in
|
||||
the manual. To avoid excessively long lists and to reduce effort, this
|
||||
came with a requirement to have rather generic error messages (e.g.
|
||||
"Illegal ... command"). To identify the specific cause, the name of the
|
||||
source file and the line number of the error location would be printed,
|
||||
so that one could look up the cause by reading the source code.
|
||||
|
||||
The new policy encourages more specific error messages that ideally
|
||||
indicate the cause directly and no further lookup would be needed.
|
||||
This is aided by using the `{fmt} library <https://fmt.dev>`_ to convert
|
||||
the Error class commands so that they take a variable number of arguments
|
||||
and error text will be treated like a {fmt} syntax format string.
|
||||
Error messages should still kept to a single line or two lines at the most.
|
||||
|
||||
For more complex explanations or errors that have multiple possible
|
||||
reasons, a paragraph should be added to the `Error_details` page with an
|
||||
error code reference (e.g. ``.. _err0001:``) then the utility function
|
||||
:cpp:func:`utils::errorurl() <LAMMPS_NS::utils::errorurl>` can be used
|
||||
to generate an URL that will directly lead to that paragraph. An error
|
||||
for missing arguments can be easily generated using the
|
||||
:cpp:func:`utils::missing_cmd_args()
|
||||
<LAMMPS_NS::utils::missing_cmd_args>` convenience function.
|
||||
|
||||
The transformation of existing LAMMPS code to this new scheme is ongoing
|
||||
and - given the size of the LAMMPS source code - will take a significant
|
||||
amount of time until completion. However, for new code following the
|
||||
new approach is strongly preferred. The expectation is that the new
|
||||
scheme will make it easier for LAMMPS users, developers, and
|
||||
maintainers.
|
||||
|
||||
An example for this approach would be the
|
||||
``src/read_data.cpp`` and ``src/atom.cpp`` files that implement the
|
||||
:doc:`read_data <read_data>` and :doc:`atom_modify <atom_modify>`
|
||||
commands and that may create :ref:`"Unknown identifier in data file" <err0001>`
|
||||
errors that seem difficult to debug for users because they may have
|
||||
one of multiple possible reasons, and thus require some additional explanations.
|
||||
|
||||
Programming language standards (required)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Binary file not shown.
@ -51,6 +51,7 @@ page gives those details.
|
||||
* :ref:`DPD-SMOOTH <PKG-DPD-SMOOTH>`
|
||||
* :ref:`DRUDE <PKG-DRUDE>`
|
||||
* :ref:`EFF <PKG-EFF>`
|
||||
* :ref:`ELECTRODE <PKG-ELECTRODE>`
|
||||
* :ref:`EXTRA-COMPUTE <PKG-EXTRA-COMPUTE>`
|
||||
* :ref:`EXTRA-DUMP <PKG-EXTRA-DUMP>`
|
||||
* :ref:`EXTRA-FIX <PKG-EXTRA-FIX>`
|
||||
@ -828,6 +829,31 @@ tools/eff; see its README file.
|
||||
|
||||
-------------------
|
||||
|
||||
.. _PKG-ELECTRODE:
|
||||
|
||||
ELECTRODE package
|
||||
-----------------
|
||||
|
||||
**Contents:**
|
||||
|
||||
The ELECTRODE package allows the user to enforce a constant potential method for
|
||||
groups of atoms that interact with the remaining atoms as electrolyte.
|
||||
|
||||
**Authors:** The ELECTRODE library is written and maintained by Ludwig
|
||||
Ahrens-Iwers (TUHH, Hamburg, Germany), Shern Tee (UQ, Brisbane, Australia) and
|
||||
Robert Meissner (TUHH, Hamburg, Germany).
|
||||
|
||||
**Install:**
|
||||
|
||||
This package has :ref:`specific installation instructions <electrode>` on the
|
||||
:doc:`Build extras <Build_extras>` page.
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* :doc:`fix electrode/conp <fix_electrode_conp>`
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-EXTRA-COMPUTE:
|
||||
|
||||
EXTRA-COMPUTE package
|
||||
@ -2597,18 +2623,20 @@ SMTBQ package
|
||||
|
||||
**Contents:**
|
||||
|
||||
A pair style which implements a Second Moment Tight Binding model with
|
||||
QEq charge equilibration (SMTBQ) potential for the description of
|
||||
ionocovalent bonds in oxides.
|
||||
Pair styles which implement Second Moment Tight Binding models.
|
||||
One with QEq charge equilibration (SMTBQ) for the description of
|
||||
ionocovalent bonds in oxides, and two more as plain SMATB models.
|
||||
|
||||
**Authors:** Nicolas Salles, Emile Maras, Olivier Politano, and Robert
|
||||
Tetot (LAAS-CNRS, France).
|
||||
**Authors:** SMTBQ: Nicolas Salles, Emile Maras, Olivier Politano, and Robert
|
||||
Tetot (LAAS-CNRS, France);
|
||||
SMATB: Daniele Rapetti (Politecnico di Torino)
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* src/SMTBQ: filenames -> commands
|
||||
* src/SMTBQ/README
|
||||
* :doc:`pair_style smtbq <pair_smtbq>`
|
||||
* :doc:`pair_style smatb <pair_smatb>`, :doc:`pair_style smatb/single <pair_smatb>`
|
||||
* examples/PACKAGES/smtbq
|
||||
|
||||
----------
|
||||
|
||||
@ -153,6 +153,11 @@ whether an extra library is needed to build and use the package:
|
||||
- :doc:`pair_style eff/cut <pair_eff>`
|
||||
- PACKAGES/eff
|
||||
- no
|
||||
* - :ref:`ELECTRODE <PKG-ELECTRODE>`
|
||||
- electrode charges to match potential
|
||||
- :doc:`fix electrode/conp <fix_electrode_conp>`
|
||||
- PACKAGES/electrode
|
||||
- no
|
||||
* - :ref:`EXTRA-COMPUTE <PKG-EXTRA-COMPUTE>`
|
||||
- additional compute styles
|
||||
- :doc:`compute <compute>`
|
||||
@ -434,8 +439,8 @@ whether an extra library is needed to build and use the package:
|
||||
- n/a
|
||||
- no
|
||||
* - :ref:`SMTBQ <PKG-SMTBQ>`
|
||||
- second moment tight binding potential
|
||||
- :doc:`pair_style smtbq <pair_smtbq>`
|
||||
- second moment tight binding potentials
|
||||
- :doc:`pair_style smtbq <pair_smtbq>` :doc:`pair_style smatb <pair_smatb>`
|
||||
- PACKAGES/smtbq
|
||||
- no
|
||||
* - :ref:`SPH <PKG-SPH>`
|
||||
|
||||
@ -56,6 +56,7 @@ Pre-processing tools
|
||||
* :ref:`moltemplate <moltemplate>`
|
||||
* :ref:`msi2lmp <msi>`
|
||||
* :ref:`polybond <polybond>`
|
||||
* :ref:`stl_bin2txt <stlconvert>`
|
||||
|
||||
|
||||
Post-processing tools
|
||||
@ -87,7 +88,7 @@ Miscellaneous tools
|
||||
.. table_from_list::
|
||||
:columns: 6
|
||||
|
||||
* :ref:`CMake <cmake>`
|
||||
* :ref:`LAMMPS coding standards <coding_standard>`
|
||||
* :ref:`emacs <emacs>`
|
||||
* :ref:`i-pi <ipi>`
|
||||
* :ref:`kate <kate>`
|
||||
@ -189,27 +190,32 @@ for the :doc:`chain benchmark <Speed_bench>`.
|
||||
|
||||
----------
|
||||
|
||||
.. _cmake:
|
||||
.. _coding_standard:
|
||||
|
||||
CMake tools
|
||||
-----------
|
||||
LAMMPS coding standard
|
||||
----------------------
|
||||
|
||||
The ``cmbuild`` script is a wrapper around using ``cmake --build <dir>
|
||||
--target`` and allows compiling LAMMPS in a :ref:`CMake build folder
|
||||
<cmake_build>` with a make-like syntax regardless of the actual build
|
||||
tool and the specific name of the program used (e.g. ``ninja-v1.10`` or
|
||||
``gmake``) when using ``-D CMAKE_MAKE_PROGRAM=<name>``.
|
||||
The ``coding_standard`` folder contains multiple python scripts to
|
||||
check for and apply some LAMMPS coding conventions. The following
|
||||
scripts are available:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
Usage: cmbuild [-v] [-h] [-C <dir>] [-j <num>] [<target>]
|
||||
permissions.py # detects if sources have executable permissions and scripts have not
|
||||
whitespace.py # detects TAB characters and trailing whitespace
|
||||
homepage.py # detects outdated LAMMPS homepage URLs (pointing to sandia.gov instead of lammps.org)
|
||||
errordocs.py # detects deprecated error docs in header files
|
||||
|
||||
Options:
|
||||
-h print this message
|
||||
-j <NUM> allow processing of NUM concurrent tasks
|
||||
-C DIRECTORY execute build in folder DIRECTORY
|
||||
-v produce verbose output
|
||||
The tools need to be given the main folder of the LAMMPS distribution
|
||||
or individual file names as argument and will by default check them
|
||||
and report any non-compliance. With the optional ``-f`` argument the
|
||||
corresponding script will try to change the non-compliant file(s) to
|
||||
match the conventions.
|
||||
|
||||
For convenience this scripts can also be invoked by the make file in
|
||||
the ``src`` folder with, `make check-whitespace` or `make fix-whitespace`
|
||||
to either detect or edit the files. Correspondingly for the other python
|
||||
scripts. `make check` will run all checks.
|
||||
|
||||
----------
|
||||
|
||||
@ -1012,6 +1018,28 @@ For more details please see the README.md file in that folder.
|
||||
|
||||
----------
|
||||
|
||||
.. _stlconvert:
|
||||
|
||||
stl_bin2txt tool
|
||||
----------------
|
||||
|
||||
The file stl_bin2txt.cpp converts binary STL files - like they are
|
||||
frequently offered for download on the web - into ASCII format STL files
|
||||
that LAMMPS can read with the :doc:`create_atoms mesh <create_atoms>` or
|
||||
the :doc:`fix smd/wall_surface <fix_smd_wall_surface>` commands. The syntax
|
||||
for running the tool is
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
stl_bin2txt infile.stl outfile.stl
|
||||
|
||||
which creates outfile.stl from infile.stl. This tool must be compiled
|
||||
on a platform compatible with the byte-ordering that was used to create
|
||||
the binary file. This usually is a so-called little endian hardware
|
||||
(like x86).
|
||||
|
||||
----------
|
||||
|
||||
.. _swig:
|
||||
|
||||
SWIG interface
|
||||
|
||||
@ -88,7 +88,7 @@ of (g,i,k,o,t) to indicate which accelerated styles exist.
|
||||
* :doc:`dipole <angle_dipole>` - angle that controls orientation of a point dipole
|
||||
* :doc:`fourier <angle_fourier>` - angle with multiple cosine terms
|
||||
* :doc:`fourier/simple <angle_fourier_simple>` - angle with a single cosine term
|
||||
* :doc:`gaussian <angle_gaussian>` - multicentered Gaussian-based angle potential
|
||||
* :doc:`gaussian <angle_gaussian>` - multi-centered Gaussian-based angle potential
|
||||
* :doc:`harmonic <angle_harmonic>` - harmonic angle
|
||||
* :doc:`mm3 <angle_mm3>` - anharmonic angle
|
||||
* :doc:`quartic <angle_quartic>` - angle with cubic and quartic terms
|
||||
|
||||
@ -179,6 +179,7 @@ The individual style names on the :doc:`Commands compute <Commands_compute>` pag
|
||||
* :doc:`body/local <compute_body_local>` - attributes of body sub-particles
|
||||
* :doc:`bond <compute_bond>` - energy of each bond sub-style
|
||||
* :doc:`bond/local <compute_bond_local>` - distance and energy of each bond
|
||||
* :doc:`born/matrix <compute_born_matrix>` - second derivative or potential with respect to strain
|
||||
* :doc:`centro/atom <compute_centro_atom>` - centro-symmetry parameter for each atom
|
||||
* :doc:`centroid/stress/atom <compute_stress_atom>` - centroid based stress tensor for each atom
|
||||
* :doc:`chunk/atom <compute_chunk_atom>` - assign chunk IDs to each atom
|
||||
|
||||
213
doc/src/compute_born_matrix.rst
Normal file
213
doc/src/compute_born_matrix.rst
Normal file
@ -0,0 +1,213 @@
|
||||
.. index:: compute born/matrix
|
||||
|
||||
compute born/matrix command
|
||||
===========================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
compute ID group-ID born/matrix keyword value ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* born/matrix = style name of this compute command
|
||||
* zero or more keyword/value pairs may be appended
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
keyword = *numdiff*
|
||||
*numdiff* values = delta virial-ID
|
||||
delta = magnitude of strain (dimensionless)
|
||||
virial-ID = ID of pressure compute for virial (string)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all born/matrix
|
||||
compute 1 all born/matrix bond angle
|
||||
compute 1 all born/matrix numdiff 1.0e-4 myvirial
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Define a compute that calculates
|
||||
:math:`\frac{\partial{}^2U}{\partial\varepsilon_{i}\partial\varepsilon_{j}}` the
|
||||
second derivatives of the potential energy :math:`U` w.r.t. strain
|
||||
tensor :math:`\varepsilon` elements. These values are related to:
|
||||
|
||||
.. math::
|
||||
|
||||
C^{B}_{i,j}=\frac{1}{V}\frac{\partial{}^2U}{\partial{}\varepsilon_{i}\partial\varepsilon_{j}}
|
||||
|
||||
also called the Born term of elastic constants in the stress-stress fluctuation
|
||||
formalism. This quantity can be used to compute the elastic constant tensor.
|
||||
Using the symmetric Voigt notation, the elastic constant tensor can be written
|
||||
as a 6x6 symmetric matrix:
|
||||
|
||||
.. math::
|
||||
|
||||
C_{i,j} = \langle{}C^{B}_{i,j}\rangle
|
||||
+ \frac{V}{k_{B}T}\left(\langle\sigma_{i}\sigma_{j}\rangle\right.
|
||||
\left.- \langle\sigma_{i}\rangle\langle\sigma_{j}\rangle\right)
|
||||
+ \frac{Nk_{B}T}{V}
|
||||
\left(\delta_{i,j}+(\delta_{1,i}+\delta_{2,i}+\delta_{3,i})\right.
|
||||
\left.*(\delta_{1,j}+\delta_{2,j}+\delta_{3,j})\right)
|
||||
|
||||
In the above expression, :math:`\sigma` stands for the virial stress
|
||||
tensor, :math:`\delta` is the Kronecker delta and the usual notation apply for
|
||||
the number of particle, the temperature and volume respectively :math:`N`,
|
||||
:math:`T` and :math:`V`. :math:`k_{B}` is the Boltzmann constant.
|
||||
|
||||
The Born term is a symmetric 6x6 matrix, as is the matrix of second derivatives
|
||||
of potential energy w.r.t strain,
|
||||
whose 21 independent elements are output in this order:
|
||||
|
||||
.. math::
|
||||
|
||||
\begin{matrix}
|
||||
C_{1} & C_{7} & C_{8} & C_{9} & C_{10} & C_{11} \\
|
||||
C_{7} & C_{2} & C_{12} & C_{13} & C_{14} & C_{15} \\
|
||||
\vdots & C_{12} & C_{3} & C_{16} & C_{17} & C_{18} \\
|
||||
\vdots & C_{13} & C_{16} & C_{4} & C_{19} & C_{20} \\
|
||||
\vdots & \vdots & \vdots & C_{19} & C_{5} & C_{21} \\
|
||||
\vdots & \vdots & \vdots & \vdots & C_{21} & C_{6}
|
||||
\end{matrix}
|
||||
|
||||
in this matrix the indices of :math:`C_{k}` value are the corresponding element
|
||||
:math:`k` in the global vector output by this compute. Each term comes from the sum
|
||||
of the derivatives of every contribution to the potential energy
|
||||
in the system as explained in :ref:`(VanWorkum)
|
||||
<VanWorkum>`.
|
||||
|
||||
The output can be accessed using usual Lammps routines:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all born/matrix
|
||||
compute 2 all pressure NULL virial
|
||||
variable S1 equal -c_2[1]
|
||||
variable S2 equal -c_2[2]
|
||||
variable S3 equal -c_2[3]
|
||||
variable S4 equal -c_2[4]
|
||||
variable S5 equal -c_2[5]
|
||||
variable S6 equal -c_2[6]
|
||||
fix 1 all ave/time 1 1 1 v_S1 v_S2 v_S3 v_S4 v_S5 v_S6 c_1[*] file born.out
|
||||
|
||||
In this example, the file *born.out* will contain the information needed to
|
||||
compute the first and second terms of the elastic constant matrix in a post
|
||||
processing procedure. The other required quantities can be accessed using any
|
||||
other *LAMMPS* usual method. Several examples of this method are
|
||||
provided in the examples/ELASTIC_T/BORN_MATRIX directory
|
||||
described on the :doc:`Examples <Examples>` doc page.
|
||||
|
||||
NOTE: In the above :math:`C_{i,j}` computation, the fluctuation
|
||||
term involving the virial stress tensor :math:`\sigma` is the
|
||||
covariance between each elements. In a
|
||||
solid the stress fluctuations can vary rapidly, while average
|
||||
fluctuations can be slow to converge.
|
||||
A detailed analysis of the convergence rate of all the terms in
|
||||
the elastic tensor
|
||||
is provided in the paper by Clavier et al. :ref:`(Clavier) <Clavier2>`.
|
||||
|
||||
Two different computation methods for the Born matrix are implemented in this
|
||||
compute and are mutually exclusive.
|
||||
|
||||
The first one is a direct computation from the analytical formula from the
|
||||
different terms of the potential used for the simulations :ref:`(VanWorkum)
|
||||
<VanWorkum>`. However, the implementation of such derivations must be done
|
||||
for every potential form. This has not been done yet and can be very
|
||||
complicated for complex potentials. At the moment a warning message is
|
||||
displayed for every term that is not supporting the compute at the moment.
|
||||
This method is the default for now.
|
||||
|
||||
The second method uses finite differences of energy to numerically approximate
|
||||
the second derivatives :ref:`(Zhen) <Zhen>`. This is useful when using
|
||||
interaction styles for which the analytical second derivatives have not been
|
||||
implemented. In this cases, the compute applies linear strain fields of
|
||||
magnitude *delta* to all the atoms relative to a point at the center of the
|
||||
box. The strain fields are in six different directions, corresponding to the
|
||||
six Cartesian components of the stress tensor defined by LAMMPS. For each
|
||||
direction it applies the strain field in both the positive and negative senses,
|
||||
and the new stress virial tensor of the entire system is calculated after each.
|
||||
The difference in these two virials divided by two times *delta*, approximates
|
||||
the corresponding components of the second derivative, after applying a
|
||||
suitable unit conversion.
|
||||
|
||||
.. note::
|
||||
|
||||
It is important to choose a suitable value for delta, the magnitude of
|
||||
strains that are used to generate finite difference
|
||||
approximations to the exact virial stress. For typical systems, a value in
|
||||
the range of 1 part in 1e5 to 1e6 will be sufficient.
|
||||
However, the best value will depend on a multitude of factors
|
||||
including the stiffness of the interatomic potential, the thermodynamic
|
||||
state of the material being probed, and so on. The only way to be sure
|
||||
that you have made a good choice is to do a sensitivity study on a
|
||||
representative atomic configuration, sweeping over a wide range of
|
||||
values of delta. If delta is too small, the output values will vary
|
||||
erratically due to truncation effects. If delta is increased beyond a
|
||||
certain point, the output values will start to vary smoothly with
|
||||
delta, due to growing contributions from higher order derivatives. In
|
||||
between these two limits, the numerical virial values should be largely
|
||||
independent of delta.
|
||||
|
||||
The keyword requires the additional arguments *delta* and *virial-ID*.
|
||||
*delta* gives the size of the applied strains. *virial-ID* gives
|
||||
the ID string of the pressure compute that provides the virial stress tensor,
|
||||
requiring that it use the virial keyword e.g.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
compute 1 all born/matrix numdiff 1.0e-4 myvirial
|
||||
|
||||
**Output info:**
|
||||
|
||||
This compute calculates a global vector with 21 values that are
|
||||
the second derivatives of the potential energy w.r.t. strain.
|
||||
The values are in energy units.
|
||||
The values are ordered as explained above. These values can be used
|
||||
by any command that uses global values from a compute as input. See
|
||||
the :doc:`Howto output <Howto_output>` doc page for an overview of
|
||||
LAMMPS output options.
|
||||
|
||||
The array values calculated by this compute are all "extensive".
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This compute is part of the EXTRA-COMPUTE package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info. LAMMPS was built with that package. See
|
||||
the :doc:`Build package <Build_package>` page for more info.
|
||||
|
||||
The Born term can be decomposed as a product of two terms. The first one is a
|
||||
general term which depends on the configuration. The second one is specific to
|
||||
every interaction composing your force field (non-bonded, bonds, angle...).
|
||||
Currently not all LAMMPS interaction styles implement the *born_matrix* method
|
||||
giving first and second order derivatives and LAMMPS will exit with an error if
|
||||
this compute is used with such interactions unless the *numdiff* option is
|
||||
also used. The *numdiff* option cannot be used with any other keyword. In this
|
||||
situation, LAMMPS will also exit with an error.
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _VanWorkum:
|
||||
|
||||
**(Van Workum)** K. Van Workum et al., J. Chem. Phys. 125 144506 (2006)
|
||||
|
||||
.. _Clavier2:
|
||||
|
||||
**(Clavier)** G. Clavier, N. Desbiens, E. Bourasseau, V. Lachet, N. Brusselle-Dupend and B. Rousseau, Mol Sim, 43, 1413 (2017).
|
||||
|
||||
.. _Zhen:
|
||||
|
||||
**(Zhen)** Y. Zhen, C. Chu, Computer Physics Communications 183(2012)261-265
|
||||
@ -23,7 +23,7 @@ Syntax
|
||||
*reduce/region* arg = region-ID
|
||||
region-ID = ID of region to use for choosing atoms
|
||||
|
||||
* mode = *sum* or *min* or *max* or *ave* or *sumsq* or *avesq*
|
||||
* mode = *sum* or *min* or *max* or *ave* or *sumsq* or *avesq* or *sumabs* or *aveabs*
|
||||
* one or more inputs can be listed
|
||||
* input = x, y, z, vx, vy, vz, fx, fy, fz, c_ID, c_ID[N], f_ID, f_ID[N], v_name
|
||||
|
||||
@ -77,7 +77,10 @@ option sums the square of the values in the vector into a global
|
||||
total. The *avesq* setting does the same as *sumsq*, then divides the
|
||||
sum of squares by the number of values. The last two options can be
|
||||
useful for calculating the variance of some quantity, e.g. variance =
|
||||
sumsq - ave\^2.
|
||||
sumsq - ave\^2. The *sumabs* option sums the absolute values in the
|
||||
vector into a global total. The *aveabs* setting does the same as
|
||||
*sumabs*, then divides the sum of absolute values by the number of
|
||||
values.
|
||||
|
||||
Each listed input is operated on independently. For per-atom inputs,
|
||||
the group specified with this command means only atoms within the
|
||||
@ -189,7 +192,7 @@ value. If multiple inputs are specified, this compute produces a
|
||||
global vector of values, the length of which is equal to the number of
|
||||
inputs specified.
|
||||
|
||||
As discussed below, for the *sum* and *sumsq* modes, the value(s)
|
||||
As discussed below, for the *sum*, *sumabs* and *sumsq* modes, the value(s)
|
||||
produced by this compute are all "extensive", meaning their value
|
||||
scales linearly with the number of atoms involved. If normalized
|
||||
values are desired, this compute can be accessed by the :doc:`thermo_style custom <thermo_style>` command with :doc:`thermo_modify norm yes <thermo_modify>` set as an option. Or it can be accessed by a
|
||||
@ -208,7 +211,7 @@ compute as input. See the :doc:`Howto output <Howto_output>` doc page
|
||||
for an overview of LAMMPS output options.
|
||||
|
||||
All the scalar or vector values calculated by this compute are
|
||||
"intensive", except when the *sum* or *sumsq* modes are used on
|
||||
"intensive", except when the *sum*, *sumabs* or *sumsq* modes are used on
|
||||
per-atom or local vectors, in which case the calculated values are
|
||||
"extensive".
|
||||
|
||||
|
||||
@ -127,19 +127,16 @@ The *vx*, *vy*, *vz*, *fx*, *fy*, *fz* attributes are components of
|
||||
the COM velocity and force on the COM of the body.
|
||||
|
||||
The *omegax*, *omegay*, and *omegaz* attributes are the angular
|
||||
velocity components of the body around its COM.
|
||||
velocity components of the body in the system frame around its COM.
|
||||
|
||||
The *angmomx*, *angmomy*, and *angmomz* attributes are the angular
|
||||
momentum components of the body around its COM.
|
||||
momentum components of the body in the system frame around its COM.
|
||||
|
||||
The *quatw*, *quati*, *quatj*, and *quatk* attributes are the
|
||||
components of the 4-vector quaternion representing the orientation of
|
||||
the rigid body. See the :doc:`set <set>` command for an explanation of
|
||||
the quaternion vector.
|
||||
|
||||
The *angmomx*, *angmomy*, and *angmomz* attributes are the angular
|
||||
momentum components of the body around its COM.
|
||||
|
||||
The *tqx*, *tqy*, *tqz* attributes are components of the torque acting
|
||||
on the body around its COM.
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ Syntax
|
||||
* R_1, R_2,... = list of cutoff radii, one for each type (distance units)
|
||||
* w_1, w_2,... = list of neighbor weights, one for each type
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *rmin0* or *switchflag* or *bzeroflag* or *quadraticflag* or *chem* or *bnormflag* or *wselfallflag* or *bikflag* or *switchinnerflag*
|
||||
* keyword = *rmin0* or *switchflag* or *bzeroflag* or *quadraticflag* or *chem* or *bnormflag* or *wselfallflag* or *bikflag* or *switchinnerflag* or *sinner* or *dinner*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -59,9 +59,13 @@ Syntax
|
||||
*bikflag* value = *0* or *1* (only implemented for compute snap)
|
||||
*0* = per-atom bispectrum descriptors are summed over atoms
|
||||
*1* = per-atom bispectrum descriptors are not summed over atoms
|
||||
*switchinnerflag* values = *rinnerlist* *drinnerlist*
|
||||
*rinnerlist* = *ntypes* values of rinner (distance units)
|
||||
*drinnerlist* = *ntypes* values of drinner (distance units)
|
||||
*switchinnerflag* value = *0* or *1*
|
||||
*0* = do not use inner switching function
|
||||
*1* = use inner switching function
|
||||
*sinner* values = *sinnerlist*
|
||||
*sinnerlist* = *ntypes* values of *Sinner* (distance units)
|
||||
*dinner* values = *dinnerlist*
|
||||
*dinnerlist* = *ntypes* values of *Dinner* (distance units)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -73,7 +77,7 @@ Examples
|
||||
compute vb all sna/atom 1.4 0.95 6 2.0 1.0
|
||||
compute snap all snap 1.4 0.95 6 2.0 1.0
|
||||
compute snap all snap 1.0 0.99363 6 3.81 3.83 1.0 0.93 chem 2 0 1
|
||||
compute snap all snap 1.0 0.99363 6 3.81 3.83 1.0 0.93 switchinnerflag 1.1 1.3 0.5 0.6
|
||||
compute snap all snap 1.0 0.99363 6 3.81 3.83 1.0 0.93 switchinnerflag 1 sinner 1.35 1.6 dinner 0.25 0.3
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
@ -312,25 +316,29 @@ the resulting bispectrum rows are :math:`B_{i,k}` instead of just
|
||||
:math:`B_k`. In this case, the entries in the final column for these rows
|
||||
are set to zero.
|
||||
|
||||
The keyword *switchinnerflag* activates an additional radial switching
|
||||
The keyword *switchinnerflag* with value 1
|
||||
activates an additional radial switching
|
||||
function similar to :math:`f_c(r)` above, but acting to switch off
|
||||
smoothly contributions from neighbor atoms at short separation distances.
|
||||
This is useful when SNAP is used in combination with a simple
|
||||
repulsive potential. The keyword is followed by the *ntypes*
|
||||
values for :math:`r_{inner}` and the *ntypes*
|
||||
values for :math:`\Delta r_{inner}`. For a neighbor atom at
|
||||
repulsive potential. For a neighbor atom at
|
||||
distance :math:`r`, its contribution is scaled by a multiplicative
|
||||
factor :math:`f_{inner}(r)` defined as follows:
|
||||
|
||||
.. math::
|
||||
|
||||
= & 0, r \leq r_{inner} \\
|
||||
f_{inner}(r) = & \frac{1}{2}(1 - \cos(\pi \frac{r-r_{inner}}{\Delta r_{inner}})), r_{inner} < r \leq r_{inner} + \Delta r_{inner} \\
|
||||
= & 1, r > r_{inner} + \Delta r_{inner}
|
||||
= & 0, r \leq S_{inner} - D_{inner} \\
|
||||
f_{inner}(r) = & \frac{1}{2}(1 - \cos(\frac{\pi}{2} (1 + \frac{r-S_{inner}}{D_{inner}})), S_{inner} - D_{inner} < r \leq S_{inner} + D_{inner} \\
|
||||
= & 1, r > S_{inner} + D_{inner}
|
||||
|
||||
The values of :math:`r_{inner}` and :math:`\Delta r_{inner}` are
|
||||
the arithmetic means of the values for the central atom of type I
|
||||
and the neighbor atom of type J.
|
||||
where the switching region is centered at :math:`S_{inner}` and it extends a distance :math:`D_{inner}`
|
||||
to the left and to the right of this.
|
||||
With this option, additional keywords *sinner* and *dinner* must be used,
|
||||
each followed by *ntypes*
|
||||
values for :math:`S_{inner}` and :math:`D_{inner}`, respectively.
|
||||
When the central atom and the neighbor atom have different types,
|
||||
the values of :math:`S_{inner}` and :math:`D_{inner}` are
|
||||
the arithmetic means of the values for both types.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -450,7 +458,7 @@ Default
|
||||
|
||||
The optional keyword defaults are *rmin0* = 0,
|
||||
*switchflag* = 1, *bzeroflag* = 1, *quadraticflag* = 0,
|
||||
*bnormflag* = 0, *wselfallflag* = 0
|
||||
*bnormflag* = 0, *wselfallflag* = 0, *switchinnerflag* = 0,
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -198,7 +198,9 @@ potentials only include the pair potential portion of the EAM
|
||||
interaction when used by this compute, not the embedding term. Also
|
||||
bonded or Kspace interactions do not contribute to this compute.
|
||||
|
||||
The computes in this package are not compatible with dynamic groups.
|
||||
When used with dynamic groups, a :doc:`run 0 <run>` command needs to
|
||||
be inserted in order to initialize the dynamic groups before accessing
|
||||
the computes.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
@ -76,21 +76,28 @@ velocity for each atom. Note that if there is only one atom in the
|
||||
bin, its thermal velocity will thus be 0.0.
|
||||
|
||||
After the spatially-averaged velocity field has been subtracted from
|
||||
each atom, the temperature is calculated by the formula KE = (dim\*N
|
||||
- dim\*Nx\*Ny\*Nz) k T/2, where KE = total kinetic energy of the group of
|
||||
atoms (sum of 1/2 m v\^2), dim = 2 or 3 = dimensionality of the
|
||||
simulation, N = number of atoms in the group, k = Boltzmann constant,
|
||||
and T = temperature. The dim\*Nx\*Ny\*Nz term are degrees of freedom
|
||||
subtracted to adjust for the removal of the center-of-mass velocity in
|
||||
each of Nx\*Ny\*Nz bins, as discussed in the :ref:`(Evans) <Evans1>` paper.
|
||||
each atom, the temperature is calculated by the formula
|
||||
*KE* = (*dim\*N* - *Ns\*Nx\*Ny\*Nz* - *extra* ) *k* *T*/2, where *KE* = total
|
||||
kinetic energy of the group of atoms (sum of 1/2 *m* *v*\^2), *dim* = 2
|
||||
or 3 = dimensionality of the simulation, *Ns* = 0, 1, 2 or 3 for
|
||||
streaming velocity subtracted in 0, 1, 2 or 3 dimensions, *extra* = extra
|
||||
degrees-of-freedom, *N* = number of atoms in the group, *k* = Boltzmann
|
||||
constant, and *T* = temperature. The *Ns\*Nx\*Ny\*Nz* term is degrees
|
||||
of freedom subtracted to adjust for the removal of the center-of-mass
|
||||
velocity in each direction of the *Nx\*Ny\*Nz* bins, as discussed in the
|
||||
:ref:`(Evans) <Evans1>` paper. The extra term defaults to (*dim* - *Ns*)
|
||||
and accounts for overall conservation of center-of-mass velocity across
|
||||
the group in directions where streaming velocity is *not* subtracted. This
|
||||
can be altered using the *extra* option of the
|
||||
:doc:`compute_modify <compute_modify>` command.
|
||||
|
||||
If the *out* keyword is used with a *tensor* value, which is the
|
||||
default, a kinetic energy tensor, stored as a 6-element vector, is
|
||||
also calculated by this compute for use in the computation of a
|
||||
pressure tensor. The formula for the components of the tensor is the
|
||||
same as the above formula, except that v\^2 is replaced by vx\*vy for
|
||||
the xy component, etc. The 6 components of the vector are ordered xx,
|
||||
yy, zz, xy, xz, yz.
|
||||
same as the above formula, except that *v*\^2 is replaced by *vx\*vy* for
|
||||
the xy component, etc. The 6 components of the vector are ordered *xx,
|
||||
yy, zz, xy, xz, yz.*
|
||||
|
||||
If the *out* keyword is used with a *bin* value, the count of atoms
|
||||
and computed temperature for each bin are stored for output, as an
|
||||
@ -123,10 +130,20 @@ needed, the subtracted degrees-of-freedom can be altered using the
|
||||
.. note::
|
||||
|
||||
When using the *out* keyword with a value of *bin*, the
|
||||
calculated temperature for each bin does not include the
|
||||
degrees-of-freedom adjustment described in the preceding paragraph,
|
||||
for fixes that constrain molecular motion. It does include the
|
||||
adjustment due to the *extra* option, which is applied to each bin.
|
||||
calculated temperature for each bin includes the degrees-of-freedom
|
||||
adjustment described in the preceding paragraph for fixes that
|
||||
constrain molecular motion, as well as the adjustment due to
|
||||
the *extra* option (which defaults to *dim* - *Ns* as described above),
|
||||
by fractionally applying them based on the fraction of atoms in each
|
||||
bin. As a result, the bin degrees-of-freedom summed over all bins exactly
|
||||
equals the degrees-of-freedom used in the scalar temperature calculation,
|
||||
:math:`\Sigma N_{DOF_i} = N_{DOF}` and the corresponding relation for temperature
|
||||
is also satisfied :math:`\Sigma N_{DOF_i} T_i = N_{DOF} T`.
|
||||
These relations will breakdown in cases where the adjustment
|
||||
exceeds the actual number of degrees-of-freedom in a bin. This could happen
|
||||
if a bin is empty or in situations where rigid molecules
|
||||
are non-uniformly distributed, in which case the reported
|
||||
temperature within a bin may not be accurate.
|
||||
|
||||
See the :doc:`Howto thermostat <Howto_thermostat>` page for a
|
||||
discussion of different ways to compute temperature and perform
|
||||
|
||||
@ -21,12 +21,13 @@ Examples
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
units real
|
||||
compute cos all viscosity/cos
|
||||
variable V equal c_cos[7]
|
||||
variable A equal 0.02E-5
|
||||
variable A equal 0.02E-5 # A/fs^2
|
||||
variable density equal density
|
||||
variable lz equal lz
|
||||
variable reciprocalViscosity equal v_V/${A}/v_density*39.4784/v_lz/v_lz*100
|
||||
variable reciprocalViscosity equal v_V/${A}/v_density*39.4784/v_lz/v_lz*100 # 1/(Pa*s)
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
@ -11,7 +11,7 @@ Syntax
|
||||
create_atoms type style args keyword values ...
|
||||
|
||||
* type = atom type (1-Ntypes) of atoms to create (offset for molecule creation)
|
||||
* style = *box* or *region* or *single* or *random*
|
||||
* style = *box* or *region* or *single* or *mesh* or *random*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -20,17 +20,19 @@ Syntax
|
||||
region-ID = particles will only be created if contained in the region
|
||||
*single* args = x y z
|
||||
x,y,z = coordinates of a single particle (distance units)
|
||||
*mesh* args = STL-file
|
||||
STL-file = file with triangle mesh in STL format
|
||||
*random* args = N seed region-ID
|
||||
N = number of particles to create
|
||||
seed = random # seed (positive integer)
|
||||
region-ID = create atoms within this region, use NULL for entire simulation box
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *mol* or *basis* or *ratio* or *subset* or *remap* or *var* or *set* or *rotate* or *units*
|
||||
* keyword = *mol* or *basis* or *ratio* or *subset* or *remap* or *var* or *set* or *rotate* or *overlap* or *maxtry* or *units*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*mol* value = template-ID seed
|
||||
*mol* values = template-ID seed
|
||||
template-ID = ID of molecule template specified in a separate :doc:`molecule <molecule>` command
|
||||
seed = random # seed (positive integer)
|
||||
*basis* values = M itype
|
||||
@ -47,9 +49,21 @@ Syntax
|
||||
*set* values = dim name
|
||||
dim = *x* or *y* or *z*
|
||||
name = name of variable to set with x, y, or z atom position
|
||||
*radscale* value = factor
|
||||
factor = scale factor for setting atom radius
|
||||
*meshmode* values = mode arg
|
||||
mode = *bisect* or *qrand*
|
||||
*bisect* arg = radthresh
|
||||
radthresh = threshold value for *mesh* to determine when to split triangles (distance units)
|
||||
*qrand* arg = density
|
||||
density = minimum number density for atoms place on *mesh* triangles (inverse distance squared units)
|
||||
*rotate* values = theta Rx Ry Rz
|
||||
theta = rotation angle for single molecule (degrees)
|
||||
Rx,Ry,Rz = rotation vector for single molecule
|
||||
*overlap* value = Doverlap
|
||||
Doverlap = only insert if at least this distance from all existing atoms
|
||||
*maxtry* value = Ntry
|
||||
Ntry = number of attempts to insert a particle before failure
|
||||
*units* value = *lattice* or *box*
|
||||
*lattice* = the geometry is defined in lattice units
|
||||
*box* = the geometry is defined in simulation box units
|
||||
@ -64,17 +78,21 @@ Examples
|
||||
create_atoms 3 region regsphere basis 2 3 ratio 0.5 74637
|
||||
create_atoms 3 single 0 0 5
|
||||
create_atoms 1 box var v set x xpos set y ypos
|
||||
create_atoms 2 random 50 12345 NULL overlap 2.0 maxtry 50
|
||||
create_atoms 1 mesh open_box.stl meshmode qrand 0.1 units box
|
||||
create_atoms 1 mesh funnel.stl meshmode bisect 4.0 units box radscale 0.9
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This command creates atoms (or molecules) on a lattice, or a single
|
||||
atom (or molecule), or a random collection of atoms (or molecules), as
|
||||
an alternative to reading in their coordinates explicitly via a
|
||||
:doc:`read_data <read_data>` or :doc:`read_restart <read_restart>`
|
||||
command. A simulation box must already exist, which is typically
|
||||
created via the :doc:`create_box <create_box>` command. Before using
|
||||
this command, a lattice must also be defined using the
|
||||
This command creates atoms (or molecules) within the simulation box,
|
||||
either on a lattice, or a single atom (or molecule), or on a surface
|
||||
defined by a triangulated mesh, or a random collection of atoms (or
|
||||
molecules). It is an alternative to reading in atom coordinates
|
||||
explicitly via a :doc:`read_data <read_data>` or :doc:`read_restart
|
||||
<read_restart>` command. A simulation box must already exist, which is
|
||||
typically created via the :doc:`create_box <create_box>` command.
|
||||
Before using this command, a lattice must also be defined using the
|
||||
:doc:`lattice <lattice>` command, unless you specify the *single* style
|
||||
with units = box or the *random* style. For the remainder of this doc
|
||||
page, a created atom or molecule is referred to as a "particle".
|
||||
@ -97,58 +115,126 @@ particular dimension, LAMMPS is careful to put exactly one particle at
|
||||
the boundary (on either side of the box), not zero or two.
|
||||
|
||||
For the *region* style, a geometric volume is filled with particles on
|
||||
the lattice. This volume what is inside the simulation box and is
|
||||
also consistent with the region volume. See the :doc:`region <region>`
|
||||
command for details. Note that a region can be specified so that its
|
||||
"volume" is either inside or outside a geometric boundary. Also note
|
||||
that if your region is the same size as a periodic simulation box (in
|
||||
some dimension), LAMMPS does not implement the same logic described
|
||||
above as for the *box* style, to insure exactly one particle at
|
||||
periodic boundaries. if this is what you desire, you should either
|
||||
use the *box* style, or tweak the region size to get precisely the
|
||||
particles you want.
|
||||
the lattice. This volume is what is both inside the simulation box
|
||||
and also consistent with the region volume. See the :doc:`region
|
||||
<region>` command for details. Note that a region can be specified so
|
||||
that its "volume" is either inside or outside its geometric boundary.
|
||||
Also note that if a region is the same size as a periodic simulation
|
||||
box (in some dimension), LAMMPS does NOT implement the same logic
|
||||
described above for the *box* style, to insure exactly one particle at
|
||||
periodic boundaries. If this is desired, you should either use the
|
||||
*box* style, or tweak the region size to get precisely the particles
|
||||
you want.
|
||||
|
||||
For the *single* style, a single particle is added to the system at
|
||||
the specified coordinates. This can be useful for debugging purposes
|
||||
or to create a tiny system with a handful of particles at specified
|
||||
positions.
|
||||
|
||||
For the *random* style, N particles are added to the system at
|
||||
randomly generated coordinates, which can be useful for generating an
|
||||
amorphous system. The particles are created one by one using the
|
||||
specified random number *seed*, resulting in the same set of particles
|
||||
coordinates, independent of how many processors are being used in the
|
||||
simulation. If the *region-ID* argument is specified as NULL, then
|
||||
the created particles will be anywhere in the simulation box. If a
|
||||
*region-ID* is specified, a geometric volume is filled which is both
|
||||
inside the simulation box and is also consistent with the region
|
||||
volume. See the :doc:`region <region>` command for details. Note that
|
||||
a region can be specified so that its "volume" is either inside or
|
||||
outside a geometric boundary.
|
||||
.. figure:: img/marble_race.jpg
|
||||
:figwidth: 33%
|
||||
:align: right
|
||||
:target: _images/marble_race.jpg
|
||||
|
||||
For the *mesh* style, a file with a triangle mesh in `STL format
|
||||
<https://en.wikipedia.org/wiki/STL_(file_format)>`_ is read and one or
|
||||
more particles are placed into the area of each triangle. The reader
|
||||
supports both ASCII and binary files conforming to the format on the
|
||||
Wikipedia page. Binary STL files (e.g. as frequently offered for
|
||||
3d-printing) can also be first converted to ASCII for editing with the
|
||||
:ref:`stl_bin2txt tool <stlconvert>`. The use of the *units box* option
|
||||
is required. There are two algorithms available for placing atoms:
|
||||
*bisect* and *qrand*. They can be selected via the *meshmode* option;
|
||||
*bisect* is the default. If the atom style allows it, the radius will
|
||||
be set to a value depending on the algorithm and the value of the
|
||||
*radscale* parameter (see below), and the atoms created from the mesh
|
||||
are assigned a new molecule ID.
|
||||
|
||||
In *bisect* mode a particle is created at the center of each triangle
|
||||
unless the average distance of the triangle vertices from its center is
|
||||
larger than the *radthresh* value (default is lattice spacing in
|
||||
x-direction). In case the average distance is over the threshold, the
|
||||
triangle is recursively split into two halves along the the longest side
|
||||
until the threshold is reached. There will be at least one sphere per
|
||||
triangle. The value of *radthresh* is set as an argument to *meshmode
|
||||
bisect*. The average distance of the vertices from the center is also
|
||||
used to set the radius.
|
||||
|
||||
In *qrand* mode a quasi-random sequence is used to distribute particles
|
||||
on mesh triangles using an approach by :ref:`(Roberts) <Roberts2019>`.
|
||||
Particles are added to the triangle until the minimum number density is
|
||||
met or exceeded such that every triangle will have at least one
|
||||
particle. The minimum number density is set as an argument to the
|
||||
*qrand* option. The radius will be set so that the sum of the area of
|
||||
the radius of the particles created in place of a triangle will be equal
|
||||
to the area of that triangle.
|
||||
|
||||
.. note::
|
||||
|
||||
Particles generated by the *random* style will typically be
|
||||
highly overlapped which will cause many interatomic potentials to
|
||||
compute large energies and forces. Thus you should either perform an
|
||||
:doc:`energy minimization <minimize>` or run dynamics with :doc:`fix nve/limit <fix_nve_limit>` to equilibrate such a system, before
|
||||
running normal dynamics.
|
||||
The atom placement algorithms in the *mesh* style benefit from meshes
|
||||
where triangles are close to equilateral. It is therefore
|
||||
recommended to pre-process STL files to optimize the mesh
|
||||
accordingly. There are multiple open source and commercial software
|
||||
tools available with the capability to generate optimized meshes.
|
||||
|
||||
Note that this command adds particles to those that already exist.
|
||||
This means it can be used to add particles to a system previously read
|
||||
in from a data or restart file. Or the create_atoms command can be
|
||||
used multiple times, to add multiple sets of particles to the
|
||||
simulation. For example, grain boundaries can be created, by
|
||||
interleaving create_atoms with :doc:`lattice <lattice>` commands
|
||||
specifying different orientations. By using the create_atoms command
|
||||
in conjunction with the :doc:`delete_atoms <delete_atoms>` command,
|
||||
reasonably complex geometries can be created, or a protein can be
|
||||
solvated with a surrounding box of water molecules.
|
||||
.. note::
|
||||
|
||||
In all these cases, care should be taken to insure that new atoms do
|
||||
not overlap existing atoms inappropriately, especially if molecules
|
||||
are being added. The :doc:`delete_atoms <delete_atoms>` command can be
|
||||
used to remove overlapping atoms or molecules.
|
||||
In most cases the atoms created in *mesh* style will become an
|
||||
immobile or rigid object that would not be time integrated or moved
|
||||
by :doc:`fix move <fix_move>` or :doc:`fix rigid <fix_rigid>`. For
|
||||
computational efficiency *and* to avoid undesired contributions to
|
||||
pressure and potential energy due to close contacts, it is usually
|
||||
beneficial to exclude computing interactions between the created
|
||||
particles using :doc:`neigh_modify exclude <neigh_modify>`.
|
||||
|
||||
For the *random* style, *N* particles are added to the system at
|
||||
randomly generated coordinates, which can be useful for generating an
|
||||
amorphous system. The particles are created one by one using the
|
||||
specified random number *seed*, resulting in the same set of particle
|
||||
coordinates, independent of how many processors are being used in the
|
||||
simulation. Unless the *overlap* keyword is specified, particles
|
||||
created by the *random* style will typically be highly overlapped.
|
||||
Various additional criteria can be used to accept or reject a random
|
||||
particle insertion; see the keyword discussion below. Multiple
|
||||
attempts per particle are made (see the *maxtry* keyword) until the
|
||||
insertion is either successful or fails. If this command fails to add
|
||||
all requested *N* particles, a warning will be output.
|
||||
|
||||
If the *region-ID* argument is specified as NULL, then the randomly
|
||||
created particles will be anywhere in the simulation box. If a
|
||||
*region-ID* is specified, a geometric volume is filled which is both
|
||||
inside the simulation box and is also consistent with the region
|
||||
volume. See the :doc:`region <region>` command for details. Note
|
||||
that a region can be specified so that its "volume" is either inside
|
||||
or outside its geometric boundary.
|
||||
|
||||
Note that the create_atoms command adds particles to those that
|
||||
already exist. This means it can be used to add particles to a system
|
||||
previously read in from a data or restart file. Or the create_atoms
|
||||
command can be used multiple times, to add multiple sets of particles
|
||||
to the simulation. For example, grain boundaries can be created, by
|
||||
interleaving the create_atoms command with :doc:`lattice <lattice>`
|
||||
commands specifying different orientations.
|
||||
|
||||
When this command is used, care should be taken to insure the
|
||||
resulting system does not contain particles which are highly
|
||||
overlapped. Such overlaps will cause many interatomic potentials to
|
||||
compute huge energies and forces, leading to bad dynamics. There are
|
||||
several strategies to avoid this problem:
|
||||
|
||||
* Use the :doc:`delete_atoms overlap <delete_atoms>` command after
|
||||
create_atoms. For example, this strategy can be used to overlay and
|
||||
surround a large protein molecule with a volume of water molecules,
|
||||
then delete water molecules that overlap with the protein atoms.
|
||||
|
||||
* For the *random* style, use the optional *overlap* keyword to avoid
|
||||
overlaps when each new particle is created.
|
||||
|
||||
* Before running dynamics on an overlapped system, perform an
|
||||
:doc:`energy minimization <minimize>`. Or run initial dynamics with
|
||||
:doc:`pair_style soft <pair_soft>` or with :doc:`fix nve/limit
|
||||
<fix_nve_limit>` to un-overlap the particles, before running normal
|
||||
dynamics.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -156,12 +242,13 @@ used to remove overlapping atoms or molecules.
|
||||
that are outside the simulation box; they will just be ignored by
|
||||
LAMMPS. This is true even if you are using shrink-wrapped box
|
||||
boundaries, as specified by the :doc:`boundary <boundary>` command.
|
||||
However, you can first use the :doc:`change_box <change_box>` command to
|
||||
temporarily expand the box, then add atoms via create_atoms, then
|
||||
finally use change_box command again if needed to re-shrink-wrap the
|
||||
new atoms. See the :doc:`change_box <change_box>` page for an
|
||||
example of how to do this, using the create_atoms *single* style to
|
||||
insert a new atom outside the current simulation box.
|
||||
However, you can first use the :doc:`change_box <change_box>`
|
||||
command to temporarily expand the box, then add atoms via
|
||||
create_atoms, then finally use change_box command again if needed
|
||||
to re-shrink-wrap the new atoms. See the :doc:`change_box
|
||||
<change_box>` doc page for an example of how to do this, using the
|
||||
create_atoms *single* style to insert a new atom outside the
|
||||
current simulation box.
|
||||
|
||||
----------
|
||||
|
||||
@ -180,17 +267,19 @@ Using a lattice to add molecules, e.g. via the *box* or *region* or
|
||||
points, except that entire molecules are added at each point, i.e. on
|
||||
the point defined by each basis atom in the unit cell as it tiles the
|
||||
simulation box or region. This is done by placing the geometric
|
||||
center of the molecule at the lattice point, and giving the molecule a
|
||||
random orientation about the point. The random *seed* specified with
|
||||
the *mol* keyword is used for this operation, and the random numbers
|
||||
generated by each processor are different. This means the coordinates
|
||||
of individual atoms (in the molecules) will be different when running
|
||||
on different numbers of processors, unlike when atoms are being
|
||||
created in parallel.
|
||||
center of the molecule at the lattice point, and (by default) giving
|
||||
the molecule a random orientation about the point. The random *seed*
|
||||
specified with the *mol* keyword is used for this operation, and the
|
||||
random numbers generated by each processor are different. This means
|
||||
the coordinates of individual atoms (in the molecules) will be
|
||||
different when running on different numbers of processors, unlike when
|
||||
atoms are being created in parallel.
|
||||
|
||||
Also note that because of the random rotations, it may be important to
|
||||
use a lattice with a large enough spacing that adjacent molecules will
|
||||
not overlap, regardless of their relative orientations.
|
||||
Note that with random rotations, it may be important to use a lattice
|
||||
with a large enough spacing that adjacent molecules will not overlap,
|
||||
regardless of their relative orientations. See the description of the
|
||||
*rotate* keyword below, which overrides the default random orientation
|
||||
and inserts all molecules at a specified orientation.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -204,7 +293,7 @@ not overlap, regardless of their relative orientations.
|
||||
|
||||
----------
|
||||
|
||||
This is the meaning of the other allowed keywords.
|
||||
This is the meaning of the other optional keywords.
|
||||
|
||||
The *basis* keyword is only used when atoms (not molecules) are being
|
||||
created. It specifies an atom type that will be assigned to specific
|
||||
@ -234,18 +323,24 @@ and no particle is created if its position is outside the box.
|
||||
|
||||
The *var* and *set* keywords can be used together to provide a
|
||||
criterion for accepting or rejecting the addition of an individual
|
||||
atom, based on its coordinates. The *name* specified for the *var*
|
||||
keyword is the name of an :doc:`equal-style variable <variable>` which
|
||||
should evaluate to a zero or non-zero value based on one or two or
|
||||
three variables which will store the x, y, or z coordinates of an atom
|
||||
(one variable per coordinate). If used, these other variables must be
|
||||
:doc:`internal-style variables <variable>` defined in the input script;
|
||||
their initial numeric value can be anything. They must be
|
||||
atom, based on its coordinates. They apply to all styles except
|
||||
*single*. The *name* specified for the *var* keyword is the name of
|
||||
an :doc:`equal-style variable <variable>` which should evaluate to a
|
||||
zero or non-zero value based on one or two or three variables which
|
||||
will store the x, y, or z coordinates of an atom (one variable per
|
||||
coordinate). If used, these other variables must be
|
||||
:doc:`internal-style variables <variable>` defined in the input
|
||||
script; their initial numeric value can be anything. They must be
|
||||
internal-style variables, because this command resets their values
|
||||
directly. The *set* keyword is used to identify the names of these
|
||||
other variables, one variable for the x-coordinate of a created atom,
|
||||
one for y, and one for z.
|
||||
|
||||
.. figure:: img/sinusoid.jpg
|
||||
:figwidth: 50%
|
||||
:align: right
|
||||
:target: _images/sinusoid.jpg
|
||||
|
||||
When an atom is created, its x,y,z coordinates become the values for
|
||||
any *set* variable that is defined. The *var* variable is then
|
||||
evaluated. If the returned value is 0.0, the atom is not created. If
|
||||
@ -259,28 +354,26 @@ the sinusoid would appear to be "smoother". Also note the use of the
|
||||
"xlat" and "ylat" :doc:`thermo_style <thermo_style>` keywords which
|
||||
converts lattice spacings to distance.
|
||||
|
||||
.. only:: html
|
||||
|
||||
(Click on the image for a larger version)
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
dimension 2
|
||||
variable x equal 100
|
||||
variable y equal 25
|
||||
lattice hex 0.8442
|
||||
region box block 0 $x 0 $y -0.5 0.5
|
||||
create_box 1 box
|
||||
dimension 2
|
||||
variable x equal 100
|
||||
variable y equal 25
|
||||
lattice hex 0.8442
|
||||
region box block 0 $x 0 $y -0.5 0.5
|
||||
create_box 1 box
|
||||
|
||||
variable xx internal 0.0
|
||||
variable yy internal 0.0
|
||||
variable v equal "(0.2*v_y*ylat * cos(v_xx/xlat * 2.0*PI*4.0/v_x) + 0.5*v_y*ylat - v_yy) > 0.0"
|
||||
create_atoms 1 box var v set x xx set y yy
|
||||
write_dump all atom sinusoid.lammpstrj
|
||||
variable xx internal 0.0
|
||||
variable yy internal 0.0
|
||||
variable v equal "(0.2*v_y*ylat * cos(v_xx/xlat * 2.0*PI*4.0/v_x) + 0.5*v_y*ylat - v_yy) > 0.0"
|
||||
create_atoms 1 box var v set x xx set y yy
|
||||
write_dump all atom sinusoid.lammpstrj
|
||||
|
||||
.. image:: img/sinusoid.jpg
|
||||
:scale: 50%
|
||||
:align: center
|
||||
|
||||
.. raw:: html
|
||||
|
||||
Click on the image for a larger version.
|
||||
-----
|
||||
|
||||
The *rotate* keyword allows specification of the orientation
|
||||
at which molecules are inserted. The axis of rotation is
|
||||
@ -291,10 +384,79 @@ the atoms around the rotation axis is consistent with the right-hand
|
||||
rule: if your right-hand's thumb points along *R*, then your fingers
|
||||
wrap around the axis in the direction of rotation.
|
||||
|
||||
The *radscale* keyword only applies to the *mesh* style and adjusts the
|
||||
radius of created particles (see above), provided this is supported by
|
||||
the atom style. Its value is a prefactor (must be > 0.0, default is
|
||||
1.0) that is applied to the atom radius inferred from the size of the
|
||||
individual triangles in the triangle mesh that the particle corresponds
|
||||
to.
|
||||
|
||||
The *overlap* keyword only applies to the *random* style. It prevents
|
||||
newly created particles from being created closer than the specified
|
||||
*Doverlap* distance from any other particle. When the particles being
|
||||
created are molecules, the radius of the molecule (from its geometric
|
||||
center) is added to *Doverlap*. If particles have finite size (see
|
||||
:doc:`atom_style sphere <atom_style>` for example) *Doverlap* should
|
||||
be specified large enough to include the particle size in the
|
||||
non-overlapping criterion.
|
||||
|
||||
.. note::
|
||||
|
||||
Checking for overlaps is a costly O(N(N+M)) operation for inserting
|
||||
*N* new particles into a system with *M* existing particles. This
|
||||
is because distances to all *M* existing particles are computed for
|
||||
each new particle that is added. Thus the intended use of this
|
||||
keyword is to add relatively small numbers of particles to systems
|
||||
which remain at a relatively low density even after the new
|
||||
particles are created. Careful use of the *maxtry* keyword in
|
||||
combination with *overlap* is recommended. See the discussion
|
||||
above about systems with overlapped particles for alternate
|
||||
strategies that allow for overlapped insertions.
|
||||
|
||||
The *maxtry* keyword only applies to the *random* style. It limits
|
||||
the number of attempts to generate valid coordinates for a single new
|
||||
particle that satisfy all requirements imposed by the *region*, *var*,
|
||||
and *overlap* keywords. The default is 10 attempts per particle
|
||||
before the loop over the requested *N* particles advances to the next
|
||||
particle. Note that if insertion success is unlikely (e.g. inserting
|
||||
new particles into a dense system using the *overlap* keyword),
|
||||
setting the *maxtry* keyword to a large value may result in this
|
||||
command running for a long time.
|
||||
|
||||
.. figure:: img/overlap.png
|
||||
:figwidth: 30%
|
||||
:align: right
|
||||
:target: _images/overlap.png
|
||||
|
||||
Here is an example for the *random* style using these commands
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
units lj
|
||||
dimension 2
|
||||
region box block 0 50 0 50 -0.5 0.5
|
||||
create_box 1 box
|
||||
create_atoms 1 random 2000 13487 NULL overlap 1.0 maxtry 50
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0 2.5
|
||||
|
||||
to produce a system as shown in the image with 1520 particles (out of
|
||||
2000 requested) that are moderately dense and which have no overlaps
|
||||
sufficient to prevent the LJ pair_style from running properly (because
|
||||
the overlap criterion = 1.0). The create_atoms command ran for 0.3 s
|
||||
on a single CPU core.
|
||||
|
||||
.. only:: html
|
||||
|
||||
(Click on the image for a larger version)
|
||||
|
||||
-----
|
||||
|
||||
The *units* keyword determines the meaning of the distance units used
|
||||
to specify the coordinates of the one particle created by the *single*
|
||||
style. A *box* value selects standard distance units as defined by
|
||||
the :doc:`units <units>` command, e.g. Angstroms for units = real or
|
||||
style, or the overlap distance *Doverlap* by the *overlap* keyword. A
|
||||
*box* value selects standard distance units as defined by the
|
||||
:doc:`units <units>` command, e.g. Angstroms for units = real or
|
||||
metal. A *lattice* value means the distance units are in lattice
|
||||
spacings.
|
||||
|
||||
@ -315,9 +477,10 @@ assigned to created molecules in a similar fashion.
|
||||
|
||||
Aside from their ID, atom type, and xyz position, other properties of
|
||||
created atoms are set to default values, depending on which quantities
|
||||
are defined by the chosen :doc:`atom style <atom_style>`. See the :doc:`atom style <atom_style>` command for more details. See the
|
||||
:doc:`set <set>` and :doc:`velocity <velocity>` commands for info on how
|
||||
to change these values.
|
||||
are defined by the chosen :doc:`atom style <atom_style>`. See the
|
||||
:doc:`atom style <atom_style>` command for more details. See the
|
||||
:doc:`set <set>` and :doc:`velocity <velocity>` commands for info on
|
||||
how to change these values.
|
||||
|
||||
* charge = 0.0
|
||||
* dipole moment magnitude = 0.0
|
||||
@ -336,9 +499,11 @@ values specified in the file read by the :doc:`molecule <molecule>`
|
||||
command. E.g. the file typically defines bonds (angles,etc) between
|
||||
atoms in the molecule, and can optionally define charges on each atom.
|
||||
|
||||
Note that the *sphere* atom style sets the default particle diameter
|
||||
to 1.0 as well as the density. This means the mass for the particle
|
||||
is not 1.0, but is PI/6 \* diameter\^3 = 0.5236.
|
||||
Note that the *sphere* atom style sets the default particle diameter to
|
||||
1.0 as well as the density. This means the mass for the particle is not
|
||||
1.0, but is PI/6 \* diameter\^3 = 0.5236. When using the *mesh* style,
|
||||
the particle diameter is adjusted from the size of the individual
|
||||
triangles in the triangle mesh.
|
||||
|
||||
Note that the *ellipsoid* atom style sets the default particle shape
|
||||
to (0.0 0.0 0.0) and the density to 1.0 which means it is a point
|
||||
@ -372,5 +537,13 @@ Default
|
||||
|
||||
The default for the *basis* keyword is that all created atoms are
|
||||
assigned the argument *type* as their atom type (when single atoms are
|
||||
being created). The other defaults are *remap* = no, *rotate* =
|
||||
random, and *units* = lattice.
|
||||
being created). The other defaults are *remap* = no, *rotate* = random,
|
||||
*radscale* = 1.0, *radthresh* = x-lattice spacing, *overlap* not
|
||||
checked, *maxtry* = 10, and *units* = lattice.
|
||||
|
||||
----------
|
||||
|
||||
.. _Roberts2019:
|
||||
|
||||
**(Roberts)** R. Roberts (2019) "Evenly Distributing Points in a Triangle." Extreme Learning.
|
||||
`<http://extremelearning.com.au/evenly-distributing-points-in-a-triangle/>`_
|
||||
|
||||
@ -10,7 +10,7 @@ Syntax
|
||||
|
||||
delete_atoms style args keyword value ...
|
||||
|
||||
* style = *group* or *region* or *overlap* or *porosity*
|
||||
* style = *group* or *region* or *overlap* or *random* or *variable*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -20,12 +20,19 @@ Syntax
|
||||
cutoff = delete one atom from pairs of atoms within the cutoff (distance units)
|
||||
group1-ID = one atom in pair must be in this group
|
||||
group2-ID = other atom in pair must be in this group
|
||||
*porosity* args = group-ID region-ID fraction seed
|
||||
*random* args = ranstyle value eflag group-ID region-ID seed
|
||||
ranstyle = *fraction* or *count*
|
||||
for *fraction*:
|
||||
value = fraction (0.0 to 1.0) of eligible atoms to delete
|
||||
eflag = *no* for fast approximate deletion, *yes* for exact deletion
|
||||
for *count*:
|
||||
value = number of atoms to delete
|
||||
eflag = *no* for warning if count > eligible atoms, *yes* for error
|
||||
group-ID = group within which to perform deletions
|
||||
region-ID = region within which to perform deletions
|
||||
or NULL to only impose the group criterion
|
||||
fraction = delete this fraction of atoms
|
||||
seed = random number seed (positive integer)
|
||||
*variable* args = variable-name
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *compress* or *bond* or *mol*
|
||||
@ -45,15 +52,17 @@ Examples
|
||||
delete_atoms region sphere compress no
|
||||
delete_atoms overlap 0.3 all all
|
||||
delete_atoms overlap 0.5 solvent colloid
|
||||
delete_atoms porosity all cube 0.1 482793 bond yes
|
||||
delete_atoms porosity polymer cube 0.1 482793 bond yes
|
||||
delete_atoms random fraction 0.1 yes all cube 482793 bond yes
|
||||
delete_atoms random fraction 0.3 no polymer NULL 482793 bond yes
|
||||
delete_atoms random count 500 no ions NULL 482793
|
||||
detele_atoms variable checkers
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Delete the specified atoms. This command can be used to carve out
|
||||
voids from a block of material or to delete created atoms that are too
|
||||
close to each other (e.g. at a grain boundary).
|
||||
Delete the specified atoms. This command can be used, for example, to
|
||||
carve out voids from a block of material or to delete created atoms
|
||||
that are too close to each other (e.g. at a grain boundary).
|
||||
|
||||
For style *group*, all atoms belonging to the group are deleted.
|
||||
|
||||
@ -79,17 +88,44 @@ have occurred that no atom pairs within the cutoff will remain
|
||||
minimum number of atoms will be deleted, or that the same atoms will
|
||||
be deleted when running on different numbers of processors.
|
||||
|
||||
For style *porosity* a specified *fraction* of atoms are deleted which
|
||||
are both in the specified group and within the specified region. The
|
||||
region-ID can be specified as NULL to only impose the group criterion.
|
||||
Likewise, specifying the group-ID as *all* will only impose the region
|
||||
criterion.
|
||||
For style *random* a subset of eligible atoms are deleted. Which
|
||||
atoms to delete are chosen randomly using the specified random number
|
||||
*seed*. Which atoms are deleted may vary when running on different
|
||||
numbers of processors.
|
||||
|
||||
For example, if fraction is 0.1, then 10% of the eligible atoms will
|
||||
be deleted. The atoms to delete are chosen randomly. There is no
|
||||
guarantee that the exact fraction of atoms will be deleted, or that
|
||||
the same atoms will be deleted when running on different numbers of
|
||||
processors.
|
||||
For *ranstyle* = *fraction*, the specified fractional *value* (0.0 to
|
||||
1.0) of eligible atoms are deleted. If *eflag* is set to *no*, then
|
||||
the number of deleted atoms will be approximate, but the operation
|
||||
will be fast. If *eflag* is set to *yes*, then the number deleted
|
||||
will match the requested fraction, but for large systems the selection
|
||||
of deleted atoms may take additional time to determine.
|
||||
|
||||
For *ranstyle* = *count*, the specified integer *value* is the number
|
||||
of eligible atoms are deleted. If *eflag* is set to *no*, then if the
|
||||
requested number is larger then the number of eligible atoms, a
|
||||
warning is issued and only the eligible atoms are deleted instead of
|
||||
the requested *value*. If *eflag* is set to *yes*, an error is
|
||||
triggered instead and LAMMPS will exit. For large systems the
|
||||
selection of atoms to delete may take additional time to determine,
|
||||
the same as for requesting an exact fraction with *pstyle* =
|
||||
*fraction*.
|
||||
|
||||
Which atoms are eligible for deletion for style *random* is determined
|
||||
by the specified *group-ID* and *region-ID*. To be eligible, an atom
|
||||
must be in both the specified group and region. If *group-ID* = all,
|
||||
there is effectively no group criterion. If *region-ID* is specified
|
||||
as NULL, no region criterion is imposed.
|
||||
|
||||
For style *variable*, all atoms for which the atom-style variable with
|
||||
the given name evaluates to non-zero will be deleted. Additional atoms
|
||||
can be deleted if they are in a molecule for which one or more atoms
|
||||
were deleted within the region; see the *mol* keyword discussion below.
|
||||
This option allows complex selections of atoms not covered by the
|
||||
other options listed above.
|
||||
|
||||
----------
|
||||
|
||||
Here is the meaning of the optional keywords.
|
||||
|
||||
If the *compress* keyword is set to *yes*, then after atoms are
|
||||
deleted, then atom IDs are re-assigned so that they run from 1 to the
|
||||
|
||||
@ -133,13 +133,14 @@ Examples
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
dump myDump all atom 100 dump.atom
|
||||
dump myDump all atom 100 dump.lammpstrj
|
||||
dump myDump all atom/mpiio 100 dump.atom.mpiio
|
||||
dump myDump all atom/gz 100 dump.atom.gz
|
||||
dump myDump all atom/zstd 100 dump.atom.zst
|
||||
dump 2 subgroup atom 50 dump.run.bin
|
||||
dump 2 subgroup atom/mpiio 50 dump.run.mpiio.bin
|
||||
dump 4a all custom 100 dump.myforce.* id type x y vx fx
|
||||
dump 4a all custom 100 dump.myvel.lammpsbin id type x y z vx vy vz
|
||||
dump 4b flow custom 100 dump.%.myforce id type c_myF[3] v_ke
|
||||
dump 4b flow custom 100 dump.%.myforce id type c_myF[*] v_ke
|
||||
dump 2 inner cfg 10 dump.snap.*.cfg mass type xs ys zs vx vy vz
|
||||
@ -419,6 +420,7 @@ style.
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
creator: LAMMPS
|
||||
timestep: 0
|
||||
units: lj
|
||||
time: 0
|
||||
@ -534,11 +536,11 @@ MPI-IO.
|
||||
Note that MPI-IO dump files are one large file which all processors
|
||||
write to. You thus cannot use the "%" wildcard character described
|
||||
above in the filename since that specifies generation of multiple
|
||||
files. You can use the ".bin" suffix described below in an MPI-IO
|
||||
files. You can use the ".bin" or ".lammpsbin" suffix described below in an MPI-IO
|
||||
dump file; again this file will be written in parallel and have the
|
||||
same binary format as if it were written without MPI-IO.
|
||||
|
||||
If the filename ends with ".bin", the dump file (or files, if "\*" or
|
||||
If the filename ends with ".bin" or ".lammpsbin", the dump file (or files, if "\*" or
|
||||
"%" is also used) is written in binary format. A binary dump file
|
||||
will be about the same size as a text version, but will typically
|
||||
write out much faster. Of course, when post-processing, you will need
|
||||
|
||||
@ -44,7 +44,7 @@ Syntax
|
||||
color = *type*
|
||||
bflag1,bflag2 = 2 numeric flags to affect how bodies are drawn
|
||||
*fix* = fixID color fflag1 fflag2
|
||||
fixID = ID of fix that generates objects to dray
|
||||
fixID = ID of fix that generates objects to draw
|
||||
color = *type*
|
||||
fflag1,fflag2 = 2 numeric flags to affect how fix objects are drawn
|
||||
*size* values = width height = size of images
|
||||
|
||||
@ -392,9 +392,8 @@ keyword. For *atom* dump styles only the keywords "id", "type", "x",
|
||||
"y", "z", "ix", "iy", "iz" can be accessed via string regardless of
|
||||
whether scaled or unwrapped coordinates were enabled or disabled, and
|
||||
it always assumes 8 columns for indexing regardless of whether image
|
||||
flags are enabled or not. For dump style *cfg* only the "auxiliary"
|
||||
keywords (6th or later keyword) may be changed and the column indexing
|
||||
considers only them (i.e. the 6th keyword is the the 1st column).
|
||||
flags are enabled or not. For dump style *cfg* only changes to the
|
||||
"auxiliary" keywords (6th or later keyword) will become visible.
|
||||
|
||||
The *colname* keyword can be used multiple times. If multiple *colname*
|
||||
settings refer to the same keyword, the last setting has precedence. A
|
||||
|
||||
@ -211,6 +211,9 @@ accelerated styles exist.
|
||||
* :doc:`edpd/source <fix_dpd_source>` - add heat source to eDPD simulations
|
||||
* :doc:`efield <fix_efield>` - impose electric field on system
|
||||
* :doc:`ehex <fix_ehex>` - enhanced heat exchange algorithm
|
||||
* :doc:`electrode/conp <fix_electrode_conp>` - impose electric potential
|
||||
* :doc:`electrode/conq <fix_electrode_conp>` - impose total electric charge
|
||||
* :doc:`electrode/thermo <fix_electrode_conp>` - apply thermo-potentiostat
|
||||
* :doc:`electron/stopping <fix_electron_stopping>` - electronic stopping power as a friction force
|
||||
* :doc:`electron/stopping/fit <fix_electron_stopping>` - electronic stopping power as a friction force
|
||||
* :doc:`enforce2d <fix_enforce2d>` - zero out z-dimension velocity and force
|
||||
|
||||
@ -13,7 +13,7 @@ Syntax
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* accelerate/cos = style name of this fix command
|
||||
* value = amplitude of acceleration (in unit of force/mass)
|
||||
* value = amplitude of acceleration (in unit of velocity/time)
|
||||
|
||||
|
||||
Examples
|
||||
|
||||
@ -14,7 +14,7 @@ Syntax
|
||||
* adapt = style name of this fix command
|
||||
* N = adapt simulation settings every this many timesteps
|
||||
* one or more attribute/arg pairs may be appended
|
||||
* attribute = *pair* or *bond* or *kspace* or *atom*
|
||||
* attribute = *pair* or *bond* or *angle* or *kspace* or *atom*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -28,11 +28,16 @@ Syntax
|
||||
bparam = parameter to adapt over time
|
||||
I = type bond to set parameter for
|
||||
v_name = variable with name that calculates value of bparam
|
||||
*angle* args = astyle aparam I v_name
|
||||
astyle = angle style name, e.g. harmonic
|
||||
aparam = parameter to adapt over time
|
||||
I = type angle to set parameter for
|
||||
v_name = variable with name that calculates value of aparam
|
||||
*kspace* arg = v_name
|
||||
v_name = variable with name that calculates scale factor on K-space terms
|
||||
*atom* args = aparam v_name
|
||||
aparam = parameter to adapt over time
|
||||
v_name = variable with name that calculates value of aparam
|
||||
*atom* args = atomparam v_name
|
||||
atomparam = parameter to adapt over time
|
||||
v_name = variable with name that calculates value of atomparam
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *scale* or *reset* or *mass*
|
||||
@ -283,30 +288,62 @@ operates. The only difference is that now a bond coefficient for a
|
||||
given bond type is adapted.
|
||||
|
||||
A wild-card asterisk can be used in place of or in conjunction with
|
||||
the bond type argument to set the coefficients for multiple bond types.
|
||||
This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of
|
||||
atom types, then an asterisk with no numeric values means all types
|
||||
from 1 to N. A leading asterisk means all types from 1 to n (inclusive).
|
||||
A trailing asterisk means all types from n to N (inclusive). A middle
|
||||
asterisk means all types from m to n (inclusive).
|
||||
the bond type argument to set the coefficients for multiple bond
|
||||
types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N =
|
||||
the number of bond types, then an asterisk with no numeric values
|
||||
means all types from 1 to N. A leading asterisk means all types from
|
||||
1 to n (inclusive). A trailing asterisk means all types from n to N
|
||||
(inclusive). A middle asterisk means all types from m to n
|
||||
(inclusive).
|
||||
|
||||
Currently *bond* does not support bond_style hybrid nor bond_style
|
||||
hybrid/overlay as bond styles. The only bonds that currently are
|
||||
working with fix_adapt are
|
||||
hybrid/overlay as bond styles. The bond styles that currently work
|
||||
with fix_adapt are
|
||||
|
||||
+------------------------------------+-------+------------+
|
||||
| :doc:`class2 <bond_class2>` | r0 | type bonds |
|
||||
+------------------------------------+-------+------------+
|
||||
| :doc:`fene <bond_fene>` | k, r0 | type bonds |
|
||||
+------------------------------------+-------+------------+
|
||||
| :doc:`gromos <bond_gromos>` | k, r0 | type bonds |
|
||||
+------------------------------------+-------+------------+
|
||||
| :doc:`harmonic <bond_harmonic>` | k,r0 | type bonds |
|
||||
+------------------------------------+-------+------------+
|
||||
| :doc:`morse <bond_morse>` | r0 | type bonds |
|
||||
+------------------------------------+-------+------------+
|
||||
| :doc:`nonlinear <bond_nonlinear>` | r0 | type bonds |
|
||||
+------------------------------------+-------+------------+
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`class2 <bond_class2>` | r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`fene <bond_fene>` | k,r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`fene/nm <bond_fene>` | k,r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`gromos <bond_gromos>` | k,r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`harmonic <bond_harmonic>` | k,r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`morse <bond_morse>` | r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`nonlinear <bond_nonlinear>` | epsilon,r0 | type bonds |
|
||||
+------------------------------------+-------+-----------------+
|
||||
|
||||
----------
|
||||
|
||||
The *angle* keyword uses the specified variable to change the value of
|
||||
an angle coefficient over time, very similar to how the *pair* keyword
|
||||
operates. The only difference is that now an angle coefficient for a
|
||||
given angle type is adapted.
|
||||
|
||||
A wild-card asterisk can be used in place of or in conjunction with
|
||||
the angle type argument to set the coefficients for multiple angle
|
||||
types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N =
|
||||
the number of angle types, then an asterisk with no numeric values
|
||||
means all types from 1 to N. A leading asterisk means all types from
|
||||
1 to n (inclusive). A trailing asterisk means all types from n to N
|
||||
(inclusive). A middle asterisk means all types from m to n
|
||||
(inclusive).
|
||||
|
||||
Currently *angle* does not support angle_style hybrid nor angle_style
|
||||
hybrid/overlay as angle styles. The angle styles that currently work
|
||||
with fix_adapt are
|
||||
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`harmonic <angle_harmonic>` | k,theta0 | type angles |
|
||||
+------------------------------------+-------+-----------------+
|
||||
| :doc:`cosine <angle_cosine>` | k | type angles |
|
||||
+------------------------------------+-------+-----------------+
|
||||
|
||||
Note that internally, theta0 is stored in radians, so the variable
|
||||
this fix uses to reset theta0 needs to generate values in radians.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Syntax
|
||||
f_ID = global scalar calculated by a fix with ID
|
||||
f_ID[I] = Ith component of global vector calculated by a fix with ID, I can include wildcard (see below)
|
||||
v_name = global value calculated by an equal-style variable with name
|
||||
v_name[I] = Ith component of a vector-style variable with name
|
||||
v_name[I] = Ith component of a vector-style variable with name, I can include wildcard (see below)
|
||||
|
||||
* zero or more keyword/arg pairs may be appended
|
||||
* keyword = *type* or *ave* or *start* or *prefactor* or *file* or *overwrite* or *title1* or *title2* or *title3*
|
||||
@ -105,20 +105,21 @@ individual fixes for info on which ones produce such values.
|
||||
ones that can be used with this fix. Variables of style *atom* cannot
|
||||
be used, since they produce per-atom values.
|
||||
|
||||
Note that for values from a compute or fix, the bracketed index I can
|
||||
be specified using a wildcard asterisk with the index to effectively
|
||||
specify multiple values. This takes the form "\*" or "\*n" or "n\*" or
|
||||
"m\*n". If N = the size of the vector (for *mode* = scalar) or the
|
||||
number of columns in the array (for *mode* = vector), then an asterisk
|
||||
with no numeric values means all indices from 1 to N. A leading
|
||||
asterisk means all indices from 1 to n (inclusive). A trailing
|
||||
asterisk means all indices from n to N (inclusive). A middle asterisk
|
||||
means all indices from m to n (inclusive).
|
||||
----------
|
||||
|
||||
For input values from a compute or fix or variable , the bracketed
|
||||
index I can be specified using a wildcard asterisk with the index to
|
||||
effectively specify multiple values. This takes the form "\*" or
|
||||
"\*n" or "n\*" or "m\*n". If N = the size of the vector, then an
|
||||
asterisk with no numeric values means all indices from 1 to N. A
|
||||
leading asterisk means all indices from 1 to n (inclusive). A
|
||||
trailing asterisk means all indices from n to N (inclusive). A middle
|
||||
asterisk means all indices from m to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual elements of the
|
||||
vector had been listed one by one. E.g. these 2 fix ave/correlate
|
||||
commands are equivalent, since the :doc:`compute pressure <compute_pressure>` command creates a global vector with 6
|
||||
values.
|
||||
commands are equivalent, since the :doc:`compute pressure
|
||||
<compute_pressure>` command creates a global vector with 6 values.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -128,6 +129,14 @@ values.
|
||||
c_myPress[1] c_myPress[2] c_myPress[3] &
|
||||
c_myPress[4] c_myPress[5] c_myPress[6]
|
||||
|
||||
.. note::
|
||||
|
||||
For a vector-style variable, only the wildcard forms "\*n" or
|
||||
"m\*n" are allowed. You must specify the upper bound, because
|
||||
vector-style variable lengths are not determined until the variable
|
||||
is evaluated. If n is specified larger than the vector length
|
||||
turns out to be, zeroes are output for missing vector values.
|
||||
|
||||
----------
|
||||
|
||||
The *Nevery*, *Nrepeat*, and *Nfreq* arguments specify on what
|
||||
|
||||
@ -32,7 +32,7 @@ Syntax
|
||||
f_ID = scalar or vector calculated by a fix with ID
|
||||
f_ID[I] = Ith component of vector or Ith column of array calculated by a fix with ID, I can include wildcard (see below)
|
||||
v_name = value(s) calculated by an equal-style or vector-style or atom-style variable with name
|
||||
v_name[I] = value calculated by a vector-style variable with name
|
||||
v_name[I] = value calculated by a vector-style variable with name, I can include wildcard (see below)
|
||||
|
||||
* zero or more keyword/arg pairs may be appended
|
||||
* keyword = *mode* or *file* or *ave* or *start* or *beyond* or *overwrite* or *title1* or *title2* or *title3*
|
||||
@ -120,27 +120,6 @@ If *mode* = vector, then the input values must be vectors, or arrays
|
||||
with a bracketed term appended, indicating the Ith column of the array
|
||||
is used.
|
||||
|
||||
Note that for values from a compute or fix, the bracketed index I can
|
||||
be specified using a wildcard asterisk with the index to effectively
|
||||
specify multiple values. This takes the form "\*" or "\*n" or "n\*" or
|
||||
"m\*n". If N = the size of the vector (for *mode* = scalar) or the
|
||||
number of columns in the array (for *mode* = vector), then an asterisk
|
||||
with no numeric values means all indices from 1 to N. A leading
|
||||
asterisk means all indices from 1 to n (inclusive). A trailing
|
||||
asterisk means all indices from n to N (inclusive). A middle asterisk
|
||||
means all indices from m to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual elements of the
|
||||
vector or columns of the array had been listed one by one. E.g. these
|
||||
2 fix ave/histo commands are equivalent, since the :doc:`compute com/chunk <compute_com_chunk>` command creates a global array with
|
||||
3 columns:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute myCOM all com/chunk
|
||||
fix 1 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[*] file tmp1.com mode vector
|
||||
fix 2 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[1] c_myCOM[2] c_myCOM[3] file tmp2.com mode vector
|
||||
|
||||
If the fix ave/histo/weight command is used, exactly two values must
|
||||
be specified. If the values are vectors, they must be the same
|
||||
length. The first value (a scalar or vector) is what is histogrammed
|
||||
@ -153,6 +132,38 @@ the first vector.
|
||||
|
||||
----------
|
||||
|
||||
For input values from a compute or fix or variable, the bracketed
|
||||
index I can be specified using a wildcard asterisk with the index to
|
||||
effectively specify multiple values. This takes the form "\*" or
|
||||
"\*n" or "n\*" or "m\*n". If N = the size of the vector (for *mode* =
|
||||
scalar) or the number of columns in the array (for *mode* = vector),
|
||||
then an asterisk with no numeric values means all indices from 1 to N.
|
||||
A leading asterisk means all indices from 1 to n (inclusive). A
|
||||
trailing asterisk means all indices from n to N (inclusive). A middle
|
||||
asterisk means all indices from m to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual elements of the
|
||||
vector or columns of the array had been listed one by one. E.g. these
|
||||
2 fix ave/histo commands are equivalent, since the :doc:`compute
|
||||
com/chunk <compute_com_chunk>` command creates a global array with 3
|
||||
columns:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute myCOM all com/chunk
|
||||
fix 1 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[*] file tmp1.com mode vector
|
||||
fix 2 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[1] c_myCOM[2] c_myCOM[3] file tmp2.com mode vector
|
||||
|
||||
.. note::
|
||||
|
||||
For a vector-style variable, only the wildcard forms "\*n" or
|
||||
"m\*n" are allowed. You must specify the upper bound, because
|
||||
vector-style variable lengths are not determined until the variable
|
||||
is evaluated. If n is specified larger than the vector length
|
||||
turns out to be, zeroes are output for missing vector values.
|
||||
|
||||
----------
|
||||
|
||||
The *Nevery*, *Nrepeat*, and *Nfreq* arguments specify on what
|
||||
timesteps the input values will be used in order to contribute to the
|
||||
histogram. The final histogram is generated on timesteps that are
|
||||
|
||||
@ -25,7 +25,7 @@ Syntax
|
||||
f_ID = global scalar or vector calculated by a fix with ID
|
||||
f_ID[I] = Ith component of global vector or Ith column of global array calculated by a fix with ID, I can include wildcard (see below)
|
||||
v_name = value(s) calculated by an equal-style or vector-style variable with name
|
||||
v_name[I] = value calculated by a vector-style variable with name
|
||||
v_name[I] = value calculated by a vector-style variable with name, I can include wildcard (see below)
|
||||
|
||||
* zero or more keyword/arg pairs may be appended
|
||||
* keyword = *mode* or *file* or *ave* or *start* or *off* or *overwrite* or *title1* or *title2* or *title3*
|
||||
@ -113,20 +113,23 @@ with a bracketed term appended, indicating the Ith column of the array
|
||||
is used. All vectors must be the same length, which is the length of
|
||||
the vector or number of rows in the array.
|
||||
|
||||
Note that for values from a compute or fix, the bracketed index I can
|
||||
be specified using a wildcard asterisk with the index to effectively
|
||||
specify multiple values. This takes the form "\*" or "\*n" or "n\*" or
|
||||
"m\*n". If N = the size of the vector (for *mode* = scalar) or the
|
||||
number of columns in the array (for *mode* = vector), then an asterisk
|
||||
with no numeric values means all indices from 1 to N. A leading
|
||||
asterisk means all indices from 1 to n (inclusive). A trailing
|
||||
asterisk means all indices from n to N (inclusive). A middle asterisk
|
||||
means all indices from m to n (inclusive).
|
||||
----------
|
||||
|
||||
For input values from a compute or fix or variable, the bracketed
|
||||
index I can be specified using a wildcard asterisk with the index to
|
||||
effectively specify multiple values. This takes the form "\*" or
|
||||
"\*n" or "n\*" or "m\*n". If N = the size of the vector (for *mode* =
|
||||
scalar) or the number of columns in the array (for *mode* = vector),
|
||||
then an asterisk with no numeric values means all indices from 1 to N.
|
||||
A leading asterisk means all indices from 1 to n (inclusive). A
|
||||
trailing asterisk means all indices from n to N (inclusive). A middle
|
||||
asterisk means all indices from m to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual elements of the
|
||||
vector or columns of the array had been listed one by one. E.g. these
|
||||
2 fix ave/time commands are equivalent, since the :doc:`compute rdf <compute_rdf>` command creates, in this case, a global array
|
||||
with 3 columns, each of length 50:
|
||||
2 fix ave/time commands are equivalent, since the :doc:`compute rdf
|
||||
<compute_rdf>` command creates, in this case, a global array with 3
|
||||
columns, each of length 50:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -134,6 +137,14 @@ with 3 columns, each of length 50:
|
||||
fix 1 all ave/time 100 1 100 c_myRDF[*] file tmp1.rdf mode vector
|
||||
fix 2 all ave/time 100 1 100 c_myRDF[1] c_myRDF[2] c_myRDF[3] file tmp2.rdf mode vector
|
||||
|
||||
.. note::
|
||||
|
||||
For a vector-style variable, only the wildcard forms "\*n" or
|
||||
"m\*n" are allowed. You must specify the upper bound, because
|
||||
vector-style variable lengths are not determined until the variable
|
||||
is evaluated. If n is specified larger than the vector length
|
||||
turns out to be, zeroes are output for missing vector values.
|
||||
|
||||
----------
|
||||
|
||||
The *Nevery*, *Nrepeat*, and *Nfreq* arguments specify on what
|
||||
@ -169,9 +180,12 @@ asterisk to effectively specify multiple values.
|
||||
Note that there is a :doc:`compute reduce <compute_reduce>` command
|
||||
which can sum per-atom quantities into a global scalar or vector which
|
||||
can thus be accessed by fix ave/time. Or it can be a compute defined
|
||||
not in your input script, but by :doc:`thermodynamic output <thermo_style>` or other fixes such as :doc:`fix nvt <fix_nh>` or :doc:`fix temp/rescale <fix_temp_rescale>`. See
|
||||
the doc pages for these commands which give the IDs of these computes.
|
||||
Users can also write code for their own compute styles and :doc:`add them to LAMMPS <Modify>`.
|
||||
not in your input script, but by :doc:`thermodynamic output
|
||||
<thermo_style>` or other fixes such as :doc:`fix nvt <fix_nh>` or
|
||||
:doc:`fix temp/rescale <fix_temp_rescale>`. See the doc pages for
|
||||
these commands which give the IDs of these computes. Users can also
|
||||
write code for their own compute styles and :doc:`add them to LAMMPS
|
||||
<Modify>`.
|
||||
|
||||
If a value begins with "f\_", a fix ID must follow which has been
|
||||
previously defined in the input script. If *mode* = scalar, then if
|
||||
@ -258,10 +272,18 @@ each input value specified in the fix ave/time command. For *mode* =
|
||||
scalar, this means a single line is written each time output is
|
||||
performed. Thus the file ends up to be a series of lines, i.e. one
|
||||
column of numbers for each input value. For *mode* = vector, an array
|
||||
of numbers is written each time output is performed. The number of
|
||||
rows is the length of the input vectors, and the number of columns is
|
||||
the number of values. Thus the file ends up to be a series of these
|
||||
array sections.
|
||||
of numbers is written each time output is performed. The number of rows
|
||||
is the length of the input vectors, and the number of columns is the
|
||||
number of values. Thus the file ends up to be a series of these array
|
||||
sections.
|
||||
|
||||
If the filename ends in '.yaml' or '.yml' then the output format
|
||||
conforms to the `YAML standard <https://yaml.org/>`_ which allows
|
||||
easy import that data into tools and scripts that support reading YAML
|
||||
files. The :doc:`structured data Howto <Howto_structured_data>` contains
|
||||
examples for parsing and plotting such data with very little programming
|
||||
effort in Python using the *pyyaml*, *pandas*, and *matplotlib*
|
||||
packages.
|
||||
|
||||
The *overwrite* keyword will continuously overwrite the output file
|
||||
with the latest output, so that it only contains one timestep worth of
|
||||
@ -307,8 +329,10 @@ appropriate fields from the fix ave/time command.
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to :doc:`binary restart files <restart>`. None of the :doc:`fix_modify <fix_modify>` options
|
||||
are relevant to this fix.
|
||||
No information about this fix is written to :doc:`binary restart files
|
||||
<restart>`. The :doc:`fix_modify colname <fix_modify>` option can be
|
||||
used to change the name of the column in the output file. When writing
|
||||
a YAML format file this name will be in the list of keywords.
|
||||
|
||||
This fix produces a global scalar or global vector or global array
|
||||
which can be accessed by various :doc:`output commands <Howto_output>`.
|
||||
|
||||
221
doc/src/fix_electrode_conp.rst
Normal file
221
doc/src/fix_electrode_conp.rst
Normal file
@ -0,0 +1,221 @@
|
||||
.. index:: fix electrode/conp
|
||||
.. index:: fix electrode/conq
|
||||
.. index:: fix electrode/thermo
|
||||
.. index:: fix electrode/conp/intel
|
||||
.. index:: fix electrode/conq/intel
|
||||
.. index:: fix electrode/thermo/intel
|
||||
|
||||
fix electrode/conp command
|
||||
==========================
|
||||
|
||||
Accelerator Variant: *electrode/conp/intel*
|
||||
|
||||
fix electrode/conq command
|
||||
==========================
|
||||
|
||||
Accelerator Variant: *electrode/conq/intel*
|
||||
|
||||
fix electrode/thermo command
|
||||
============================
|
||||
|
||||
Accelerator Variant: *electrode/thermo/intel*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID electrode/conp potential eta keyword values ...
|
||||
fix ID group-ID electrode/conq charge eta keyword values ...
|
||||
fix ID group-ID electrode/thermo potential eta temp T_v tau_v rng_v keyword values ...
|
||||
|
||||
* ID, group-ID are documented in fix command
|
||||
* mode = electrode/conp or electrode/conq or electrode/thermo
|
||||
* potential = electrode potential
|
||||
* charge = electrode charge
|
||||
* eta = reciprocal width of electrode charge smearing
|
||||
* T_v = temperature of thermo-potentiostat
|
||||
* tau_v = time constant of thermo-potentiostat
|
||||
* rng_v = integer used to initialize random number generator
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*symm(etry) on/off*
|
||||
turn on/off charge neutrality constraint for the electrodes
|
||||
*couple group-ID value*
|
||||
group-ID = group of atoms treated as additional electrode
|
||||
value = electric potential or charge on this electrode
|
||||
*etypes values = atom types*
|
||||
specify atom types exclusive to the electrode for optimized neighbor lists
|
||||
*ffield on/off*
|
||||
turn on/off finite-field implementation
|
||||
*write_mat filename*
|
||||
write elastance matrix to file
|
||||
*write_inv filename*
|
||||
write inverted matrix to file
|
||||
*read_mat filename*
|
||||
read elastance matrix from file
|
||||
*read_inv filename*
|
||||
read inverted matrix from file
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix fxconp bot electrode/conp -1.0 1.805 couple top 1.0 couple ref 0.0 write_inv inv.csv symm on
|
||||
fix fxconp electrodes electrode/conq 0.0 1.805
|
||||
fix fxconp bot electrode/thermo -1.0 1.805 temp 298 100 couple top 1.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
fix electrode/conp mode implements a constant potential method (CPM)
|
||||
(:ref:`Siepmann <Siepmann>`, :ref:`Reed <Reed3>`). Charges of groups specified
|
||||
via group-ID and optionally with the `couple` keyword are adapted to meet their respective
|
||||
potential at every time step. An arbitrary number of electrodes can be set but
|
||||
the respective groups may not overlap. Electrode charges have a Gaussian charge
|
||||
distribution with reciprocal width eta. The energy minimization is achieved via
|
||||
matrix inversion :ref:`(Wang) <Wang5>`.
|
||||
|
||||
fix electrode/conq enforces a total charge specified in the input on each electrode. The energy is
|
||||
minimized w.r.t. the charge distribution within the electrode.
|
||||
|
||||
fix electrode/thermo implements a thermo-potentiostat :ref:`(Deissenbeck)
|
||||
<Deissenbeck>`. Temperature and time constant of the thermo-potentiostat need
|
||||
to be specified using the temp keyword. Currently, only two electrodes are possible with
|
||||
this style.
|
||||
|
||||
This fix necessitates the use of a long range solver that calculates and provides the matrix
|
||||
of electrode-electrode interactions and a vector of electrode-electrolyte
|
||||
interactions. The Kspace styles *ewald/electrode*, *pppm/electrode* and
|
||||
*pppm/electrode/intel* are created specifically for this task
|
||||
:ref:`(Ahrens-Iwers) <Ahrens-Iwers>`.
|
||||
|
||||
For systems with non-periodic boundaries in one or two directions dipole
|
||||
corrections are available with the :doc:`kspace_modify <kspace_modify>`. For
|
||||
ewald/electrode a two-dimensional Ewald summation :ref:`(Hu) <Hu>` can be used
|
||||
by setting "slab ew2d":
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
kspace_modify slab <slab_factor>
|
||||
kspace_modify wire <wire_factor>
|
||||
kspace_modify slab ew2d
|
||||
|
||||
Two implementations for the calculation of the elastance matrix are available
|
||||
with pppm and can be selected using the *amat onestep/twostep* keyword.
|
||||
*onestep* is the default; *twostep* can be faster for large electrodes and a
|
||||
moderate mesh size but requires more memory.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
kspace_modify amat onestep/twostep
|
||||
|
||||
|
||||
The *fix_modify tf* option enables the Thomas-Fermi metallicity model
|
||||
(:ref:`Scalfi <Scalfi>`) and allows parameters to be set for each atom type.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify ID tf type length voronoi
|
||||
|
||||
|
||||
If this option is used parameters must be set for all atom types of the electrode.
|
||||
|
||||
The *fix_modify timer* option turns on (off) additional timer outputs in the log
|
||||
file, for code developers to track optimization.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify ID timer on/off
|
||||
|
||||
The *fix_modify set* options allow calculated quantities to be accessed via
|
||||
internal variables. Currently four types of quantities can be accessed:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix-modify ID set v group-ID variablename
|
||||
fix-modify ID set qsb group-ID variablename
|
||||
fix-modify ID set mc group-ID1 group-ID2 variablename
|
||||
fix-modify ID set me group-ID1 group-ID2 variablename
|
||||
|
||||
One use case is to output the potential that is internally calculated and
|
||||
applied to each electrode group by *fix electrode/conq* or *fix electrode/thermo*.
|
||||
For that case the *v* option makes *fix electrode* update the variable
|
||||
*variablename* with the potential applied to group *group-ID*, where *group-ID*
|
||||
must be a group whose charges are updated by *fix electrode* and *variablename*
|
||||
must be an internal-style variable:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix conq bot electrode/conq -1.0 1.979 couple top 1.0
|
||||
variable vbot internal 0.0
|
||||
fix_modify conq set v bot vbot
|
||||
|
||||
The *qsb* option similarly outputs the total updated charge of the group if its
|
||||
potential were 0.0V. The *mc* option requires two *group-IDs*, and outputs the
|
||||
entry \{*group-ID1*, *group-ID2*\} of the (symmetric) *macro-capacitance* matrix
|
||||
(MC) which relates the electrodes' applied potentials (V), total charges (Q), and
|
||||
total charges at 0.0 V (Qsb):
|
||||
|
||||
.. math::
|
||||
|
||||
\mathbf{Q} = \mathbf{Q}_{SB} + \mathbf{MC} \cdot \mathbf{V}
|
||||
|
||||
Lastly, the *me* option also requires two *group-IDs* and outputs the entry
|
||||
\{*group-ID1*, *group-ID2*\} of the *macro-elastance* matrix, which is the
|
||||
inverse of the macro-capacitance matrix. (As the names denote, the
|
||||
macro-capacitance matrix gives electrode charges from potentials, and the
|
||||
macro-elastance matrix gives electrode potentials from charges).
|
||||
|
||||
.. warning::
|
||||
|
||||
Positions of electrode particles have to be immobilized at all times.
|
||||
|
||||
The parallelization for the fix works best if electrode atoms are evenly
|
||||
distributed across processors. For a system with two electrodes at the bottom
|
||||
and top of the cell this can be achieved with *processors * * 2*, or with the
|
||||
line
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
if "$(extract_setting(world_size) % 2) == 0" then "processors * * 2"
|
||||
|
||||
which avoids an error if the script is run on an odd number of processors (such
|
||||
as on just one processor for testing).
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
----------
|
||||
|
||||
.. _Siepmann:
|
||||
|
||||
**(Siepmann)** Siepmann and Sprik, J. Chem. Phys. 102, 511 (1995).
|
||||
|
||||
.. _Reed3:
|
||||
|
||||
**(Reed)** Reed *et al.*, J. Chem. Phys. 126, 084704 (2007).
|
||||
|
||||
.. _Wang5:
|
||||
|
||||
**(Wang)** Wang *et al.*, J. Chem. Phys. 141, 184102 (2014).
|
||||
|
||||
.. _Deissenbeck:
|
||||
|
||||
**(Deissenbeck)** Deissenbeck *et al.*, Phys. Rev. Letters 126, 136803 (2021).
|
||||
|
||||
.. _Ahrens-Iwers:
|
||||
|
||||
**(Ahrens-Iwers)** Ahrens-Iwers and Meissner, J. Chem. Phys. 155, 104104 (2021).
|
||||
|
||||
.. _Hu:
|
||||
|
||||
**(Hu)** Hu, J. Chem. Theory Comput. 10, 5254 (2014).
|
||||
|
||||
.. _Scalfi:
|
||||
|
||||
**(Scalfi)** Scalfi *et al.*, J. Chem. Phys., 153, 174704 (2020).
|
||||
|
||||
@ -75,7 +75,7 @@ doc page. This description of LHD builds on the GHD description.
|
||||
|
||||
The definition of bonds and :math:`E_{ij}` are the same for GHD and LHD.
|
||||
The formulas for :math:`V^{max}_{ij}` and :math:`F^{max}_{ij}` are also
|
||||
the same except for a pre-factor :math:`C_{ij}`, explained below.
|
||||
the same except for a prefactor :math:`C_{ij}`, explained below.
|
||||
|
||||
The bias energy :math:`V_{ij}` applied to a bond *ij* with maximum strain is
|
||||
|
||||
@ -256,7 +256,7 @@ Note that this fix does not know the *cutevent* parameter, but uses
|
||||
half the *cutbond* parameter as an estimate to warn if the ghost
|
||||
cutoff is not long enough.
|
||||
|
||||
As described above the *alpha* argument is a pre-factor in the
|
||||
As described above the *alpha* argument is a prefactor in the
|
||||
boostostat update equation for each bond's :math:`C_{ij}` prefactor.
|
||||
*Alpha* is specified in time units, similar to other thermostat or barostat
|
||||
damping parameters. It is roughly the physical time it will take the
|
||||
|
||||
@ -12,19 +12,23 @@ Syntax
|
||||
|
||||
* fix-ID = ID of the fix to modify
|
||||
* one or more keyword/value pairs may be appended
|
||||
* keyword = *temp* or *press* or *energy* or *virial* or *respa* or *dynamic/dof* or *bodyforces*
|
||||
* keyword = *bodyforces* or *colname* or *dynamic/dof* or *energy* or *press* or *respa* or *temp* or *virial*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*temp* value = compute ID that calculates a temperature
|
||||
*press* value = compute ID that calculates a pressure
|
||||
*energy* value = *yes* or *no*
|
||||
*virial* value = *yes* or *no*
|
||||
*respa* value = *1* to *max respa level* or *0* (for outermost level)
|
||||
*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
|
||||
*bodyforces* value = *early* or *late*
|
||||
early/late = compute rigid-body forces/torques early or late in the timestep
|
||||
*colname* values = ID string
|
||||
string = new column header name
|
||||
ID = integer from 1 to N, or integer from -1 to -N, where N = # of quantities being output
|
||||
*or* a fix output property keyword or reference to compute, fix, property or variable.
|
||||
*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
|
||||
*energy* value = *yes* or *no*
|
||||
*press* value = compute ID that calculates a pressure
|
||||
*respa* value = *1* to *max respa level* or *0* (for outermost level)
|
||||
*temp* value = compute ID that calculates a temperature
|
||||
*virial* value = *yes* or *no*
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -34,6 +38,7 @@ Examples
|
||||
fix_modify 3 temp myTemp press myPress
|
||||
fix_modify 1 energy yes
|
||||
fix_modify tether respa 2
|
||||
fix_modify ave colname c_thermo_press Pressure colname 1 Temperature
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
@ -165,6 +170,20 @@ will have no effect on the motion of the rigid bodies if they are
|
||||
specified in the input script after the fix rigid command. LAMMPS
|
||||
will give a warning if that is the case.
|
||||
|
||||
|
||||
The *colname* keyword can be used to change the default header keywords
|
||||
in output files of fix styles that support it: currently only :doc:`fix
|
||||
ave/time <fix_ave_time>` is supported. The setting for *ID string*
|
||||
replaces the default text with the provided string. *ID* can be a
|
||||
positive integer when it represents the column number counting from the
|
||||
left, a negative integer when it represents the column number from the
|
||||
right (i.e. -1 is the last column/keyword), or a custom fix output
|
||||
keyword (or compute, fix, property, or variable reference) and then it
|
||||
replaces the string for that specific keyword. The *colname* keyword can
|
||||
be used multiple times. If multiple *colname* settings refer to the same
|
||||
keyword, the last setting has precedence.
|
||||
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
none
|
||||
@ -172,7 +191,8 @@ none
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix <fix>`, :doc:`compute temp <compute_temp>`, :doc:`compute pressure <compute_pressure>`, :doc:`thermo_style <thermo_style>`
|
||||
:doc:`fix <fix>`, :doc:`compute temp <compute_temp>`,
|
||||
:doc:`compute pressure <compute_pressure>`, :doc:`thermo_style <thermo_style>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -21,7 +21,8 @@ Syntax
|
||||
* momentum = style name of this fix command
|
||||
* N = adjust the momentum every this many timesteps
|
||||
one or more keyword/value pairs may be appended
|
||||
* keyword = *linear* or *angular* or *rescale*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID momentum/chunk N chunkID keyword values ...
|
||||
|
||||
@ -30,7 +31,7 @@ Syntax
|
||||
* N = adjust the momentum per chunk every this many timesteps
|
||||
* chunkID = ID of :doc:`compute chunk/atom <compute_chunk_atom>` command
|
||||
|
||||
one or more keyword/value pairs may be appended
|
||||
one or more keyword/value settings may be appended to each of the fix commands:
|
||||
* keyword = *linear* or *angular* or *rescale*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -35,6 +35,10 @@ consistent with the microcanonical ensemble (NVE) provided there
|
||||
are (full) periodic boundary conditions and no other "manipulations"
|
||||
of the system (e.g. fixes that modify forces or velocities).
|
||||
|
||||
This fix invokes the velocity form of the
|
||||
Stoermer-Verlet time integration algorithm (velocity-Verlet). Other
|
||||
time integration options can be invoked using the :doc:`run_style <run_style>` command.
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
@ -57,7 +61,7 @@ Restrictions
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix nvt <fix_nh>`, :doc:`fix npt <fix_nh>`
|
||||
:doc:`fix nvt <fix_nh>`, :doc:`fix npt <fix_nh>`, :doc:`run_style <run_style>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -39,19 +39,35 @@ Description
|
||||
Print a text string every N steps during a simulation run. This can
|
||||
be used for diagnostic purposes or as a debugging tool to monitor some
|
||||
quantity during a run. The text string must be a single argument, so
|
||||
it should be enclosed in double quotes if it is more than one word.
|
||||
If it contains variables it must be enclosed in double quotes to
|
||||
insure they are not evaluated when the input script line is read, but
|
||||
will instead be evaluated each time the string is printed.
|
||||
it should be enclosed in single or double quotes if it is more than
|
||||
one word. If it contains variables it must be enclosed in double
|
||||
quotes to insure they are not evaluated when the input script line is
|
||||
read, but will instead be evaluated each time the string is printed.
|
||||
|
||||
Instead of a numeric value, N can be specified as an :doc:`equal-style variable <variable>`, which should be specified as v_name, where
|
||||
name is the variable name. In this case, the variable is evaluated at
|
||||
the beginning of a run to determine the **next** timestep at which the
|
||||
.. note::
|
||||
|
||||
As discussed on the :doc:`Commands parse <Commands_parse>` doc
|
||||
page, the text string can use "immediate" variables, specified as
|
||||
$(formula) with parenthesis, where the numeric formula has the same
|
||||
syntax as equal-style variables described on the :doc:`variable
|
||||
<variable>` doc page. This is a convenient way to evaluate a
|
||||
formula immediately without using the variable command to define a
|
||||
named variable and then use that variable in the text string. The
|
||||
formula can include a trailing colon and format string which
|
||||
determines the precision with which the numeric value is output.
|
||||
This is also explained on the :doc:`Commands parse
|
||||
<Commands_parse>` doc page.
|
||||
|
||||
Instead of a numeric value, N can be specified as an :doc:`equal-style
|
||||
variable <variable>`, which should be specified as v_name, where name
|
||||
is the variable name. In this case, the variable is evaluated at the
|
||||
beginning of a run to determine the **next** timestep at which the
|
||||
string will be written out. On that timestep, the variable will be
|
||||
evaluated again to determine the next timestep, etc.
|
||||
Thus the variable should return timestep values. See the stagger()
|
||||
and logfreq() and stride() math functions for :doc:`equal-style variables <variable>`, as examples of useful functions to use in
|
||||
this context. For example, the following commands will print output at
|
||||
evaluated again to determine the next timestep, etc. Thus the
|
||||
variable should return timestep values. See the stagger() and
|
||||
logfreq() and stride() math functions for :doc:`equal-style variables
|
||||
<variable>`, as examples of useful functions to use in this
|
||||
context. For example, the following commands will print output at
|
||||
timesteps 10,20,30,100,200,300,1000,2000,etc:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
@ -61,12 +77,12 @@ timesteps 10,20,30,100,200,300,1000,2000,etc:
|
||||
|
||||
The specified group-ID is ignored by this fix.
|
||||
|
||||
See the :doc:`variable <variable>` command for a description of *equal*
|
||||
style variables which are the most useful ones to use with the fix
|
||||
print command, since they are evaluated afresh each timestep that the
|
||||
fix print line is output. Equal-style variables calculate formulas
|
||||
involving mathematical operations, atom properties, group properties,
|
||||
thermodynamic properties, global values calculated by a
|
||||
See the :doc:`variable <variable>` command for a description of
|
||||
*equal* style variables which are the most useful ones to use with the
|
||||
fix print command, since they are evaluated afresh each timestep that
|
||||
the fix print line is output. Equal-style variables calculate
|
||||
formulas involving mathematical operations, atom properties, group
|
||||
properties, thermodynamic properties, global values calculated by a
|
||||
:doc:`compute <compute>` or :doc:`fix <fix>`, or references to other
|
||||
:doc:`variables <variable>`.
|
||||
|
||||
@ -92,11 +108,13 @@ where ID is replaced with the fix-ID.
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to :doc:`binary restart files <restart>`. None of the :doc:`fix_modify <fix_modify>` options
|
||||
are relevant to this fix. No global or per-atom quantities are stored
|
||||
by this fix for access by various :doc:`output commands <Howto_output>`.
|
||||
No information about this fix is written to :doc:`binary restart files
|
||||
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
|
||||
relevant to this fix. No global or per-atom quantities are stored by
|
||||
this fix for access by various :doc:`output commands <Howto_output>`.
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
@ -304,13 +304,15 @@ uninterrupted fashion.
|
||||
.. warning::
|
||||
|
||||
When reading data from a restart file, this fix command has to be
|
||||
specified **exactly** the same was in the input script that created
|
||||
the restart file. LAMMPS will only check whether a fix is of the
|
||||
same style and has the same fix ID and in case of a match will then
|
||||
try to initialize the fix with the data stored in the binary
|
||||
restart file. If the names and associated date types in the new
|
||||
fix property/atom command do not match the old one exactly, data
|
||||
can be corrupted or LAMMPS may crash.
|
||||
specified **after** the *read_restart* command and **exactly** the
|
||||
same was in the input script that created the restart file. LAMMPS
|
||||
will only check whether a fix is of the same style and has the same
|
||||
fix ID and in case of a match will then try to initialize the fix
|
||||
with the data stored in the binary restart file. If the names and
|
||||
associated date types in the new fix property/atom command do not
|
||||
match the old one exactly, data can be corrupted or LAMMPS may crash.
|
||||
If the fix is specified **before** the *read_restart* command its
|
||||
data will not be restored.
|
||||
|
||||
None of the :doc:`fix_modify <fix_modify>` options are relevant to
|
||||
this fix. No global or per-atom quantities are stored by this fix for
|
||||
|
||||
@ -59,7 +59,7 @@ of a bond or angle or dihedral interaction whose strength can vary
|
||||
over time during a simulation. This is functionally similar to
|
||||
creating a bond or angle or dihedral for the same atoms in a data
|
||||
file, as specified by the :doc:`read_data <read_data>` command, albeit
|
||||
with a time-varying pre-factor coefficient, and except for exclusion
|
||||
with a time-varying prefactor coefficient, and except for exclusion
|
||||
rules, as explained below.
|
||||
|
||||
For the purpose of force field parameter-fitting or mapping a molecular
|
||||
|
||||
@ -214,10 +214,10 @@ generate an error. LAMMPS will check if a "UNITS:" tag is in the first
|
||||
line and stop with an error, if there is a mismatch with the current
|
||||
units used.
|
||||
|
||||
..note::
|
||||
.. note::
|
||||
|
||||
The electronic temperature at each grid point must be a non-zero
|
||||
positive value, both initially, and as the temperature evovles over
|
||||
positive value, both initially, and as the temperature evolves over
|
||||
time. Thus you must use either the *set* or *infile* keyword or be
|
||||
restarting a simulation that used this fix previously.
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ inside the colloid particle and wall. Note that the cutoff distance Rc
|
||||
in this case is the distance from the colloid particle center to the
|
||||
wall. The prefactor :math:`\epsilon` can be thought of as an effective
|
||||
Hamaker constant with energy units for the strength of the colloid-wall
|
||||
interaction. More specifically, the :math:`\epsilon` pre-factor is
|
||||
interaction. More specifically, the :math:`\epsilon` prefactor is
|
||||
:math:`4\pi^2 \rho_{wall} \rho_{colloid} \epsilon \sigma^6`, where
|
||||
:math:`\epsilon` and :math:`\sigma` are the LJ parameters for the
|
||||
constituent LJ particles. :math:`\rho_{wall}` and :math:`\rho_{colloid}`
|
||||
@ -211,7 +211,7 @@ constituent LJ particles of size :math:`\sigma` within the colloid particle
|
||||
and a 3d half-lattice of Lennard-Jones 12/6 particles of size :math:`\sigma`
|
||||
in the wall. As mentioned in the preceding paragraph, the density of
|
||||
particles in the wall and colloid can be different, as specified by
|
||||
the :math:`\epsilon` pre-factor.
|
||||
the :math:`\epsilon` prefactor.
|
||||
|
||||
For the *wall/harmonic* style, :math:`\epsilon` is effectively the spring
|
||||
constant K, and has units (energy/distance\^2). The input parameter
|
||||
|
||||
@ -88,7 +88,7 @@ examples/ directory.
|
||||
The prefactor :math:`\epsilon` can be thought of as an
|
||||
effective Hamaker constant with energy units for the strength of the
|
||||
ellipsoid-wall interaction. More specifically, the :math:`\epsilon`
|
||||
pre-factor is
|
||||
prefactor is
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
@ -258,11 +258,17 @@ assignment is made at the beginning of the minimization, but not
|
||||
during the iterations of the minimizer.
|
||||
|
||||
The point in the timestep at which atoms are assigned to a dynamic
|
||||
group is after the initial stage of velocity Verlet time integration
|
||||
has been performed, and before neighbor lists or forces are computed.
|
||||
This is the point in the timestep where atom positions have just
|
||||
changed due to the time integration, so the region criterion should be
|
||||
accurate, if applied.
|
||||
group is after interatomic forces have been computed, but before any
|
||||
fixes which alter forces or otherwise update the system have been
|
||||
invoked. This means that atom positions have been updated, neighbor
|
||||
lists and ghost atoms are current, and both intermolecular and
|
||||
intramolecular forces have been calculated based on the new
|
||||
coordinates. Thus the region criterion, if applied, should be
|
||||
accurate. Also, any computes invoked by an atom-style variable should
|
||||
use updated information for that timestep, e.g. potential energy/atom
|
||||
or coordination number/atom. Similarly, fixes or computes which are
|
||||
invoked after that point in the timestep, should operate on the new
|
||||
group of atoms.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
BIN
doc/src/img/marble_race.jpg
Normal file
BIN
doc/src/img/marble_race.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
BIN
doc/src/img/overlap.png
Normal file
BIN
doc/src/img/overlap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 572 KiB |
@ -51,9 +51,13 @@ Syntax
|
||||
*slab* value = volfactor or *nozforce*
|
||||
volfactor = ratio of the total extended volume used in the
|
||||
2d approximation compared with the volume of the simulation domain
|
||||
*ew2d* EW2D correction (available with ELECTRODE package)
|
||||
*nozforce* turns off kspace forces in the z direction
|
||||
*splittol* value = tol
|
||||
tol = relative size of two eigenvalues (see discussion below)
|
||||
*wire* value = volfactor (available with ELECTRODE package)
|
||||
volfactor = ratio of the total extended dimension used in the 1d
|
||||
approximation compared with the dimension of the simulation domain
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
.. index:: kspace_style ewald/disp
|
||||
.. index:: kspace_style ewald/disp/dipole
|
||||
.. index:: kspace_style ewald/omp
|
||||
.. index:: kspace_style ewald/electrode
|
||||
.. index:: kspace_style pppm
|
||||
.. index:: kspace_style pppm/kk
|
||||
.. index:: kspace_style pppm/omp
|
||||
@ -23,6 +24,8 @@
|
||||
.. index:: kspace_style pppm/stagger
|
||||
.. index:: kspace_style pppm/tip4p
|
||||
.. index:: kspace_style pppm/tip4p/omp
|
||||
.. index:: kspace_style pppm/electrode
|
||||
.. index:: kspace_style pppm/electrode/intel
|
||||
.. index:: kspace_style msm
|
||||
.. index:: kspace_style msm/omp
|
||||
.. index:: kspace_style msm/cg
|
||||
@ -40,7 +43,7 @@ Syntax
|
||||
|
||||
kspace_style style value
|
||||
|
||||
* style = *none* or *ewald* or *ewald/dipole* or *ewald/dipole/spin* or *ewald/disp* or *ewald/disp/dipole* or *ewald/omp* or *pppm* or *pppm/cg* or *pppm/disp* or *pppm/tip4p* or *pppm/stagger* or *pppm/disp/tip4p* or *pppm/gpu* or *pppm/intel* or *pppm/disp/intel* or *pppm/kk* or *pppm/omp* or *pppm/cg/omp* or *pppm/disp/tip4p/omp* or *pppm/tip4p/omp* or *pppm/dielectic* or *pppm/disp/dielectric* or *msm* or *msm/cg* or *msm/omp* or *msm/cg/omp* or *msm/dielectric* or *scafacos*
|
||||
* style = *none* or *ewald* or *ewald/dipole* or *ewald/dipole/spin* or *ewald/disp* or *ewald/disp/dipole* or *ewald/omp* or *ewald/electrode* or *pppm* or *pppm/cg* or *pppm/disp* or *pppm/tip4p* or *pppm/stagger* or *pppm/disp/tip4p* or *pppm/gpu* or *pppm/intel* or *pppm/disp/intel* or *pppm/kk* or *pppm/omp* or *pppm/cg/omp* or *pppm/disp/tip4p/omp* or *pppm/tip4p/omp* or *pppm/dielectic* or *pppm/disp/dielectric* or *pppm/electrode* or *pppm/electrode/intel* or *msm* or *msm/cg* or *msm/omp* or *msm/cg/omp* or *msm/dielectric* or *scafacos*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -57,6 +60,8 @@ Syntax
|
||||
accuracy = desired relative error in forces
|
||||
*ewald/omp* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*ewald/electrode* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*pppm* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*pppm/cg* values = accuracy (smallq)
|
||||
@ -97,6 +102,10 @@ Syntax
|
||||
accuracy = desired relative error in forces
|
||||
*pppm/disp/dielectric* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*pppm/electrode* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*pppm/electrode/intel* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*msm* value = accuracy
|
||||
accuracy = desired relative error in forces
|
||||
*msm/cg* value = accuracy (smallq)
|
||||
@ -273,6 +282,13 @@ parameters and how to choose them is described in
|
||||
|
||||
----------
|
||||
|
||||
The *electrode* styles add methods that are required for the constant potential
|
||||
method implemented in :doc:`fix electrode/* <fix_electrode_conp>`. The styles
|
||||
*ewald/electrode*, *pppm/electrode* and *pppm/electrode/intel* are available.
|
||||
These styles do not support the `kspace_modify slab nozforce` command.
|
||||
|
||||
----------
|
||||
|
||||
The *msm* style invokes a multi-level summation method MSM solver,
|
||||
:ref:`(Hardy) <Hardy2006>` or :ref:`(Hardy2) <Hardy2009>`, which maps atom charge
|
||||
to a 3d mesh, and uses a multi-level hierarchy of coarser and coarser
|
||||
@ -459,8 +475,8 @@ that package **and** the KSPACE package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
For MSM, a simulation must be 3d and one can use any combination of
|
||||
periodic, non-periodic, or shrink-wrapped boundaries (specified using
|
||||
the :doc:`boundary <boundary>` command).
|
||||
periodic, non-periodic, but not shrink-wrapped boundaries (specified
|
||||
using the :doc:`boundary <boundary>` command).
|
||||
|
||||
For Ewald and PPPM, a simulation must be 3d and periodic in all
|
||||
dimensions. The only exception is if the slab option is set with
|
||||
|
||||
@ -98,6 +98,10 @@ see their implementation reported in :ref:`(Ivanov) <Ivanov1>`.
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
The *spin*, *spin/cg*, and *spin/lbfgps* styles are part of the SPIN
|
||||
package. They are only enabled if LAMMPS was built with that package.
|
||||
See the :doc:`Build package <Build_package>` page for more info.
|
||||
|
||||
This minimization procedure is only applied to spin degrees of
|
||||
freedom for a frozen lattice configuration.
|
||||
|
||||
|
||||
@ -1,25 +1,55 @@
|
||||
.. index:: min_style
|
||||
|
||||
min_style command
|
||||
=================
|
||||
min_style cg command
|
||||
====================
|
||||
|
||||
min_style hftn command
|
||||
======================
|
||||
|
||||
min_style sd command
|
||||
====================
|
||||
|
||||
min_style quickmin command
|
||||
==========================
|
||||
|
||||
min_style fire command
|
||||
======================
|
||||
|
||||
min_style fire/old command
|
||||
==========================
|
||||
|
||||
:doc:`min_style spin <min_spin>` command
|
||||
========================================
|
||||
|
||||
:doc:`min_style spin/cg <min_spin>` command
|
||||
===========================================
|
||||
|
||||
:doc:`min_style spin/lbfgs <min_spin>` command
|
||||
==============================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
.. parsed-literal::
|
||||
|
||||
min_style style
|
||||
|
||||
* style = *cg* or *hftn* or *sd* or *quickmin* or *fire* or *fire/old* or *spin* or *spin/cg* or *spin/lbfgs*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*spin* is discussed briefly here and fully on :doc:`min_style spin <min_spin>` doc page
|
||||
*spin/cg* is discussed briefly here and fully on :doc:`min_style spin <min_spin>` doc page
|
||||
*spin/lbfgs* is discussed briefly here and fully on :doc:`min_style spin <min_spin>` doc page
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
min_style cg
|
||||
min_style spin
|
||||
min_style fire
|
||||
min_style spin
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
@ -124,7 +154,9 @@ calculations via the :doc:`neb/spin <neb_spin>` command.
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
none
|
||||
The *spin*, *spin/cg*, and *spin/lbfgps* styles are part of the SPIN
|
||||
package. They are only enabled if LAMMPS was built with that package.
|
||||
See the :doc:`Build package <Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user