Merge branch 'develop' into compute-grid-new

This commit is contained in:
Axel Kohlmeyer 2022-06-17 12:51:02 -04:00
commit ec411df9ec
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
83 changed files with 910 additions and 401 deletions

6
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@ -13,6 +13,11 @@ jobs:
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
strategy:
fail-fast: false
matrix:
@ -20,17 +25,17 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/${{ matrix.language }}.yml
@ -48,4 +53,4 @@ jobs:
cmake --build . --parallel 2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

View File

@ -15,12 +15,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Select Python version
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'

View File

@ -17,7 +17,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
@ -28,7 +28,7 @@ jobs:
run: mkdir build
- name: Set up ccache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: macos-ccache-${{ github.sha }}

View File

@ -135,11 +135,13 @@ set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
# and prints lots of pointless warnings about "unsafe" functions
if(MSVC)
add_compile_options(/Zc:__cplusplus)
add_compile_options(/wd4244)
add_compile_options(/wd4267)
if(LAMMPS_EXCEPTIONS)
add_compile_options(/EHsc)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/Zc:__cplusplus)
add_compile_options(/wd4244)
add_compile_options(/wd4267)
if(LAMMPS_EXCEPTIONS)
add_compile_options(/EHsc)
endif()
endif()
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
@ -784,14 +786,16 @@ if(BUILD_SHARED_LIBS)
find_package(Python COMPONENTS Interpreter)
endif()
if(BUILD_IS_MULTI_CONFIG)
set(LIBLAMMPS_SHARED_BINARY ${CMAKE_BINARY_DIR}/$<CONFIG>/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
else()
set(LIBLAMMPS_SHARED_BINARY ${CMAKE_BINARY_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR})
endif()
set(LIBLAMMPS_SHARED_BINARY ${MY_BUILD_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
if(Python_EXECUTABLE)
add_custom_target(
install-python ${CMAKE_COMMAND} -E remove_directory build
COMMAND ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps -l ${LIBLAMMPS_SHARED_BINARY}
COMMAND ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps
-l ${LIBLAMMPS_SHARED_BINARY} -w ${MY_BUILD_DIR}
COMMENT "Installing LAMMPS Python module")
else()
add_custom_target(

View File

@ -0,0 +1,197 @@
# CMake script code to define LAMMPS settings required for building LAMMPS plugins
# enforce out-of-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. "
"Please remove CMakeCache.txt and CMakeFiles first.")
endif()
# global LAMMPS/plugin build settings
set(LAMMPS_SOURCE_DIR "" CACHE PATH "Location of LAMMPS sources folder")
if(NOT LAMMPS_SOURCE_DIR)
message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR")
endif()
# by default, install into $HOME/.local (not /usr/local),
# so that no root access (and sudo) is needed
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
endif()
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
# and prints lots of pointless warnings about "unsafe" functions
if(MSVC)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/Zc:__cplusplus)
add_compile_options(/wd4244)
add_compile_options(/wd4267)
if(LAMMPS_EXCEPTIONS)
add_compile_options(/EHsc)
endif()
endif()
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
# C++11 is required
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Need -restrict with Intel compilers
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
#######
# helper functions from LAMMPSUtils.cmake
function(validate_option name values)
string(TOLOWER ${${name}} needle_lower)
string(TOUPPER ${${name}} needle_upper)
list(FIND ${values} ${needle_lower} IDX_LOWER)
list(FIND ${values} ${needle_upper} IDX_UPPER)
if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0)
list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}})
message(FATAL_ERROR "\n########################################################################\n"
"Invalid value '${${name}}' for option ${name}\n"
"\n"
"Possible values are:\n"
"${POSSIBLE_VALUE_LIST}"
"########################################################################")
endif()
endfunction(validate_option)
# helper function for getting the most recently modified file or folder from a glob pattern
function(get_newest_file path variable)
file(GLOB _dirs ${path})
set(_besttime 2000-01-01T00:00:00)
set(_bestfile "<unknown>")
foreach(_dir ${_dirs})
file(TIMESTAMP ${_dir} _newtime)
if(_newtime IS_NEWER_THAN _besttime)
set(_bestfile ${_dir})
set(_besttime ${_newtime})
endif()
endforeach()
if(_bestfile STREQUAL "<unknown>")
message(FATAL_ERROR "Could not find valid path at: ${path}")
endif()
set(${variable} ${_bestfile} PARENT_SCOPE)
endfunction()
#################################################################################
# LAMMPS C++ interface. We only need the header related parts except on windows.
add_library(lammps INTERFACE)
target_include_directories(lammps INTERFACE ${LAMMPS_SOURCE_DIR})
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
target_link_libraries(lammps INTERFACE ${CMAKE_BINARY_DIR}/../liblammps.dll.a)
endif()
################################################################################
# MPI configuration
if(NOT CMAKE_CROSSCOMPILING)
find_package(MPI QUIET)
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
else()
option(BUILD_MPI "Build MPI version" OFF)
endif()
if(BUILD_MPI)
# do not include the (obsolete) MPI C++ bindings which makes
# for leaner object files and avoids namespace conflicts
set(MPI_CXX_SKIP_MPICXX TRUE)
# We use a non-standard procedure to cross-compile with MPI on Windows
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
# Download and configure custom MPICH files for Windows
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
include(ExternalProject)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
ExternalProject_Add(mpi4win_build
URL ${MPICH2_WIN64_DEVEL_URL}
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
else()
ExternalProject_Add(mpi4win_build
URL ${MPICH2_WIN32_DEVEL_URL}
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
endif()
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
set_target_properties(MPI::MPI_CXX PROPERTIES
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
add_dependencies(MPI::MPI_CXX mpi4win_build)
# set variables for status reporting at the end of CMake run
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
else()
find_package(MPI REQUIRED)
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
if(LAMMPS_LONGLONG_TO_LONG)
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
endif()
endif()
target_link_libraries(lammps INTERFACE MPI::MPI_CXX)
else()
add_library(mpi_stubs INTERFACE)
target_include_directories(mpi_stubs INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
target_link_libraries(lammps INTERFACE mpi_stubs)
endif()
################################################################################
# detect if we may enable OpenMP support by default
set(BUILD_OMP_DEFAULT OFF)
find_package(OpenMP QUIET)
if(OpenMP_FOUND)
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
if(HAVE_OMP_H_INCLUDE)
set(BUILD_OMP_DEFAULT ON)
endif()
endif()
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
if(BUILD_OMP)
find_package(OpenMP REQUIRED)
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
if(NOT HAVE_OMP_H_INCLUDE)
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
endif()
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4)
else()
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3)
endif()
target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX)
endif()
################
# integer size selection
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES})

View File

@ -32,5 +32,6 @@ target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_
target_link_libraries(pace PRIVATE yaml-cpp-pace)
target_link_libraries(lammps PRIVATE pace)
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
target_link_libraries(lammps PRIVATE pace)
endif()

View File

@ -46,8 +46,8 @@ set(WIN_PACKAGES
MISC
ML-HDNNP
ML-IAP
ML-SNAP
ML-RANN
ML-SNAP
MOFFF
MOLECULE
MOLFILE
@ -56,6 +56,7 @@ set(WIN_PACKAGES
ORIENT
PERI
PHONON
PLUGIN
POEMS
PTM
QEQ

View File

@ -13,7 +13,7 @@ VENV = $(BUILDDIR)/docenv
ANCHORCHECK = $(VENV)/bin/rst_anchor_check
SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config
MATHJAX = $(SPHINXCONFIG)/_static/mathjax
MATHJAXTAG = 3.2.1
MATHJAXTAG = 3.2.2
PYTHON = $(word 3,$(shell type python3))
DOXYGEN = $(word 3,$(shell type doxygen))

View File

@ -276,10 +276,27 @@ Compilation of the plugin can be managed via both, CMake or traditional
GNU makefiles. Some examples that can be used as a template are in the
``examples/plugins`` folder. The CMake script code has some small
adjustments to allow building the plugins for running unit tests with
them. Another example that converts the KIM package into a plugin can be
found in the ``examples/kim/plugin`` folder. No changes to the sources
of the KIM package themselves are needed; only the plugin interface and
loader code needs to be added. This example only supports building with
CMake, but is probably a more typical example. To compile you need to
run CMake with -DLAMMPS_SOURCE_DIR=<path/to/lammps/src/folder>. Other
them.
Another example that converts the KIM package into a plugin can be found
in the ``examples/kim/plugin`` folder. No changes to the sources of the
KIM package themselves are needed; only the plugin interface and loader
code needs to be added. This example only supports building with CMake,
but is probably a more typical example. To compile you need to run CMake
with -DLAMMPS_SOURCE_DIR=<path/to/lammps/src/folder>. Other
configuration setting are identical to those for compiling LAMMPS.
A second example for a plugin from a package is in the
``examples/PACKAGES/pace/plugin`` folder that will create a plugin from
the ML-PACE package. In this case the bulk of the code is in a static
external library that is being downloaded and compiled first and then
combined with the pair style wrapper and the plugin loader. This
example also contains a NSIS script that can be used to create an
Installer package for Windows (the mutual licensing terms of the
external library and LAMMPS conflict when distributing binaries, so the
ML-PACE package cannot be linked statically, but the LAMMPS headers
required to build the plugin are also available under a less restrictive
license). This will automatically set the required environment variable
and launching a (compatible) LAMMPS binary will load and register the
plugin and the ML-PACE package can then be used as it was linked into
LAMMPS.

View File

@ -657,7 +657,7 @@ advection-diffusion-reaction systems. The equations of motion of these
DPD extensions are integrated through a modified velocity-Verlet (MVV)
algorithm.
**Author:** Zhen Li (Division of Applied Mathematics, Brown University)
**Author:** Zhen Li (Department of Mechanical Engineering, Clemson University)
**Supporting info:**

View File

@ -95,7 +95,7 @@ Miscellaneous tools
* :ref:`LAMMPS shell <lammps_shell>`
* :ref:`LAMMPS magic patterns for file(1) <magic>`
* :ref:`Offline build tool <offline>`
* :ref:`singularity <singularity_tool>`
* :ref:`singularity/apptainer <singularity_tool>`
* :ref:`SWIG interface <swig>`
* :ref:`vim <vim>`
@ -1007,14 +1007,15 @@ Ivanov, at University of Iceland (ali5 at hi.is).
.. _singularity_tool:
singularity tool
----------------------------------------
singularity/apptainer tool
--------------------------
The singularity sub-directory contains container definitions files
that can be used to build container images for building and testing
LAMMPS on specific OS variants using the `Singularity <https://sylabs.io>`_
container software. Contributions for additional variants are welcome.
For more details please see the README.md file in that folder.
The singularity sub-directory contains container definitions files that
can be used to build container images for building and testing LAMMPS on
specific OS variants using the `Apptainer <https://apptainer.org>`_ or
`Singularity <https://sylabs.io>`_ container software. Contributions for
additional variants are welcome. For more details please see the
README.md file in that folder.
----------

View File

@ -35,16 +35,24 @@ Examples
Description
"""""""""""
Define a computation that calculates the local density and temperature
for each atom and neighbors inside a spherical cutoff.
Define a computation that calculates the local mass density and
temperature for each atom based on its neighbors inside a spherical
cutoff. If an atom has M neighbors, then its local mass density is
calculated as the sum of its mass and its M neighbor masses, divided
by the volume of the cutoff sphere (or circle in 2d). The local
temperature of the atom is calculated as the temperature of the
collection of M+1 atoms, after subtracting the center-of-mass velocity
of the M+1 atoms from each of the M+1 atom's velocities. This is
effectively the thermal velocity of the neighborhood of the central
atom, similar to :doc:`compute temp/com <compute_temp_com>`.
The optional keyword *cutoff* defines the distance cutoff
used when searching for neighbors. The default value is the cutoff
specified by the pair style. If no pair style is defined, then a cutoff
must be defined using this keyword. If the specified cutoff is larger than
that of the pair_style plus neighbor skin (or no pair style is defined),
the *comm_modify cutoff* option must also be set to match that of the
*cutoff* keyword.
The optional keyword *cutoff* defines the distance cutoff used when
searching for neighbors. The default value is the cutoff specified by
the pair style. If no pair style is defined, then a cutoff must be
defined using this keyword. If the specified cutoff is larger than
that of the pair_style plus neighbor skin (or no pair style is
defined), the *comm_modify cutoff* option must also be set to match
that of the *cutoff* keyword.
The neighbor list needed to compute this quantity is constructed each
time the calculation is performed (i.e. each time a snapshot of atoms
@ -55,16 +63,16 @@ too frequently.
If you have a bonded system, then the settings of
:doc:`special_bonds <special_bonds>` command can remove pairwise
interactions between atoms in the same bond, angle, or dihedral. This
is the default setting for the :doc:`special_bonds <special_bonds>`
command, and means those pairwise interactions do not appear in the
neighbor list. Because this fix uses the neighbor list, it also means
those pairs will not be included in the order parameter. This
difficulty can be circumvented by writing a dump file, and using the
:doc:`rerun <rerun>` command to compute the order parameter for
snapshots in the dump file. The rerun script can use a
:doc:`special_bonds <special_bonds>` command that includes all pairs in
the neighbor list.
interactions between atoms in the same bond, angle, or dihedral.
This is the default setting for the :doc:`special_bonds
<special_bonds>` command, and means those pairwise interactions do
not appear in the neighbor list. Because this compute uses the
neighbor list, it also means those pairs will not be included in
the order parameter. This difficulty can be circumvented by
writing a dump file, and using the :doc:`rerun <rerun>` command to
compute the order parameter for snapshots in the dump file. The
rerun script can use a :doc:`special_bonds <special_bonds>` command
that includes all pairs in the neighbor list.
----------
@ -77,17 +85,20 @@ too frequently.
Output info
"""""""""""
This compute calculates a per-atom array with two columns: density and temperature.
This compute calculates a per-atom array with two columns: mass
density in density :doc:`units <units>` and temperature in temperature
:doc:`units <units>`.
These values can be accessed by any command that uses per-atom values
from a compute as input. See the :doc:`Howto output <Howto_output>` doc
page for an overview of LAMMPS output options.
from a compute as input. See the :doc:`Howto output <Howto_output>`
doc page for an overview of LAMMPS output options.
Restrictions
""""""""""""
This compute is part of the EXTRA-COMPUTE package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
This compute is part of the EXTRA-COMPUTE package. It is only enabled
if LAMMPS was built with that package. See the :doc:`Build package
<Build_package>` page for more info.
Related commands
""""""""""""""""
@ -97,5 +108,5 @@ Related commands
Default
"""""""
The option defaults are *cutoff* = pair style cutoff
The option defaults are *cutoff* = pair style cutoff.

View File

@ -12,7 +12,6 @@ Syntax
* ID, group-ID are documented in :doc:`fix <fix>` command
* mdi/aimd = style name of this fix command
* optional keyword = *plugin*
Examples
""""""""
@ -20,7 +19,6 @@ Examples
.. code-block:: LAMMPS
fix 1 all mdi/aimd
fix 1 all mdi/aimd plugin
Description
"""""""""""
@ -53,14 +51,6 @@ same time as LAMMPS, or as a plugin library. See the :doc:`mdi plugin
Again, the examples/mdi/README file explains how to launch both driver
and engine codes so that engine is used in plugin mode.
To use this fix with a plugin engine, you must specify the
*plugin* keyword as the last argument, as illustrated above.
.. note::
As of April 2022, the *plugin* keyword is needed. In a future
version of the MDI library it will no longer be necessary.
----------
This fix performs the timestepping portion of an AIMD simulation.

View File

@ -129,8 +129,8 @@ Examples
kspace_style pppm 1.0e-4
kspace_style pppm/cg 1.0e-5 1.0e-6
kspace style msm 1.0e-4
kspace style scafacos fmm 1.0e-4
kspace_style msm 1.0e-4
kspace_style scafacos fmm 1.0e-4
kspace_style none
Used in input scripts:

View File

@ -50,6 +50,12 @@ Examples
pair_style hybrid/overlay e3b 1 lj/cut/tip4p/long 1 2 1 1 0.15 8.5
pair_coeff * * e3b preset 2011
Used in example input script:
.. parsed-literal::
examples/PACKAGES/e3b/in.e3b-tip4p2005
Description
"""""""""""
@ -68,21 +74,27 @@ The *e3b* style computes an \"explicit three-body\" (E3B) potential for water :r
0 & r>R_f\\
\end{cases}
This potential was developed as a water model that includes the three-body cooperativity of hydrogen bonding explicitly.
To use it in this way, it must be applied in conjunction with a conventional two-body water model, through *pair_style hybrid/overlay*.
The three body interactions are split into three types: A, B, and C.
Type A corresponds to anti-cooperative double hydrogen bond donor interactions.
Type B corresponds to the cooperative interaction of molecules that both donate and accept a hydrogen bond.
Type C corresponds to anti-cooperative double hydrogen bond acceptor interactions.
The three-body interactions are smoothly cutoff by the switching function s(r) between Rs and Rc3.
The two-body interactions are designed to correct for the effective many-body interactions implicitly included in the conventional two-body potential.
The two-body interactions are cut off sharply at Rc2, because K3 is typically significantly smaller than K2.
See :ref:`(Kumar 2008) <Kumar>` for more details.
This potential was developed as a water model that includes the
three-body cooperativity of hydrogen bonding explicitly. To use it in
this way, it must be applied in conjunction with a conventional two-body
water model, through pair style :doc:`hybrid/overlay <pair_hybrid>`. The
three body interactions are split into three types: A, B, and C. Type A
corresponds to anti-cooperative double hydrogen bond donor interactions.
Type B corresponds to the cooperative interaction of molecules that both
donate and accept a hydrogen bond. Type C corresponds to
anti-cooperative double hydrogen bond acceptor interactions. The
three-body interactions are smoothly cutoff by the switching function
s(r) between Rs and Rc3. The two-body interactions are designed to
correct for the effective many-body interactions implicitly included in
the conventional two-body potential. The two-body interactions are cut
off sharply at Rc2, because K3 is typically significantly smaller than
K2. See :ref:`(Kumar 2008) <Kumar>` for more details.
Only a single *pair_coeff* command is used with the *e3b* style.
The first two arguments must be \* \*.
The oxygen atom type for the pair style is passed as the only argument to the *pair_style* command, not in the *pair_coeff* command.
The hydrogen atom type is inferred by the ordering of the atoms.
Only a single :doc:`pair_coeff <pair_coeff>` command is used with the
*e3b* style and the first two arguments must be \* \*. The oxygen atom
type for the pair style is passed as the only argument to the
*pair_style* command, not in the *pair_coeff* command. The hydrogen
atom type is inferred from the ordering of the atoms.
.. note::
@ -90,26 +102,41 @@ The hydrogen atom type is inferred by the ordering of the atoms.
Each water molecule must have consecutive IDs with the oxygen first.
This pair style does not test that this criteria is met.
The *pair_coeff* command must have at least one keyword/value pair, as described above.
The *preset* keyword sets the potential parameters to the values used in :ref:`(Tainter 2011) <Tainter2011>` or :ref:`(Tainter 2015) <Tainter2015>`.
To use the water models defined in those references, the *e3b* style should always be used in conjunction with an *lj/cut/tip4p/long* style through *pair_style hybrid/overlay*, as demonstrated in the second example above.
The *preset 2011* option should be used with the :doc:`TIP4P water model <Howto_tip4p>`.
The *preset 2015* option should be used with the :doc:`TIP4P/2005 water model <Howto_tip4p>`.
If the *preset* keyword is used, no other keyword is needed.
Changes to the preset parameters can be made by specifying the *preset* keyword followed by the specific parameter to change, like *Ea*\ .
Note that the other keywords must come after *preset* in the pair_style command.
The *e3b* style can also be used to implement any three-body potential of the same form by specifying all the keywords except *neigh*\ : *Ea*, *Eb*, *Ec*, *E2*, *K3*, *K2*, *Rc3*, *Rc2*, *Rs*, and *bondL*\ .
The keyword *bondL* specifies the intramolecular OH bond length of the water model being used.
This is needed to include H atoms that are within the cutoff even when the attached oxygen atom is not.
The *pair_coeff* command must have at least one keyword/value pair, as
described above. The *preset* keyword sets the potential parameters to
the values used in :ref:`(Tainter 2011) <Tainter2011>` or
:ref:`(Tainter 2015) <Tainter2015>`. To use the water models defined in
those references, the *e3b* style should always be used in conjunction
with an *lj/cut/tip4p/long* style through *pair_style hybrid/overlay*,
as demonstrated in the second example above. The *preset 2011* option
should be used with the :doc:`TIP4P water model <Howto_tip4p>`. The
*preset 2015* option should be used with the :doc:`TIP4P/2005 water
model <Howto_tip4p>`. If the *preset* keyword is used, no other keyword
is needed. Changes to the preset parameters can be made by specifying
the *preset* keyword followed by the specific parameter to change, like
*Ea*\ . Note that the other keywords must come after *preset* in the
pair_style command. The *e3b* style can also be used to implement any
three-body potential of the same form by specifying all the keywords
except *neigh*\ : *Ea*, *Eb*, *Ec*, *E2*, *K3*, *K2*, *Rc3*, *Rc2*,
*Rs*, and *bondL*\ . The keyword *bondL* specifies the intramolecular
OH bond length of the water model being used. This is needed to include
H atoms that are within the cutoff even when the attached oxygen atom is
not.
This pair style allocates arrays sized according to the number of pairwise interactions within Rc3.
To do this it needs an estimate for the number of water molecules within Rc3 of an oxygen atom.
This estimate defaults to 10 and can be changed using the *neigh* keyword, which takes an integer as an argument.
If the neigh setting is too small, the simulation will fail with the error "neigh is too small".
If the neigh setting is too large, the pair style will use more memory than necessary.
This pair style allocates arrays sized according to the number of
pairwise interactions within Rc3. To do this it needs an estimate for
the number of water molecules within Rc3 of an oxygen atom. This
estimate defaults to 10 and can be changed using the *neigh* keyword,
which takes an integer as an argument. If the neigh setting is too
small, the simulation will fail with the error "neigh is too small". If
the neigh setting is too large, the pair style will use more memory than
necessary.
This pair style tallies a breakdown of the total E3B potential energy into sub-categories, which can be accessed via the :doc:`compute pair <compute_pair>` command as a vector of values of length 4.
The 4 values correspond to the terms in the first equation above: the E2 term, the Ea term, the Eb term, and the Ec term.
This pair style tallies a breakdown of the total E3B potential energy
into sub-categories, which can be accessed via the :doc:`compute pair
<compute_pair>` command as a vector of values of length 4. The 4 values
correspond to the terms in the first equation above: the E2 term, the Ea
term, the Eb term, and the Ec term.
See the examples/PACKAGES/e3b directory for a complete example script.

View File

@ -23,9 +23,9 @@ Examples
Used in example input script:
.. parsed-literal::
.. parsed-literal::
examples/PACKAGES/manybody_table/in.spce_sw
examples/PACKAGES/manybody_table/in.spce_sw
Description

View File

@ -27,10 +27,10 @@ Examples
Used in example input scripts:
.. parsed-literal::
.. parsed-literal::
examples/PACKAGES/manybody_table/in.spce
examples/PACKAGES/manybody_table/in.spce2
examples/PACKAGES/manybody_table/in.spce
examples/PACKAGES/manybody_table/in.spce2
Description
"""""""""""

View File

@ -56,7 +56,7 @@ Examples
read_data ../run7/data.polymer.gz
read_data data.protein fix mycmap crossterm CMAP
read_data data.water add append offset 3 1 1 1 1 shift 0.0 0.0 50.0
read_data data.water add merge 1 group solvent
read_data data.water add merge group solvent
Description
"""""""""""
@ -622,6 +622,8 @@ of analysis.
- atom-ID molecule-ID atom-type x y z
* - charge
- atom-ID atom-type q x y z
* - dielectric
- atom-ID atom-type q x y z normx normy normz area ed em epsilon curvature
* - dipole
- atom-ID atom-type q x y z mux muy muz
* - dpd

View File

@ -120,6 +120,7 @@ Antonelli
api
Apoorva
Appl
apptainer
Apu
arallel
arccos
@ -2370,6 +2371,9 @@ Nord
norder
Nordlund
normals
normx
normy
normz
Noskov
noslip
noticable

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import numpy as np
def reduce_Born(Cf):

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import numpy as np
def reduce_Born(Cf):

View File

@ -1,5 +1,5 @@
import numpy as np
from lammps import lammps, LAMMPS_INT, LMP_STYLE_GLOBAL, LMP_VAR_EQUAL, LMP_VAR_ATOM
from lammps import lammps, LMP_VAR_EQUAL
# method for rotating elastic constants

View File

@ -0,0 +1,36 @@
##########################################
# CMake build system for plugin examples.
# The is meant to be used as a template for plugins that are
# distributed independent from the LAMMPS package.
##########################################
cmake_minimum_required(VERSION 3.10)
project(paceplugin VERSION 1.0 LANGUAGES CXX)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(CheckIncludeFileCXX)
include(LAMMPSInterfacePlugin)
include(ML-PACE)
##########################
# building the plugins
add_library(paceplugin MODULE paceplugin.cpp ${LAMMPS_SOURCE_DIR}/ML-PACE/pair_pace.cpp)
target_link_libraries(paceplugin PRIVATE pace)
target_link_libraries(paceplugin PRIVATE lammps)
target_include_directories(paceplugin PRIVATE ${LAMMPS_SOURCE_DIR}/ML-PACE)
set_target_properties(paceplugin PROPERTIES PREFIX "" SUFFIX ".so")
# MacOS seems to need this
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers
set_target_properties(paceplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(CMAKE_CROSSCOMPILING)
set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
endif()
else()
set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-rdynamic")
endif()

View File

@ -0,0 +1 @@
../../../../cmake/Modules/LAMMPSInterfacePlugin.cmake

View File

@ -0,0 +1 @@
../../../../cmake/Modules/Packages/ML-PACE.cmake

View File

@ -0,0 +1,2 @@
This folder contains a loader and support files to build the ML-PACE package as plugin.
For more information please see: https://docs.lammps.org/Developer_plugins.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -0,0 +1,28 @@
#include "lammpsplugin.h"
#include "version.h"
#include "pair_pace.h"
using namespace LAMMPS_NS;
static Pair *pair_pace_creator(LAMMPS *lmp)
{
return new PairPACE(lmp);
}
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
{
lammpsplugin_t plugin;
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
// register pace pair style
plugin.version = LAMMPS_VERSION;
plugin.style = "pair";
plugin.name = "pace";
plugin.info = "PACE plugin pair style v1.0";
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
plugin.creator.v1 = (lammpsplugin_factory1 *) &pair_pace_creator;
plugin.handle = handle;
(*register_plugin)(&plugin, lmp);
}

View File

@ -0,0 +1,157 @@
#!Nsis Installer Command Script
#
# The following external defines are recognized:
# ${VERSION} = YYYYMMDD
!include "MUI2.nsh"
!include "FileFunc.nsh"
!define MUI_ICON "lammps.ico"
!define MUI_UNICON "lammps.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "lammps-text-logo-wide.bmp"
!define MUI_HEADERIMAGE_RIGHT
Unicode true
XPStyle on
!include "LogicLib.nsh"
!addplugindir "envvar/Plugins/x86-unicode"
!include "x64.nsh"
RequestExecutionLevel user
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin"
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
!define PACEPLUGIN "LAMMPS ML-PACE Plugin ${VERSION}"
OutFile "LAMMPS-ML-PACE-plugin-${VERSION}.exe"
Name "${PACEPLUGIN}"
InstallDir "$LOCALAPPDATA\${PACEPLUGIN}"
ShowInstDetails show
ShowUninstDetails show
SetCompressor lzma
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
function .onInit
# Determine if LAMMPS was already installed and check whether it was in 32-bit
# or 64-bit. Then look up path to uninstaller and offer to uninstall or quit
SetRegView 32
ReadRegDWORD $0 HKCU "Software\LAMMPS-ML-PACE" "Bits"
SetRegView LastUsed
${If} $0 == "32"
SetRegView 32
${ElseIf} $0 == "64"
SetRegView 64
${Else}
SetRegView 64
${EndIf}
ClearErrors
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" "UninstallString"
SetRegView LastUsed
${If} ${Errors}
DetailPrint "LAMMPS ML-PACE plugin not (yet) installed"
${Else}
MessageBox MB_YESNO "LAMMPS ML-PACE plugin ($0 bit) is already installed. Uninstall existing version?" /SD IDYES IDNO Quit
Pop $R1
StrCmp $R1 2 Quit +1
Exec $R0
Quit:
Quit
${EndIf}
setShellVarContext all
functionEnd
Section "${PACEPLUGIN}" SecPaceplugin
SectionIn RO
# Write LAMMPS installation bitness marker. Always use 32-bit registry view
SetRegView 32
IntFmt $0 "0x%08X" 64
WriteRegDWORD HKCU "Software\LAMMPS-ML-PACE" "Bits" $0
# Switch to "native" registry view
SetRegView 64
SetShellVarContext current
SetOutPath "$INSTDIR"
File lammps.ico
File paceplugin.so
# Register Application and its uninstaller
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"DisplayName" "${PACEPLUGIN}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"Publisher" "The LAMMPS and PACE Developers"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"URLInfoAbout" "lammps.org"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"DisplayIcon" "$INSTDIR\lammps.ico"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"DisplayVersion" "${VERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \
"EstimatedSize" "$0"
# update path variables
EnVar::SetHKCU
# add to LAMMPS plugin search path
EnVar::AddValue "LAMMPS_PLUGIN_PATH" "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
function un.onInit
SetShellVarContext current
functionEnd
Section "Uninstall"
# remove LAMMPS bitness/installation indicator always in 32-bit registry view
SetRegView 32
DeleteRegKey HKCU "Software\LAMMPS-ML-PACE"
# unregister extension, and uninstall info
SetRegView 64
SetShellVarContext current
# unregister installation
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE"
# update path variables
EnVar::SetHKCU
# remove entry from LAMMPS plugin search path
EnVar::DeleteValue "LAMMPS_PLUGIN_PATH" "$INSTDIR"
Delete /REBOOTOK "$INSTDIR\paceplugin.so"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
Delete /REBOOTOK "$INSTDIR\lammps.ico"
RMDir /REBOOTOK "$INSTDIR"
SectionEnd
# Local Variables:
# mode: sh
# End:

View File

@ -6,46 +6,11 @@
cmake_minimum_required(VERSION 3.10)
# enforce out-of-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. "
"Please remove CMakeCache.txt and CMakeFiles first.")
endif()
project(kimplugin VERSION 1.0 LANGUAGES CXX)
set(LAMMPS_SOURCE_DIR "" CACHE PATH "Location of LAMMPS sources folder")
if(NOT LAMMPS_SOURCE_DIR)
message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR")
endif()
# by default, install into $HOME/.local (not /usr/local),
# so that no root access (and sudo) is needed
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
endif()
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
# and prints lots of pointless warnings about "unsafe" functions
if(MSVC)
add_compile_options(/Zc:__cplusplus)
add_compile_options(/wd4244)
add_compile_options(/wd4267)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
# C++11 is required
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Need -restrict with Intel compilers
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(CheckIncludeFileCXX)
include(LAMMPSInterfaceCXX)
include(LAMMPSInterfacePlugin)
##########################
# building the plugins
@ -90,9 +55,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers
set_target_properties(kimplugin.so PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set_target_properties(kimplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(CMAKE_CROSSCOMPILING)
set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
endif()
else()
set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-rdynamic")

View File

@ -1,88 +0,0 @@
# Cmake script code to define the LAMMPS C++ interface
# settings required for building LAMMPS plugins
################################################################################
# helper function
function(validate_option name values)
string(TOLOWER ${${name}} needle_lower)
string(TOUPPER ${${name}} needle_upper)
list(FIND ${values} ${needle_lower} IDX_LOWER)
list(FIND ${values} ${needle_upper} IDX_UPPER)
if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0)
list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}})
message(FATAL_ERROR "\n########################################################################\n"
"Invalid value '${${name}}' for option ${name}\n"
"\n"
"Possible values are:\n"
"${POSSIBLE_VALUE_LIST}"
"########################################################################")
endif()
endfunction(validate_option)
#################################################################################
# LAMMPS C++ interface. We only need the header related parts.
add_library(lammps INTERFACE)
target_include_directories(lammps INTERFACE ${LAMMPS_SOURCE_DIR})
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
target_link_libraries(lammps INTERFACE ${CMAKE_BINARY_DIR}/../liblammps.dll.a)
endif()
################################################################################
# MPI configuration
if(NOT CMAKE_CROSSCOMPILING)
set(MPI_CXX_SKIP_MPICXX TRUE)
find_package(MPI QUIET)
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
else()
option(BUILD_MPI "Build MPI version" OFF)
endif()
if(BUILD_MPI)
find_package(MPI REQUIRED)
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
if(LAMMPS_LONGLONG_TO_LONG)
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
endif()
target_link_libraries(lammps INTERFACE MPI::MPI_CXX)
else()
target_include_directories(lammps INTERFACE "${LAMMPS_SOURCE_DIR}/STUBS")
endif()
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES})
################################################################################
# detect if we may enable OpenMP support by default
set(BUILD_OMP_DEFAULT OFF)
find_package(OpenMP QUIET)
if(OpenMP_FOUND)
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
if(HAVE_OMP_H_INCLUDE)
set(BUILD_OMP_DEFAULT ON)
endif()
endif()
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
if(BUILD_OMP)
find_package(OpenMP REQUIRED)
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
if(NOT HAVE_OMP_H_INCLUDE)
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
endif()
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4)
else()
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3)
endif()
target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX)
endif()

View File

@ -0,0 +1 @@
../../../cmake/Modules/LAMMPSInterfacePlugin.cmake

View File

@ -0,0 +1,2 @@
This folder contains a loader and support files to build the KIM package as plugin.
For more information please see: https://docs.lammps.org/Developer_plugins.html

View File

@ -26,7 +26,7 @@
# -nsteps 5
# number of timesteps, default = 5
import sys,math,random
import sys
import mdi
import numpy as np
from mpi4py import MPI
@ -42,7 +42,6 @@ def error(txt=None):
def perform_aimd(world,mm_comm,qm_comm):
me = world.Get_rank()
nprocs = world.Get_size()
# receive number of atoms from the MM engine

View File

@ -32,9 +32,14 @@ else()
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
# and prints lots of pointless warnings about "unsafe" functions
if(MSVC)
add_compile_options(/Zc:__cplusplus)
add_compile_options(/wd4244)
add_compile_options(/wd4267)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/Zc:__cplusplus)
add_compile_options(/wd4244)
add_compile_options(/wd4267)
if(LAMMPS_EXCEPTIONS)
add_compile_options(/EHsc)
endif()
endif()
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
endif()

View File

@ -1,4 +1,4 @@
import hashlib,os,subprocess,sys
import hashlib,os,subprocess
# try to auto-detect the maximum number of available CPUs
def get_cpus():

View File

@ -71,7 +71,8 @@ buildflag = args.build
pathflag = args.path is not None
version = args.version
suffixflag = args.machine is not None
suffix = args.machine
if suffixflag:
suffix = args.machine
if pathflag:
lattedir = args.path
@ -132,8 +133,6 @@ os.symlink(os.path.join(lattedir, 'src', 'latte_c_bind.o'), 'filelink.o')
# copy Makefile.lammps.suffix to Makefile.lammps
if suffixflag or not os.path.exists("Makefile.lammps"):
if suffix is None:
suffix = 'gfortran'
print("Creating Makefile.lammps")
if os.path.exists("Makefile.lammps.%s" % suffix):
shutil.copyfile("Makefile.lammps.%s" % suffix, 'Makefile.lammps')

View File

@ -11,7 +11,7 @@ independently and used to build the wheel without installing it.
"""
from __future__ import print_function
import sys,os,shutil,time,glob,subprocess
import sys,os,shutil,glob,subprocess
from argparse import ArgumentParser
parser = ArgumentParser(prog='install.py',
@ -23,6 +23,8 @@ parser.add_argument("-l", "--lib", required=True,
help="path to the compiled LAMMPS shared library")
parser.add_argument("-n", "--noinstall", action="store_true", default=False,
help="only build a binary wheel. Don't attempt to install it")
parser.add_argument("-w", "--wheeldir", required=False,
help="path to a directory where the created wheel will be stored")
args = parser.parse_args()
@ -30,7 +32,7 @@ args = parser.parse_args()
if args.package:
if not os.path.exists(args.package):
print( "ERROR: LAMMPS package %s does not exist" % args.package)
print("ERROR: LAMMPS package %s does not exist" % args.package)
parser.print_help()
sys.exit(1)
else:
@ -38,12 +40,20 @@ if args.package:
if args.lib:
if not os.path.exists(args.lib):
print( "ERROR: LAMMPS shared library %s does not exist" % args.lib)
print("ERROR: LAMMPS shared library %s does not exist" % args.lib)
parser.print_help()
sys.exit(1)
else:
args.lib = os.path.abspath(args.lib)
if args.wheeldir:
if not os.path.exists(args.wheeldir):
print("ERROR: directory %s to store the wheel does not exist" % args.wheeldir)
parser.print_help()
sys.exit(1)
else:
args.wheeldir = os.path.abspath(args.wheeldir)
# we need to switch to the folder of the python package
olddir = os.path.abspath('.')
os.chdir(os.path.dirname(args.package))
@ -80,10 +90,18 @@ os.remove(os.path.join('lammps',os.path.basename(args.lib)))
# stop here if we were asked not to install the wheel we created
if args.noinstall:
exit(0)
if args.wheeldir:
for wheel in glob.glob('lammps-*.whl'):
shutil.copy(wheel, args.wheeldir)
os.remove(wheel)
exit(0)
# install the wheel with pip. first try to install in the default environment.
# that will be a virtual environment, if active, or the system folder.
# if in a virtual environment, we must not use the python executable
# that is running this script (configured by cmake), but use "python"
# from the regular system path. The user may have changed to the virtual
# environment *after* running cmake.
# recent versions of pip will automatically drop to use the user folder
# in case the system folder is not writable.
@ -93,21 +111,35 @@ if args.noinstall:
# must be uninstalled manually. We must not ignore this and drop
# back to install into a (forced) user folder.
print("Installing wheel")
if "VIRTUAL_ENV" in os.environ:
print("Installing wheel into virtual environment")
py_exe = 'python'
else:
print("Installing wheel into system site-packages folder")
py_exe = sys.executable
for wheel in glob.glob('lammps-*.whl'):
try:
txt = subprocess.check_output([sys.executable, '-m', 'pip', 'install', '--force-reinstall', wheel], stderr=subprocess.STDOUT, shell=False)
txt = subprocess.check_output([py_exe, '-m', 'pip', 'install', '--force-reinstall', wheel], stderr=subprocess.STDOUT, shell=False)
print(txt.decode('UTF-8'))
if args.wheeldir:
shutil.copy(wheel, args.wheeldir)
else:
shutil.copy(wheel, olddir)
os.remove(wheel)
continue
except subprocess.CalledProcessError as err:
errmsg = err.output.decode('UTF-8')
if errmsg.find("distutils installed"):
sys.exit(errmsg + "You need to uninstall the LAMMPS python module manually first.\n")
try:
print('Installing wheel into standard site-packages folder failed. Trying user folder now')
print('Installing wheel into system site-packages folder failed. Trying user folder now')
txt = subprocess.check_output([sys.executable, '-m', 'pip', 'install', '--user', '--force-reinstall', wheel], stderr=subprocess.STDOUT, shell=False)
print(txt.decode('UTF-8'))
if args.wheeldir:
shutil.copy(wheel, args.wheeldir)
else:
shutil.copy(wheel, olddir)
os.remove(wheel)
except:
sys.exit('Failed to install wheel ' + wheel)
shutil.copy(wheel, olddir)
os.remove(wheel)

View File

@ -1,14 +1,26 @@
#!/usr/bin/env python
import sys,os,shutil
import sys,os,site
# find python script to activate the virtual environment and source it
base = os.path.abspath('buildwheel')
if sys.platform == 'win32':
virtenv=os.path.join('buildwheel','Scripts','activate_this.py')
bin_dir=os.path.join(base,'Scripts')
else:
virtenv=os.path.join('buildwheel','bin','activate_this.py')
bin_dir=os.path.join(base,'bin')
exec(open(virtenv).read(), {'__file__': virtenv})
# prepend bin to PATH, set venv path
os.environ["PATH"] = os.pathsep.join([bin_dir] + os.environ.get("PATH", "").split(os.pathsep))
os.environ["VIRTUAL_ENV"] = base
# add the virtual environments libraries to the host python import mechanism
prev_length = len(sys.path)
for lib in "__LIB_FOLDERS__".split(os.pathsep):
path = os.path.realpath(os.path.join(bin_dir, lib))
site.addsitedir(path)
sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
sys.real_prefix = sys.prefix
sys.prefix = base
# update pip and install all requirements to build the wheel
os.system('python -m pip install --upgrade pip')

View File

@ -3,7 +3,7 @@
from setuptools import setup
from setuptools.dist import Distribution
from sys import version_info
import os,time,shutil
import os,time
LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__))
LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR)
LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src')
@ -24,7 +24,7 @@ def get_lammps_version():
class BinaryDistribution(Distribution):
"""Wrapper to enforce creating a binary package"""
def has_ext_modules(foo):
def has_ext_modules(self):
return True
if version_info.major >= 3:

8
src/.gitignore vendored
View File

@ -1001,8 +1001,8 @@
/neb.h
/netcdf_units.cpp
/netcdf_units.h
/pair_3b_table.cpp
/pair_3b_table.h
/pair_threebody_table.cpp
/pair_threebody_table.h
/pair_adp.cpp
/pair_adp.h
/pair_agni.cpp
@ -1297,8 +1297,8 @@
/pair_sph_taitwater_morris.h
/pair_sw.cpp
/pair_sw.h
/pair_sw_3b_table.cpp
/pair_sw_3b_table.h
/pair_sw_angle_table.cpp
/pair_sw_angle_table.h
/pair_sw_mod.cpp
/pair_sw_mod.h
/pair_tersoff.cpp

View File

@ -284,7 +284,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
int me = ATC::LammpsInterface::instance()->comm_rank();
string groupName(arg[1]);
int igroup = group->find(groupName.c_str());
int igroup = group->find(groupName);
int atomCount = group->count(igroup);
try {

View File

@ -78,9 +78,9 @@ AtomVecDielectric::AtomVecDielectric(LAMMPS *_lmp) : AtomVec(_lmp)
"mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"};
fields_create = {"q", "molecule", "num_bond", "num_angle", "num_dihedral", "num_improper",
"nspecial", "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"};
fields_data_atom = { "id", "molecule", "type", "q", "x", "mu3", "area", "ed", "em", "epsilon",
fields_data_atom = {"id", "molecule", "type", "q", "x", "mu3", "area", "ed", "em", "epsilon",
"curvature"};
fields_data_vel = {"id v"};
fields_data_vel = {"id", "v"};
// clang-format on
setup_fields();

View File

@ -17,8 +17,8 @@
modified velocity-Verlet (MVV) algorithm.
Setting verlet = 0.5 recovers the standard velocity-Verlet algorithm.
Contributing author: Zhen Li (Brown University)
Email: zhen_li@brown.edu
Contributing author: Zhen Li (Clemson University)
Email: zli7@clemson.edu
------------------------------------------------------------------------- */
#include "fix_mvv_dpd.h"

View File

@ -17,8 +17,8 @@
v and edpd_T) using the modified velocity-Verlet (MVV) algorithm.
Setting verlet = 0.5 recovers the standard velocity-Verlet algorithm.
Contributing author: Zhen Li (Brown University)
Email: zhen_li@brown.edu
Contributing author: Zhen Li (Clemson University)
Email: zli7@clemson.edu
Please cite the related publication:
Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. "Energy-

View File

@ -17,8 +17,8 @@
v and cc) using the modified velocity-Verlet (MVV) algorithm.
Setting verlet = 0.5 recovers the standard velocity-Verlet algorithm.
Contributing author: Zhen Li (Brown University)
Email: zhen_li@brown.edu
Contributing author: Zhen Li (Clemson University)
Email: zli7@clemson.edu
Please cite the related publication:
Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. "Transport

View File

@ -13,8 +13,8 @@
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Zhen Li (Brown University)
Email: zhen_li@brown.edu
Contributing author: Zhen Li (Clemson University)
Email: zli7@clemson.edu
------------------------------------------------------------------------- */
#include "pair_edpd.h"

View File

@ -13,8 +13,8 @@
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Zhen Li (Brown University)
Email: zhen_li@brown.edu
Contributing author: Zhen Li (Clemson University)
Email: zli7@clemson.edu
------------------------------------------------------------------------- */
#include "pair_mdpd.h"

View File

@ -17,7 +17,7 @@
before the force calculation.
The code uses 3D Lucy kernel, it can be modified for other kernels.
Contributing author: Zhen Li (Brown University)
Contributing author: Zhen Li (Clemson University)
------------------------------------------------------------------------- */
#include "pair_mdpd_rhosum.h"

View File

@ -13,8 +13,8 @@
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Zhen Li (Brown University)
Email: zhen_li@brown.edu
Contributing author: Zhen Li (Clemson University)
Email: zli7@clemson.edu
------------------------------------------------------------------------- */
#include "pair_tdpd.h"

View File

@ -44,7 +44,7 @@ static const double sqrt_2_inv = std::sqrt(0.5);
/* ---------------------------------------------------------------------- */
PairSDPDTaitwaterIsothermal::PairSDPDTaitwaterIsothermal (LAMMPS *lmp)
: Pair (lmp) {
: Pair (lmp), random(nullptr) {
restartinfo = 0;
single_enable =0;
}
@ -61,6 +61,7 @@ PairSDPDTaitwaterIsothermal::~PairSDPDTaitwaterIsothermal () {
memory->destroy (soundspeed);
memory->destroy (B);
}
delete random;
}
/* ---------------------------------------------------------------------- */

View File

@ -11,10 +11,15 @@
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Stan Moore (SNL)
------------------------------------------------------------------------- */
#include "compute_ave_sphere_atom.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "math_const.h"
@ -98,7 +103,10 @@ void ComputeAveSphereAtom::init()
}
cutsq = cutoff * cutoff;
sphere_vol = 4.0 / 3.0 * MY_PI * cutsq * cutoff;
if (domain->dimension == 3)
volume = 4.0 / 3.0 * MY_PI * cutsq * cutoff;
else
volume = MY_PI * cutsq;
// need an occasional full neighbor list
@ -121,7 +129,7 @@ void ComputeAveSphereAtom::compute_peratom()
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
int *ilist, *jlist, *numneigh, **firstneigh;
int count;
double vsum[3], vavg[3], vnet[3];
double p[3], vcom[3], vnet[3];
invoked_peratom = update->ntimestep;
@ -152,12 +160,26 @@ void ComputeAveSphereAtom::compute_peratom()
double **x = atom->x;
double **v = atom->v;
double *mass = atom->mass;
double *rmass = atom->rmass;
int *type = atom->type;
int *mask = atom->mask;
double massone_i, massone_j, totalmass;
double adof = domain->dimension;
double mvv2e = force->mvv2e;
double mv2d = force->mv2d;
double boltz = force->boltz;
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
if (mask[i] & groupbit) {
if (rmass)
massone_i = rmass[i];
else
massone_i = mass[type[i]];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
@ -167,13 +189,18 @@ void ComputeAveSphereAtom::compute_peratom()
// i atom contribution
count = 1;
vsum[0] = v[i][0];
vsum[1] = v[i][1];
vsum[2] = v[i][2];
totalmass = massone_i;
p[0] = v[i][0] * massone_i;
p[1] = v[i][1] * massone_i;
p[2] = v[i][2] * massone_i;
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
j &= NEIGHMASK;
if (rmass)
massone_j = rmass[j];
else
massone_j = mass[type[j]];
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
@ -181,42 +208,45 @@ void ComputeAveSphereAtom::compute_peratom()
rsq = delx * delx + dely * dely + delz * delz;
if (rsq < cutsq) {
count++;
vsum[0] += v[j][0];
vsum[1] += v[j][1];
vsum[2] += v[j][2];
totalmass += massone_j;
p[0] += v[j][0] * massone_j;
p[1] += v[j][1] * massone_j;
p[2] += v[j][2] * massone_j;
}
}
vavg[0] = vsum[0] / count;
vavg[1] = vsum[1] / count;
vavg[2] = vsum[2] / count;
vcom[0] = p[0] / totalmass;
vcom[1] = p[1] / totalmass;
vcom[2] = p[2] / totalmass;
// i atom contribution
count = 1;
vnet[0] = v[i][0] - vavg[0];
vnet[1] = v[i][1] - vavg[1];
vnet[2] = v[i][2] - vavg[2];
double ke_sum = vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2];
vnet[0] = v[i][0] - vcom[0];
vnet[1] = v[i][1] - vcom[1];
vnet[2] = v[i][2] - vcom[2];
double ke_sum = massone_i * (vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2]);
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
j &= NEIGHMASK;
if (rmass)
massone_j = rmass[j];
else
massone_j = mass[type[j]];
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx * delx + dely * dely + delz * delz;
if (rsq < cutsq) {
count++;
vnet[0] = v[j][0] - vavg[0];
vnet[1] = v[j][1] - vavg[1];
vnet[2] = v[j][2] - vavg[2];
ke_sum += vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2];
vnet[0] = v[j][0] - vcom[0];
vnet[1] = v[j][1] - vcom[1];
vnet[2] = v[j][2] - vcom[2];
ke_sum += massone_j * (vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2]);
}
}
double density = count / sphere_vol;
double temp = ke_sum / 3.0 / count;
double density = mv2d * totalmass / volume;
double temp = mvv2e * ke_sum / (adof * count * boltz);
result[i][0] = density;
result[i][1] = temp;
}

View File

@ -37,7 +37,7 @@ class ComputeAveSphereAtom : public Compute {
protected:
int nmax;
double cutoff, cutsq, sphere_vol;
double cutoff, cutsq, volume;
class NeighList *list;
double **result;

View File

@ -318,7 +318,7 @@ void ComputeStressCartesian::compute_array()
// Check if inside cut-off
if (rsq >= cutsq[itype][jtype]) continue;
pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair);
compute_pressure(fpair, xi1, xi2, xj1, xj2, delx, dely, delz);
compute_pressure(fpair, xi1, xi2, delx, dely, delz);
}
}
@ -356,8 +356,8 @@ void ComputeStressCartesian::compute_array()
}
}
void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double xj,
double yj, double delx, double dely, double delz)
void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double delx,
double dely, double delz)
{
int bin1, bin2, next_bin1, next_bin2;
double la = 0.0, lb = 0.0, l_sum = 0.0;

View File

@ -41,7 +41,7 @@ class ComputeStressCartesian : public Compute {
double *dens, *pkxx, *pkyy, *pkzz, *pcxx, *pcyy, *pczz;
double *tdens, *tpkxx, *tpkyy, *tpkzz, *tpcxx, *tpcyy, *tpczz;
class NeighList *list;
void compute_pressure(double, double, double, double, double, double, double, double);
void compute_pressure(double, double, double, double, double, double);
};
} // namespace LAMMPS_NS

View File

@ -433,10 +433,10 @@ int xdropen(XDR *xdrs, const char *filename, const char *type)
return 0;
}
if (*type == 'w' || *type == 'W') {
type = (char *) "w+";
type = (char *) "wb+";
lmode = XDR_ENCODE;
} else {
type = (char *) "r";
type = (char *) "rb";
lmode = XDR_DECODE;
}
xdrfiles[xdrid] = fopen(filename, type);

View File

@ -483,7 +483,7 @@ void PairILPTMD::calc_normal()
}
}
//############################ For the edge atoms of TMD ################################
else if (cont > 1 && cont < Nnei) {
else if (cont < Nnei) {
if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 ||
strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0) {
// derivatives of Ni[l] respect to the cont neighbors

View File

@ -11,11 +11,16 @@
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Stan Moore (SNL)
------------------------------------------------------------------------- */
#include "compute_ave_sphere_atom_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "memory_kokkos.h"
@ -105,11 +110,19 @@ void ComputeAveSphereAtomKokkos<DeviceType>::compute_peratom()
// compute properties for each atom in group
// use full neighbor list to count atoms less than cutoff
atomKK->sync(execution_space,X_MASK|V_MASK|TYPE_MASK|MASK_MASK);
atomKK->sync(execution_space,X_MASK|V_MASK|RMASS_MASK|TYPE_MASK|MASK_MASK);
x = atomKK->k_x.view<DeviceType>();
v = atomKK->k_v.view<DeviceType>();
rmass = atomKK->k_rmass.view<DeviceType>();
mass = atomKK->k_mass.view<DeviceType>();
type = atomKK->k_type.view<DeviceType>();
mask = atomKK->k_mask.view<DeviceType>();
adof = domain->dimension;
mvv2e = force->mvv2e;
mv2d = force->mv2d;
boltz = force->boltz;
Kokkos::deep_copy(d_result,0.0);
copymode = 1;
@ -125,8 +138,13 @@ template<class DeviceType>
KOKKOS_INLINE_FUNCTION
void ComputeAveSphereAtomKokkos<DeviceType>::operator()(TagComputeAveSphereAtom, const int &ii) const
{
double massone_i,massone_j;
const int i = d_ilist[ii];
if (mask[i] & groupbit) {
if (rmass.data()) massone_i = rmass[i];
else massone_i = mass[type[i]];
const X_FLOAT xtmp = x(i,0);
const X_FLOAT ytmp = x(i,1);
const X_FLOAT ztmp = x(i,2);
@ -135,14 +153,17 @@ void ComputeAveSphereAtomKokkos<DeviceType>::operator()(TagComputeAveSphereAtom,
// i atom contribution
int count = 1;
double vsum[3];
vsum[0] = v(i,0);
vsum[1] = v(i,1);
vsum[2] = v(i,2);
double totalmass = massone_i;
double p[3];
p[0] = v(i,0)*massone_i;
p[1] = v(i,1)*massone_i;
p[2] = v(i,2)*massone_i;
for (int jj = 0; jj < jnum; jj++) {
int j = d_neighbors(i,jj);
j &= NEIGHMASK;
if (rmass.data()) massone_j = rmass[j];
else massone_j = mass[type[j]];
const F_FLOAT delx = x(j,0) - xtmp;
const F_FLOAT dely = x(j,1) - ytmp;
@ -150,44 +171,45 @@ void ComputeAveSphereAtomKokkos<DeviceType>::operator()(TagComputeAveSphereAtom,
const F_FLOAT rsq = delx*delx + dely*dely + delz*delz;
if (rsq < cutsq) {
count++;
vsum[0] += v(j,0);
vsum[1] += v(j,1);
vsum[2] += v(j,2);
totalmass += massone_j;
p[0] += v(j,0)*massone_j;
p[1] += v(j,1)*massone_j;
p[2] += v(j,2)*massone_j;
}
}
double vavg[3];
vavg[0] = vsum[0]/count;
vavg[1] = vsum[1]/count;
vavg[2] = vsum[2]/count;
double vcom[3];
vcom[0] = p[0]/totalmass;
vcom[1] = p[1]/totalmass;
vcom[2] = p[2]/totalmass;
// i atom contribution
count = 1;
double vnet[3];
vnet[0] = v(i,0) - vavg[0];
vnet[1] = v(i,1) - vavg[1];
vnet[2] = v(i,2) - vavg[2];
double ke_sum = vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2];
vnet[0] = v(i,0) - vcom[0];
vnet[1] = v(i,1) - vcom[1];
vnet[2] = v(i,2) - vcom[2];
double ke_sum = massone_i * (vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2]);
for (int jj = 0; jj < jnum; jj++) {
int j = d_neighbors(i,jj);
j &= NEIGHMASK;
if (rmass.data()) massone_j = rmass[j];
else massone_j = mass[type[j]];
const F_FLOAT delx = x(j,0) - xtmp;
const F_FLOAT dely = x(j,1) - ytmp;
const F_FLOAT delz = x(j,2) - ztmp;
const F_FLOAT rsq = delx*delx + dely*dely + delz*delz;
if (rsq < cutsq) {
count++;
vnet[0] = v(j,0) - vavg[0];
vnet[1] = v(j,1) - vavg[1];
vnet[2] = v(j,2) - vavg[2];
ke_sum += vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2];
vnet[0] = v(j,0) - vcom[0];
vnet[1] = v(j,1) - vcom[1];
vnet[2] = v(j,2) - vcom[2];
ke_sum += massone_j * (vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2]);
}
}
double density = count/sphere_vol;
double temp = ke_sum/3.0/count;
double density = mv2d*totalmass/volume;
double temp = mvv2e*ke_sum/(adof*count*boltz);
d_result(i,0) = density;
d_result(i,1) = temp;
}

View File

@ -46,13 +46,18 @@ template <class DeviceType> class ComputeAveSphereAtomKokkos : public ComputeAve
void operator()(TagComputeAveSphereAtom, const int &) const;
private:
typename AT::t_x_array_randomread x;
typename AT::t_v_array_randomread v;
double adof,mvv2e,mv2d,boltz;
typename AT::t_x_array x;
typename AT::t_v_array v;
typename ArrayTypes<DeviceType>::t_float_1d rmass;
typename ArrayTypes<DeviceType>::t_float_1d mass;
typename ArrayTypes<DeviceType>::t_int_1d type;
typename ArrayTypes<DeviceType>::t_int_1d mask;
typename AT::t_neighbors_2d d_neighbors;
typename AT::t_int_1d_randomread d_ilist;
typename AT::t_int_1d_randomread d_numneigh;
typename AT::t_int_1d d_ilist;
typename AT::t_int_1d d_numneigh;
DAT::tdual_float_2d k_result;
typename AT::t_float_2d d_result;

View File

@ -534,8 +534,7 @@ void PairPACEKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
}
copymode = 1;
int newton_pair = force->newton_pair;
if (newton_pair == false)
if (!force->newton_pair)
error->all(FLERR,"PairPACEKokkos requires 'newton on'");
if (recursive)

View File

@ -2628,7 +2628,7 @@ int PairReaxFFKokkos<DeviceType>::preprocess_angular(int i, int itype, int j_sta
template<class DeviceType>
template<bool POPULATE>
KOKKOS_INLINE_FUNCTION
int PairReaxFFKokkos<DeviceType>::preprocess_torsion(int i, int /*itype*/, int itag,
int PairReaxFFKokkos<DeviceType>::preprocess_torsion(int i, int /*itype*/, tagint itag,
F_FLOAT xtmp, F_FLOAT ytmp, F_FLOAT ztmp, int j_start, int j_end, int location_torsion) const {
// in reaxff_torsion_angles: j = i, k = j, i = k;

View File

@ -257,7 +257,7 @@ class PairReaxFFKokkos : public PairReaxFF {
// Abstraction for counting and populating torsion intermediated
template<bool POPULATE>
KOKKOS_INLINE_FUNCTION
int preprocess_torsion(int, int, int, F_FLOAT, F_FLOAT, F_FLOAT, int, int, int) const;
int preprocess_torsion(int, int, tagint, F_FLOAT, F_FLOAT, F_FLOAT, int, int, int) const;
template<int NEIGHFLAG, int EVFLAG>
KOKKOS_INLINE_FUNCTION

View File

@ -450,7 +450,7 @@ void PairThreebodyTable::read_table(Table *tb, char *file, char *keyword, bool s
param_extract(tb, line);
// if it is a symmetric threebody interaction, less table entries are required
if (symmetric == true) {
if (symmetric) {
memory->create(tb->r12file, tb->ninput * tb->ninput * (tb->ninput + 1), "mltable:r12file");
memory->create(tb->r13file, tb->ninput * tb->ninput * (tb->ninput + 1), "mltable:r13file");
memory->create(tb->thetafile, tb->ninput * tb->ninput * (tb->ninput + 1), "mltable:thetafile");
@ -481,7 +481,7 @@ void PairThreebodyTable::read_table(Table *tb, char *file, char *keyword, bool s
int cerror = 0;
reader.skip_line();
// if it is a symmetric threebody interaction, less table entries are required
if (symmetric == true) {
if (symmetric) {
for (int i = 0; i < tb->ninput * tb->ninput * (tb->ninput + 1); i++) {
line = reader.next_line(11);
try {
@ -583,7 +583,7 @@ void PairThreebodyTable::bcast_table(Table *tb, bool symmetric)
MPI_Comm_rank(world, &me);
if (me > 0) {
// if it is a symmetric threebody interaction, less table entries are required
if (symmetric == true) {
if (symmetric) {
memory->create(tb->r12file, tb->ninput * tb->ninput * (tb->ninput + 1), "mltable:r12file");
memory->create(tb->r13file, tb->ninput * tb->ninput * (tb->ninput + 1), "mltable:r13file");
memory->create(tb->thetafile, tb->ninput * tb->ninput * (tb->ninput + 1),
@ -612,7 +612,7 @@ void PairThreebodyTable::bcast_table(Table *tb, bool symmetric)
}
// if it is a symmetric threebody interaction, less table entries are required
if (symmetric == true) {
if (symmetric) {
MPI_Bcast(tb->r12file, tb->ninput * tb->ninput * (tb->ninput + 1), MPI_DOUBLE, 0, world);
MPI_Bcast(tb->r13file, tb->ninput * tb->ninput * (tb->ninput + 1), MPI_DOUBLE, 0, world);
MPI_Bcast(tb->thetafile, tb->ninput * tb->ninput * (tb->ninput + 1), MPI_DOUBLE, 0, world);
@ -697,7 +697,7 @@ void PairThreebodyTable::uf_lookup(Param *pm, double r12, double r13, double the
//lookup scheme
// if it is a symmetric threebody interaction, less table entries are required
if (pm->symmetric == true) {
if (pm->symmetric) {
nr12 = (r12 - pm->mltable->rmin + 0.5 * dr - 0.00000001) / dr;
if (r12 == (pm->mltable->rmin - 0.5 * dr)) { nr12 = 0; }
nr13 = (r13 - pm->mltable->rmin + 0.5 * dr - 0.00000001) / dr;
@ -778,7 +778,7 @@ void PairThreebodyTable::threebody(Param *paramijk, double rsq1, double rsq2, do
}
// if the indices have been swapped, swap them back
if (swapped == true) {
if (swapped) {
temp = r12;
r12 = r13;
r13 = temp;

View File

@ -273,7 +273,7 @@ void FixWidom::init()
triclinic = domain->triclinic;
ave_widom_chemical_potential = 0;
ave_widom_chemical_potential = 0.0;
if (region) volume = region_volume;
else volume = domain->xprd * domain->yprd * domain->zprd;

View File

@ -461,7 +461,7 @@ mpi-stubs:
sinclude ../lib/python/Makefile.lammps
install-python:
@rm -rf ../python/build
@$(PYTHON) ../python/install.py -p ../python/lammps -l ../src/liblammps.so
@$(PYTHON) ../python/install.py -p ../python/lammps -l ../src/liblammps.so -w $(PWD)
# Create a tarball of src dir and packages

View File

@ -94,8 +94,8 @@ FixACKS2ReaxFF::~FixACKS2ReaxFF()
memory->destroy(s_hist_X);
memory->destroy(s_hist_last);
deallocate_storage();
deallocate_matrix();
FixACKS2ReaxFF::deallocate_storage();
FixACKS2ReaxFF::deallocate_matrix();
}
/* ---------------------------------------------------------------------- */

View File

@ -163,7 +163,7 @@ FixQEqReaxFF::~FixQEqReaxFF()
memory->destroy(t_hist);
FixQEqReaxFF::deallocate_storage();
deallocate_matrix();
FixQEqReaxFF::deallocate_matrix();
memory->destroy(shld);
@ -640,7 +640,7 @@ void FixQEqReaxFF::compute_H()
int jnum;
int i, j, ii, jj, flag;
double dx, dy, dz, r_sqr;
const double SMALL = 0.0001;
constexpr double EPSILON = 0.0001;
int *type = atom->type;
tagint *tag = atom->tag;
@ -671,10 +671,10 @@ void FixQEqReaxFF::compute_H()
if (j < atom->nlocal) flag = 1;
else if (tag[i] < tag[j]) flag = 1;
else if (tag[i] == tag[j]) {
if (dz > SMALL) flag = 1;
else if (fabs(dz) < SMALL) {
if (dy > SMALL) flag = 1;
else if (fabs(dy) < SMALL && dx > SMALL)
if (dz > EPSILON) flag = 1;
else if (fabs(dz) < EPSILON) {
if (dy > EPSILON) flag = 1;
else if (fabs(dy) < EPSILON && dx > EPSILON)
flag = 1;
}
}

View File

@ -73,7 +73,6 @@ void CreateBonds::command(int narg, char **arg)
iarg = 6;
} else if (strcmp(arg[0], "single/bond") == 0) {
style = SBOND;
if (narg < 4) error->all(FLERR, "Illegal create_bonds command");
btype = utils::inumeric(FLERR, arg[1], false, lmp);
batom1 = utils::tnumeric(FLERR, arg[2], false, lmp);
batom2 = utils::tnumeric(FLERR, arg[3], false, lmp);

View File

@ -315,7 +315,9 @@
// Enable minimal optimizations for more compact code in debug mode.
FMT_GCC_PRAGMA("GCC push_options")
#ifndef __OPTIMIZE__
// LAMMPS CUSTOMIZATION: suppress warning about pragma with KOKKOS
#if !defined(__OPTIMIZE__) && !defined(LMP_KOKKOS)
// END LAMMPS CUSTOMIZATION
FMT_GCC_PRAGMA("GCC optimize(\"Og\")")
#endif

View File

@ -28,6 +28,12 @@ Reader::Reader(LAMMPS *lmp) : Pointers(lmp)
compressed = false;
}
// avoid resource leak
Reader::~Reader()
{
if (fp != nullptr) close_file();
}
/* ----------------------------------------------------------------------
try to open given file
generic version for ASCII files with optional compression or for native binary dumps

View File

@ -23,6 +23,7 @@ namespace LAMMPS_NS {
class Reader : protected Pointers {
public:
Reader(class LAMMPS *);
~Reader() override;
virtual void settings(int, char **);

View File

@ -1,17 +1,19 @@
# Singularity container definitions for compiling/testing LAMMPS
# Apptainer (aka Singularity) container definitions for compiling/testing LAMMPS
The *.def files in this folder can be used to build container images
for [Singularity](https://sylabs.io), suitable for compiling and testing
for [Apptainer](https://apptainer.org) (previously called
[Singularity](https://sylabs.io)), suitable for compiling and testing
LAMMPS on a variety of OS variants with support for most standard
packages and - for some of them - also building/spellchecking the manual
in all supported formats. This allows to test and debug LAMMPS code on
in all supported formats. This allows to test and debug LAMMPS code on
different OS variants without doing a full installation on your development
workstation, e.g. when bugs are reported that can only be reproduced on
a specific OS or with specific (mostly older) versions of tools,
compilers, or libraries.
Here is a workflow for testing a compilation of LAMMPS with a locally
built CentOS 7.x singularity container.
built CentOS 7.x Singularity container. For Apptainer replace the
`singularity` command with `apptainer`.
```
cd some/work/directory

View File

@ -3,7 +3,7 @@ From: ubuntu:18.04
%environment
export PATH=/usr/lib/ccache:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.2/llvm/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib
%post
export DEBIAN_FRONTEND=noninteractive
apt-get update
@ -22,10 +22,10 @@ From: ubuntu:18.04
apt install -y cmake
###########################################################################
# ROCm 5.1.2
# ROCm 5.1.3
###########################################################################
wget https://repo.radeon.com/amdgpu-install/22.10.2/ubuntu/bionic/amdgpu-install_22.10.2.50102-1_all.deb
apt-get install -y ./amdgpu-install_22.10.2.50102-1_all.deb
wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/bionic/amdgpu-install_22.10.3.50103-1_all.deb
apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb
apt-get update
apt-get install --no-install-recommends -y \

View File

@ -2,11 +2,11 @@ BootStrap: docker
From: ubuntu:18.04
%environment
export PATH=/usr/lib/ccache:/usr/local/cuda-11.5/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export CUDADIR=/usr/local/cuda-11.5
export CUDA_PATH=/usr/local/cuda-11.5
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.5/lib64:/opt/rocm/lib:/opt/rocm-4.5.0/llvm/lib
export LIBRARY_PATH=/usr/local/cuda-11.5/lib64/stubs
export PATH=/usr/lib/ccache:/usr/local/cuda-11.7/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export CUDADIR=/usr/local/cuda-11.7
export CUDA_PATH=/usr/local/cuda-11.7
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.7/lib64:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib
export LIBRARY_PATH=/usr/local/cuda-11.7/lib64/stubs
%post
export DEBIAN_FRONTEND=noninteractive
apt-get update
@ -27,8 +27,8 @@ From: ubuntu:18.04
###########################################################################
# ROCm 4.5
###########################################################################
wget https://repo.radeon.com/amdgpu-install/21.40/ubuntu/focal/amdgpu-install-21.40.40500-1_all.deb
apt-get install -y ./amdgpu-install-21.40.40500-1_all.deb
wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/focal/amdgpu-install_22.10.3.50103-1_all.deb
apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb
apt-get update
apt-get install --no-install-recommends -y \
@ -122,11 +122,11 @@ From: ubuntu:18.04
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
apt-get update
export CUDA_PKG_VERSION=11.5
export CUDA_PKG_VERSION=11.7
apt-get install -y --no-install-recommends \
cuda-libraries-${CUDA_PKG_VERSION} \

View File

@ -3,7 +3,7 @@ From: ubuntu:20.04
%environment
export PATH=/usr/lib/ccache:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.2/llvm/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib
%post
export DEBIAN_FRONTEND=noninteractive
apt-get update
@ -13,10 +13,10 @@ From: ubuntu:20.04
apt-get install --no-install-recommends -y software-properties-common
###########################################################################
# ROCm 5.1.2
# ROCm 5.1.3
###########################################################################
wget https://repo.radeon.com/amdgpu-install/22.10.2/ubuntu/focal/amdgpu-install_22.10.2.50102-1_all.deb
apt-get install -y ./amdgpu-install_22.10.2.50102-1_all.deb
wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/focal/amdgpu-install_22.10.3.50103-1_all.deb
apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb
apt-get update
apt-get install --no-install-recommends -y \

View File

@ -2,11 +2,11 @@ BootStrap: docker
From: ubuntu:20.04
%environment
export PATH=/usr/lib/ccache:/usr/local/cuda-11.5/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export CUDADIR=/usr/local/cuda-11.5
export CUDA_PATH=/usr/local/cuda-11.5
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.5/lib64:/opt/rocm/lib:/opt/rocm-4.5.0/llvm/lib
export LIBRARY_PATH=/usr/local/cuda-11.5/lib64/stubs
export PATH=/usr/lib/ccache:/usr/local/cuda-11.7/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export CUDADIR=/usr/local/cuda-11.7
export CUDA_PATH=/usr/local/cuda-11.7
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.7/lib64:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib
export LIBRARY_PATH=/usr/local/cuda-11.7/lib64/stubs
%post
export DEBIAN_FRONTEND=noninteractive
apt-get update
@ -15,10 +15,10 @@ From: ubuntu:20.04
apt-get install -y --no-install-recommends curl wget libnuma-dev gnupg ca-certificates
###########################################################################
# ROCm 4.5
# ROCm 5.1.3
###########################################################################
wget https://repo.radeon.com/amdgpu-install/21.40/ubuntu/focal/amdgpu-install-21.40.40500-1_all.deb
apt-get install -y ./amdgpu-install-21.40.40500-1_all.deb
wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/focal/amdgpu-install_22.10.3.50103-1_all.deb
apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb
apt-get update
apt-get install --no-install-recommends -y \
@ -109,7 +109,7 @@ From: ubuntu:20.04
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
apt-get update

View File

@ -134,3 +134,31 @@
fun:GOMP_parallel
obj:*
}
{
OpnMP_open_part1
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
...
fun:openaux
...
fun:dl_open_worker_begin
...
fun:dl_open_worker
...
fun:_dl_open
}
{
OpnMP_open_part2
Memcheck:Leak
match-leak-kinds: reachable
fun:calloc
...
fun:openaux
...
fun:dl_open_worker_begin
...
fun:dl_open_worker
...
fun:_dl_open
}

View File

@ -1,6 +1,5 @@
---
lammps_version: 4 May 2022
tags: generated
date_generated: Wed Jun 1 15:17:22 2022
epsilon: 1e-12
skip_tests: single

View File

@ -1,6 +1,5 @@
---
lammps_version: 4 May 2022
tags: generated
date_generated: Wed Jun 1 15:28:13 2022
epsilon: 1e-05
skip_tests: single

View File

@ -1,7 +1,7 @@
---
lammps_version: 17 Feb 2022
date_generated: Fri Mar 18 22:17:48 2022
epsilon: 5e-13
epsilon: 1e-12
skip_tests:
prerequisites: ! |
pair pace

View File

@ -1,7 +1,7 @@
---
lammps_version: 10 Mar 2021
date_generated: Wed Apr 7 19:30:07 2021
epsilon: 5e-13
epsilon: 1e-12
prerequisites: ! |
pair pace
pre_commands: ! |