diff --git a/.gitignore b/.gitignore index f9dda49da647a4fd029fc9a905d869cc3bb47dee..52b8212b139460f02ecbce157ad6818206c71693 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ vgcore.* .vagrant \#*# .#* +.vscode .DS_Store .DS_Store? diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 92293f294b96f2b77671cf1927259df4e8552f06..13e1d1539fd58188ad3815a0dd3c8d787adac668 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -36,7 +36,6 @@ get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION) include(PreventInSourceBuilds) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) - #release comes with -O3 by default set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE) @@ -420,7 +419,7 @@ endforeach() ############################################## # add lib sources of (simple) enabled packages ############################################ -foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-QMMM) +foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD) if(PKG_${SIMPLE_LIB}) string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}") string(TOLOWER "${PKG_LIB}" PKG_LIB) @@ -682,7 +681,7 @@ endforeach() get_directory_property(CPPFLAGS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) include(FeatureSummary) -feature_summary(DESCRIPTION "The following packages have been found:" WHAT PACKAGES_FOUND) +feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND) message(STATUS "<<< Build configuration >>> Build type ${CMAKE_BUILD_TYPE} Install path ${CMAKE_INSTALL_PREFIX} @@ -702,7 +701,7 @@ if (${_index} GREATER -1) endif() list (FIND LANGUAGES "C" _index) if (${_index} GREATER -1) - message(STATUS "C Compiler ${CMAKE_C_COMPILER} + message(STATUS "C compiler ${CMAKE_C_COMPILER} Type ${CMAKE_C_COMPILER_ID} Version ${CMAKE_C_COMPILER_VERSION} C Flags ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}") @@ -712,22 +711,22 @@ if(CMAKE_EXE_LINKER_FLAGS) Executable ${CMAKE_EXE_LINKER_FLAGS}") endif() if(BUILD_SHARED_LIBS) - message(STATUS "Shared libraries ${CMAKE_SHARED_LINKER_FLAGS}") + message(STATUS "Shared library flags: ${CMAKE_SHARED_LINKER_FLAGS}") else() - message(STATUS "Static libraries ${CMAKE_STATIC_LINKER_FLAGS}") + message(STATUS "Static library flags: ${CMAKE_STATIC_LINKER_FLAGS}") endif() message(STATUS "Link libraries: ${LAMMPS_LINK_LIBS}") if(BUILD_MPI) - message(STATUS "Using mpi with headers in ${MPI_CXX_INCLUDE_PATH} and ${MPI_CXX_LIBRARIES}") + message(STATUS "Using MPI with headers in ${MPI_CXX_INCLUDE_PATH} and ${MPI_CXX_LIBRARIES}") endif() if(PKG_GPU) - message(STATUS "GPU Api: ${GPU_API}") + message(STATUS "GPU API: ${GPU_API}") if(GPU_API STREQUAL "CUDA") - message(STATUS "GPU Arch: ${GPU_ARCH}") + message(STATUS "GPU architecture: ${GPU_ARCH}") elseif(GPU_API STREQUAL "OPENCL") - message(STATUS "OCL Tune: ${OCL_TUNE}") + message(STATUS "OpenCL parameter tuning: ${OCL_TUNE}") endif() - message(STATUS "GPU Precision: ${GPU_PREC}") + message(STATUS "GPU precision: ${GPU_PREC}") endif() if(PKG_KOKKOS) message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}") @@ -739,4 +738,20 @@ if(PKG_KSPACE) else() message(STATUS "Using double precision FFTs") endif() + if(FFT_FFTW_THREADS OR FFT_MKL_THREADS) + message(STATUS "Using threaded FFTs") + else() + message(STATUS "Using non-threaded FFTs") + endif() + if(PKG_KOKKOS) + if(KOKKOS_ENABLE_CUDA) + if (${FFT} STREQUAL "KISS") + message(STATUS "Kokkos FFT: KISS") + else() + message(STATUS "Kokkos FFT: cuFFT") + endif() + else() + message(STATUS "Kokkos FFT: ${FFT}") + endif() + endif() endif() diff --git a/cmake/Modules/FindFFTW3.cmake b/cmake/Modules/FindFFTW3.cmake index 552bcc4257adf0833a2d4d25bcbce3974a27ec7c..63752f85dfa889980598d3891e2dbc3c66be5c87 100644 --- a/cmake/Modules/FindFFTW3.cmake +++ b/cmake/Modules/FindFFTW3.cmake @@ -1,20 +1,22 @@ # - Find fftw3 -# Find the native FFTW3 headers and libraries. +# Find the native double precision FFTW3 headers and libraries. # -# FFTW3_INCLUDE_DIRS - where to find fftw3.h, etc. -# FFTW3_LIBRARIES - List of libraries when using fftw3. -# FFTW3_FOUND - True if fftw3 found. +# FFTW3_INCLUDE_DIRS - where to find fftw3.h, etc. +# FFTW3_LIBRARIES - List of libraries when using fftw3. +# FFTW3_OMP_LIBRARIES - List of libraries when using fftw3. +# FFTW3_FOUND - True if fftw3 found. # find_package(PkgConfig) pkg_check_modules(PC_FFTW3 fftw3) find_path(FFTW3_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3_INCLUDE_DIRS}) - find_library(FFTW3_LIBRARY NAMES fftw3 HINTS ${PC_FFTW3_LIBRARY_DIRS}) +find_library(FFTW3_OMP_LIBRARY NAMES fftw3_omp HINTS ${PC_FFTW3_LIBRARY_DIRS}) -set(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) +set(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) +set(FFTW3_OMP_LIBRARIES ${FFTW3_OMP_LIBRARY}) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE @@ -22,4 +24,4 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE_DIR) -mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY ) +mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY FFTW3_OMP_LIBRARY) diff --git a/cmake/Modules/FindFFTW3F.cmake b/cmake/Modules/FindFFTW3F.cmake index 92d1e85e791ec362a15909bd09dccdc046efc2a5..c67aa5faf1ca5b7a95eac870fa268f9fa2e26e2c 100644 --- a/cmake/Modules/FindFFTW3F.cmake +++ b/cmake/Modules/FindFFTW3F.cmake @@ -1,8 +1,8 @@ -# - Find fftw3f -# Find the native FFTW3F headers and libraries. +# Find the native single precision FFTW3 headers and libraries. # # FFTW3F_INCLUDE_DIRS - where to find fftw3f.h, etc. # FFTW3F_LIBRARIES - List of libraries when using fftw3f. +# FFTW3F_OMP_LIBRARIES - List of libraries when using fftw3. # FFTW3F_FOUND - True if fftw3f found. # @@ -10,11 +10,12 @@ find_package(PkgConfig) pkg_check_modules(PC_FFTW3F fftw3f) find_path(FFTW3F_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3F_INCLUDE_DIRS}) - find_library(FFTW3F_LIBRARY NAMES fftw3f HINTS ${PC_FFTW3F_LIBRARY_DIRS}) +find_library(FFTW3F_OMP_LIBRARY NAMES fftw3f_omp HINTS ${PC_FFTW3F_LIBRARY_DIRS}) -set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARY}) set(FFTW3F_INCLUDE_DIRS ${FFTW3F_INCLUDE_DIR}) +set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARY}) +set(FFTW3F_OMP_LIBRARIES ${FFTW3F_OMP_LIBRARY}) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set FFTW3F_FOUND to TRUE @@ -22,4 +23,4 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FFTW3F DEFAULT_MSG FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR) -mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_LIBRARY ) +mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_LIBRARY) diff --git a/cmake/Modules/FindQE.cmake b/cmake/Modules/FindQE.cmake deleted file mode 100644 index 4484bd4db2ad11a65e68e9feb8b36077c2a9a074..0000000000000000000000000000000000000000 --- a/cmake/Modules/FindQE.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# - Find quantum-espresso -# Find the native QE headers and libraries. -# -# QE_INCLUDE_DIRS - where to find quantum-espresso.h, etc. -# QE_LIBRARIES - List of libraries when using quantum-espresso. -# QE_FOUND - True if quantum-espresso found. -# - -find_path(QE_INCLUDE_DIR libqecouple.h PATH_SUFFIXES COUPLE/include) - -find_library(QECOUPLE_LIBRARY NAMES qecouple) -find_library(PW_LIBRARY NAMES pw) -find_library(QEMOD_LIBRARY NAMES qemod) -find_library(QEFFT_LIBRARY NAMES qefft) -find_library(QELA_LIBRARY NAMES qela) -find_library(CLIB_LIBRARY NAMES clib) -find_library(IOTK_LIBRARY NAMES iotk) - - -set(QE_LIBRARIES ${QECOUPLE_LIBRARY} ${PW_LIBRARY} ${QEMOD_LIBRARY} ${QEFFT_LIBRARY} ${QELA_LIBRARY} ${CLIB_LIBRARY} ${IOTK_LIBRARY}) -set(QE_INCLUDE_DIRS ${QE_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set QE_FOUND to TRUE -# if all listed variables are TRUE - -find_package_handle_standard_args(QE DEFAULT_MSG QECOUPLE_LIBRARY PW_LIBRARY QEMOD_LIBRARY QEFFT_LIBRARY QELA_LIBRARY CLIB_LIBRARY IOTK_LIBRARY QE_INCLUDE_DIR) - -mark_as_advanced(QE_INCLUDE_DIR QECOUPLE_LIBRARY PW_LIBRARY QEMOD_LIBRARY QEFFT_LIBRARY QELA_LIBRARY CLIB_LIBRARY IOTK_LIBRARY) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 428588ec9d06e860f3535cf6b8de619fc896a67d..29beaca957885e0886d34c16437467066c06a061 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -10,7 +10,7 @@ if(PKG_KOKKOS) set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) - + set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src ${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src @@ -39,7 +39,15 @@ if(PKG_KOKKOS) ${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp) if(PKG_KSPACE) - list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp) + list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp) + if(KOKKOS_ENABLE_CUDA) + if(NOT ${FFT} STREQUAL "KISS") + add_definitions(-DFFT_CUFFT) + list(APPEND LAMMPS_LINK_LIBS cufft) + endif() + endif() endif() set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}") diff --git a/cmake/Modules/Packages/KSPACE.cmake b/cmake/Modules/Packages/KSPACE.cmake index 63c42baf2d5c0bb17fce96f85dfc99fe84b6eede..07612447f985140dc88fb1c55112814a32ba8c81 100644 --- a/cmake/Modules/Packages/KSPACE.cmake +++ b/cmake/Modules/Packages/KSPACE.cmake @@ -21,9 +21,27 @@ if(PKG_KSPACE) add_definitions(-DFFT_FFTW3) include_directories(${${FFTW}_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${${FFTW}_LIBRARIES}) + if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY) + option(FFT_FFTW_THREADS "Use threaded FFTW library" ON) + else() + option(FFT_FFTW_THREADS "Use threaded FFT library" OFF) + endif() + + if(FFT_FFTW_THREADS) + if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY) + add_definitions(-DFFT_FFTW_THREADS) + list(APPEND LAMMPS_LINK_LIBS ${${FFTW}_OMP_LIBRARIES}) + else() + message(FATAL_ERROR "Need OpenMP enabled FFTW3 library for FFT_THREADS") + endif() + endif() elseif(FFT STREQUAL "MKL") find_package(MKL REQUIRED) add_definitions(-DFFT_MKL) + option(FFT_MKL_THREADS "Use threaded MKL FFT" ON) + if(FFT_MKL_THREADS) + add_definitions(-DFFT_MKL_THREADS) + endif() include_directories(${MKL_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) else() diff --git a/cmake/Modules/Packages/USER-PLUMED.cmake b/cmake/Modules/Packages/USER-PLUMED.cmake index bf5c502d84bbe9421c6e37518ea519fcb3f97dbb..e10176f9fd6b3348232f569018be5252e18dbd95 100644 --- a/cmake/Modules/Packages/USER-PLUMED.cmake +++ b/cmake/Modules/Packages/USER-PLUMED.cmake @@ -49,8 +49,8 @@ if(PKG_USER-PLUMED) message(STATUS "PLUMED download requested - we will build our own") include(ExternalProject) ExternalProject_Add(plumed_build - URL https://github.com/plumed/plumed2/releases/download/v2.5.3/plumed-src-2.5.3.tgz - URL_MD5 de30d6e7c2dcc0973298e24a6da24286 + URL https://github.com/plumed/plumed2/releases/download/v2.6.0/plumed-src-2.6.0.tgz + URL_MD5 204d2edae58d9b10ba3ad460cad64191 BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure --prefix= ${CONFIGURE_REQUEST_PIC} diff --git a/cmake/Modules/Packages/USER-QMMM.cmake b/cmake/Modules/Packages/USER-QMMM.cmake index e0ae1a46dc19128f03c6004e232b284ea3692dbd..544455868e55189232b3774afb5f3e088eaac118 100644 --- a/cmake/Modules/Packages/USER-QMMM.cmake +++ b/cmake/Modules/Packages/USER-QMMM.cmake @@ -1,9 +1,13 @@ if(PKG_USER-QMMM) - enable_language(Fortran) enable_language(C) - message(WARNING "Building QMMM with CMake is still experimental") - find_package(QE REQUIRED) - include_directories(${QE_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${QE_LIBRARIES}) + if(NOT BUILD_LIB) + message(FATAL_ERROR "Building a QM/MM executable with USER-QMMM requires BUILD_LIB=yes") + endif() + if(NOT BUILD_SHARED_LIBS) + message(WARNING "It is recommended to use BUILD_SHARED_LIBS=yes with USER-QMMM") + endif() + add_library(qmmm STATIC ${LAMMPS_LIB_SOURCE_DIR}/qmmm/libqmmm.c) + list(APPEND LAMMPS_LINK_LIBS qmmm) + target_include_directories(qmmm PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/qmmm) endif() diff --git a/doc/.gitignore b/doc/.gitignore index ca450f00f929338bc7ec31a7024c7e5f1df60d5e..55b25960db371aa94df36763dbbbcd2efb104aa0 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,6 +1,8 @@ /old /html +/html-offline /latex +/mathjax /spelling /LAMMPS.epub /LAMMPS.mobi diff --git a/doc/Makefile b/doc/Makefile index a3c4906cec8ecd369a7b0877a4df88e8a4885328..53907f84656f961663321f6bb7d0613ecf20bcbc 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -3,8 +3,8 @@ SHELL = /bin/bash BUILDDIR = ${CURDIR} RSTDIR = $(BUILDDIR)/src -TXTDIR = $(BUILDDIR)/txt VENV = $(BUILDDIR)/docenv +MATHJAX = $(BUILDDIR)/mathjax TXT2RST = $(VENV)/bin/txt2rst ANCHORCHECK = $(VENV)/bin/rst_anchor_check @@ -28,65 +28,66 @@ HAS_VIRTUALENV = YES endif SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') -SOURCES=$(filter-out $(wildcard $(TXTDIR)/lammps_commands*.txt) $(TXTDIR)/lammps_support.txt $(TXTDIR)/lammps_tutorials.txt,$(wildcard $(TXTDIR)/*.txt)) -OBJECTS=$(SOURCES:$(TXTDIR)/%.txt=$(RSTDIR)/%.rst) -.PHONY: help clean-all clean epub mobi rst html pdf venv spelling anchor_check style_check +.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check # ------------------------------------------ help: @echo "Please use \`make ' where is one of" - @echo " html create HTML doc pages in html dir" - @echo " pdf create Developer.pdf and Manual.pdf in this dir" - @echo " fetch fetch HTML and PDF files from LAMMPS web site" - @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 " html create HTML doc pages in html dir" + @echo " pdf create Developer.pdf and Manual.pdf in this dir" + @echo " fetch fetch HTML and PDF files from LAMMPS web site" + @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 " clean-all reset the entire build environment" + @echo " clean remove all intermediate RST 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" - @echo " spelling spell-check the manual" + @echo " package_check check for complete and consistent package lists" + @echo " spelling spell-check the manual" # ------------------------------------------ clean-all: clean - rm -rf $(BUILDDIR)/docenv $(BUILDDIR)/doctrees + rm -rf $(BUILDDIR)/docenv $(BUILDDIR)/doctrees $(BUILDDIR)/mathjax -clean: +clean: clean-spelling rm -rf html epub latex - rm -rf spelling clean-spelling: rm -rf spelling -rst: clean $(OBJECTS) $(ANCHORCHECK) - -html: $(OBJECTS) $(ANCHORCHECK) +html: $(ANCHORCHECK) $(MATHJAX) @(\ . $(VENV)/bin/activate ;\ sphinx-build $(SPHINXEXTRA) -b html -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\ echo "############################################" ;\ rst_anchor_check src/*.rst ;\ + python utils/check-packages.py -s ../src -d src ;\ env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\ python utils/check-styles.py -s ../src -d src ;\ echo "############################################" ;\ deactivate ;\ ) - -rm html/searchindex.js @rm -rf html/_sources @rm -rf html/PDF @rm -rf html/USER + @rm -rf html/JPG @cp -r src/PDF html/PDF @cp -r src/USER html/USER + @mkdir -p html/JPG + @cp `grep -A2 '\.\. image::' src/*.rst | grep ':target:' | sed -e 's,.*:target: JPG/,src/JPG/,' | sort | uniq` html/JPG/ @rm -rf html/PDF/.[sg]* @rm -rf html/USER/.[sg]* @rm -rf html/USER/*/.[sg]* @rm -rf html/USER/*/*.[sg]* + @mkdir -p html/_static/mathjax + @cp -r $(MATHJAX)/es5 html/_static/mathjax/ @echo "Build finished. The HTML pages are in doc/html." -spelling: $(OBJECTS) utils/sphinx-config/false_positives.txt +spelling: $(VENV) utils/sphinx-config/false_positives.txt @(\ . $(VENV)/bin/activate ;\ pip install sphinxcontrib-spelling ;\ @@ -96,7 +97,7 @@ spelling: $(OBJECTS) utils/sphinx-config/false_positives.txt ) @echo "Spell check finished." -epub: $(OBJECTS) +epub: $(VENV) @mkdir -p epub/JPG @rm -f LAMMPS.epub @cp src/JPG/lammps-logo.png epub/ @@ -115,7 +116,7 @@ mobi: epub @ebook-convert LAMMPS.epub LAMMPS.mobi @echo "Conversion finished. The MOBI manual file is created." -pdf: $(OBJECTS) $(ANCHORCHECK) +pdf: $(ANCHORCHECK) @(\ cd src/Developer; \ pdflatex developer; \ @@ -128,6 +129,7 @@ pdf: $(OBJECTS) $(ANCHORCHECK) sphinx-build $(SPHINXEXTRA) -b latex -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\ echo "############################################" ;\ rst_anchor_check src/*.rst ;\ + python utils/check-packages.py -s ../src -d src ;\ env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\ python utils/check-styles.py -s ../src -d src ;\ echo "############################################" ;\ @@ -167,27 +169,26 @@ fetch: anchor_check : $(ANCHORCHECK) @(\ . $(VENV)/bin/activate ;\ - rst_anchor_check src/*.txt ;\ + rst_anchor_check src/*.rst ;\ deactivate ;\ ) -style_check : +style_check : $(VENV) @(\ . $(VENV)/bin/activate ;\ python utils/check-styles.py -s ../src -d src ;\ deactivate ;\ ) -# ------------------------------------------ - -$(RSTDIR)/%.rst : $(TXTDIR)/%.txt $(TXT2RST) +package_check : $(VENV) @(\ - mkdir -p $(RSTDIR) ; \ . $(VENV)/bin/activate ;\ - txt2rst -v $< > $@ ;\ + python utils/check-packages.py -s ../src -d src ;\ deactivate ;\ ) +# ------------------------------------------ + $(VENV): @if [ "$(HAS_PYTHON3)" == "NO" ] ; then echo "Python3 was not found! Please check README.md for further instructions" 1>&2; exit 1; fi @if [ "$(HAS_VIRTUALENV)" == "NO" ] ; then echo "virtualenv was not found! Please check README.md for further instructions" 1>&2; exit 1; fi @@ -198,6 +199,9 @@ $(VENV): deactivate;\ ) +$(MATHJAX): + @git clone --depth 1 https://github.com/mathjax/MathJax.git mathjax + $(TXT2RST) $(ANCHORCHECK): $(VENV) @( \ . $(VENV)/bin/activate; \ diff --git a/doc/lammps.1 b/doc/lammps.1 index 4355e6496157ec57648426b9ac98377f32a581e8..1368679d3ccd820636b995c01124d595ab69f270 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "9 January 2020" "2020-01-09" +.TH LAMMPS "3 March 2020" "2020-03-03" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. @@ -11,13 +11,18 @@ or mpirun \-np 2 .B lmp - [OPTIONS] ... +\-in [OPTIONS] ... or .B lmp \-r2data file.restart file.data +or + +.B lmp +\-h + .SH DESCRIPTION .B LAMMPS is a classical molecular dynamics code, and an acronym for \fBL\fRarge-scale @@ -249,7 +254,7 @@ the chapter on errors in the manual gives some additional information about error messages, if possible. .SH COPYRIGHT -© 2003--2019 Sandia Corporation +© 2003--2020 Sandia Corporation This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as diff --git a/doc/src/Build.rst b/doc/src/Build.rst index 2eba3ddd48cd580447c1f0e46ff843e7ebbc6796..bd218c8165cd3120a3fc05e55d3e990829b79f1b 100644 --- a/doc/src/Build.rst +++ b/doc/src/Build.rst @@ -21,8 +21,3 @@ as described on the :doc:`Install ` doc page. Build_extras Build_windows Build_development - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst index cf77c81e692b0d4dd9440d94f6d54c0fbae42fdd..4788d93689a83f8b5bf1fde73045c3a24e0c4bf0 100644 --- a/doc/src/Build_basics.rst +++ b/doc/src/Build_basics.rst @@ -19,94 +19,115 @@ CMake and make: Serial vs parallel build ------------------------------------- -LAMMPS can be built to run in parallel using the ubiquitous `MPI (message-passing interface) `_ -library. Or it can built to run on a single processor (serial) -without MPI. It can also be built with support for OpenMP threading -(see more discussion below). +LAMMPS is written to use the ubiquitous `MPI (Message Passing Interface) +`_ library API +for distributed memory parallel computation. You need to have such a +library installed for building and running LAMMPS in parallel using a +domain decomposition parallelization. It is compatible with the MPI +standard version 2.x and later. LAMMPS can also be built into a +"serial" executable for use with a single processor using the bundled +MPI STUBS library. -**CMake variables**\ : +Independent of the distributed memory MPI parallelization, parts of +LAMMPS are also written with support for shared memory parallelization +using the OpenMP threading standard. A more detailed discussion of that +is below. +**CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D BUILD_MPI=value # yes or no, default is yes if CMake finds MPI, else no - -D BUILD_OMP=value # yes or no (default) + -D BUILD_OMP=value # yes or no, default is yes if a compatible compiler is detected -D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc # no default value -The executable created by CMake (after running make) is lmp\_name. If -the LAMMPS\_MACHINE variable is not specified, the executable is just -lmp. Using BUILD\_MPI=no will produce a serial executable. +The executable created by CMake (after running make) is named *lmp* unless +the LAMMPS\_MACHINE option is set. When setting `LAMMPS_MACHINE=name` +the executable will be named *lmp\_name*\. Using `BUILD\_MPI=no` will +enforce building a serial executable using the MPI STUBS library. **Traditional make**\ : +The build with traditional makefiles has to be done inside the source folder `src`. -.. parsed-literal:: +.. code-block:: bash - cd lammps/src make mpi # parallel build, produces lmp_mpi using Makefile.mpi make serial # serial build, produces lmp_serial using Makefile/serial - make mybox # uses Makefile.mybox to produce lmp_mybox + make mybox # uses Makefile.mybox to produce lmp_mybox -Serial build (see src/MAKE/Makefile.serial): +Any "make machine" command will look up the make settings from a file +Makefile.machine, create a folder Obj\_machine with all objects and +generated files and an executable called *lmp\_machine*\ . The standard +parallel build with `make mpi` assumes a standard MPI installation with +MPI compiler wrappers where all necessary compiler and linker flags to +get access and link with the suitable MPI headers and libraries are set +by the wrapper programs. For other cases or the serial build, you have +to adjust the make file variables MPI\_INC, MPI\_PATH, MPI\_LIB as well +as CC and LINK. To enable OpenMP threading usually a compiler specific +flag needs to be added to the compile and link commands. For the GNU +compilers, this is *-fopenmp*\ , which can be added to the CC and LINK +makefile variables. + +For the serial build the following make variables are set (see src/MAKE/Makefile.serial): -.. parsed-literal:: +.. code-block:: make + CC = g++ + LINK = g++ MPI_INC = -I../STUBS MPI_PATH = -L../STUBS MPI_LIB = -lmpi_stubs -For a parallel build, if MPI is installed on your system in the usual -place (e.g. under /usr/local), you do not need to specify the 3 -variables MPI\_INC, MPI\_PATH, MPI\_LIB. The MPI wrapper on the compiler -(e.g. mpicxx, mpiCC) knows where to find the needed include and -library files. Failing this, these 3 variables can be used to specify -where the mpi.h file (MPI\_INC), and the MPI library files (MPI\_PATH) -are found, and the name of the library files (MPI\_LIB). - -For a serial build, you need to specify the 3 variables, as shown -above. - -For a serial LAMMPS build, use the dummy MPI library provided in -src/STUBS. You also need to build the STUBS library for your platform -before making LAMMPS itself. A "make serial" build does this for. -Otherwise, type "make mpi-stubs" from the src directory, or "make" -from the src/STUBS dir. If the build fails, you will need to edit the -STUBS/Makefile for your platform. - -The file STUBS/mpi.c provides a CPU timer function called MPI\_Wtime() -that calls gettimeofday() . If your system doesn't support -gettimeofday() , you'll need to insert code to call another timer. -Note that the ANSI-standard function clock() rolls over after an hour -or so, and is therefore insufficient for timing long LAMMPS -simulations. +You also need to build the STUBS library for your platform before making +LAMMPS itself. A "make serial" build does this for you automatically, +otherwise, type "make mpi-stubs" from the src directory, or "make" from +the src/STUBS dir. If the build fails, you will need to edit the +STUBS/Makefile for your platform. The stubs library does not provide +MPI/IO functions required by some LAMMPS packages, e.g. MPIIO or USER-LB, +and thus is not compatible with those packages. -**CMake and make info**\ : +.. note:: -If you are installing MPI yourself, we recommend MPICH2 from Argonne -National Laboratory or OpenMPI. MPICH can be downloaded from the -`Argonne MPI site `_. -OpenMPI can be downloaded from the `OpenMPI site `_. Other MPI packages should also work. -If you are running on a large parallel machine, your system admins or -the vendor should have already installed a version of MPI, which is -likely to be faster than a self-installed MPICH or OpenMPI, so find -out how to build and link with it. - -The majority of OpenMP (threading) support in LAMMPS is provided by -the USER-OMP package; see the :doc:`Speed omp ` doc page for -details. The USER-INTEL package also provides OpenMP support (it is + The file STUBS/mpi.c provides a CPU timer function called + MPI\_Wtime() that calls gettimeofday() . If your operating system + does not support gettimeofday() , you will need to insert code to + call another timer. Note that the ANSI-standard function clock() + rolls over after an hour or so, and is therefore insufficient for + timing long LAMMPS simulations. + +**MPI and OpenMP support info**\ : + +If you are installing MPI yourself to build a parallel LAMMPS +executable, we recommend either MPICH or OpenMPI which are regularly +used and tested with LAMMPS by the LAMMPS developers. MPICH can be +downloaded from the `MPICH home page `_ and +OpenMPI can be downloaded correspondingly from the `OpenMPI home page +`_. Other MPI packages should also work. No +specific vendor provided and standard compliant MPI library is currently +known to be incompatible with LAMMPS. If you are running on a large +parallel machine, your system admins or the vendor should have already +installed a version of MPI, which is likely to be faster than a +self-installed MPICH or OpenMPI, so you should study the provided +documentation to find out how to build and link with it. + +The majority of OpenMP (threading) support in LAMMPS is provided by the +USER-OMP package; see the :doc:`Speed omp ` doc page for +details. The USER-INTEL package also includes OpenMP threading (it is compatible with USER-OMP) and adds vectorization support when compiled -with the Intel compilers on top of that. Also, the KOKKOS package can -be compiled for using OpenMP threading. - -However, there are a few commands in LAMMPS that have native OpenMP -support. These are commands in the MPIIO, SNAP, USER-DIFFRACTION, and -USER-DPD packages. In addition some packages support OpenMP threading -indirectly through the libraries they interface to: e.g. LATTE and -USER-COLVARS. See the :doc:`Packages details ` doc -page for more info on these packages and the doc pages for their -respective commands for OpenMP threading info. +with compatible compilers, in particular the Intel compilers on top of +OpenMP. Also, the KOKKOS package can be compiled to include OpenMP +threading. + +In addition, there are a few commands in LAMMPS that have native OpenMP +support included as well. These are commands in the MPIIO, SNAP, +USER-DIFFRACTION, and USER-DPD packages. In addition some packages +support OpenMP threading indirectly through the libraries they interface +to: e.g. LATTE and USER-COLVARS. See the :doc:`Packages details +` doc page for more info on these packages and the doc +pages for their respective commands for OpenMP threading info. For CMake, if you use BUILD\_OMP=yes, you can use these packages and turn on their native OpenMP support and turn on their native OpenMP @@ -143,22 +164,37 @@ Choice of compiler and compile/link options --------------------------------------------------------- The choice of compiler and compiler flags can be important for -performance. Vendor compilers can produce faster code than -open-source compilers like GNU. On boxes with Intel CPUs, we suggest -trying the `Intel C++ compiler `_. +performance. Vendor provided compilers for a specific hardware can +produce faster code than open-source compilers like the GNU compilers. +On x86 hardware most popular compilers are quite similar in performance +of C/C++ code at high optimization levels. When using the USER-INTEL +package, there is a distinct advantage in using the `Intel C++ compiler +`_ due to much improved vectorization through SSE and AVX +instructions on compatible hardware as the source code includes changes +and compiler directives to enable high degrees of vectorization. .. _intel: https://software.intel.com/en-us/intel-compilers +On parallel clusters or supercomputers which use "environment modules" +for their compile/link environments, you can often access different +compilers by simply loading the appropriate module before building +LAMMPS. +**CMake build**\ : -On parallel clusters or supercomputers which use "modules" for their -compile/link environments, you can often access different compilers by -simply loading the appropriate module before building LAMMPS. - -**CMake variables**\ : +By default CMake will use a compiler it finds and it will add +optimization flags appropriate to that compiler and any +:doc:`accelerator packages ` you have included in the +build. +You can tell CMake to look for a specific compiler with these variable +settings. Likewise you can specify the FLAGS variables if you want to +experiment with alternate optimization flags. You should specify all +3 compilers, so that the small number of LAMMPS source files written +in C or Fortran are built with a compiler consistent with the one used +for all the C++ files: -.. parsed-literal:: +.. code-block:: bash -D CMAKE_CXX_COMPILER=name # name of C++ compiler -D CMAKE_C_COMPILER=name # name of C compiler @@ -168,42 +204,42 @@ simply loading the appropriate module before building LAMMPS. -D CMAKE_C_FLAGS=string # flags to use with C compiler -D CMAKE_Fortran_FLAGS=string # flags to use with Fortran compiler -By default CMake will use a compiler it finds and it will add -optimization flags appropriate to that compiler and any :doc:`accelerator packages ` you have included in the build. - -You can tell CMake to look for a specific compiler with these variable -settings. Likewise you can specify the FLAGS variables if you want to -experiment with alternate optimization flags. You should specify all -3 compilers, so that the small number of LAMMPS source files written -in C or Fortran are built with a compiler consistent with the one used -for all the C++ files: +A few example command lines are: -.. parsed-literal:: +.. code-block:: bash - Building with GNU Compilers: + # Building with GNU Compilers: cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran - Building with Intel Compilers: + # Building with Intel Compilers: cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort - Building with LLVM/Clang Compilers: + # Building with LLVM/Clang Compilers: cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang +For compiling with the Clang/LLVM compilers a special CMake preset is +included that can be loaded with `-C ../cmake/presets/clang.cmake`. + .. note:: - When the cmake command completes, it prints info to the screen - as to which compilers it is using, and what flags will be used in the - compilation. Note that if the top-level compiler is mpicxx, it is - simply a wrapper on a real compiler. The underlying compiler info is - what will be listed in the CMake output. You should check to insure - you are using the compiler and optimization flags are the ones you - want. + When the cmake command completes, it prints a summary to the screen + which compilers it is using and what flags and settings will be used + for the compilation. Note that if the top-level compiler is mpicxx, + it is simply a wrapper on a real compiler. The underlying compiler + info is what CMake will try to determine and report. You should check + to confirm you are using the compiler and optimization flags you want. -**Makefile.machine settings**\ : +**Makefile.machine settings for traditional make**\ : -Parallel build (see src/MAKE/Makefile.mpi): +The "compiler/linker settings" section of a Makefile.machine lists +compiler and linker settings for your C++ compiler, including +optimization flags. For a parallel build it is recommended to use +mpicxx or mpiCC, since these compiler wrappers will include a variety of +settings appropriate for your MPI installation and thus avoiding the +guesswork of finding the right flags. +Parallel build (see src/MAKE/Makefile.mpi): -.. parsed-literal:: +.. code-block:: bash CC = mpicxx CCFLAGS = -g -O3 @@ -212,33 +248,26 @@ Parallel build (see src/MAKE/Makefile.mpi): Serial build (see src/MAKE/Makefile.serial): - -.. parsed-literal:: +.. code-block:: make CC = g++ CCFLAGS = -g -O3 LINK = g++ LINKFLAGS = -g -O -The "compiler/linker settings" section of a Makefile.machine lists -compiler and linker settings for your C++ compiler, including -optimization flags. You should always use mpicxx or mpiCC for -a parallel build, since these compiler wrappers will include -a variety of settings appropriate for your MPI installation. - .. note:: - If you build LAMMPS with any :doc:`accelerator packages ` included, they have specific - optimization flags that are either required or recommended for optimal - performance. You need to include these in the CCFLAGS and LINKFLAGS - settings above. For details, see the individual package doc pages - listed on the :doc:`Speed packages ` doc page. Or - examine these files in the src/MAKE/OPTIONS directory. They - correspond to each of the 5 accelerator packages and their hardware - variants: - + If you build LAMMPS with any :doc:`accelerator packages ` + included, there may be specific optimization flags that are either + required or recommended to enable required features and to achieve + optimal performance. You need to include these in the CCFLAGS and + LINKFLAGS settings above. For details, see the individual package + doc pages listed on the :doc:`Speed packages ` doc + page. Or examine these files in the src/MAKE/OPTIONS directory. + They correspond to each of the 5 accelerator packages and their + hardware variants: -.. parsed-literal:: +.. code-block:: bash Makefile.opt # OPT package Makefile.omp # USER-OMP package @@ -249,10 +278,8 @@ a variety of settings appropriate for your MPI installation. Makefile.kokkos_omp # KOKKOS package for CPUs (OpenMP) Makefile.kokkos_phi # KOKKOS package for KNLs (OpenMP) - ---------- - .. _exe: Build LAMMPS as an executable or a library @@ -265,10 +292,13 @@ page for more info on coupling LAMMPS to other codes. See the :doc:`Python ` doc page for more info on wrapping and running LAMMPS from Python via its library interface. -**CMake variables**\ : +**CMake build**\ : +For CMake builds, you can select through setting CMake variables which +files the compilation produces during the configuration step. If none +are set, defaults are applied. -.. parsed-literal:: +.. code-block:: bash -D BUILD_EXE=value # yes (default) or no -D BUILD_LIB=value # yes or no (default) @@ -277,24 +307,32 @@ running LAMMPS from Python via its library interface. # no default value Setting BUILD\_EXE=no will not produce an executable. Setting -BUILD\_LIB=yes will produce a static library named liblammps.a. +BUILD\_LIB=yes will produce a static library named *liblammps.a*\ . Setting both BUILD\_LIB=yes and BUILD\_SHARED\_LIBS=yes will produce a -shared library named liblammps.so. If LAMMPS\_LIB\_SUFFIX is set the generated -libraries will be named liblammps\_name.a or liblammps\_name.so instead. +shared library named *liblammps.so* instead. If LAMMPS\_LIB\_SUFFIX is +set to *name* in addition, the name of the generated libraries will be +changed to either *liblammps\_name.a* or *liblammps\_name.so*\ , +respectively. **Traditional make**\ : +With the traditional makefile based build process, the choice of +the generated executable or library depends on the "mode" setting. +Several options are available and "mode=exe" is the default. -.. parsed-literal:: +.. code-block:: bash - cd lammps/src make machine # build LAMMPS executable lmp_machine + mkae mode=exe machine # same as "make machine" make mode=lib machine # build LAMMPS static lib liblammps_machine.a make mode=shlib machine # build LAMMPS shared lib liblammps_machine.so + make mode=shexe machine # same as "mode=exe" but uses objects from "mode=shlib" -The two library builds also create generic soft links, named -liblammps.a and liblammps.so, which point to the liblammps\_machine -files. +The two "exe" builds will generate and executable *lmp\_machine*\ , +while the two library builds will create a file *liblammps\_machine.a* +or *liblammps\_machine.so*\ . They will also create generic soft links, +named *liblammps.a* and *liblammps.so*\ , which point to the specific +*liblammps\_machine.a/so* files. **CMake and make info**\ : @@ -302,32 +340,40 @@ Note that for a shared library to be usable by a calling program, all the auxiliary libraries it depends on must also exist as shared libraries. This will be the case for libraries included with LAMMPS, such as the dummy MPI library in src/STUBS or any package libraries in -the lib/packages directory, since they are always built as shared -libraries using the -fPIC switch. However, if a library like MPI or -FFTW does not exist as a shared library, the shared library build will -generate an error. This means you will need to install a shared -library version of the auxiliary library. The build instructions for -the library should tell you how to do this. - -As an example, here is how to build and install the `MPICH library `_, a popular open-source version of MPI, distributed by -Argonne National Lab, as a shared library in the default -/usr/local/lib location: +the lib/packages directory, since they are always built in a shared +library compatible way using the -fPIC switch. However, if a library +like MPI or FFTW does not exist as a shared library, the shared library +build may generate an error. This means you will need to install a +shared library version of the auxiliary library. The build instructions +for the library should tell you how to do this. -.. _mpich: http://www-unix.mcs.anl.gov/mpi +As an example, here is how to build and install the `MPICH library +`_, a popular open-source version of MPI, as a shared library +in the default /usr/local/lib location: +.. _mpich: https://www.mpich.org - -.. parsed-literal:: +.. code-block:: bash ./configure --enable-shared make make install -You may need to use "sudo make install" in place of the last line if -you do not have write privileges for /usr/local/lib. The end result -should be the file /usr/local/lib/libmpich.so. +You may need to use "sudo make install" in place of the last line if you +do not have write privileges for /usr/local/lib. The end result should +be the file /usr/local/lib/libmpich.so. On many Linux installations the +folder "${HOME}/.local" is an alternative to using /usr/local and does +not require superuser or sudo access. In that case the configuration +step becomes: + +.. code-block:: bash + + ./configure --enable-shared --prefix=${HOME}/.local +Avoiding using "sudo" for custom software installation (i.e. from source +and not through a package manager tool provided by the OS) is generally +recommended to ensure the integrity of the system software installation. ---------- @@ -337,30 +383,39 @@ should be the file /usr/local/lib/libmpich.so. Build the LAMMPS documentation ---------------------------------------- -**CMake variable**\ : +The LAMMPS manual is written in `reStructuredText `_ format which +can be translated to different output format using the `Sphinx `_ +document generator tool. Currently the translation to HTML and PDF (via +LaTeX) are supported. For that to work a Python 3 interpreter and +internet access is required. For the documentation build a python +based virtual environment is set up in the folder doc/docenv and various +python packages are installed into that virtual environment via the pip +tool. The actual translation is then done via make commands. +.. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html +.. _sphinx: https://sphinx-doc.org -.. parsed-literal:: +**Documentation make option**\ : - -D BUILD_DOC=value # yes or no (default) - -This will create the HTML doc pages within the CMake build directory. -The reason to do this is if you want to "install" LAMMPS on a system -after the CMake build via "make install", and include the doc pages in -the install. - -**Traditional make**\ : +The following make commands can be issued in the doc folder of the +LAMMPS source distribution. +.. code-block:: bash -.. parsed-literal:: + make html # create HTML doc pages in html directory + make pdf # create Developer.pdf and Manual.pdf in this directory + make fetch # fetch HTML and PDF files from LAMMPS web site + make clean # remove all intermediate files + make clean-all # reset the entire doc build environment + make anchor_check # scan for duplicate anchor labels + make style_check # check for complete and consistent style lists + make package_check # check for complete and consistent package lists + make spelling # spell-check the manual - cd lammps/doc - make html # html doc pages - make pdf # single Manual.pdf file -This will create a lammps/doc/html dir with the HTML doc pages so that -you can browse them locally on your system. Type "make" from the -lammps/doc dir to see other options. +Thus "make html" will create a "doc/html" directory with the HTML format +manual pages so that you can browse them with a web browser locally on +your system. .. note:: @@ -369,6 +424,19 @@ lammps/doc dir to see other options. `download page `_. +**CMake build option**\ : + +It is also possible to create the HTML version of the manual within +the :doc:`CMake build directory `. The reason for this +option is to include the installation of the HTML manual pages into +the "install" step when installing LAMMPS after the CMake build via +"make install". + +.. code-block:: bash + + -D BUILD_DOC=value # yes or no (default) + + ---------- @@ -380,19 +448,20 @@ Build LAMMPS tools Some tools described in :doc:`Auxiliary tools ` can be built directly using CMake or Make. -**CMake variable**\ : +**CMake build3**\ : -.. parsed-literal:: +.. code-block:: bash -D BUILD_TOOLS=value # yes or no (default) -The generated binaries will also become part of the LAMMPS installation (see below) +The generated binaries will also become part of the LAMMPS installation +(see below). **Traditional make**\ : -.. parsed-literal:: +.. code-block:: bash cd lammps/tools make all # build all binaries of tools @@ -416,10 +485,10 @@ a globally visible place on your system, for others to access. Note that you may need super-user privileges (e.g. sudo) if the directory you want to copy files to is protected. -**CMake variable**\ : +**CMake build**\ : -.. parsed-literal:: +.. code-block:: bash cmake -D CMAKE_INSTALL_PREFIX=path [options ...] ../cmake make # perform make after CMake command @@ -430,8 +499,3 @@ you want to copy files to is protected. There is no "install" option in the src/Makefile for LAMMPS. If you wish to do this you will need to first build LAMMPS, then manually copy the desired LAMMPS files to the appropriate system directories. - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_cmake.rst b/doc/src/Build_cmake.rst index 78459bb9906e07bdddc48b330fe48c7b12d1ec91..8314afaa0e85657114bac6308446d3ab11084219 100644 --- a/doc/src/Build_cmake.rst +++ b/doc/src/Build_cmake.rst @@ -20,7 +20,7 @@ make command to build LAMMPS, which uses the created Makefile(s). Example: -.. parsed-literal:: +.. code-block:: bash cd lammps # change to the LAMMPS distribution directory mkdir build; cd build # create a new directory (folder) for build @@ -52,7 +52,7 @@ After compilation, you may optionally install the LAMMPS executable into your system with: -.. parsed-literal:: +.. code-block:: bash make install # optional, copy LAMMPS executable & library elsewhere @@ -115,7 +115,7 @@ folder, recreate the directory and start over. **Command-line version of CMake**\ : -.. parsed-literal:: +.. code-block:: bash cmake [options ...] /path/to/lammps/cmake # build from any dir cmake [options ...] ../cmake # build from lammps/build @@ -127,7 +127,7 @@ The argument can be preceeded or followed by various CMake command-line options. Several useful ones are: -.. parsed-literal:: +.. code-block:: bash -D CMAKE_INSTALL_PREFIX=path # where to install LAMMPS executable/lib if desired -D CMAKE_BUILD_TYPE=type # type = RelWithDebInfo (default), Release, MinSizeRel, or Debug @@ -177,7 +177,7 @@ directory. **Curses version (terminal-style menu) of CMake**\ : -.. parsed-literal:: +.. code-block:: bash ccmake ../cmake @@ -195,7 +195,7 @@ more information. **GUI version of CMake**\ : -.. parsed-literal:: +.. code-block:: bash cmake-gui ../cmake @@ -216,7 +216,7 @@ for more information. Check if your machine already has CMake installed: -.. parsed-literal:: +.. code-block:: bash which cmake # do you have it? which cmake3 # version 3 may have this name @@ -226,10 +226,10 @@ On clusters or supercomputers which use environment modules to manage software packages, do this: -.. parsed-literal:: +.. code-block:: bash - module list # is a cmake module already loaded? - module avail # is a cmake module available? + module list # is a module for cmake already loaded? + module avail # is a module for cmake available? module load cmake3 # load cmake module with appropriate name Most Linux distributions offer pre-compiled cmake packages through @@ -238,8 +238,3 @@ enough version, you can download the latest version at `https://cmake.org/download/ `_. Instructions on how to install it on various platforms can be found `on this page `_. - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index 7286caf7b3be0b8d21cd9e839cfc456d7fe4e9ff..f8eee73197e8972296a5425fb274a8ae929eec74 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -18,14 +18,14 @@ generated by the CMake build. To enable a more verbose output during compilation you can use the following option. -.. parsed-literal:: +.. code-block:: bash -D CMAKE_VERBOSE_MAKEFILE=value # value = no (default) or yes Another way of doing this without reconfiguration is calling make with variable VERBOSE set to 1: -.. parsed-literal:: +.. code-block:: bash make VERBOSE=1 @@ -48,7 +48,7 @@ it. Please note that they come with a performance hit. However, they are usually faster than using tools like Valgrind. -.. parsed-literal:: +.. code-block:: bash -D ENABLE_SANITIZE_ADDRESS=value # enable Address Sanitizer, value = no (default) or yes -D ENABLE_SANITIZE_UNDEFINED=value # enable Undefined Behaviour Sanitizer, value = no (default) or yes @@ -72,7 +72,7 @@ developers can run the tests directly on their workstation. this is incomplete and only represents a small subset of tests that we run -.. parsed-literal:: +.. code-block:: bash -D ENABLE_TESTING=value # enable simple run tests of LAMMPS, value = no (default) or yes -D LAMMPS_TESTING_SOURCE_DIR=path # path to lammps-testing repository (option if in custom location) @@ -81,7 +81,7 @@ developers can run the tests directly on their workstation. If you enable testing in the CMake build it will create an additional target called "test". You can run them with: -.. parsed-literal:: +.. code-block:: bash make test @@ -93,14 +93,14 @@ You can also collect code coverage metrics while running the tests by enabling coverage support during building. -.. parsed-literal:: +.. code-block:: bash -D ENABLE_COVERAGE=value # enable coverage measurements, value = no (default) or yes This will also add the following targets to generate coverage reports after running the LAMMPS executable: -.. parsed-literal:: +.. code-block:: bash make test # run tests first! make gen_coverage_html # generate coverage report in HTML format @@ -109,12 +109,6 @@ This will also add the following targets to generate coverage reports after runn These reports require GCOVR to be installed. The easiest way to do this to install it via pip: -.. parsed-literal:: +.. code-block:: bash pip install git+https://github.com/gcovr/gcovr.git - - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 2cba59bde0e68bff498cf6881bf790d43cfd64f5..a4064ee8125c2806f887d8b9d234b7d5143ba070 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -5,10 +5,15 @@ When building with some packages, additional steps may be required, in addition to: -.. parsed-literal:: +.. code-block:: bash + + $ cmake -D PKG_NAME=yes + +or - -D PKG_NAME=yes # CMake - make yes-name # make +.. code-block:: bash + + $ make yes-name as described on the :doc:`Build\_package ` doc page. @@ -20,18 +25,35 @@ You may need to tell LAMMPS where it is found on your system. This is the list of packages that may require additional steps. -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`COMPRESS ` | :ref:`GPU ` | :ref:`KIM ` | :ref:`KOKKOS ` | :ref:`LATTE ` | :ref:`MESSAGE ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`MSCG ` | :ref:`OPT ` | :ref:`POEMS ` | :ref:`PYTHON ` | :ref:`VORONOI ` | :ref:`USER-ADIOS ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`USER-ATC ` | :ref:`USER-AWPMD ` | :ref:`USER-COLVARS ` | :ref:`USER-H5MD ` | :ref:`USER-INTEL ` | :ref:`USER-MOLFILE ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`USER-NETCDF ` | :ref:`USER-PLUMED ` | :ref:`USER-OMP ` | :ref:`USER-QMMM ` | :ref:`USER-QUIP ` | :ref:`USER-SCAFACOS ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`USER-SMD ` | :ref:`USER-VTK ` | | | | | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ - +.. table_from_list:: + :columns: 6 + + * :ref:`COMPRESS ` + * :ref:`GPU ` + * :ref:`KIM ` + * :ref:`KOKKOS ` + * :ref:`LATTE ` + * :ref:`MESSAGE ` + * :ref:`MSCG ` + * :ref:`OPT ` + * :ref:`POEMS ` + * :ref:`PYTHON ` + * :ref:`VORONOI ` + * :ref:`USER-ADIOS ` + * :ref:`USER-ATC ` + * :ref:`USER-AWPMD ` + * :ref:`USER-COLVARS ` + * :ref:`USER-H5MD ` + * :ref:`USER-INTEL ` + * :ref:`USER-MOLFILE ` + * :ref:`USER-NETCDF ` + * :ref:`USER-PLUMED ` + * :ref:`USER-OMP ` + * :ref:`USER-QMMM ` + * :ref:`USER-QUIP ` + * :ref:`USER-SCAFACOS ` + * :ref:`USER-SMD ` + * :ref:`USER-VTK ` ---------- @@ -49,15 +71,15 @@ available on your system. If CMake cannot find the library, you can set these variables: -.. parsed-literal:: +.. code-block:: bash -D ZLIB_INCLUDE_DIR=path # path to zlib.h header file -D ZLIB_LIBRARIES=path # path to libz.a (.so) file **Traditional make**\ : -If make cannot find the library, you can edit the -lib/compress/Makefile.lammps file to specify the paths and library +If make cannot find the library, you can edit the file +lib/compress/Makefile.lammps to specify the paths and library name. @@ -75,7 +97,7 @@ which GPU hardware to build for. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D GPU_API=value # value = opencl (default) or cuda -D GPU_PREC=value # precision setting @@ -125,12 +147,12 @@ using a command like these, which simply invoke the lib/gpu/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-gpu # print help message - make lib-gpu args="-b" # build GPU library with default Makefile.linux - make lib-gpu args="-m xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision - make lib-gpu args="-m mpi -a sm_60 -p mixed -b" # build GPU library with mixed precision and P100 using other settings in Makefile.mpi + $ make lib-gpu # print help message + $ make lib-gpu args="-b" # build GPU library with default Makefile.linux + $ make lib-gpu args="-m xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision + $ make lib-gpu args="-m mpi -a sm_60 -p mixed -b" # build GPU library with mixed precision and P100 using other settings in Makefile.mpi Note that this procedure starts with a Makefile.machine in lib/gpu, as specified by the "-m" switch. For your convenience, machine makefiles @@ -177,11 +199,12 @@ KIM package To build with this package, the KIM library with API v2 must be downloaded and built on your system. It must include the KIM models that you want to -use with LAMMPS. If you want to use the :doc:`kim\_query ` +use with LAMMPS. If you want to use the :doc:`kim_query ` command, you also need to have libcurl installed with the matching development headers and the curl-config tool. -See `Obtaining KIM Models `_ to +See the `Obtaining KIM Models `_ +web page to learn how to install a pre-build binary of the OpenKIM Repository of Models. See the list of all KIM models here: https://openkim.org/browse/models @@ -192,7 +215,7 @@ minutes to hours) to build. Of course you only need to do that once.) **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes -D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on @@ -203,7 +226,7 @@ inside the CMake build directory. If the KIM library is already on your system (in a location CMake cannot find it), set the PKG\_CONFIG\_PATH environment variable so that libkim-api can be found. -For using OpenKIM web queries in LAMMPS. +*For using OpenKIM web queries in LAMMPS*\ : If LMP\_DEBUG\_CURL is set, the libcurl verbose mode will be on, and any libcurl calls within the KIM web query display a lot of information about @@ -229,16 +252,23 @@ step from the lammps/src dir, using a command like these, which simply invoke the lib/kim/Install.py script with the specified args. -.. parsed-literal:: +.. code-block:: bash + + $ make lib-kim # print help message + $ make lib-kim args="-b " # (re-)install KIM API lib with only example models + $ make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model + $ make lib-kim args="-b -a everything" # install KIM API lib with all models + $ make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver + $ make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location + $ make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver - make lib-kim # print help message - make lib-kim args="-b " # (re-)install KIM API lib with only example models - make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model - make lib-kim args="-b -a everything" # install KIM API lib with all models - make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver - make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location - make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver +Settings for OpenKIM web queries discussed above need to be applied by adding +them to the LMP\_INC variable through editing the Makefile.machine you are +using. For example: +.. code-block:: make + + LMP_INC = -DLMP_NO_SSL_CHECK ---------- @@ -257,22 +287,29 @@ KOKKOS\_ARCH settings described below. Note that for CMake, these are really Kokkos variables, not LAMMPS variables. Hence you must use case-sensitive values, e.g. BDW, not bdw. +* AMDAVX = AMD 64-bit x86 CPUs +* EPYC = AMD EPYC Zen class CPUs * ARMv80 = ARMv8.0 Compatible CPU * ARMv81 = ARMv8.1 Compatible CPU * ARMv8-ThunderX = ARMv8 Cavium ThunderX CPU -* BGQ = IBM Blue Gene/Q CPUs -* Power8 = IBM POWER8 CPUs -* Power9 = IBM POWER9 CPUs +* ARMv8-TX2 = ARMv8 Cavium ThunderX2 CPU +* WSM = Intel Westmere CPUs * SNB = Intel Sandy/Ivy Bridge CPUs * HSW = Intel Haswell CPUs * BDW = Intel Broadwell Xeon E-class CPUs * SKX = Intel Sky Lake Xeon E-class HPC CPUs (AVX512) * KNC = Intel Knights Corner Xeon Phi * KNL = Intel Knights Landing Xeon Phi +* BGQ = IBM Blue Gene/Q CPUs +* Power7 = IBM POWER8 CPUs +* Power8 = IBM POWER8 CPUs +* Power9 = IBM POWER9 CPUs +* Kepler = NVIDIA Kepler default (generation CC 3.5) * Kepler30 = NVIDIA Kepler generation CC 3.0 * Kepler32 = NVIDIA Kepler generation CC 3.2 * Kepler35 = NVIDIA Kepler generation CC 3.5 * Kepler37 = NVIDIA Kepler generation CC 3.7 +* Maxwell = NVIDIA Maxwell default (generation CC 5.0) * Maxwell50 = NVIDIA Maxwell generation CC 5.0 * Maxwell52 = NVIDIA Maxwell generation CC 5.2 * Maxwell53 = NVIDIA Maxwell generation CC 5.3 @@ -287,7 +324,7 @@ case-sensitive values, e.g. BDW, not bdw. For multicore CPUs using OpenMP, set these 2 variables. -.. parsed-literal:: +.. code-block:: bash -D KOKKOS_ARCH=archCPU # archCPU = CPU from list above -D KOKKOS_ENABLE_OPENMP=yes @@ -295,7 +332,7 @@ For multicore CPUs using OpenMP, set these 2 variables. For Intel KNLs using OpenMP, set these 2 variables: -.. parsed-literal:: +.. code-block:: bash -D KOKKOS_ARCH=KNL -D KOKKOS_ENABLE_OPENMP=yes @@ -303,7 +340,7 @@ For Intel KNLs using OpenMP, set these 2 variables: For NVIDIA GPUs using CUDA, set these 4 variables: -.. parsed-literal:: +.. code-block:: bash -D KOKKOS_ARCH="archCPU;archGPU" # archCPU = CPU from list above that is hosting the GPU # archGPU = GPU from list above @@ -316,7 +353,7 @@ Kokkos library: lib/kokkos/bin/nvcc\_wrapper. The setting should include the full path name to the wrapper, e.g. -.. parsed-literal:: +.. code-block:: bash -D CMAKE_CXX_COMPILER=/home/username/lammps/lib/kokkos/bin/nvcc_wrapper @@ -329,7 +366,7 @@ src/MAKE/OPTIONS/Makefile.kokkos\* files for examples. For multicore CPUs using OpenMP: -.. parsed-literal:: +.. code-block:: make KOKKOS_DEVICES = OpenMP KOKKOS_ARCH = archCPU # archCPU = CPU from list above @@ -337,7 +374,7 @@ For multicore CPUs using OpenMP: For Intel KNLs using OpenMP: -.. parsed-literal:: +.. code-block:: make KOKKOS_DEVICES = OpenMP KOKKOS_ARCH = KNL @@ -345,20 +382,22 @@ For Intel KNLs using OpenMP: For NVIDIA GPUs using CUDA: -.. parsed-literal:: +.. code-block:: make KOKKOS_DEVICES = Cuda KOKKOS_ARCH = archCPU,archGPU # archCPU = CPU from list above that is hosting the GPU # archGPU = GPU from list above + FFT_INC = -DFFT_CUFFT # enable use of cuFFT (optional) + FFT_LIB = -lcufft # link to cuFFT library -For GPUs, you also need these 2 lines in your Makefile.machine before -the CC line is defined, in this case for use with OpenMPI mpicxx. The -2 lines define a nvcc wrapper compiler, which will use nvcc for +For GPUs, you also need the following 2 lines in your Makefile.machine +before the CC line is defined, in this case for use with OpenMPI mpicxx. +The 2 lines define a nvcc wrapper compiler, which will use nvcc for compiling CUDA files and use a C++ compiler for non-Kokkos, non-CUDA files. -.. parsed-literal:: +.. code-block:: make KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper @@ -379,7 +418,7 @@ library. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D DOWNLOAD_LATTE=value # download LATTE for build, value = no (default) or yes -D LATTE_LIBRARY=path # LATTE library file (only needed if a custom location) @@ -399,12 +438,12 @@ simply invokes the lib/latte/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-latte # print help message - make lib-latte args="-b" # download and build in lib/latte/LATTE-master - make lib-latte args="-p $HOME/latte" # use existing LATTE installation in $HOME/latte - make lib-latte args="-b -m gfortran" # download and build in lib/latte and + $ make lib-latte # print help message + $ make lib-latte args="-b" # download and build in lib/latte/LATTE-master + $ make lib-latte args="-p $HOME/latte" # use existing LATTE installation in $HOME/latte + $ make lib-latte args="-b -m gfortran" # download and build in lib/latte and # copy Makefile.lammps.gfortran to Makefile.lammps Note that 3 symbolic (soft) links, "includelink" and "liblink" and @@ -429,7 +468,7 @@ be installed on your system. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D MESSAGE_ZMQ=value # build with ZeroMQ support, value = no (default) or yes -D ZMQ_LIBRARY=path # ZMQ library file (only needed if a custom location) @@ -444,11 +483,11 @@ one step from the lammps/src dir, using a command like these, which simply invoke the lib/message/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-message # print help message - make lib-message args="-m -z" # build with MPI and socket (ZMQ) support - make lib-message args="-s" # build as serial lib with no ZMQ support + $ make lib-message # print help message + $ make lib-message args="-m -z" # build with MPI and socket (ZMQ) support + $ make lib-message args="-s" # build as serial lib with no ZMQ support The build should produce two files: lib/message/cslib/src/libmessage.a and lib/message/Makefile.lammps. The latter is copied from an @@ -473,7 +512,7 @@ lib/mscg/README and MSCG/Install files for more details. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D DOWNLOAD_MSCG=value # download MSCG for build, value = no (default) or yes -D MSCG_LIBRARY=path # MSCG library file (only needed if a custom location) @@ -494,14 +533,14 @@ step from the lammps/src dir, using a command like these, which simply invoke the lib/mscg/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-mscg # print help message - make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master + $ make lib-mscg # print help message + $ make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master # with the settings compatible with "make serial" - make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master + $ make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master # with the settings compatible with "make mpi" - make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release + $ make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release Note that 2 symbolic (soft) links, "includelink" and "liblink", will be created in lib/mscg to point to the MS-CG src/installation dir. @@ -550,12 +589,12 @@ dir, using a command like these, which simply invoke the lib/poems/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-poems # print help message - make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") - make lib-poems args="-m icc" # build with Intel icc compiler + $ make lib-poems # print help message + $ make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial") + $ make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") + $ make lib-poems args="-m icc" # build with Intel icc compiler The build should produce two files: lib/poems/libpoems.a and lib/poems/Makefile.lammps. The latter is copied from an existing @@ -582,7 +621,7 @@ lib/python/README for more details. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D PYTHON_EXECUTABLE=path # path to Python executable to use @@ -618,7 +657,7 @@ To build with this package, you must download and build the `Voro++ library - make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++ - make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 + $ make lib-voronoi # print help message + $ make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++- + $ make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++ + $ make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 Note that 2 symbolic (soft) links, "includelink" and "liblink", are created in lib/voronoi to point to the Voro++ src dir. When LAMMPS @@ -671,7 +710,7 @@ installation and the instructions below are followed for the respective build sy **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D ADIOS2_DIR=path # path is where ADIOS 2.x is installed -D PKG_USER-ADIOS=yes @@ -681,16 +720,16 @@ installation and the instructions below are followed for the respective build sy Turn on the USER-ADIOS package before building LAMMPS. If the ADIOS 2.x software is installed in PATH, there is nothing else to do: -.. parsed-literal:: +.. code-block:: bash - make yes-user-adios + $ make yes-user-adios otherwise, set ADIOS2\_DIR environment variable when turning on the package: -.. parsed-literal:: +.. code-block:: bash - ADIOS2_DIR=path make yes-user-adios # path is where ADIOS 2.x is installed + $ ADIOS2_DIR=path make yes-user-adios # path is where ADIOS 2.x is installed ---------- @@ -717,12 +756,12 @@ dir, using a command like these, which simply invoke the lib/atc/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-atc # print help message - make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - make lib-atc args="-m icc" # build with Intel icc compiler + $ make lib-atc # print help message + $ make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + $ make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + $ make lib-atc args="-m icc" # build with Intel icc compiler The build should produce two files: lib/atc/libatc.a and lib/atc/Makefile.lammps. The latter is copied from an existing @@ -739,12 +778,12 @@ lib/linalg. In the latter case you also need to build the library in lib/linalg with a command like these: -.. parsed-literal:: +.. 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 + $ 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 ---------- @@ -768,12 +807,12 @@ dir, using a command like these, which simply invoke the lib/awpmd/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-awpmd # print help message - make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - make lib-awpmd args="-m icc" # build with Intel icc compiler + $ make lib-awpmd # print help message + $ make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + $ make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + $ make lib-awpmd args="-m icc" # build with Intel icc compiler The build should produce two files: lib/awpmd/libawpmd.a and lib/awpmd/Makefile.lammps. The latter is copied from an existing @@ -790,12 +829,12 @@ provided in lib/linalg. In the latter case you also need to build the library in lib/linalg with a command like these: -.. parsed-literal:: +.. 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 + $ 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 ---------- @@ -842,12 +881,12 @@ command like these, which simply invoke the lib/colvars/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-colvars # print help message - make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled + $ make lib-colvars # print help message + $ make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial") + $ make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + $ make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled The "machine" argument of the "-m" flag is used to find a Makefile.machine to use as build recipe. If it does not already exist in lib/colvars, it will be @@ -856,8 +895,10 @@ core LAMMPS makefiles. Optional flags may be specified as environment variables: -COLVARS\_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower) -COLVARS\_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise) +.. code-block:: bash + + $ COLVARS_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower) + $ COLVARS_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise) The build should produce two files: the library lib/colvars/libcolvars.a (which also includes Lepton objects if enabled) and the specification file @@ -878,6 +919,9 @@ USER-PLUMED package Before building LAMMPS with this package, you must first build PLUMED. PLUMED can be built as part of the LAMMPS build or installed separately from LAMMPS using the generic `plumed installation instructions `_. +The USER-PLUMED package has been tested to work with Plumed versions +2.4.x, 2.5.x, and 2.6.x and will error out, when trying to run calculations +with a different version of the Plumed kernel. PLUMED can be linked into MD codes in three different modes: static, @@ -916,7 +960,7 @@ your environment. There are then two additional commands that control the manner in which PLUMED is obtained and linked into LAMMPS. -.. parsed-literal:: +.. code-block:: bash -D DOWNLOAD_PLUMED=value # download PLUMED for build, value = no (default) or yes -D PLUMED_MODE=value # Linkage mode for PLUMED, value = static (default), shared, or runtime @@ -952,12 +996,12 @@ Download/compilation/configuration of the plumed library can be done from the src folder through the following make args: -.. parsed-literal:: +.. code-block:: bash - make lib-plumed # print help message - make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2 - make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local - make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in + $ make lib-plumed # print help message + $ make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2 + $ make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local + $ make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in # /usr/local and use shared linkage mode Note that 2 symbolic (soft) links, "includelink" and "liblink" are @@ -968,10 +1012,10 @@ mode. After this step is completed, you can install the USER-PLUMED package and compile LAMMPS in the usual manner: -.. parsed-literal:: +.. code-block:: bash - make yes-user-plumed - make machine + $ make yes-user-plumed + $ make machine Once this compilation completes you should be able to run LAMMPS in the usual way. For shared linkage mode, libplumed.so must be found by the @@ -1019,10 +1063,10 @@ dir, using a command like these, which simply invoke the lib/h5md/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-h5md # print help message - make lib-h5md args="-m h5cc" # build with h5cc compiler + $ make lib-h5md # print help message + $ make lib-h5md args="-m h5cc" # build with h5cc compiler The build should produce two files: lib/h5md/libch5md.a and lib/h5md/Makefile.lammps. The latter is copied from an existing @@ -1050,7 +1094,7 @@ on the :doc:`Speed intel ` doc page. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D INTEL_ARCH=value # value = cpu (default) or knl -D INTEL_LRT_MODE=value # value = threads, none, or c++11 @@ -1077,7 +1121,7 @@ additional information. For CPUs: -.. parsed-literal:: +.. code-block:: make OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload -fno-alias -ansi-alias -restrict $(OPTFLAGS) @@ -1087,7 +1131,7 @@ For CPUs: For KNLs: -.. parsed-literal:: +.. code-block:: make OPTFLAGS = -xMIC-AVX512 -O2 -fp-model fast=2 -no-prec-div -qoverride-limits CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload -fno-alias -ansi-alias -restrict $(OPTFLAGS) @@ -1106,7 +1150,7 @@ USER-MOLFILE package **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D MOLFILE_INCLUDE_DIRS=path # (optional) path where VMD molfile plugin headers are installed -D PKG_USER-MOLFILE=yes @@ -1186,9 +1230,9 @@ See src/MAKE/OPTIONS/Makefile.omp for an example. .. parsed-literal:: - CCFLAGS: -fopenmp # for GNU Compilers + CCFLAGS: -fopenmp # for GNU and Clang Compilers CCFLAGS: -qopenmp -restrict # for Intel compilers on Linux - LINKFLAGS: -fopenmp # for GNU Compilers + LINKFLAGS: -fopenmp # for GNU and Clang Compilers LINKFLAGS: -qopenmp # for Intel compilers on Linux For other platforms and compilers, please consult the documentation @@ -1204,25 +1248,40 @@ how to address compatibility :ref:`issues with the 'default(none)' directive ` for +background information. This requires compatible Quantum Espresso +and LAMMPS versions. The current interface and makefiles have last +been verified to work in February 2020 with Quantum Espresso versions +6.3 to 6.5. **CMake build**\ : -The CMake build system currently does not support building the full -QM/MM-capable hybrid executable of LAMMPS and QE called pwqmmm.x. -You must use the traditional make build for this package. +When using CMake, building a LAMMPS library is required and it is +recommended to build a shared library, since any libraries built from +the sources in the *lib* folder (including the essential libqmmm.a) +are not included in the static LAMMPS library and (currently) not +installed, while their code is included in the shared LAMMPS library. +Thus a typical command line to configure building LAMMPS for USER-QMMM +would be: + +.. code-block:: bash + + cmake -C ../cmake/presets/minimal.cmake -D PKG_USER-QMMM=yes \ + -D BUILD_LIB=yes -DBUILD_SHARED_LIBS=yes ../cmake + +After completing the LAMMPS build and also configuring and compiling +Quantum ESPRESSO with external library support (via "make couple"), +go back to the lib/qmmm folder and follow the instructions on the +README file to build the combined LAMMPS/QE QM/MM executable +(pwqmmm.x) in the lib/qmmm folder. You need to make certain, that + **Traditional make**\ : @@ -1233,12 +1292,12 @@ lammps/src dir, using a command like these, which simply invoke the lib/qmmm/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-qmmm # print help message - make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial") - make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi") - make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler + $ make lib-qmmm # print help message + $ make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial") + $ make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi") + $ make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler The build should produce two files: lib/qmmm/libqmmm.a and lib/qmmm/Makefile.lammps. The latter is copied from an existing @@ -1250,10 +1309,10 @@ a corresponding Makefile.lammps.machine file. You can then install QMMM package and build LAMMPS in the usual manner. After completing the LAMMPS build and compiling Quantum -ESPRESSO with external library support, go back to the lib/qmmm folder -and follow the instructions on the README file to build the combined -LAMMPS/QE QM/MM executable (pwqmmm.x) in the lib/qmmm folder. - +ESPRESSO with external library support (via "make couple"), go back to +the lib/qmmm folder and follow the instructions in the README file to +build the combined LAMMPS/QE QM/MM executable (pwqmmm.x) in the +lib/qmmm folder. ---------- @@ -1272,7 +1331,7 @@ lib/quip/README file for details on how to do this. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location) @@ -1308,7 +1367,7 @@ To build with this package, you must download and build the `ScaFaCoS Coulomb so **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D DOWNLOAD_SCAFACOS=value # download ScaFaCoS for build, value = no (default) or yes -D SCAFACOS_LIBRARY=path # ScaFaCos library file (only needed if at custom location) @@ -1353,7 +1412,7 @@ Eigen3 is a template library, so you do not need to build it. **CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D DOWNLOAD_EIGEN3 # download Eigen3, value = no (default) or yes -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a custom location) @@ -1371,11 +1430,11 @@ the lammps/src dir, using a command like these, which simply invoke the lib/smd/Install.py script with the specified args: -.. parsed-literal:: +.. code-block:: bash - make lib-smd # print help message - make lib-smd args="-b" # download to lib/smd/eigen3 - make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 + $ make lib-smd # print help message + $ make lib-smd args="-b" # download to lib/smd/eigen3 + $ make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 Note that a symbolic (soft) link named "includelink" is created in lib/smd to point to the Eigen dir. When LAMMPS builds it will use @@ -1412,8 +1471,3 @@ the settings are not valid for your system, check if one of the other lib/vtk/Makefile.lammps.\* files is compatible and copy it to Makefile.lammps. If none of the provided files work, you will need to edit the Makefile.lammps file. See lib/vtk/README for details. - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_link.rst b/doc/src/Build_link.rst index 8306fcb86f5930d89179a16b467a0cfecc9b0c62..365decd54dd1998443d0d169b5e7b55d126f19d8 100644 --- a/doc/src/Build_link.rst +++ b/doc/src/Build_link.rst @@ -3,62 +3,228 @@ Link LAMMPS as a library to another code LAMMPS can be used as a library by another application, including Python scripts. The files src/library.cpp and library.h define the -C-style API for using LAMMPS as a library. See the :doc:`Howto library ` doc page for a description of the -interface and how to extend it for your needs. +C-style API for using LAMMPS as a library. See the :doc:`Howto +library ` doc page for a description of the interface +and how to extend it for your needs. The :doc:`Build basics ` doc page explains how to build LAMMPS as either a shared or static library. This results in one of these 2 files: -liblammps.so # shared library -liblammps.a # static library +.. parsed-literal:: + + liblammps.so # shared library + liblammps.a # static library + +.. note:: + Care should be taken to use the same MPI library for the calling + code and the LAMMPS library. The library.h file includes mpi.h and + uses definitions from it so those need to be available and + consistent. When LAMMPS is compiled with the MPI STUBS library, + then its mpi.h file needs to be included. While it is technically + possible to use a full MPI library in the calling code and link to + a serial LAMMPS library compiled with MPI STUBS, it is recommended + to use the *same* MPI library for both, and then use MPI\_Comm\_split() + in the calling code to pass a suitable communicator with a subset + of MPI ranks to the function creating the LAMMPS instance. ---------- **Link with LAMMPS as a static library**\ : -The calling application can link to LAMMPS as a static library with a -link command like this: +The calling application can link to LAMMPS as a static library with +compilation and link commands as in the examples shown below. These +are examples for a code written in C in the file *caller.c*. +The benefit of linking to a static library is, that the resulting +executable is independent of that library since all required +executable code from the library is copied into the calling executable. -g++ caller.o -L/home/sjplimp/lammps/src -llammps -o caller +*CMake build*\ : -The -L argument is the path to where the liblammps.a file is. The --llammps argument is shorthand for the file liblammps.a. +This assumes that LAMMPS has been configured with "-D BUILD_LIB=yes" +and installed with "make install" and the PKG\_CONFIG\_PATH environment +variable updated to include the *liblammps.pc* file installed into the +configured destination folder, if needed. The commands to compile and +link the coupled executable are then: +.. code-block:: bash ----------- + mpicc -c -O $(pkgconf liblammps --cflags) caller.c + mpicxx -o caller caller.o -$(pkgconf liblammps --libs) + + +*Traditional make*\ : + +This assumes that LAMMPS has been compiled in the folder +"${HOME}/lammps/src" with "make mode=lib mpi". The commands to compile +and link the coupled executable are then: + +.. code-block:: bash + + mpicc -c -O -I${HOME}/lammps/src caller.c + mpicxx -o caller caller.o -L${HOME}/lammps/src -llammps + +The *-I* argument is the path to the location of the *library.h* +header file containing the interface to the LAMMPS C-style library +interface. The *-L* argument is the path to where the *liblammps.a* +file is located. The *-llammps* argument is shorthand for telling the +compiler to link the file *liblammps.a*\ . + +However, it is only as simple as shown above for the case of a plain +LAMMPS library without any optional packages that depend on libraries +(bundled or external). Otherwise, you need to include all flags, +libraries, and paths for the coupled executable, that are also +required to link the LAMMPS executable. + +*CMake build*\ : + +When using CMake, additional libraries with sources in the lib folder +are built, but not included in liblammps.a and (currently) not +installed with "make install" and not included in the *pkgconfig* +configuration file. They can be found in the top level build folder, +but you have to determine the necessary link flags manually. It is +therefore recommended to either use the traditional make procedure to +build and link with a static library or build and link with a shared +library instead. + +*Traditional make*\ : + +After you have compiled a static LAMMPS library using the conventional +build system for example with "make mode=lib serial". And you also +have installed the POEMS package after building its bundled library in +lib/poems. Then the commands to build and link the coupled executable +change to: + +.. code-block:: bash + + gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c + g++ -o caller caller.o -L${HOME}/lammps/lib/poems \ + -L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src -llammps -lpoems -lmpi_stubs + +Note, that you need to link with "g++" instead of "gcc", since LAMMPS +is C++ code. You can display the currently applied settings for building +LAMMPS for the "serial" machine target by using the command: + +.. code-block:: bash + + make mode=print serial + +Which should output something like: + +.. code-block:: bash + + # Compiler: + CXX=g++ + # Linker: + LD=g++ + # Compilation: + CXXFLAGS=-g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I${HOME}/lammps/lib/poems -I${HOME}/lammps/src/STUBS + # Linking: + LDFLAGS=-g -O + # Libraries: + LDLIBS=-L${HOME}/lammps/lib/poems -L${HOME}/lammps/src/STUBS -lpoems -lmpi_stubs + +From this you can gather the necessary paths and flags. With +makefiles for other *machine* configurations you need to do the +equivalent and replace "serial" with the corresponding *machine* name +of the makefile. +---------- **Link with LAMMPS as a shared library**\ : -If you wish to link to liblammps.so, the operating system finds shared -libraries to load at run-time using the environment variable -LD\_LIBRARY\_PATH. To enable this you can do one of two things: +When linking to LAMMPS built as a shared library, the situation +becomes much simpler, as all dependent libraries and objects are +included in the shared library, which is - technically speaking - +effectively a regular LAMMPS executable that is missing the `main()` +function. Thus those libraries need not to be specified when linking +the calling executable. Only the *-I* flags are needed. So the +example case from above of the serial version static LAMMPS library +with the POEMS package installed becomes: -(1) Copy the liblammps.so file to a location the system can find it, -such as /usr/local/lib. I.e. a directory already listed in your -LD\_LIBRARY\_PATH variable. You can type +*CMake build*\ : +The commands with a shared LAMMPS library compiled with the CMake +build process are the same as for the static library. -.. parsed-literal:: +.. code-block:: bash + + mpicc -c -O $(pkgconf liblammps --cflags) caller.c + mpicxx -o caller caller.o -$(pkgconf --libs) + +*Traditional make*\ : + +The commands with a shared LAMMPS library compiled with the +traditional make build using "make mode=shlib serial" becomes: + +.. code-block:: bash + + gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c + g++ -o caller caller.o -L${HOME}/lammps/src -llammps + +*Locating liblammps.so at runtime*\ : + +However, now the `liblammps.so` file is required at runtime and needs +to be in a folder, where the shared linker program of the operating +system can find it. This would be either a folder like "/usr/local/lib64" +or "${HOME}/.local/lib64" or a folder pointed to by the LD\_LIBRARY\_PATH +environment variable. You can type + +.. code-block:: bash printenv LD_LIBRARY_PATH to see what directories are in that list. -(2) Add the LAMMPS src directory (or the directory you perform CMake -build in) to your LD\_LIBRARY\_PATH, so that the current version of the -shared library is always available to programs that use it. +Or you can add the LAMMPS src directory (or the directory you performed +a CMake style build in) to your LD\_LIBRARY\_PATH, so that the current +version of the shared library is always available to programs that use it. -For the csh or tcsh shells, you would add something like this to your -~/.cshrc file: +For the Bourne or Korn shells (/bin/sh, /bin/ksh, /bin/bash etc.), you +would add something like this to your ~/.profile file: +.. code-block:: bash + + LD_LIBRARY_PATH ${LD_LIBRARY_PATH-/usr/lib64}:${HOME}/lammps/src + export LD_LIBRARY_PATH + +For the csh or tcsh shells, you would equivalently add something like this +to your ~/.cshrc file: -.. parsed-literal:: - setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/home/sjplimp/lammps/src +.. code-block:: csh + + setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HOME}/lammps/src + +You can verify whether all required shared libraries are found with the +`ldd` tool. Example: + +.. code-block:: bash + + $ LD_LIBRARY_PATH=/home/user/lammps/src ldd caller + linux-vdso.so.1 (0x00007ffe729e0000) + liblammps.so => /home/user/lammps/src/liblammps.so (0x00007fc91bb9e000) + libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fc91b984000) + libm.so.6 => /lib64/libm.so.6 (0x00007fc91b83e000) + libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fc91b824000) + libc.so.6 => /lib64/libc.so.6 (0x00007fc91b65b000) + /lib64/ld-linux-x86-64.so.2 (0x00007fc91c094000) + + +If a required library is missing, you would get a 'not found' entry: + +.. code-block:: bash + + $ ldd caller + linux-vdso.so.1 (0x00007ffd672fe000) + liblammps.so => not found + libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fb7c7e86000) + libm.so.6 => /usr/lib64/libm.so.6 (0x00007fb7c7d40000) + libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fb7c7d26000) + libc.so.6 => /usr/lib64/libc.so.6 (0x00007fb7c7b5d000) + /lib64/ld-linux-x86-64.so.2 (0x00007fb7c80a2000) ---------- @@ -67,25 +233,22 @@ For the csh or tcsh shells, you would add something like this to your **Calling the LAMMPS library**\ : Either flavor of library (static or shared) allows one or more LAMMPS -objects to be instantiated from the calling program. - -When used from a C++ program, all of LAMMPS is wrapped in a LAMMPS\_NS -namespace; you can safely use any of its classes and methods from -within the calling code, as needed. - -When used from a C or Fortran program, the library has a simple +objects to be instantiated from the calling program. When used from a +C++ program, most of the symbols and functions in LAMMPS are wrapped +in a LAMMPS\_NS namespace; you can safely use any of its classes and +methods from within the calling code, as needed, and you will not incur +conflicts with functions and variables in your code that share the name. +This, however, does not extend to all additional libraries bundled with +LAMMPS in the lib folder and some of the low-level code of some packages. + +To be compatible with C, Fortran, Python programs, the library has a simple C-style interface, provided in src/library.cpp and src/library.h. See the :doc:`Python library ` doc page for a description of the Python interface to LAMMPS, which wraps the C-style -interface. +interface from a shared library through the ctypes python module. See the sample codes in examples/COUPLE/simple for examples of C++ and C and Fortran codes that invoke LAMMPS through its library interface. Other examples in the COUPLE directory use coupling ideas discussed on the :doc:`Howto couple ` doc page. - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_make.rst b/doc/src/Build_make.rst index 8f1966f1014bc120cc9858c88fb23afe1ba92613..ebd1790e11402fd684818b5a82b59a263dd7520e 100644 --- a/doc/src/Build_make.rst +++ b/doc/src/Build_make.rst @@ -7,18 +7,33 @@ src/MAKE/MACHINES, src/MAKE/OPTIONS, or src/MAKE/MINE directory (see below). It can include various options for customizing your LAMMPS build with a number of global compilation options and features. -To include LAMMPS packages (i.e. optional commands and styles) you -must install them first, as discussed on the :doc:`Build package ` doc page. If the packages require -provided or external libraries, you must build those libraries before -building LAMMPS. Building :doc:`LAMMPS with CMake ` can -automate all of this for many types of machines, especially -workstations, desktops and laptops, so we suggest you try it first. +Those makefiles are written for and tested with GNU make and may not +be compatible with other make programs. In most cases, if the "make" +program is not GNU make, then there will be a GNU make program +available under the name "gmake". If GNU make or a compatible make is +not available, you may have to first install it or switch to building +with :doc:`CMake `. The makefiles of the traditional +make based build process and the scripts they are calling expect a few +additional tools to be available and functioning. + + * a Bourne shell compatible "Unix" shell program (often this is bash) + * a few shell utilities: ls, mv, ln, rm, grep, sed, tr, cat, touch, diff, dirname + * python (optional, required for "make lib-XXX" in the src folder) -These commands perform a default LAMMPS build, producing the LAMMPS -executable lmp\_serial or lmp\_mpi in lammps/src: +To include LAMMPS packages (i.e. optional commands and styles) you +must enable them first, as discussed on the :doc:`Build package +` doc page. If a packages requires (provided or +external) libraries, you must configure and build those libraries +**before** building LAMMPS itself and especially **before** enabling +such a package with "make yes-". Building :doc:`LAMMPS +with CMake ` can automate much of this for many types of +machines, especially workstations, desktops, and laptops, so we suggest +you try it first when building LAMMPS in those cases. +The commands below perform a default LAMMPS build, producing the LAMMPS +executable lmp\_serial and lmp\_mpi in lammps/src: -.. parsed-literal:: +.. code-block:: bash cd lammps/src make serial # build a serial LAMMPS executable @@ -42,18 +57,21 @@ re-compiled. .. note:: - When you build LAMMPS for the first time, a long list of \*.d - files will be printed out rapidly. This is not an error; it is the - Makefile doing its normal creation of dependencies. - + Before the actual compilation starts, LAMMPS will perform several + steps to collect information from the configuration and setup that + is then embedded into the executable. When you build LAMMPS for + the first time, it will also compile a tool to quickly assemble + a list of dependencies, that are required for the make program to + correctly detect which parts need to be recompiled after changes + were made to the sources. ---------- - -The lammps/src/MAKE tree contains all the Makefile.machine files -included in the LAMMPS distribution. Typing "make machine" uses -Makefile.machine. Thus the "make serial" or "make mpi" lines above -use Makefile.serial and Makefile.mpi. Others are in these dirs: +The lammps/src/MAKE tree contains the Makefile.machine files included +in the LAMMPS distribution. Typing "make machine" uses +*Makefile.machine*\ . Thus the "make serial" or "make mpi" lines above +use Makefile.serial and Makefile.mpi, respectively. Other makefiles +are in these directories: .. parsed-literal:: @@ -64,7 +82,7 @@ use Makefile.serial and Makefile.mpi. Others are in these dirs: Typing "make" lists all the available Makefile.machine files. A file with the same name can appear in multiple folders (not a good idea). -The order the dirs are searched is as follows: src/MAKE/MINE, +The order the directories are searched is as follows: src/MAKE/MINE, src/MAKE, src/MAKE/OPTIONS, src/MAKE/MACHINES. This gives preference to a customized file you put in src/MAKE/MINE. @@ -76,7 +94,7 @@ compilers, OS configurations, and LAMMPS itself keep changing, their settings may become outdated: -.. parsed-literal:: +.. code-block:: bash make mac # build serial LAMMPS on a Mac make mac_mpi # build parallel LAMMPS on a Mac @@ -87,8 +105,3 @@ settings may become outdated: make kokkos_omp # build with the KOKKOS package for OpenMP make kokkos_cuda_mpi # build with the KOKKOS package for GPUs make kokkos_phi # build with the KOKKOS package for KNLs - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index 9f56f3f329d7c13d78874ddafdb0b7e7e9402ffc..cd178161b3eaba525c74789b1848fa93a5321136 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -14,10 +14,13 @@ package. In general there is no need to include a package if you never plan to use its features. If you get a run-time error that a LAMMPS command or style is -"Unknown", it is often because the command is contained in a package, -and your build did not include that package. Running LAMMPS with the -:doc:`-h command-line switch ` will print all the included -packages and commands for that executable. +"unknown", it is often because the command is contained in a package, +and your build did not include that package. If the command or style +*is* available in a package included in the LAMMPS distribution, +the error message will indicate which package would be needed. +Running LAMMPS with the :doc:`-h command-line switch ` +will print *all* optional commands and packages that were enabled +when building that executable. For the majority of packages, if you follow the single step below to include it, you can then build LAMMPS exactly the same as you would @@ -42,17 +45,17 @@ packages: The mechanism for including packages is simple but different for CMake versus make. -**CMake variables**\ : +**CMake build**\ : -.. parsed-literal:: +.. code-block:: bash -D PKG_NAME=value # yes or no (default) Examples: -.. parsed-literal:: +.. code-block:: bash -D PKG_MANYBODY=yes -D PKG_USER-INTEL=yes @@ -74,7 +77,7 @@ once with CMake. **Traditional make**\ : -.. parsed-literal:: +.. code-block:: bash cd lammps/src make ps # check which packages are currently installed @@ -85,7 +88,7 @@ once with CMake. Examples: -.. parsed-literal:: +.. code-block:: bash make no-rigid make yes-user-intel @@ -119,7 +122,7 @@ are already included. Likewise, if a package is excluded, other files dependent on that package are also excluded. When you download a LAMMPS tarball or download LAMMPS source files -from the Git or SVN repositories, no packages are pre-installed in the +from the git repository, no packages are pre-installed in the src directory. .. note:: @@ -136,9 +139,10 @@ src directory. **CMake shortcuts for installing many packages**\ : Instead of specifying all the CMake options via the command-line, -CMake allows initializing the variable cache using script files. These -are regular CMake files which can manipulate and set variables, and -can also contain control flow constructs. +CMake allows initializing its settings cache using script files. +These are regular CMake files which can manipulate and set CMake +variables (which represent selected options), and can also contain +control flow constructs for more complex operations. LAMMPS includes several of these files to define configuration "presets", similar to the options that exist for the Make based @@ -146,25 +150,19 @@ system. Using these files you can enable/disable portions of the available packages in LAMMPS. If you need a custom preset you can take one of them as a starting point and customize it to your needs. -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/all\_on.cmake [OPTIONS] ../cmake | enable all packages | -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/all\_off.cmake [OPTIONS] ../cmake | disable all packages | -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/minimal.cmake [OPTIONS] ../cmake | enable just a few core packages | -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/most.cmake [OPTIONS] ../cmake | enable most common packages | -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/nolib.cmake [OPTIONS] ../cmake | disable packages that do require extra libraries or tools | -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake | change settings to use the Clang compilers by default | -+-------------------------------------------------------------+-----------------------------------------------------------+ -| cmake -C ../cmake/presets/mingw.cmake [OPTIONS] ../cmake | enable all packages compatible with MinGW compilers | -+-------------------------------------------------------------+-----------------------------------------------------------+ +.. code-block:: bash + + cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages + cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages + cmake -C ../cmake/presets/minimal.cmake [OPTIONS] ../cmake # enable just a few core packages + cmake -C ../cmake/presets/most.cmake [OPTIONS] ../cmake # enable most common packages + cmake -C ../cmake/presets/nolib.cmake [OPTIONS] ../cmake # disable packages that do require extra libraries or tools + cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake # change settings to use the Clang compilers by default + cmake -C ../cmake/presets/mingw.cmake [OPTIONS] ../cmake # enable all packages compatible with MinGW compilers .. note:: - Running cmake this way manipulates the variable cache in your + Running cmake this way manipulates the CMake settings cache in your current build directory. You can combine multiple presets and options in a single cmake run, or change settings incrementally by running cmake with new flags. @@ -172,7 +170,7 @@ one of them as a starting point and customize it to your needs. **Example:** -.. parsed-literal:: +.. code-block:: bash # build LAMMPS with most commonly used packages, but then remove # those requiring additional library or tools, but still enable @@ -200,37 +198,30 @@ Just type "make" in lammps/src to see a one-line summary. These commands install/un-install sets of packages: -+-----------------------------------+-----------------------------------------------------+ -| make yes-all | install all packages | -+-----------------------------------+-----------------------------------------------------+ -| make no-all | un-install all packages | -+-----------------------------------+-----------------------------------------------------+ -| make yes-standard or make yes-std | install standard packages | -+-----------------------------------+-----------------------------------------------------+ -| make no-standard or make no-std | un-install standard packages | -+-----------------------------------+-----------------------------------------------------+ -| make yes-user | install user packages | -+-----------------------------------+-----------------------------------------------------+ -| make no-user | un-install user packages | -+-----------------------------------+-----------------------------------------------------+ -| make yes-lib | install packages that require extra libraries | -+-----------------------------------+-----------------------------------------------------+ -| make no-lib | un-install packages that require extra libraries | -+-----------------------------------+-----------------------------------------------------+ -| make yes-ext | install packages that require external libraries | -+-----------------------------------+-----------------------------------------------------+ -| make no-ext | un-install packages that require external libraries | -+-----------------------------------+-----------------------------------------------------+ +.. code-block:: bash + + make yes-all # install all packages + make no-all # uninstall all packages + make yes-standard or make yes-std # install standard packages + make no-standard or make no-std # uninstall standard packages + make yes-user # install user packages + make no-user # uninstall user packages + make yes-lib # install packages that require extra libraries + make no-lib # uninstall packages that require extra libraries + make yes-ext # install packages that require external libraries + make no-ext # uninstall packages that require external libraries which install/un-install various sets of packages. Typing "make package" will list all the these commands. .. note:: - Installing or un-installing a package works by simply copying - files back and forth between the main src directory and - sub-directories with the package name (e.g. src/KSPACE, src/USER-ATC), - so that the files are included or excluded when LAMMPS is built. + Installing or un-installing a package for the make based build process + works by simply copying files back and forth between the main source + directory src and the sub-directories with the package name (e.g. + src/KSPACE, src/USER-ATC), so that the files are included or excluded + when LAMMPS is built. Only source files in the src folder will be + compiled. The following make commands help manage files that exist in both the src directory and in package sub-directories. You do not normally @@ -257,9 +248,4 @@ Type "make package-overwrite" to overwrite files in the package sub-directories with src files. Type "make package-diff" to list all differences between pairs of -files in both the src dir and a package dir. - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html +files in both the source directory and the package directory. diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 07d427db49860a522797a46d7b875177287b8948..1e668ee95d2d2b2f376a2eede7d59bc147c21a99 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -4,16 +4,15 @@ Optional build settings LAMMPS can be built with several optional settings. Each sub-section explain how to do this for building both with CMake and make. -| :ref:`C++11 standard compliance test ` when building all of LAMMPS -| :ref:`FFT library ` for use with the :doc:`kspace\_style pppm ` command -| :ref:`Size of LAMMPS data types ` -| :ref:`Read or write compressed files ` -| :ref:`Output of JPG and PNG files ` via the :doc:`dump image ` command -| :ref:`Output of movie files ` via the :doc:`dump\_movie ` command -| :ref:`Memory allocation alignment ` -| :ref:`Workaround for long long integers ` -| :ref:`Error handling exceptions ` when using LAMMPS as a library -| +* :ref:`C++11 standard compliance ` when building all of LAMMPS +* :ref:`FFT library ` for use with the :doc:`kspace_style pppm ` command +* :ref:`Size of LAMMPS data types ` +* :ref:`Read or write compressed files ` +* :ref:`Output of JPG and PNG files ` via the :doc:`dump image ` command +* :ref:`Output of movie files ` via the :doc:`dump_movie ` command +* :ref:`Memory allocation alignment ` +* :ref:`Workaround for long long integers ` +* :ref:`Error handling exceptions ` when using LAMMPS as a library ---------- @@ -21,41 +20,18 @@ explain how to do this for building both with CMake and make. .. _cxx11: -C++11 standard compliance test +C++11 standard compliance ------------------------------------------ The LAMMPS developers plan to transition to make the C++11 standard the minimum requirement for compiling LAMMPS. Currently this only applies to some packages like KOKKOS while the rest aims to be compatible with the C++98 standard. Most currently used compilers are compatible with C++11; some need -to set extra flags to switch. To determine the impact of requiring C++11, -we have added a simple compliance test to the source code, that will cause -the compilation to abort, if C++11 compliance is not available or enabled. -To bypass this check, you need to change a setting in the makefile or -when calling CMake. +to set extra flags to enable C++11 compliance. Example for GNU c++: -**CMake variable**\ : - - -.. parsed-literal:: - - -D DISABLE_CXX11_REQUIREMENT=yes - -You can set additional C++ compiler flags (beyond those selected by CMake) -through the CMAKE\_CXX\_FLAGS variable. Example for CentOS 7: - - -.. parsed-literal:: - - -D CMAKE_CXX_FLAGS="-O3 -g -fopenmp -DNDEBUG -std=c++11" - -**Makefile.machine setting**\ : - - -.. parsed-literal:: - - LMP_INC = -DLAMMPS_CXX98 +.. code-block:: make + CCFLAGS = -g -O3 -std=c++11 ---------- @@ -66,7 +42,7 @@ FFT library --------------------- When the KSPACE package is included in a LAMMPS build, the -:doc:`kspace\_style pppm ` command performs 3d FFTs which +:doc:`kspace_style pppm ` command performs 3d FFTs which require use of an FFT library to compute 1d FFTs. The KISS FFT library is included with LAMMPS but other libraries can be faster. LAMMPS can use them if they are available on your system. @@ -74,7 +50,7 @@ LAMMPS can use them if they are available on your system. **CMake variables**\ : -.. parsed-literal:: +.. code-block:: bash -D FFT=value # FFTW3 or MKL or KISS, default is FFTW3 if found, else KISS -D FFT_SINGLE=value # yes or no (default), no = double precision @@ -86,56 +62,71 @@ LAMMPS can use them if they are available on your system. an exception to the rule that all CMake variables can be specified with lower-case values. -Usually these settings are all that is needed. If CMake cannot find -the FFT library, you can set these variables: +Usually these settings are all that is needed. If FFTW3 is selected, +then CMake will try to detect, if threaded FFTW libraries are available +and enable them by default. This setting is independent of whether +OpenMP threads are enabled and a packages like KOKKOS or USER-OMP is +used. If CMake cannot detect the FFT library, you can set these variables +to assist: -.. parsed-literal:: +.. code-block:: bash -D FFTW3_INCLUDE_DIRS=path # path to FFTW3 include files -D FFTW3_LIBRARIES=path # path to FFTW3 libraries + -D FFT_FFTW_THREADS=on # enable using threaded FFTW3 libraries -D MKL_INCLUDE_DIRS=path # ditto for Intel MKL library + -D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries -D MKL_LIBRARIES=path **Makefile.machine settings**\ : -.. parsed-literal:: +.. code-block:: make FFT_INC = -DFFT_FFTW3 # -DFFT_FFTW3, -DFFT_FFTW (same as -DFFT_FFTW3), -DFFT_MKL, or -DFFT_KISS # default is KISS if not specified FFT_INC = -DFFT_SINGLE # do not specify for double precision + FFT_INC = -DFFT_FFTW_THREADS # enable using threaded FFTW3 libraries + FFT_INC = -DFFT_MKL_THREADS # enable using threaded FFTs with MKL libraries FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY # default is FFT\_PACK\_ARRAY if not specified -.. parsed-literal:: +.. code-block:: make FFT_INC = -I/usr/local/include FFT_PATH = -L/usr/local/lib FFT_LIB = -lfftw3 # FFTW3 double precision + FFT_LIB = -lfftw3 -lfftw3_omp # FFTW3 double precision with threads (needs -DFFT_FFTW_THREADS) FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision - FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler - FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compier + FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler, serial interface + FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compier, serial interface + FFT_LIB = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core # MKL with Intel compiler, threaded interface + FFT_LIB = -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core # MKL with GNU compiler, threaded interface + FFT_LIB = -lmkl_rt # MKL with automatic runtime selection of interface libs As with CMake, you do not need to set paths in FFT\_INC or FFT\_PATH, if -make can find the FFT header and library files. You must specify -FFT\_LIB with the appropriate FFT libraries to include in the link. +the compiler can find the FFT header and library files in its default search path. +You must specify FFT\_LIB with the appropriate FFT libraries to include in the link. **CMake and make info**\ : The `KISS FFT library `_ is included in the LAMMPS -distribution. It is portable across all platforms. Depending on the -size of the FFTs and the number of processors used, the other -libraries listed here can be faster. +distribution. It is portable across all platforms. Depending on the size +of the FFTs and the number of processors used, the other libraries listed +here can be faster. However, note that long-range Coulombics are only a portion of the per-timestep CPU cost, FFTs are only a portion of long-range Coulombics, and 1d FFTs are only a portion of the FFT cost (parallel communication can be costly). A breakdown of these timings is printed -to the screen at the end of a run using the :doc:`kspace\_style pppm ` command. The :doc:`Run output ` -doc page gives more details. +to the screen at the end of a run when using the +:doc:`kspace_style pppm ` command. The :doc:`Run output ` +doc page gives more details. A more detailed (and time consuming) +report of the FFT performance is generated with the +:doc:`kspace_modify fftbench yes ` command. FFTW is a fast, portable FFT library that should also work on any platform and can be faster than the KISS FFT library. You can @@ -166,10 +157,10 @@ When using -DFFT\_SINGLE with FFTW3 you may need to build the FFTW library a second time with support for single-precision. For FFTW3, do the following, which should produce the additional -library libfftw3f.a +library libfftw3f.a or libfftw3f.so. -.. parsed-literal:: +.. code-block:: bash make clean ./configure --enable-single; make; make install @@ -197,14 +188,14 @@ adequate. **CMake variable**\ : -.. parsed-literal:: +.. code-block:: bash -D LAMMPS_SIZES=value # smallbig (default) or bigbig or smallsmall **Makefile.machine setting**\ : -.. parsed-literal:: +.. code-block:: make LMP_INC = -DLAMMPS_SMALLBIG # or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL @@ -235,7 +226,7 @@ support 8-byte integers. It allows for: Atom IDs are not required for atomic systems which do not store bond topology information, though IDs are enabled by default. The -:doc:`atom\_modify id no ` command will turn them off. Atom +:doc:`atom_modify id no ` command will turn them off. Atom IDs are required for molecular systems with bond topology (bonds, angles, dihedrals, etc). Thus if you model a molecular system with more than 2 billion atoms, you need the "bigbig" setting. @@ -275,21 +266,21 @@ following settings: **CMake variables**\ : -.. parsed-literal:: +.. code-block:: bash -D WITH_JPEG=value # yes or no - # default = yes if CMake finds JPEG files, else no + # default = yes if CMake finds JPEG files, else no -D WITH_PNG=value # yes or no - # default = yes if CMake finds PNG and ZLIB files, else no + # default = yes if CMake finds PNG and ZLIB files, else no -D WITH_FFMPEG=value # yes or no - # default = yes if CMake can find ffmpeg, else 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: -.. parsed-literal:: +.. code-block:: bash -D JPEG_INCLUDE_DIR=path # path to jpeglib.h header file -D JPEG_LIBRARIES=path # path to libjpeg.a (.so) file @@ -302,7 +293,7 @@ variables: **Makefile.machine settings**\ : -.. parsed-literal:: +.. code-block:: make LMP_INC = -DLAMMPS_JPEG LMP_INC = -DLAMMPS_PNG @@ -316,7 +307,7 @@ 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, -i.e. a dir in your PATH environment variable. +that is a directory in your PATH environment variable. **CMake and make info**\ : @@ -326,7 +317,7 @@ supports the "popen" function in the standard runtime library. .. note:: On some clusters with high-speed networks, using the fork() - library calls (required by popen()) can interfere with the fast + library call (required by popen()) can interfere with the fast communication library and lead to simulations using ffmpeg to hang or crash. @@ -341,12 +332,12 @@ Read or write compressed files If this option is enabled, large files can be read or written with gzip compression by several LAMMPS commands, including -:doc:`read\_data `, :doc:`rerun `, and :doc:`dump `. +:doc:`read_data `, :doc:`rerun `, and :doc:`dump `. **CMake variables**\ : -.. parsed-literal:: +.. code-block:: bash -D WITH_GZIP=value # yes or no # default is yes if CMake can find gzip, else no @@ -355,7 +346,7 @@ gzip compression by several LAMMPS commands, including **Makefile.machine setting**\ : -.. parsed-literal:: +.. code-block:: make LMP_INC = -DLAMMPS_GZIP @@ -368,7 +359,7 @@ found by LAMMPS during a run. .. note:: On some clusters with high-speed networks, using the fork() - library calls (required by popen()) can interfere with the fast + library call (required by popen()) can interfere with the fast communication library and lead to simulations using compressed output or input to hang or crash. For selected operations, compressed file I/O is also available using a compression library instead, which is @@ -395,7 +386,7 @@ aligned on 64-byte boundaries. **CMake variable**\ : -.. parsed-literal:: +.. code-block:: bash -D LAMMPS_MEMALIGN=value # 0, 8, 16, 32, 64 (default) @@ -407,7 +398,7 @@ and this setting ignored. **Makefile.machine setting**\ : -.. parsed-literal:: +.. code-block:: make LMP_INC = -DLAMMPS_MEMALIGN=value # 8, 16, 32, 64 @@ -434,14 +425,14 @@ those systems: **CMake variable**\ : -.. parsed-literal:: +.. code-block:: bash -D LAMMPS_LONGLONG_TO_LONG=value # yes or no (default) **Makefile.machine setting**\ : -.. parsed-literal:: +.. code-block:: make LMP_INC = -DLAMMPS_LONGLONG_TO_LONG @@ -455,25 +446,21 @@ Exception handling when using LAMMPS as a library ------------------------------------------------------------------ This setting is useful when external codes drive LAMMPS as a library. -With this option enabled LAMMPS errors do not kill the caller. +With this option enabled, LAMMPS errors do not kill the calling code. Instead, the call stack is unwound and control returns to the caller, -e.g. to Python. +e.g. to Python. Of course the calling code has to be set up to +*catch* exceptions from within LAMMPS. **CMake variable**\ : -.. parsed-literal:: +.. code-block:: bash -D LAMMPS_EXCEPTIONS=value # yes or no (default) **Makefile.machine setting**\ : -.. parsed-literal:: +.. code-block:: make LMP_INC = -DLAMMPS_EXCEPTIONS - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Build_windows.rst b/doc/src/Build_windows.rst index fd96b379839bf298d9ce57d51358d206c2b6be50..264e4bf44fc8f515b65e63ab2721ea0567b0a487 100644 --- a/doc/src/Build_windows.rst +++ b/doc/src/Build_windows.rst @@ -17,9 +17,9 @@ General remarks LAMMPS is developed and tested primarily on Linux machines. The vast majority of HPC clusters and supercomputers today runs on Linux as well. -Thus portability to other platforms is desired, but not always achieved. +While portability to other platforms is desired, it is not always achieved. The LAMMPS developers strongly rely on LAMMPS users giving feedback and -providing assistance in resolving portability issues. This particularly +providing assistance in resolving portability issues. This is particularly true for compiling LAMMPS on Windows, since this platform has significant differences with some low-level functionality. @@ -31,18 +31,20 @@ Running Linux on Windows So before trying to build LAMMPS on Windows, please consider if using the pre-compiled Windows binary packages are sufficient for your needs (as an aside, those packages themselves are build on a Linux machine -using cross-compilers). If it is necessary for your to compile LAMMPS +using cross-compilers). If it is necessary for you to compile LAMMPS on a Windows machine (e.g. because it is your main desktop), please also -consider using a virtual machine software and run a Linux virtual machine, -or - if have a recently updated Windows 10 installation - consider using -the Windows subsystem for Linux, which allows to run a bash shell from -Ubuntu and from there on, you can pretty much use that shell like you -are running on an Ubuntu Linux machine (e.g. installing software via -apt-get). For more details on that, please see :doc:`this tutorial ` +consider using a virtual machine software and compile and run LAMMPS in +a Linux virtual machine, or - if you have a recently updated Windows 10 +installation - consider using the Windows subsystem for Linux. This +optional Windows feature allows you to run the bash shell from Ubuntu +from within Windows and from there on, you can pretty much use that +shell like you are running on an Ubuntu Linux machine (e.g. installing +software via apt-get and more). For more details on that, please +see :doc:`this tutorial ` .. _gnu: -Using GNU GCC ported to Windows +Using a GNU GCC ported to Windows ----------------------------------------- One option for compiling LAMMPS on Windows natively, that has been known @@ -83,13 +85,13 @@ traditional build system, but CMake has also been successfully tested using the mingw32-cmake and mingw64-cmake wrappers that are bundled with the cross-compiler environment on Fedora machines. A CMake preset selecting all packages compatible with this cross-compilation build -is provided. You likely need to disable the GPU package unless you +is provided. You will likely need to disable the GPU package unless you download and install the contents of the pre-compiled `OpenCL ICD loader library `_ into your MinGW64 cross-compiler environment. The cross-compilation currently will only produce non-MPI serial binaries. -Please keep in mind, though, that this only applies to compiling LAMMPS. -Whether the resulting binaries do work correctly is no tested by the +Please keep in mind, though, that this only applies to **compiling** LAMMPS. +Whether the resulting binaries do work correctly is not tested by the 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 @@ -104,8 +106,3 @@ 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 code itself is not fully ported to support Visual C++. Volunteers to take on this task are welcome. - - -.. _lws: http://lammps.sandia.gov -.. _ld: Manual.html -.. _lc: Commands_all.html diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index 5ad8fff44c9b7203135124b21b2394e5b5fbc9ed..36ae112527631e7e7fb443a2623624b78b2a9cdd 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -17,7 +17,7 @@ General commands An alphabetic list of all general LAMMPS commands. .. table_from_list:: - :columns: 6 + :columns: 5 * :doc:`angle_coeff ` * :doc:`angle_style ` @@ -46,7 +46,8 @@ An alphabetic list of all general LAMMPS commands. * :doc:`dimension ` * :doc:`displace_atoms ` * :doc:`dump ` - * :doc:`dump adios ` + * :doc:`dump atom/adios ` + * :doc:`dump custom/adios ` * :doc:`dump image ` * :doc:`dump movie ` * :doc:`dump netcdf ` @@ -135,7 +136,3 @@ An alphabetic list of all general LAMMPS commands. * :doc:`write_data ` * :doc:`write_dump ` * :doc:`write_restart ` - * - * - * - * diff --git a/doc/src/Commands_bond.rst b/doc/src/Commands_bond.rst index 27ff2d19dace25ec7effe05d63f40f54b862f929..19be6d8cbc958bdf939b89174fc5629c519d9fdd 100644 --- a/doc/src/Commands_bond.rst +++ b/doc/src/Commands_bond.rst @@ -47,7 +47,6 @@ OPT. * :doc:`oxrna2/fene ` * :doc:`quartic (o) ` * :doc:`table (o) ` - * .. _angle: @@ -89,7 +88,6 @@ OPT. * :doc:`quartic (o) ` * :doc:`sdk (o) ` * :doc:`table (o) ` - * .. _dihedral: @@ -127,15 +125,13 @@ OPT. * :doc:`spherical ` * :doc:`table (o) ` * :doc:`table/cut ` - * - * .. _improper: Improper_style potentials ========================= -All LAMMPS :doc:`improper\_style ` commands. Some styles +All LAMMPS :doc:`improper_style ` commands. Some styles have accelerated versions. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. @@ -162,4 +158,3 @@ OPT. * :doc:`ring (o) ` * :doc:`sqdistharm ` * :doc:`umbrella (o) ` - * diff --git a/doc/src/Commands_category.rst b/doc/src/Commands_category.rst index b1b0e0cadcf6e83d1875c7728566f7a2e5e01494..da40ada9998844f53d0bdacd53b7abc848791cf0 100644 --- a/doc/src/Commands_category.rst +++ b/doc/src/Commands_category.rst @@ -7,126 +7,163 @@ alphabetically. Style options for entries like fix, compute, pair etc. have their own pages where they are listed alphabetically. Initialization: +------------------------------ -* :doc:`newton `, -* :doc:`package `, -* :doc:`processors `, -* :doc:`suffix `, -* :doc:`units ` +.. table_from_list:: + :columns: 5 + + * :doc:`newton ` + * :doc:`package ` + * :doc:`processors ` + * :doc:`suffix ` + * :doc:`units ` Setup simulation box: +------------------------------ -* :doc:`boundary `, -* :doc:`box `, -* :doc:`change\_box `, -* :doc:`create\_box `, -* :doc:`dimension `, -* :doc:`lattice `, -* :doc:`region ` +.. table_from_list:: + :columns: 4 -Setup atoms: + * :doc:`boundary ` + * :doc:`box ` + * :doc:`change_box ` + * :doc:`create_box ` + * :doc:`dimension ` + * :doc:`lattice ` + * :doc:`region ` -* :doc:`atom\_modify `, -* :doc:`atom\_style `, -* :doc:`balance `, -* :doc:`create\_atoms `, -* :doc:`create\_bonds `, -* :doc:`delete\_atoms `, -* :doc:`delete\_bonds `, -* :doc:`displace\_atoms `, -* :doc:`group `, -* :doc:`mass `, -* :doc:`molecule `, -* :doc:`read\_data `, -* :doc:`read\_dump `, -* :doc:`read\_restart `, -* :doc:`replicate `, -* :doc:`set `, -* :doc:`velocity ` +Setup atoms: +------------------------------ + +.. table_from_list:: + :columns: 4 + + * :doc:`atom_modify ` + * :doc:`atom_style ` + * :doc:`balance ` + * :doc:`create_atoms ` + * :doc:`create_bonds ` + * :doc:`delete_atoms ` + * :doc:`delete_bonds ` + * :doc:`displace_atoms ` + * :doc:`group ` + * :doc:`mass ` + * :doc:`molecule ` + * :doc:`read_data ` + * :doc:`read_dump ` + * :doc:`read_restart ` + * :doc:`replicate ` + * :doc:`set ` + * :doc:`velocity ` Force fields: - -* :doc:`angle\_coeff `, -* :doc:`angle\_style `, -* :doc:`bond\_coeff `, -* :doc:`bond\_style `, -* :doc:`bond\_write `, -* :doc:`dielectric `, -* :doc:`dihedral\_coeff `, -* :doc:`dihedral\_style `, -* :doc:`improper\_coeff `, -* :doc:`improper\_style `, -* :doc:`kspace\_modify `, -* :doc:`kspace\_style `, -* :doc:`pair\_coeff `, -* :doc:`pair\_modify `, -* :doc:`pair\_style `, -* :doc:`pair\_write `, -* :doc:`special\_bonds ` +------------------------------ + +.. table_from_list:: + :columns: 4 + + * :doc:`angle_coeff ` + * :doc:`angle_style ` + * :doc:`bond_coeff ` + * :doc:`bond_style ` + * :doc:`bond_write ` + * :doc:`dielectric ` + * :doc:`dihedral_coeff ` + * :doc:`dihedral_style ` + * :doc:`improper_coeff ` + * :doc:`improper_style ` + * :doc:`kspace_modify ` + * :doc:`kspace_style ` + * :doc:`pair_coeff ` + * :doc:`pair_modify ` + * :doc:`pair_style ` + * :doc:`pair_write ` + * :doc:`special_bonds ` Settings: - -* :doc:`comm\_modify `, -* :doc:`comm\_style `, -* :doc:`info `, -* :doc:`min\_modify `, -* :doc:`min\_style `, -* :doc:`neigh\_modify `, -* :doc:`neighbor `, -* :doc:`partition `, -* :doc:`reset\_timestep `, -* :doc:`run\_style `, -* :doc:`timer `, -* :doc:`timestep ` +------------------------------ + +.. table_from_list:: + :columns: 4 + + * :doc:`comm_modify ` + * :doc:`comm_style ` + * :doc:`info ` + * :doc:`min_modify ` + * :doc:`min_style ` + * :doc:`neigh_modify ` + * :doc:`neighbor ` + * :doc:`partition ` + * :doc:`reset_timestep ` + * :doc:`run_style ` + * :doc:`timer ` + * :doc:`timestep ` Operations within timestepping (fixes) and diagnostics (computes): +------------------------------------------------------------------------------------------ -* :doc:`compute `, -* :doc:`compute\_modify `, -* :doc:`fix `, -* :doc:`fix\_modify `, -* :doc:`uncompute `, -* :doc:`unfix ` +.. table_from_list:: + :columns: 4 -Output: + * :doc:`compute ` + * :doc:`compute_modify ` + * :doc:`fix ` + * :doc:`fix_modify ` + * :doc:`uncompute ` + * :doc:`unfix ` -* :doc:`dump image `, -* :doc:`dump movie `, -* :doc:`dump `, -* :doc:`dump\_modify `, -* :doc:`restart `, -* :doc:`thermo `, -* :doc:`thermo\_modify `, -* :doc:`thermo\_style `, -* :doc:`undump `, -* :doc:`write\_coeff `, -* :doc:`write\_data `, -* :doc:`write\_dump `, -* :doc:`write\_restart ` +Output: +------------------------------ + +.. table_from_list:: + :columns: 4 + + * :doc:`dump image ` + * :doc:`dump movie ` + * :doc:`dump ` + * :doc:`dump_modify ` + * :doc:`restart ` + * :doc:`thermo ` + * :doc:`thermo_modify ` + * :doc:`thermo_style ` + * :doc:`undump ` + * :doc:`write_coeff ` + * :doc:`write_data ` + * :doc:`write_dump ` + * :doc:`write_restart ` Actions: +------------------------------ -* :doc:`minimize `, -* :doc:`neb `, -* :doc:`neb\_spin `, -* :doc:`prd `, -* :doc:`rerun `, -* :doc:`run `, -* :doc:`tad `, -* :doc:`temper ` +.. table_from_list:: + :columns: 6 -Input script control: + * :doc:`minimize ` + * :doc:`neb ` + * :doc:`neb_spin ` + * :doc:`prd ` + * :doc:`rerun ` + * :doc:`run ` + * :doc:`tad ` + * :doc:`temper ` -* :doc:`clear `, -* :doc:`echo `, -* :doc:`if `, -* :doc:`include `, -* :doc:`jump `, -* :doc:`label