Merge branch 'develop' of https://github.com/lammps/lammps into kokkos-dipole-lj-expand
This commit is contained in:
@ -9,8 +9,22 @@ function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
|
||||
|
||||
get_filename_component(archive ${url} NAME)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/_deps/${archive})
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
||||
endif()
|
||||
if(NOT "${DL_MD5}" STREQUAL "${hash}")
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} STATUS DL_STATUS SHOW_PROGRESS)
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${hash}"))
|
||||
set(${target}_URL ${url})
|
||||
GetFallbackURL(${target}_URL fallback)
|
||||
message(WARNING "Download from primary URL ${url} failed\nTrying fallback URL ${fallback}")
|
||||
file(DOWNLOAD ${fallback} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/_deps/${archive}")
|
||||
endif()
|
||||
message(STATUS "Unpacking and configuring ${archive}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||
|
||||
@ -158,3 +158,14 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
||||
set(CMAKE_LINUX_DISTRO ${distro})
|
||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||
endif()
|
||||
|
||||
function(GetFallbackURL input output)
|
||||
string(REPLACE "_URL" "" _tmp ${input})
|
||||
string(TOLOWER ${_tmp} libname)
|
||||
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
||||
if ("${newurl}" STREQUAL "${${input}}")
|
||||
set(${output} "" PARENT_SCOPE)
|
||||
else()
|
||||
set(${output} ${newurl} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(GetFallbackURL)
|
||||
|
||||
@ -428,15 +428,17 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
|
||||
if(DOWNLOAD_CUB)
|
||||
message(STATUS "CUB download requested")
|
||||
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||
# TODO: test update to current version 1.17.2
|
||||
set(CUB_URL "https://github.com/nvidia/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
||||
mark_as_advanced(CUB_URL)
|
||||
mark_as_advanced(CUB_MD5)
|
||||
GetFallbackURL(CUB_URL CUB_FALLBACK)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(CUB
|
||||
URL ${CUB_URL}
|
||||
URL ${CUB_URL} ${CUB_FALLBACK}
|
||||
URL_MD5 ${CUB_MD5}
|
||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
@ -53,8 +53,10 @@ if(DOWNLOAD_KOKKOS)
|
||||
set(KOKKOS_MD5 "f140e02b826223b1045207d9bc10d404" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||
mark_as_advanced(KOKKOS_URL)
|
||||
mark_as_advanced(KOKKOS_MD5)
|
||||
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
|
||||
|
||||
ExternalProject_Add(kokkos_build
|
||||
URL ${KOKKOS_URL}
|
||||
URL ${KOKKOS_URL} ${KOKKOS_FALLBACK}
|
||||
URL_MD5 ${KOKKOS_MD5}
|
||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
||||
|
||||
@ -19,6 +19,7 @@ if(DOWNLOAD_LATTE)
|
||||
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
|
||||
mark_as_advanced(LATTE_URL)
|
||||
mark_as_advanced(LATTE_MD5)
|
||||
GetFallbackURL(LATTE_URL LATTE_FALLBACK)
|
||||
|
||||
# CMake cannot pass BLAS or LAPACK library variable to external project if they are a list
|
||||
list(LENGTH BLAS_LIBRARIES} NUM_BLAS)
|
||||
@ -30,7 +31,7 @@ if(DOWNLOAD_LATTE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(latte_build
|
||||
URL ${LATTE_URL}
|
||||
URL ${LATTE_URL} ${LATTE_FALLBACK}
|
||||
URL_MD5 ${LATTE_MD5}
|
||||
SOURCE_SUBDIR cmake
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
||||
|
||||
@ -12,6 +12,7 @@ if(DOWNLOAD_MDI)
|
||||
set(MDI_MD5 "7a222353ae8e03961d5365e6cd48baee" CACHE STRING "MD5 checksum for MDI tarball")
|
||||
mark_as_advanced(MDI_URL)
|
||||
mark_as_advanced(MDI_MD5)
|
||||
GetFallbackURL(MDI_URL MDI_FALLBACK)
|
||||
enable_language(C)
|
||||
|
||||
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
||||
@ -63,7 +64,7 @@ if(DOWNLOAD_MDI)
|
||||
# support cross-compilation and ninja-build
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(mdi_build
|
||||
URL ${MDI_URL}
|
||||
URL ${MDI_URL} ${MDI_FALLBACK}
|
||||
URL_MD5 ${MDI_MD5}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext
|
||||
CMAKE_ARGS
|
||||
|
||||
@ -10,6 +10,7 @@ if(DOWNLOAD_N2P2)
|
||||
set(N2P2_MD5 "9595b066636cd6b90b0fef93398297a5" CACHE STRING "MD5 checksum of N2P2 tarball")
|
||||
mark_as_advanced(N2P2_URL)
|
||||
mark_as_advanced(N2P2_MD5)
|
||||
GetFallbackURL(N2P2_URL N2P2_FALLBACK)
|
||||
|
||||
# adjust settings from detected compiler to compiler platform in n2p2 library
|
||||
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
|
||||
@ -72,7 +73,7 @@ if(DOWNLOAD_N2P2)
|
||||
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(n2p2_build
|
||||
URL ${N2P2_URL}
|
||||
URL ${N2P2_URL} ${N2P2_FALLBACK}
|
||||
URL_MD5 ${N2P2_MD5}
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
@ -1,11 +1,25 @@
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.01.3.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.01.3.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
|
||||
set(PACELIB_MD5 "f418d32b60e531063ac4285bf702b468" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
set(PACELIB_MD5 "4f0b3b5b14456fe9a73b447de3765caa" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
mark_as_advanced(PACELIB_URL)
|
||||
mark_as_advanced(PACELIB_MD5)
|
||||
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
|
||||
|
||||
# download library sources to build folder
|
||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz)
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
||||
endif()
|
||||
if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")
|
||||
message(STATUS "Downloading ${PACELIB_URL}")
|
||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS)
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}"))
|
||||
message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}")
|
||||
file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS)
|
||||
else()
|
||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# uncompress downloaded sources
|
||||
execute_process(
|
||||
|
||||
@ -59,10 +59,11 @@ if(DOWNLOAD_PLUMED)
|
||||
|
||||
mark_as_advanced(PLUMED_URL)
|
||||
mark_as_advanced(PLUMED_MD5)
|
||||
GetFallbackURL(PLUMED_URL PLUMED_FALLBACK)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL ${PLUMED_URL}
|
||||
URL ${PLUMED_URL} ${PLUMED_FALLBACK}
|
||||
URL_MD5 ${PLUMED_MD5}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
|
||||
@ -18,6 +18,8 @@ if(DOWNLOAD_SCAFACOS)
|
||||
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
||||
mark_as_advanced(SCAFACOS_URL)
|
||||
mark_as_advanced(SCAFACOS_MD5)
|
||||
GetFallbackURL(SCAFACOS_URL SCAFACOS_FALLBACK)
|
||||
|
||||
|
||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
@ -30,7 +32,7 @@ if(DOWNLOAD_SCAFACOS)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(scafacos_build
|
||||
URL ${SCAFACOS_URL}
|
||||
URL ${SCAFACOS_URL} ${SCAFACOS_FALLBACK}
|
||||
URL_MD5 ${SCAFACOS_MD5}
|
||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
pair_style pace command
|
||||
=======================
|
||||
|
||||
Accelerator Variants: *pace/kk*
|
||||
Accelerator Variants: *pace/kk*, *pace/extrapolation/kk*
|
||||
|
||||
pair_style pace/extrapolation command
|
||||
=====================================
|
||||
|
||||
3
lib/hdnnp/.gitignore
vendored
Normal file
3
lib/hdnnp/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/includelink
|
||||
/liblink
|
||||
/n2p2-*
|
||||
@ -10,7 +10,7 @@ import sys, os, platform, subprocess, shutil
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import get_cpus, fullpath, geturl, checkmd5sum
|
||||
from install_helpers import get_cpus, fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
parser = ArgumentParser(prog='Install.py',
|
||||
description="LAMMPS library build wrapper script")
|
||||
@ -76,14 +76,21 @@ if pathflag:
|
||||
|
||||
if buildflag:
|
||||
url = "https://github.com/CompPhysVienna/n2p2/archive/v%s.tar.gz" % (version)
|
||||
filename = "n2p2-%s.tar.gz" %version
|
||||
print("Downloading n2p2 ...")
|
||||
geturl(url, filename)
|
||||
filename = "n2p2-%s.tar.gz" % version
|
||||
fallback = getfallback('n2p2', url)
|
||||
print("Downloading n2p2 from", url)
|
||||
try:
|
||||
geturl(url, filename)
|
||||
except:
|
||||
geturl(fallback, filename)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for n2p2 library does not match")
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, filename)
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for n2p2 library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking n2p2 source tarball ...")
|
||||
if os.path.exists("%s/n2p2-%s" % (homepath, version)):
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
import hashlib,os,subprocess
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
# try to auto-detect the maximum number of available CPUs
|
||||
def get_cpus():
|
||||
@ -32,31 +35,31 @@ def which(program):
|
||||
|
||||
return None
|
||||
|
||||
def geturl(url,fname):
|
||||
def geturl(url, fname):
|
||||
success = False
|
||||
|
||||
if which('curl') != None:
|
||||
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||
cmd = 'curl -L -o "%s" %s' % (fname, url)
|
||||
try:
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
|
||||
success = True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Calling curl failed with: %s" % e.output.decode('UTF-8'))
|
||||
|
||||
if not success and which('wget') != None:
|
||||
cmd = 'wget -O "%s" %s' % (fname,url)
|
||||
cmd = 'wget -O "%s" %s' % (fname, url)
|
||||
try:
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
|
||||
success = True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Calling wget failed with: %s" % e.output.decode('UTF-8'))
|
||||
|
||||
if not success:
|
||||
error("Failed to download source code with 'curl' or 'wget'")
|
||||
raise Exception("Failed to download source code with 'curl' or 'wget' from " + url)
|
||||
return
|
||||
|
||||
def checkmd5sum(md5sum,fname):
|
||||
with open(fname,'rb') as fh:
|
||||
def checkmd5sum(md5sum, fname):
|
||||
with open(fname, 'rb') as fh:
|
||||
m = hashlib.md5()
|
||||
while True:
|
||||
data = fh.read(81920)
|
||||
@ -66,3 +69,6 @@ def checkmd5sum(md5sum,fname):
|
||||
fh.close()
|
||||
return m.hexdigest() == md5sum
|
||||
|
||||
def getfallback(lib, url):
|
||||
archive = re.sub(r'^https://.*/([^/]+gz)', r'-\1', url)
|
||||
return 'https://download.lammps.org/thirdparty/' + lib + archive
|
||||
|
||||
@ -10,7 +10,7 @@ import sys, os, subprocess, shutil, tarfile
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import fullpath, geturl, checkmd5sum
|
||||
from install_helpers import fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
parser = ArgumentParser(prog='Install.py',
|
||||
description="LAMMPS library build wrapper script")
|
||||
@ -86,17 +86,25 @@ if buildflag:
|
||||
url = "https://github.com/lanl/LATTE/archive/v%s.tar.gz" % version
|
||||
lattepath = fullpath(homepath)
|
||||
lattedir = os.path.join(lattepath, homedir)
|
||||
fallback = getfallback('latte', url)
|
||||
filename = 'LATTE.tar.gz'
|
||||
|
||||
# download and unpack LATTE tarball
|
||||
|
||||
if buildflag:
|
||||
print("Downloading LATTE ...")
|
||||
geturl(url, "LATTE.tar.gz")
|
||||
try:
|
||||
geturl(url, filename)
|
||||
except:
|
||||
geturl(fallback, filename)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], 'LATTE.tar.gz'):
|
||||
sys.exit("Checksum for LATTE library does not match")
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, filename)
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for LATTE library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking LATTE ...")
|
||||
if os.path.exists(lattedir):
|
||||
|
||||
@ -9,7 +9,7 @@ import sys,os,subprocess
|
||||
import glob
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import checkmd5sum
|
||||
from install_helpers import fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
# help message
|
||||
|
||||
@ -51,49 +51,6 @@ def error(str=None):
|
||||
# expand to full path name
|
||||
# process leading '~' or relative path
|
||||
|
||||
def fullpath(path):
|
||||
return os.path.abspath(os.path.expanduser(path))
|
||||
|
||||
def which(program):
|
||||
def is_exe(fpath):
|
||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||
|
||||
fpath, fname = os.path.split(program)
|
||||
if fpath:
|
||||
if is_exe(program):
|
||||
return program
|
||||
else:
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
path = path.strip('"')
|
||||
exe_file = os.path.join(path, program)
|
||||
if is_exe(exe_file):
|
||||
return exe_file
|
||||
|
||||
return None
|
||||
|
||||
def geturl(url,fname):
|
||||
success = False
|
||||
|
||||
if which('curl') != None:
|
||||
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||
try:
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
success = True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Calling curl failed with: %s" % e.output.decode('UTF-8'))
|
||||
|
||||
if not success and which('wget') != None:
|
||||
cmd = 'wget -O "%s" %s' % (fname,url)
|
||||
try:
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
success = True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Calling wget failed with: %s" % e.output.decode('UTF-8'))
|
||||
|
||||
if not success:
|
||||
error("Failed to download source code with 'curl' or 'wget'")
|
||||
return
|
||||
|
||||
# parse args
|
||||
|
||||
args = sys.argv[1:]
|
||||
@ -123,17 +80,24 @@ lib = os.path.basename(cwd)
|
||||
|
||||
# download and unpack MDI_Library tarball
|
||||
|
||||
homepath = "."
|
||||
homepath = fullpath('.')
|
||||
homedir = "%s/MDI_Library" % homepath
|
||||
|
||||
print("Downloading MDI_Library ...")
|
||||
mditar = "%s/v%s.tar.gz" % (homepath,version)
|
||||
geturl(url, mditar)
|
||||
mditar = "%s/v%s.tar.gz" % (homepath, version)
|
||||
fallback = getfallback('mdi', url)
|
||||
try:
|
||||
geturl(url, mditar)
|
||||
except:
|
||||
geturl(fallback, mditar)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], mditar):
|
||||
sys.exit("Checksum for MDI library does not match")
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, mditar)
|
||||
if not checkmd5sum(checksums[version], mditar):
|
||||
sys.exit("Checksum for MDI library does not match")
|
||||
|
||||
print("Unpacking MDI_Library tarball ...")
|
||||
if os.path.exists("%s/v%s" % (homepath,version)):
|
||||
@ -199,7 +163,6 @@ makefile_lammps = open(str(dir_path) + "/Makefile.lammps", "a")
|
||||
makefile_lammps.write(str(rpath_option) + "\n")
|
||||
makefile_lammps.close()
|
||||
|
||||
|
||||
shared_files = glob.glob( os.path.join( homepath, "liblink", "lib%s.a" % lib) )
|
||||
if len(shared_files) > 0:
|
||||
print("Build was successful")
|
||||
|
||||
@ -10,7 +10,7 @@ import sys, os, subprocess, shutil, tarfile
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import fullpath, geturl
|
||||
from install_helpers import fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
parser = ArgumentParser(prog='Install.py',
|
||||
description="LAMMPS library build wrapper script")
|
||||
@ -84,7 +84,19 @@ if pathflag:
|
||||
if buildflag:
|
||||
print("Downloading MS-CG ...")
|
||||
tarname = os.path.join(homepath, tarname)
|
||||
geturl(url, tarname)
|
||||
fallback = getfallback('mscg', url)
|
||||
try:
|
||||
geturl(url, tarname)
|
||||
except:
|
||||
geturl(fallback, tarname)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if mscgver in checksums:
|
||||
if not checkmd5sum(checksums[mscgver], tarname):
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, tarname)
|
||||
if not checkmd5sum(checksums[mscgver], tarname):
|
||||
sys.exit("Checksum for LATTE library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking MS-CG tarfile ...")
|
||||
|
||||
|
||||
@ -13,16 +13,16 @@ import sys
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import fullpath, geturl, checkmd5sum
|
||||
from install_helpers import fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
# settings
|
||||
|
||||
thisdir = fullpath('.')
|
||||
version ='v.2023.01.3'
|
||||
version ='v.2023.01.3.fix'
|
||||
|
||||
# known checksums for different PACE versions. used to validate the download.
|
||||
checksums = { \
|
||||
'v.2023.01.3': 'f418d32b60e531063ac4285bf702b468'
|
||||
'v.2023.01.3.fix': '4f0b3b5b14456fe9a73b447de3765caa'
|
||||
}
|
||||
|
||||
parser = ArgumentParser(prog='Install.py', description="LAMMPS library build wrapper script")
|
||||
@ -77,14 +77,21 @@ if buildflag:
|
||||
print("Downloading pace tarball ...")
|
||||
archive_filename = "%s.%s" % (version, archive_extension)
|
||||
download_filename = "%s/%s" % (thisdir, archive_filename)
|
||||
fallback = getfallback('pacelib', url)
|
||||
print("Downloading from ", url, " to ", download_filename, end=" ")
|
||||
geturl(url, download_filename)
|
||||
try:
|
||||
geturl(url, download_filename)
|
||||
except:
|
||||
geturl(fallback, download_filename)
|
||||
print(" done")
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], archive_filename):
|
||||
sys.exit("Checksum for pace library does not match")
|
||||
if not checkmd5sum(checksums[version], download_filename):
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, download_filename)
|
||||
if not checkmd5sum(checksums[version], download_filename):
|
||||
sys.exit("Checksum for pace library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking pace tarball ...")
|
||||
src_folder = thisdir + "/src"
|
||||
|
||||
@ -10,7 +10,7 @@ import sys, os, platform, subprocess, shutil
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import get_cpus, fullpath, geturl, checkmd5sum
|
||||
from install_helpers import get_cpus, fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
parser = ArgumentParser(prog='Install.py',
|
||||
description="LAMMPS library build wrapper script")
|
||||
@ -86,6 +86,7 @@ buildflag = args.build
|
||||
pathflag = args.path is not None
|
||||
plumedpath = args.path
|
||||
mode = args.mode
|
||||
version = args.version
|
||||
|
||||
homepath = fullpath('.')
|
||||
homedir = "%s/plumed2" % (homepath)
|
||||
@ -101,14 +102,21 @@ if pathflag:
|
||||
|
||||
if buildflag:
|
||||
url = "https://github.com/plumed/plumed2/releases/download/v%s/plumed-src-%s.tgz" % (version, version)
|
||||
filename = "plumed-src-%s.tar.gz" %version
|
||||
filename = "plumed-src-%s.tar.gz" % version
|
||||
fallback = getfallback('plumed', url)
|
||||
print("Downloading plumed ...")
|
||||
geturl(url, filename)
|
||||
try:
|
||||
geturl(url, filename)
|
||||
except:
|
||||
geturl(fallback, filename)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for plumed2 library does not match")
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, filename)
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for plumed2 library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking plumed2 source tarball ...")
|
||||
if os.path.exists("%s/plumed-%s" % (homepath, version)):
|
||||
|
||||
@ -10,15 +10,13 @@ import sys, os, subprocess, shutil, tarfile
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import fullpath, geturl, get_cpus, checkmd5sum
|
||||
from install_helpers import fullpath, geturl, get_cpus, checkmd5sum, getfallback
|
||||
|
||||
parser = ArgumentParser(prog='Install.py',
|
||||
description="LAMMPS library build wrapper script")
|
||||
parser = ArgumentParser(prog='Install.py', description="LAMMPS library build wrapper script")
|
||||
|
||||
# settings
|
||||
|
||||
version = "1.0.1"
|
||||
url = "https://github.com/scafacos/scafacos/releases/download/v%s/scafacos-%s.tar.gz" % (version, version)
|
||||
|
||||
# known checksums for different ScaFaCoS versions. used to validate the download.
|
||||
checksums = { \
|
||||
@ -59,6 +57,7 @@ if not args.build and not args.path:
|
||||
buildflag = args.build
|
||||
pathflag = args.path is not None
|
||||
version = args.version
|
||||
url = "https://github.com/scafacos/scafacos/releases/download/v%s/scafacos-%s.tar.gz" % (version, version)
|
||||
|
||||
homepath = fullpath(".")
|
||||
scafacospath = os.path.join(homepath, "scafacos-%s" % version)
|
||||
@ -76,12 +75,20 @@ if pathflag:
|
||||
|
||||
if buildflag:
|
||||
print("Downloading ScaFaCoS ...")
|
||||
geturl(url, "%s/scafacos-%s.tar.gz" % (homepath, version))
|
||||
filename = "%s/scafacos-%s.tar.gz" % (homepath, version)
|
||||
fallback = getfallback('scafacos', url)
|
||||
try:
|
||||
geturl(url, filename)
|
||||
except:
|
||||
geturl(fallback, filename)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], '%s/scafacos-%s.tar.gz' % (homepath, version)):
|
||||
sys.exit("Checksum for ScaFaCoS library does not match")
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, filename)
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for ScaFaCoS library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking ScaFaCoS tarball ...")
|
||||
if os.path.exists(scafacospath):
|
||||
|
||||
@ -175,8 +175,6 @@ void FixQEqReaxFFKokkos<DeviceType>::init_hist()
|
||||
template<class DeviceType>
|
||||
void FixQEqReaxFFKokkos<DeviceType>::setup_pre_force(int vflag)
|
||||
{
|
||||
//neighbor->build_one(list);
|
||||
|
||||
pre_force(vflag);
|
||||
}
|
||||
|
||||
|
||||
@ -28,8 +28,8 @@ namespace LAMMPS_NS {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST, int TRI, int SIZE>
|
||||
NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::NPairKokkos(LAMMPS *lmp) : NPair(lmp) {
|
||||
template<class DeviceType, int HALF, int NEWTON, int GHOST, int TRI, int SIZE>
|
||||
NPairKokkos<DeviceType,HALF,NEWTON,GHOST,TRI,SIZE>::NPairKokkos(LAMMPS *lmp) : NPair(lmp) {
|
||||
|
||||
last_stencil_old = -1;
|
||||
|
||||
@ -49,8 +49,8 @@ NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::NPairKokkos(LAMMPS *lmp) : NP
|
||||
copy needed info from Neighbor class to this build class
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_neighbor_info()
|
||||
template<class DeviceType, int HALF, int NEWTON, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF,NEWTON,GHOST,TRI,SIZE>::copy_neighbor_info()
|
||||
{
|
||||
NPair::copy_neighbor_info();
|
||||
|
||||
@ -58,7 +58,6 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_neighbor_info()
|
||||
|
||||
// general params
|
||||
|
||||
newton_pair = force->newton_pair;
|
||||
k_cutneighsq = neighborKK->k_cutneighsq;
|
||||
|
||||
// overwrite per-type Neighbor cutoffs with custom value set by requestor
|
||||
@ -93,8 +92,8 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_neighbor_info()
|
||||
copy per-atom and per-bin vectors from NBin class to this build class
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_bin_info()
|
||||
template<class DeviceType, int HALF, int NEWTON, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF,NEWTON,GHOST,TRI,SIZE>::copy_bin_info()
|
||||
{
|
||||
NPair::copy_bin_info();
|
||||
|
||||
@ -110,8 +109,8 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_bin_info()
|
||||
copy needed info from NStencil class to this build class
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_stencil_info()
|
||||
template<class DeviceType, int HALF, int NEWTON, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF,NEWTON,GHOST,TRI,SIZE>::copy_stencil_info()
|
||||
{
|
||||
NPair::copy_stencil_info();
|
||||
nstencil = ns->nstencil;
|
||||
@ -145,8 +144,8 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::copy_stencil_info()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
|
||||
template<class DeviceType, int HALF, int NEWTON, int GHOST, int TRI, int SIZE>
|
||||
void NPairKokkos<DeviceType,HALF,NEWTON,GHOST,TRI,SIZE>::build(NeighList *list_)
|
||||
{
|
||||
NeighListKokkos<DeviceType>* list = (NeighListKokkos<DeviceType>*) list_;
|
||||
const int nlocal = includegroup?atom->nfirst:atom->nlocal;
|
||||
@ -244,7 +243,7 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
|
||||
#endif
|
||||
|
||||
if (GHOST) {
|
||||
NPairKokkosBuildFunctorGhost<DeviceType,HALF_NEIGH> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
NPairKokkosBuildFunctorGhost<DeviceType,HALF> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
@ -262,82 +261,42 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
} else {
|
||||
if (newton_pair) {
|
||||
if (SIZE) {
|
||||
NPairKokkosBuildFunctorSize<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 6 * sizeof(X_FLOAT) * factor);
|
||||
if (SIZE) {
|
||||
NPairKokkosBuildFunctorSize<DeviceType,TRI?0:HALF,NEWTON,TRI> f(data,atoms_per_bin * 6 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
int team_size_max = Kokkos::TeamPolicy<DeviceType>(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag());
|
||||
if (team_size <= team_size_max) {
|
||||
Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
|
||||
Kokkos::parallel_for(config, f);
|
||||
} else { // fall back to flat method
|
||||
f.sharedsize = 0;
|
||||
Kokkos::parallel_for(nall, f);
|
||||
}
|
||||
} else
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
int team_size_max = Kokkos::TeamPolicy<DeviceType>(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag());
|
||||
if (team_size <= team_size_max) {
|
||||
Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
|
||||
Kokkos::parallel_for(config, f);
|
||||
} else { // fall back to flat method
|
||||
f.sharedsize = 0;
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#else
|
||||
}
|
||||
} else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
} else {
|
||||
NPairKokkosBuildFunctor<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
int team_size_max = Kokkos::TeamPolicy<DeviceType>(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag());
|
||||
if (team_size <= team_size_max) {
|
||||
Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
|
||||
Kokkos::parallel_for(config, f);
|
||||
} else { // fall back to flat method
|
||||
f.sharedsize = 0;
|
||||
Kokkos::parallel_for(nall, f);
|
||||
}
|
||||
} else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (SIZE) {
|
||||
NPairKokkosBuildFunctorSize<DeviceType,HALF_NEIGH,0,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
NPairKokkosBuildFunctor<DeviceType,TRI?0:HALF,NEWTON,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
int team_size_max = Kokkos::TeamPolicy<DeviceType>(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag());
|
||||
if (team_size <= team_size_max) {
|
||||
Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
|
||||
Kokkos::parallel_for(config, f);
|
||||
} else { // fall back to flat method
|
||||
f.sharedsize = 0;
|
||||
Kokkos::parallel_for(nall, f);
|
||||
}
|
||||
} else
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
int team_size_max = Kokkos::TeamPolicy<DeviceType>(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag());
|
||||
if (team_size <= team_size_max) {
|
||||
Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
|
||||
Kokkos::parallel_for(config, f);
|
||||
} else { // fall back to flat method
|
||||
f.sharedsize = 0;
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#else
|
||||
}
|
||||
} else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
} else {
|
||||
NPairKokkosBuildFunctor<DeviceType,HALF_NEIGH,0,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
|
||||
int team_size = atoms_per_bin*factor;
|
||||
int team_size_max = Kokkos::TeamPolicy<DeviceType>(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag());
|
||||
if (team_size <= team_size_max) {
|
||||
Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
|
||||
Kokkos::parallel_for(config, f);
|
||||
} else { // fall back to flat method
|
||||
f.sharedsize = 0;
|
||||
Kokkos::parallel_for(nall, f);
|
||||
}
|
||||
} else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Kokkos::deep_copy(h_scalars, d_scalars);
|
||||
@ -1402,20 +1361,30 @@ void NeighborKokkosExecute<DeviceType>::build_ItemSizeGPU(typename Kokkos::TeamP
|
||||
}
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
template class NPairKokkos<LMPDeviceType,0,0,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,0,1,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,1,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,1,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,0,1>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,1,1>;
|
||||
template class NPairKokkos<LMPDeviceType,0,0,0,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,0,0,1,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,1,0,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,0,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,1,1,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,1,0,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,1,0,1,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,0,1,0>;
|
||||
template class NPairKokkos<LMPDeviceType,1,1,0,0,1>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,0,0,1>;
|
||||
template class NPairKokkos<LMPDeviceType,1,1,0,1,1>;
|
||||
template class NPairKokkos<LMPDeviceType,1,0,0,1,1>;
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
template class NPairKokkos<LMPHostType,0,0,0,0>;
|
||||
template class NPairKokkos<LMPHostType,0,1,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,0,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,1,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,0,1,0>;
|
||||
template class NPairKokkos<LMPHostType,1,0,0,1>;
|
||||
template class NPairKokkos<LMPHostType,1,0,1,1>;
|
||||
template class NPairKokkos<LMPHostType,0,0,0,0,0>;
|
||||
template class NPairKokkos<LMPHostType,0,0,1,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,1,0,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,0,0,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,1,1,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,0,1,0,0>;
|
||||
template class NPairKokkos<LMPHostType,1,1,0,1,0>;
|
||||
template class NPairKokkos<LMPHostType,1,0,0,1,0>;
|
||||
template class NPairKokkos<LMPHostType,1,1,0,0,1>;
|
||||
template class NPairKokkos<LMPHostType,1,0,0,0,1>;
|
||||
template class NPairKokkos<LMPHostType,1,1,0,1,1>;
|
||||
template class NPairKokkos<LMPHostType,1,0,0,1,1>;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -13,75 +13,125 @@
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
typedef NPairKokkos<LMPHostType,0,0,0,0> NPairKokkosFullBinHost;
|
||||
typedef NPairKokkos<LMPHostType,0,0,0,0,0> NPairKokkosFullBinHost;
|
||||
NPairStyle(full/bin/kk/host,
|
||||
NPairKokkosFullBinHost,
|
||||
NP_FULL | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_FULL | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,0,0,0,0> NPairKokkosFullBinDevice;
|
||||
typedef NPairKokkos<LMPDeviceType,0,0,0,0,0> NPairKokkosFullBinDevice;
|
||||
NPairStyle(full/bin/kk/device,
|
||||
NPairKokkosFullBinDevice,
|
||||
NP_FULL | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
NP_BIN | NP_KOKKOS_DEVICE | NP_FULL | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,0,1,0,0> NPairKokkosFullBinGhostHost;
|
||||
typedef NPairKokkos<LMPHostType,0,0,1,0,0> NPairKokkosFullBinGhostHost;
|
||||
NPairStyle(full/bin/ghost/kk/host,
|
||||
NPairKokkosFullBinGhostHost,
|
||||
NP_FULL | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_FULL | NP_NEWTON | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,0,1,0,0> NPairKokkosFullBinGhostDevice;
|
||||
typedef NPairKokkos<LMPDeviceType,0,0,1,0,0> NPairKokkosFullBinGhostDevice;
|
||||
NPairStyle(full/bin/ghost/kk/device,
|
||||
NPairKokkosFullBinGhostDevice,
|
||||
NP_FULL | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
NP_BIN | NP_KOKKOS_DEVICE | NP_FULL | NP_NEWTON | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,0,0,0> NPairKokkosHalfBinHost;
|
||||
NPairStyle(half/bin/kk/host,
|
||||
NPairKokkosHalfBinHost,
|
||||
NP_HALF | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_ORTHO);
|
||||
typedef NPairKokkos<LMPHostType,1,1,0,0,0> NPairKokkosHalfBinNewtonHost;
|
||||
NPairStyle(half/bin/newton/kk/host,
|
||||
NPairKokkosHalfBinNewtonHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTON | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,0,0> NPairKokkosHalfBinDevice;
|
||||
NPairStyle(half/bin/kk/device,
|
||||
NPairKokkosHalfBinDevice,
|
||||
NP_HALF | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_ORTHO);
|
||||
typedef NPairKokkos<LMPHostType,1,0,0,0,0> NPairKokkosHalfBinNewtoffHost;
|
||||
NPairStyle(half/bin/newtoff/kk/host,
|
||||
NPairKokkosHalfBinNewtoffHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTOFF | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,0,1,0> NPairKokkosHalfBinHostTri;
|
||||
NPairStyle(half/bin/kk/host,
|
||||
NPairKokkosHalfBinHostTri,
|
||||
NP_HALF | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_TRI);
|
||||
typedef NPairKokkos<LMPDeviceType,1,1,0,0,0> NPairKokkosHalfBinNewtonDevice;
|
||||
NPairStyle(half/bin/newton/kk/device,
|
||||
NPairKokkosHalfBinNewtonDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTON | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,1,0> NPairKokkosHalfBinDeviceTri;
|
||||
NPairStyle(half/bin/kk/device,
|
||||
NPairKokkosHalfBinDeviceTri,
|
||||
NP_HALF | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_TRI);
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,0,0,0> NPairKokkosHalfBinNewtoffDevice;
|
||||
NPairStyle(half/bin/newtoff/kk/device,
|
||||
NPairKokkosHalfBinNewtoffDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTOFF | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,1,0,0> NPairKokkosHalfBinGhostHost;
|
||||
NPairStyle(half/bin/ghost/kk/host,
|
||||
NPairKokkosHalfBinGhostHost,
|
||||
NP_HALF | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
typedef NPairKokkos<LMPHostType,1,1,0,1,0> NPairKokkosHalfBinNewtonTriHost;
|
||||
NPairStyle(half/bin/newton/kk/host,
|
||||
NPairKokkosHalfBinNewtonTriHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTON | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,1,0,0> NPairKokkosHalfBinGhostDevice;
|
||||
NPairStyle(half/bin/ghost/kk/device,
|
||||
NPairKokkosHalfBinGhostDevice,
|
||||
NP_HALF | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
typedef NPairKokkos<LMPHostType,1,0,0,1,0> NPairKokkosHalfBinNewtoffTriHost;
|
||||
NPairStyle(half/bin/newtoff/kk/host,
|
||||
NPairKokkosHalfBinNewtoffTriHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTOFF | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,0,0,1> NPairKokkosHalfSizeBinHost;
|
||||
NPairStyle(half/size/bin/kk/host,
|
||||
NPairKokkosHalfSizeBinHost,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_ORTHO);
|
||||
typedef NPairKokkos<LMPDeviceType,1,1,0,1,0> NPairKokkosHalfBinNewtonTriDevice;
|
||||
NPairStyle(half/bin/newton/kk/device,
|
||||
NPairKokkosHalfBinNewtonTriDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTON | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,0,1> NPairKokkosHalfSizeBinDevice;
|
||||
NPairStyle(half/size/bin/kk/device,
|
||||
NPairKokkosHalfSizeBinDevice,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_ORTHO);
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,0,1,0> NPairKokkosHalfBinNewtoffTriDevice;
|
||||
NPairStyle(half/bin/newtoff/kk/device,
|
||||
NPairKokkosHalfBinNewtoffTriDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTOFF | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,0,1,1> NPairKokkosHalfSizeBinHostTri;
|
||||
NPairStyle(half/size/bin/kk/host,
|
||||
NPairKokkosHalfSizeBinHostTri,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_KOKKOS_HOST | NP_NEWTON | NP_NEWTOFF | NP_TRI);
|
||||
typedef NPairKokkos<LMPHostType,1,1,1,0,0> NPairKokkosHalfBinNewtonGhostHost;
|
||||
NPairStyle(half/bin/newton/ghost/kk/host,
|
||||
NPairKokkosHalfBinNewtonGhostHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTON | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,1,1> NPairKokkosHalfSizeBinDeviceTri;
|
||||
NPairStyle(half/size/bin/kk/device,
|
||||
NPairKokkosHalfSizeBinDeviceTri,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_KOKKOS_DEVICE | NP_NEWTON | NP_NEWTOFF | NP_TRI);
|
||||
typedef NPairKokkos<LMPHostType,1,0,1,0,0> NPairKokkosHalfBinNewtoffGhostHost;
|
||||
NPairStyle(half/bin/newtoff/ghost/kk/host,
|
||||
NPairKokkosHalfBinNewtoffGhostHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,1,1,0,0> NPairKokkosHalfBinNewtonGhostDevice;
|
||||
NPairStyle(half/bin/newton/ghost/kk/device,
|
||||
NPairKokkosHalfBinNewtonGhostDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTON | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,1,0,0> NPairKokkosHalfBinNewtoffGhostDevice;
|
||||
NPairStyle(half/bin/newtoff/ghost/kk/device,
|
||||
NPairKokkosHalfBinNewtoffGhostDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,1,0,0,1> NPairKokkosHalfBinNewtonSizeHost;
|
||||
NPairStyle(half/bin/newton/size/kk/host,
|
||||
NPairKokkosHalfBinNewtonSizeHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTON | NP_SIZE | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,0,0,0,1> NPairKokkosHalfBinNewtoffSizeHost;
|
||||
NPairStyle(half/bin/newtoff/size/kk/host,
|
||||
NPairKokkosHalfBinNewtoffSizeHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTOFF | NP_SIZE | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,1,0,0,1> NPairKokkosHalfBinNewtonSizeDevice;
|
||||
NPairStyle(half/bin/newton/size/kk/device,
|
||||
NPairKokkosHalfBinNewtonSizeDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTON | NP_SIZE | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,0,0,1> NPairKokkosHalfBinNewtoffSizeDevice;
|
||||
NPairStyle(half/bin/newtoff/size/kk/device,
|
||||
NPairKokkosHalfBinNewtoffSizeDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTOFF | NP_SIZE | NP_ORTHO);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,1,0,1,1> NPairKokkosHalfBinNewtonSizeTriHost;
|
||||
NPairStyle(half/bin/newton/size/kk/host,
|
||||
NPairKokkosHalfBinNewtonSizeTriHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTON | NP_SIZE | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPHostType,1,0,0,1,1> NPairKokkosHalfBinNewtoffSizeTriHost;
|
||||
NPairStyle(half/bin/newtoff/size/kk/host,
|
||||
NPairKokkosHalfBinNewtoffSizeTriHost,
|
||||
NP_BIN | NP_KOKKOS_HOST | NP_HALF | NP_NEWTOFF | NP_SIZE | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,1,0,1,1> NPairKokkosHalfBinNewtonSizeTriDevice;
|
||||
NPairStyle(half/bin/newton/size/kk/device,
|
||||
NPairKokkosHalfBinNewtonSizeTriDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTON | NP_SIZE | NP_TRI);
|
||||
|
||||
typedef NPairKokkos<LMPDeviceType,1,0,0,1,1> NPairKokkosHalfBinNewtoffSizeTriDevice;
|
||||
NPairStyle(half/bin/newtoff/size/kk/device,
|
||||
NPairKokkosHalfBinNewtoffSizeTriDevice,
|
||||
NP_KOKKOS_DEVICE | NP_HALF | NP_BIN | NP_NEWTOFF | NP_SIZE | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
@ -94,7 +144,7 @@ NPairStyle(half/size/bin/kk/device,
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST, int TRI, int SIZE>
|
||||
template<class DeviceType, int HALF_NEIGH, int NEWTON, int GHOST, int TRI, int SIZE>
|
||||
class NPairKokkos : public NPair {
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
|
||||
@ -379,7 +429,7 @@ class NeighborKokkosExecute
|
||||
|
||||
};
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST_NEWTON, int TRI>
|
||||
template<class DeviceType, int HALF_NEIGH, int NEWTON, int TRI>
|
||||
struct NPairKokkosBuildFunctor {
|
||||
typedef DeviceType device_type;
|
||||
|
||||
@ -392,19 +442,19 @@ struct NPairKokkosBuildFunctor {
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int & i) const {
|
||||
c.template build_Item<HALF_NEIGH,GHOST_NEWTON,TRI>(i);
|
||||
c.template build_Item<HALF_NEIGH,NEWTON,TRI>(i);
|
||||
}
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
LAMMPS_DEVICE_FUNCTION inline
|
||||
void operator() (typename Kokkos::TeamPolicy<DeviceType>::member_type dev) const {
|
||||
c.template build_ItemGPU<HALF_NEIGH,GHOST_NEWTON,TRI>(dev, sharedsize);
|
||||
c.template build_ItemGPU<HALF_NEIGH,NEWTON,TRI>(dev, sharedsize);
|
||||
}
|
||||
size_t team_shmem_size(const int team_size) const { (void) team_size; return sharedsize; }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<int HALF_NEIGH, int GHOST_NEWTON, int TRI>
|
||||
struct NPairKokkosBuildFunctor<LMPHostType,HALF_NEIGH,GHOST_NEWTON,TRI> {
|
||||
template<int HALF_NEIGH, int NEWTON, int TRI>
|
||||
struct NPairKokkosBuildFunctor<LMPHostType,HALF_NEIGH,NEWTON,TRI> {
|
||||
typedef LMPHostType device_type;
|
||||
|
||||
const NeighborKokkosExecute<LMPHostType> c;
|
||||
@ -416,7 +466,7 @@ struct NPairKokkosBuildFunctor<LMPHostType,HALF_NEIGH,GHOST_NEWTON,TRI> {
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int & i) const {
|
||||
c.template build_Item<HALF_NEIGH,GHOST_NEWTON,TRI>(i);
|
||||
c.template build_Item<HALF_NEIGH,NEWTON,TRI>(i);
|
||||
}
|
||||
|
||||
void operator() (typename Kokkos::TeamPolicy<LMPHostType>::member_type /*dev*/) const {} // Should error out
|
||||
@ -466,7 +516,7 @@ struct NPairKokkosBuildFunctorGhost<LMPHostType,HALF_NEIGH> {
|
||||
void operator() (typename Kokkos::TeamPolicy<LMPHostType>::member_type /*dev*/) const {} // Should error out
|
||||
};
|
||||
|
||||
template <class DeviceType, int HALF_NEIGH, int GHOST_NEWTON, int TRI>
|
||||
template <class DeviceType, int HALF_NEIGH, int NEWTON, int TRI>
|
||||
struct NPairKokkosBuildFunctorSize {
|
||||
typedef DeviceType device_type;
|
||||
|
||||
@ -478,20 +528,20 @@ struct NPairKokkosBuildFunctorSize {
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int & i) const {
|
||||
c.template build_ItemSize<HALF_NEIGH,GHOST_NEWTON,TRI>(i);
|
||||
c.template build_ItemSize<HALF_NEIGH,NEWTON,TRI>(i);
|
||||
}
|
||||
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
LAMMPS_DEVICE_FUNCTION inline
|
||||
void operator() (typename Kokkos::TeamPolicy<DeviceType>::member_type dev) const {
|
||||
c.template build_ItemSizeGPU<HALF_NEIGH,GHOST_NEWTON,TRI>(dev, sharedsize);
|
||||
c.template build_ItemSizeGPU<HALF_NEIGH,NEWTON,TRI>(dev, sharedsize);
|
||||
}
|
||||
size_t team_shmem_size(const int team_size) const { (void) team_size; return sharedsize; }
|
||||
#endif
|
||||
};
|
||||
|
||||
template <int HALF_NEIGH, int GHOST_NEWTON, int TRI>
|
||||
struct NPairKokkosBuildFunctorSize<LMPHostType,HALF_NEIGH,GHOST_NEWTON,TRI> {
|
||||
template <int HALF_NEIGH, int NEWTON, int TRI>
|
||||
struct NPairKokkosBuildFunctorSize<LMPHostType,HALF_NEIGH,NEWTON,TRI> {
|
||||
typedef LMPHostType device_type;
|
||||
|
||||
const NeighborKokkosExecute<LMPHostType> c;
|
||||
@ -502,7 +552,7 @@ struct NPairKokkosBuildFunctorSize<LMPHostType,HALF_NEIGH,GHOST_NEWTON,TRI> {
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int & i) const {
|
||||
c.template build_ItemSize<HALF_NEIGH,GHOST_NEWTON,TRI>(i);
|
||||
c.template build_ItemSize<HALF_NEIGH,NEWTON,TRI>(i);
|
||||
}
|
||||
|
||||
void operator() (typename Kokkos::TeamPolicy<LMPHostType>::member_type /*dev*/) const {} // Should error out
|
||||
|
||||
@ -130,6 +130,7 @@ void PairLJCutKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
|
||||
if (vflag_fdotr) pair_virial_fdotr_compute(this);
|
||||
|
||||
copymode = 0;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
|
||||
@ -95,6 +95,8 @@ PairReaxFFKokkos<DeviceType>::~PairReaxFFKokkos()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
DeAllocate_System(api->system);
|
||||
|
||||
memoryKK->destroy_kokkos(k_eatom,eatom);
|
||||
memoryKK->destroy_kokkos(k_vatom,vatom);
|
||||
|
||||
@ -184,6 +186,8 @@ void PairReaxFFKokkos<DeviceType>::init_style()
|
||||
if (neighflag == FULL)
|
||||
error->all(FLERR,"Must use half neighbor list with pair style reaxff/kk");
|
||||
|
||||
need_dup = lmp->kokkos->need_dup<DeviceType>();
|
||||
|
||||
allocate();
|
||||
setup();
|
||||
init_md();
|
||||
@ -577,17 +581,17 @@ void PairReaxFFKokkos<DeviceType>::Deallocate_Lookup_Tables()
|
||||
for (j = i; j <= ntypes; ++j) {
|
||||
if (map[i] == -1) continue;
|
||||
if (LR[i][j].n) {
|
||||
sfree(api->control->error_ptr, LR[i][j].y, "LR[i,j].y");
|
||||
sfree(api->control->error_ptr, LR[i][j].H, "LR[i,j].H");
|
||||
sfree(api->control->error_ptr, LR[i][j].vdW, "LR[i,j].vdW");
|
||||
sfree(api->control->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd");
|
||||
sfree(api->control->error_ptr, LR[i][j].ele, "LR[i,j].ele");
|
||||
sfree(api->control->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb");
|
||||
sfree(LR[i][j].y);
|
||||
sfree(LR[i][j].H);
|
||||
sfree(LR[i][j].vdW);
|
||||
sfree(LR[i][j].CEvd);
|
||||
sfree(LR[i][j].ele);
|
||||
sfree(LR[i][j].CEclmb);
|
||||
}
|
||||
}
|
||||
sfree(api->control->error_ptr, LR[i], "LR[i]");
|
||||
sfree(LR[i]);
|
||||
}
|
||||
sfree(api->control->error_ptr, LR, "LR");
|
||||
sfree(LR);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -738,8 +742,6 @@ void PairReaxFFKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
}
|
||||
}
|
||||
|
||||
need_dup = lmp->kokkos->need_dup<DeviceType>();
|
||||
|
||||
// allocate duplicated memory
|
||||
if (need_dup) {
|
||||
dup_f = Kokkos::Experimental::create_scatter_view<Kokkos::Experimental::ScatterSum, Kokkos::Experimental::ScatterDuplicated>(f);
|
||||
|
||||
@ -47,7 +47,6 @@ PairSWKokkos<DeviceType>::PairSWKokkos(LAMMPS *lmp) : PairSW(lmp)
|
||||
{
|
||||
respa_enable = 0;
|
||||
|
||||
|
||||
kokkosable = 1;
|
||||
atomKK = (AtomKokkos *) atom;
|
||||
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||
@ -138,6 +137,7 @@ void PairSWKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
}
|
||||
if ((int)d_numneigh_short.extent(0) < ignum)
|
||||
d_numneigh_short = Kokkos::View<int*,DeviceType>("SW::numneighs_short",ignum*1.2);
|
||||
|
||||
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType,TagPairSWComputeShortNeigh>(0,inum), *this);
|
||||
|
||||
// loop over neighbor list of my atoms
|
||||
|
||||
@ -117,24 +117,23 @@ void PairVashishtaKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
EV_FLOAT ev;
|
||||
EV_FLOAT ev_all;
|
||||
|
||||
// build short neighbor list
|
||||
|
||||
int max_neighs = d_neighbors.extent(1);
|
||||
|
||||
if (((int)d_neighbors_short_2body.extent(1) != max_neighs) ||
|
||||
((int)d_neighbors_short_2body.extent(0) != ignum)) {
|
||||
d_neighbors_short_2body = Kokkos::View<int**,DeviceType>("Vashishta::neighbors_short_2body",ignum,max_neighs);
|
||||
}
|
||||
if ((int)d_numneigh_short_2body.extent(0)!=ignum) {
|
||||
d_numneigh_short_2body = Kokkos::View<int*,DeviceType>("Vashishta::numneighs_short_2body",ignum);
|
||||
if (((int)d_neighbors_short_2body.extent(1) < max_neighs) ||
|
||||
((int)d_neighbors_short_2body.extent(0) < ignum)) {
|
||||
d_neighbors_short_2body = Kokkos::View<int**,DeviceType>("Vashishta::neighbors_short_2body",ignum*1.2,max_neighs);
|
||||
}
|
||||
if ((int)d_numneigh_short_2body.extent(0) < ignum)
|
||||
d_numneigh_short_2body = Kokkos::View<int*,DeviceType>("Vashishta::numneighs_short_2body",ignum*1.2);
|
||||
|
||||
if (((int)d_neighbors_short_3body.extent(1) != max_neighs) ||
|
||||
((int)d_neighbors_short_3body.extent(0) != ignum)) {
|
||||
d_neighbors_short_3body = Kokkos::View<int**,DeviceType>("Vashishta::neighbors_short_3body",ignum,max_neighs);
|
||||
}
|
||||
|
||||
if ((int)d_numneigh_short_3body.extent(0)!=ignum) {
|
||||
d_numneigh_short_3body = Kokkos::View<int*,DeviceType>("Vashishta::numneighs_short_3body",ignum);
|
||||
if (((int)d_neighbors_short_3body.extent(1) < max_neighs) ||
|
||||
((int)d_neighbors_short_3body.extent(0) < ignum)) {
|
||||
d_neighbors_short_3body = Kokkos::View<int**,DeviceType>("Vashishta::neighbors_short_3body",ignum*1.2,max_neighs);
|
||||
}
|
||||
if ((int)d_numneigh_short_3body.extent(0) < ignum)
|
||||
d_numneigh_short_3body = Kokkos::View<int*,DeviceType>("Vashishta::numneighs_short_3body",ignum*1.2);
|
||||
|
||||
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType,TagPairVashishtaComputeShortNeigh>(0,neighflag==FULL?ignum:inum), *this);
|
||||
|
||||
@ -217,17 +216,17 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeShortNei
|
||||
const F_FLOAT rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
if (rsq < d_params[ijparam].cutsq) {
|
||||
d_neighbors_short_2body(i,inside_2body) = j;
|
||||
d_neighbors_short_2body(ii,inside_2body) = j;
|
||||
inside_2body++;
|
||||
}
|
||||
|
||||
if (rsq < d_params[ijparam].cutsq2) {
|
||||
d_neighbors_short_3body(i,inside_3body) = j;
|
||||
d_neighbors_short_3body(ii,inside_3body) = j;
|
||||
inside_3body++;
|
||||
}
|
||||
}
|
||||
d_numneigh_short_2body(i) = inside_2body;
|
||||
d_numneigh_short_3body(i) = inside_3body;
|
||||
d_numneigh_short_2body(ii) = inside_2body;
|
||||
d_numneigh_short_3body(ii) = inside_3body;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
@ -252,14 +251,14 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeHalf<NEI
|
||||
|
||||
// two-body interactions, skip half of them
|
||||
|
||||
const int jnum = d_numneigh_short_2body[i];
|
||||
const int jnum = d_numneigh_short_2body[ii];
|
||||
|
||||
F_FLOAT fxtmpi = 0.0;
|
||||
F_FLOAT fytmpi = 0.0;
|
||||
F_FLOAT fztmpi = 0.0;
|
||||
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = d_neighbors_short_2body(i,jj);
|
||||
int j = d_neighbors_short_2body(ii,jj);
|
||||
j &= NEIGHMASK;
|
||||
const tagint jtag = tag[j];
|
||||
|
||||
@ -297,10 +296,10 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeHalf<NEI
|
||||
}
|
||||
}
|
||||
|
||||
const int jnumm1 = d_numneigh_short_3body[i];
|
||||
const int jnumm1 = d_numneigh_short_3body[ii];
|
||||
|
||||
for (int jj = 0; jj < jnumm1-1; jj++) {
|
||||
int j = d_neighbors_short_3body(i,jj);
|
||||
int j = d_neighbors_short_3body(ii,jj);
|
||||
j &= NEIGHMASK;
|
||||
const int jtype = d_map[type[j]];
|
||||
const int ijparam = d_elem3param(itype,jtype,jtype);
|
||||
@ -314,7 +313,7 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeHalf<NEI
|
||||
F_FLOAT fztmpj = 0.0;
|
||||
|
||||
for (int kk = jj+1; kk < jnumm1; kk++) {
|
||||
int k = d_neighbors_short_3body(i,kk);
|
||||
int k = d_neighbors_short_3body(ii,kk);
|
||||
k &= NEIGHMASK;
|
||||
const int ktype = d_map[type[k]];
|
||||
const int ikparam = d_elem3param(itype,ktype,ktype);
|
||||
@ -382,14 +381,14 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeFullA<NE
|
||||
|
||||
// two-body interactions
|
||||
|
||||
const int jnum = d_numneigh_short_2body[i];
|
||||
const int jnum = d_numneigh_short_2body[ii];
|
||||
|
||||
F_FLOAT fxtmpi = 0.0;
|
||||
F_FLOAT fytmpi = 0.0;
|
||||
F_FLOAT fztmpi = 0.0;
|
||||
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = d_neighbors_short_2body(i,jj);
|
||||
int j = d_neighbors_short_2body(ii,jj);
|
||||
j &= NEIGHMASK;
|
||||
|
||||
const int jtype = d_map[type[j]];
|
||||
@ -413,10 +412,10 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeFullA<NE
|
||||
}
|
||||
}
|
||||
|
||||
const int jnumm1 = d_numneigh_short_3body[i];
|
||||
const int jnumm1 = d_numneigh_short_3body[ii];
|
||||
|
||||
for (int jj = 0; jj < jnumm1-1; jj++) {
|
||||
int j = d_neighbors_short_3body(i,jj);
|
||||
int j = d_neighbors_short_3body(ii,jj);
|
||||
j &= NEIGHMASK;
|
||||
const int jtype = d_map[type[j]];
|
||||
const int ijparam = d_elem3param(itype,jtype,jtype);
|
||||
@ -426,7 +425,7 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeFullA<NE
|
||||
const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2];
|
||||
|
||||
for (int kk = jj+1; kk < jnumm1; kk++) {
|
||||
int k = d_neighbors_short_3body(i,kk);
|
||||
int k = d_neighbors_short_3body(ii,kk);
|
||||
k &= NEIGHMASK;
|
||||
const int ktype = d_map[type[k]];
|
||||
const int ikparam = d_elem3param(itype,ktype,ktype);
|
||||
@ -481,14 +480,14 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeFullB<NE
|
||||
const X_FLOAT ytmpi = x(i,1);
|
||||
const X_FLOAT ztmpi = x(i,2);
|
||||
|
||||
const int jnum = d_numneigh_short_3body[i];
|
||||
const int jnum = d_numneigh_short_3body[ii];
|
||||
|
||||
F_FLOAT fxtmpi = 0.0;
|
||||
F_FLOAT fytmpi = 0.0;
|
||||
F_FLOAT fztmpi = 0.0;
|
||||
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = d_neighbors_short_3body(i,jj);
|
||||
int j = d_neighbors_short_3body(ii,jj);
|
||||
j &= NEIGHMASK;
|
||||
if (j >= nlocal) continue;
|
||||
const int jtype = d_map[type[j]];
|
||||
@ -502,10 +501,10 @@ void PairVashishtaKokkos<DeviceType>::operator()(TagPairVashishtaComputeFullB<NE
|
||||
delr1[2] = ztmpi - ztmpj;
|
||||
const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2];
|
||||
|
||||
const int j_jnum = d_numneigh_short_3body[j];
|
||||
const int j_jnum = d_numneigh_short_3body[jj];
|
||||
|
||||
for (int kk = 0; kk < j_jnum; kk++) {
|
||||
int k = d_neighbors_short_3body(j,kk);
|
||||
int k = d_neighbors_short_3body(jj,kk);
|
||||
k &= NEIGHMASK;
|
||||
if (k == i) continue;
|
||||
const int ktype = d_map[type[k]];
|
||||
|
||||
@ -93,7 +93,7 @@ PairReaxFFOMP::~PairReaxFFOMP()
|
||||
if (setup_flag) {
|
||||
reax_list * bonds = api->lists+BONDS;
|
||||
for (int i=0; i<bonds->num_intrs; ++i)
|
||||
sfree(error, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction");
|
||||
sfree(bonds->select.bond_list[i].bo_data.CdboReduction);
|
||||
}
|
||||
memory->destroy(num_nbrs_offset);
|
||||
}
|
||||
|
||||
@ -99,6 +99,7 @@ namespace ReaxFF {
|
||||
/* set the pointers */
|
||||
type_i = system->my_atoms[i].type;
|
||||
type_j = system->my_atoms[j].type;
|
||||
if ((type_i < 0) || (type_j < 0)) continue;
|
||||
sbp_i = &(system->reax_param.sbp[type_i]);
|
||||
sbp_j = &(system->reax_param.sbp[type_j]);
|
||||
twbp = &(system->reax_param.tbp[type_i][type_j]);
|
||||
|
||||
@ -265,6 +265,7 @@ namespace ReaxFF {
|
||||
for (int i = 0; i < system->N; ++i) {
|
||||
atom_i = &(system->my_atoms[i]);
|
||||
type_i = atom_i->type;
|
||||
if (type_i < 0) continue;
|
||||
sbp_i = &(system->reax_param.sbp[type_i]);
|
||||
|
||||
start_i = Start_Index(i, far_nbrs);
|
||||
@ -276,6 +277,7 @@ namespace ReaxFF {
|
||||
int j = nbr_pj->nbr;
|
||||
atom_j = &(system->my_atoms[j]);
|
||||
type_j = atom_j->type;
|
||||
if (type_j < 0) continue;
|
||||
sbp_j = &(system->reax_param.sbp[type_j]);
|
||||
twbp = &(system->reax_param.tbp[type_i][type_j]);
|
||||
|
||||
@ -376,6 +378,7 @@ namespace ReaxFF {
|
||||
for (int i = 0; i < system->n; ++i) {
|
||||
atom_i = &(system->my_atoms[i]);
|
||||
type_i = atom_i->type;
|
||||
if (type_i < 0) continue;
|
||||
sbp_i = &(system->reax_param.sbp[type_i]);
|
||||
ihb = sbp_i->p_hbond;
|
||||
|
||||
|
||||
@ -98,14 +98,14 @@ namespace ReaxFF {
|
||||
// for (j = 0; j < system->n; ++j)
|
||||
for (j = ifrom; j < ito; ++j) {
|
||||
/* j has to be of type H */
|
||||
if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) {
|
||||
type_j = system->my_atoms[j].type;
|
||||
if (type_j < 0) continue;
|
||||
if (system->reax_param.sbp[type_j].p_hbond == 1) {
|
||||
/*set j's variables */
|
||||
type_j = system->my_atoms[j].type;
|
||||
start_j = Start_Index(j, bonds);
|
||||
end_j = End_Index(j, bonds);
|
||||
hb_start_j = Start_Index(system->my_atoms[j].Hindex, hbonds);
|
||||
hb_end_j = End_Index(system->my_atoms[j].Hindex, hbonds);
|
||||
if (type_j < 0) continue;
|
||||
|
||||
top = 0;
|
||||
for (pi = start_j; pi < end_j; ++pi) {
|
||||
|
||||
@ -110,9 +110,7 @@ PairReaxFF::PairReaxFF(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
setup_flag = 0;
|
||||
fixspecies_flag = 0;
|
||||
|
||||
nmax = 0;
|
||||
|
||||
list_blocking_flag = 0;
|
||||
}
|
||||
|
||||
@ -130,13 +128,13 @@ PairReaxFF::~PairReaxFF()
|
||||
// deallocate reax data-structures
|
||||
|
||||
if (api->control->tabulate) Deallocate_Lookup_Tables(api->system);
|
||||
|
||||
if (api->control->hbond_cut > 0) Delete_List(api->lists+HBONDS);
|
||||
|
||||
Delete_List(api->lists+BONDS);
|
||||
Delete_List(api->lists+THREE_BODIES);
|
||||
Delete_List(api->lists+FAR_NBRS);
|
||||
|
||||
DeAllocate_Workspace(api->control, api->workspace);
|
||||
DeAllocate_Workspace(api->workspace);
|
||||
DeAllocate_System(api->system);
|
||||
}
|
||||
|
||||
@ -153,17 +151,16 @@ PairReaxFF::~PairReaxFF()
|
||||
memory->destroy(cutsq);
|
||||
memory->destroy(cutghost);
|
||||
|
||||
delete [] chi;
|
||||
delete [] eta;
|
||||
delete [] gamma;
|
||||
delete [] bcut_acks2;
|
||||
delete[] chi;
|
||||
delete[] eta;
|
||||
delete[] gamma;
|
||||
delete[] bcut_acks2;
|
||||
}
|
||||
|
||||
memory->destroy(tmpid);
|
||||
memory->destroy(tmpbo);
|
||||
|
||||
delete [] pvector;
|
||||
|
||||
delete[] pvector;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -282,11 +279,6 @@ void PairReaxFF::coeff(int nargs, char **args)
|
||||
if (nargs != 3 + atom->ntypes)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
|
||||
// ensure I,J args are * *
|
||||
|
||||
if (strcmp(args[0],"*") != 0 || strcmp(args[1],"*") != 0)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
|
||||
// read ffield file
|
||||
|
||||
Read_Force_Field(args[2], &(api->system->reax_param), api->control, world);
|
||||
@ -536,7 +528,6 @@ void PairReaxFF::compute(int eflag, int vflag)
|
||||
}
|
||||
FindBond();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -654,7 +645,7 @@ int PairReaxFF::write_reax_lists()
|
||||
jlist = firstneigh[i];
|
||||
Set_Start_Index(i, num_nbrs, far_nbrs);
|
||||
|
||||
if (i < inum)
|
||||
if (itr_i < inum)
|
||||
cutoff_sqr = SQR(api->control->nonb_cut);
|
||||
else
|
||||
cutoff_sqr = SQR(api->control->bond_cut);
|
||||
|
||||
@ -62,11 +62,10 @@ namespace ReaxFF {
|
||||
|
||||
void DeAllocate_System(reax_system *system)
|
||||
{
|
||||
auto error = system->error_ptr;
|
||||
auto memory = system->mem_ptr;
|
||||
|
||||
// deallocate the atom list
|
||||
sfree(error, system->my_atoms, "system->my_atoms");
|
||||
sfree(system->my_atoms);
|
||||
|
||||
// deallocate the ffield parameters storage
|
||||
memory->destroy(system->reax_param.gp.l);
|
||||
@ -78,45 +77,44 @@ namespace ReaxFF {
|
||||
}
|
||||
|
||||
/************* workspace *************/
|
||||
void DeAllocate_Workspace(control_params *control, storage *workspace)
|
||||
void DeAllocate_Workspace(storage *workspace)
|
||||
{
|
||||
if (!workspace->allocated)
|
||||
return;
|
||||
|
||||
workspace->allocated = 0;
|
||||
auto error = control->error_ptr;
|
||||
|
||||
/* bond order storage */
|
||||
sfree(error, workspace->total_bond_order, "total_bo");
|
||||
sfree(error, workspace->Deltap, "Deltap");
|
||||
sfree(error, workspace->Deltap_boc, "Deltap_boc");
|
||||
sfree(error, workspace->dDeltap_self, "dDeltap_self");
|
||||
sfree(error, workspace->Delta, "Delta");
|
||||
sfree(error, workspace->Delta_lp, "Delta_lp");
|
||||
sfree(error, workspace->Delta_lp_temp, "Delta_lp_temp");
|
||||
sfree(error, workspace->dDelta_lp, "dDelta_lp");
|
||||
sfree(error, workspace->dDelta_lp_temp, "dDelta_lp_temp");
|
||||
sfree(error, workspace->Delta_e, "Delta_e");
|
||||
sfree(error, workspace->Delta_boc, "Delta_boc");
|
||||
sfree(error, workspace->Delta_val, "Delta_val");
|
||||
sfree(error, workspace->nlp, "nlp");
|
||||
sfree(error, workspace->nlp_temp, "nlp_temp");
|
||||
sfree(error, workspace->Clp, "Clp");
|
||||
sfree(error, workspace->vlpex, "vlpex");
|
||||
sfree(error, workspace->bond_mark, "bond_mark");
|
||||
sfree(workspace->total_bond_order);
|
||||
sfree(workspace->Deltap);
|
||||
sfree(workspace->Deltap_boc);
|
||||
sfree(workspace->dDeltap_self);
|
||||
sfree(workspace->Delta);
|
||||
sfree(workspace->Delta_lp);
|
||||
sfree(workspace->Delta_lp_temp);
|
||||
sfree(workspace->dDelta_lp);
|
||||
sfree(workspace->dDelta_lp_temp);
|
||||
sfree(workspace->Delta_e);
|
||||
sfree(workspace->Delta_boc);
|
||||
sfree(workspace->Delta_val);
|
||||
sfree(workspace->nlp);
|
||||
sfree(workspace->nlp_temp);
|
||||
sfree(workspace->Clp);
|
||||
sfree(workspace->vlpex);
|
||||
sfree(workspace->bond_mark);
|
||||
|
||||
/* force related storage */
|
||||
sfree(error, workspace->f, "f");
|
||||
sfree(error, workspace->CdDelta, "CdDelta");
|
||||
sfree(workspace->f);
|
||||
sfree(workspace->CdDelta);
|
||||
|
||||
/* reductions */
|
||||
|
||||
if (workspace->CdDeltaReduction)
|
||||
sfree(error, workspace->CdDeltaReduction, "cddelta_reduce");
|
||||
sfree(workspace->CdDeltaReduction);
|
||||
if (workspace->forceReduction)
|
||||
sfree(error, workspace->forceReduction, "f_reduce");
|
||||
sfree(workspace->forceReduction);
|
||||
if (workspace->valence_angle_atom_myoffset)
|
||||
sfree(error, workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset");
|
||||
sfree(workspace->valence_angle_atom_myoffset);
|
||||
}
|
||||
|
||||
void Allocate_Workspace(control_params *control, storage *workspace, int total_cap)
|
||||
@ -206,7 +204,7 @@ namespace ReaxFF {
|
||||
|
||||
if (system->omp_active)
|
||||
for (i = 0; i < bonds->num_intrs; ++i)
|
||||
sfree(system->error_ptr, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction");
|
||||
sfree(bonds->select.bond_list[i].bo_data.CdboReduction);
|
||||
|
||||
Delete_List(bonds);
|
||||
Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds);
|
||||
@ -245,7 +243,7 @@ namespace ReaxFF {
|
||||
system->my_atoms = (reax_atom *)::realloc(system->my_atoms,
|
||||
system->total_cap*sizeof(reax_atom));
|
||||
/* workspace */
|
||||
DeAllocate_Workspace(control, workspace);
|
||||
DeAllocate_Workspace(workspace);
|
||||
Allocate_Workspace(control, workspace, system->total_cap);
|
||||
}
|
||||
|
||||
@ -292,8 +290,7 @@ namespace ReaxFF {
|
||||
reax_list *bonds = (*lists)+BONDS;
|
||||
|
||||
for (int i = 0; i < bonds->num_intrs; ++i) {
|
||||
sfree(error, bonds->select.bond_list[i].bo_data.CdboReduction,
|
||||
"CdboReduction");
|
||||
sfree(bonds->select.bond_list[i].bo_data.CdboReduction);
|
||||
|
||||
bonds->select.bond_list[i].bo_data.CdboReduction =
|
||||
(double*) smalloc(error, sizeof(double)*nthreads, "CdboReduction");
|
||||
|
||||
@ -41,7 +41,7 @@ struct API {
|
||||
|
||||
extern void Allocate_Workspace(control_params *, storage *, int);
|
||||
extern void DeAllocate_System(reax_system *);
|
||||
extern void DeAllocate_Workspace(control_params *, storage *);
|
||||
extern void DeAllocate_Workspace(storage *);
|
||||
extern void PreAllocate_Space(reax_system *, storage *);
|
||||
extern void ReAllocate(reax_system *, control_params *, simulation_data *, storage *, reax_list **);
|
||||
|
||||
@ -142,7 +142,7 @@ extern void Reset_Workspace(reax_system *, storage *);
|
||||
|
||||
extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const std::string &);
|
||||
extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const std::string &);
|
||||
extern void sfree(LAMMPS_NS::Error *, void *, const std::string &);
|
||||
extern void sfree(void *);
|
||||
|
||||
// torsion angles
|
||||
|
||||
|
||||
@ -75,6 +75,7 @@ namespace ReaxFF {
|
||||
/* set the pointers */
|
||||
type_i = system->my_atoms[i].type;
|
||||
type_j = system->my_atoms[j].type;
|
||||
if ((type_i < 0) || (type_j < 0)) continue;
|
||||
sbp_i = &(system->reax_param.sbp[type_i]);
|
||||
sbp_j = &(system->reax_param.sbp[type_j]);
|
||||
twbp = &(system->reax_param.tbp[type_i][type_j]);
|
||||
|
||||
@ -59,14 +59,14 @@ namespace ReaxFF {
|
||||
hbonds = (*lists) + HBONDS;
|
||||
hbond_list = hbonds->select.hbond_list;
|
||||
|
||||
for (j = 0; j < system->n; ++j)
|
||||
if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) {
|
||||
type_j = system->my_atoms[j].type;
|
||||
for (j = 0; j < system->n; ++j) {
|
||||
type_j = system->my_atoms[j].type;
|
||||
if (type_j < 0) continue;
|
||||
if (system->reax_param.sbp[type_j].p_hbond == 1) {
|
||||
start_j = Start_Index(j, bonds);
|
||||
end_j = End_Index(j, bonds);
|
||||
hb_start_j = Start_Index(system->my_atoms[j].Hindex, hbonds);
|
||||
hb_end_j = End_Index(system->my_atoms[j].Hindex, hbonds);
|
||||
if (type_j < 0) continue;
|
||||
|
||||
top = 0;
|
||||
for (pi = start_j; pi < end_j; ++pi) {
|
||||
@ -154,5 +154,6 @@ namespace ReaxFF {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,8 @@ namespace ReaxFF {
|
||||
if (control->hbond_cut > 0)
|
||||
for (i = 0; i < system->n; ++i) {
|
||||
atom = &(system->my_atoms[i]);
|
||||
if (system->reax_param.sbp[atom->type].p_hbond == 1 && atom->type >= 0)
|
||||
if ((atom->type >= 0)
|
||||
&& (system->reax_param.sbp[atom->type].p_hbond == 1 && atom->type >= 0))
|
||||
atom->Hindex = system->numH++;
|
||||
else atom->Hindex = -1;
|
||||
}
|
||||
|
||||
@ -39,8 +39,8 @@ namespace ReaxFF {
|
||||
l->n = n;
|
||||
l->num_intrs = num_intrs;
|
||||
|
||||
if (l->index) sfree(l->error_ptr, l->index, "list:index");
|
||||
if (l->end_index) sfree(l->error_ptr, l->end_index, "list:end_index");
|
||||
if (l->index) sfree(l->index);
|
||||
if (l->end_index) sfree(l->end_index);
|
||||
l->index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:index");
|
||||
l->end_index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:end_index");
|
||||
|
||||
@ -48,26 +48,26 @@ namespace ReaxFF {
|
||||
|
||||
switch(l->type) {
|
||||
case TYP_THREE_BODY:
|
||||
if (l->select.three_body_list) sfree(l->error_ptr, l->select.three_body_list,"list:three_bodies");
|
||||
if (l->select.three_body_list) sfree(l->select.three_body_list);
|
||||
l->select.three_body_list = (three_body_interaction_data*)
|
||||
smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(three_body_interaction_data),
|
||||
"list:three_bodies");
|
||||
break;
|
||||
|
||||
case TYP_BOND:
|
||||
if (l->select.bond_list) sfree(l->error_ptr, l->select.bond_list,"list:bonds");
|
||||
if (l->select.bond_list) sfree(l->select.bond_list);
|
||||
l->select.bond_list = (bond_data*)
|
||||
smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(bond_data), "list:bonds");
|
||||
break;
|
||||
|
||||
case TYP_FAR_NEIGHBOR:
|
||||
if (l->select.far_nbr_list) sfree(l->error_ptr, l->select.far_nbr_list,"list:far_nbrs");
|
||||
if (l->select.far_nbr_list) sfree(l->select.far_nbr_list);
|
||||
l->select.far_nbr_list = (far_neighbor_data*)
|
||||
smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(far_neighbor_data), "list:far_nbrs");
|
||||
break;
|
||||
|
||||
case TYP_HBOND:
|
||||
if (l->select.hbond_list) sfree(l->error_ptr, l->select.hbond_list,"list:hbonds");
|
||||
if (l->select.hbond_list) sfree(l->select.hbond_list);
|
||||
l->select.hbond_list = (hbond_data*)
|
||||
smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(hbond_data), "list:hbonds");
|
||||
break;
|
||||
@ -83,26 +83,26 @@ namespace ReaxFF {
|
||||
return;
|
||||
l->allocated = 0;
|
||||
|
||||
sfree(l->error_ptr, l->index, "list:index");
|
||||
sfree(l->error_ptr, l->end_index, "list:end_index");
|
||||
sfree(l->index);
|
||||
sfree(l->end_index);
|
||||
l->index = nullptr;
|
||||
l->end_index = nullptr;
|
||||
|
||||
switch(l->type) {
|
||||
case TYP_HBOND:
|
||||
sfree(l->error_ptr, l->select.hbond_list, "list:hbonds");
|
||||
sfree(l->select.hbond_list);
|
||||
l->select.hbond_list = nullptr;
|
||||
break;
|
||||
case TYP_FAR_NEIGHBOR:
|
||||
sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs");
|
||||
sfree(l->select.far_nbr_list);
|
||||
l->select.far_nbr_list = nullptr;
|
||||
break;
|
||||
case TYP_BOND:
|
||||
sfree(l->error_ptr, l->select.bond_list, "list:bonds");
|
||||
sfree(l->select.bond_list);
|
||||
l->select.bond_list = nullptr;
|
||||
break;
|
||||
case TYP_THREE_BODY:
|
||||
sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies");
|
||||
sfree(l->select.three_body_list);
|
||||
l->select.three_body_list = nullptr;
|
||||
break;
|
||||
|
||||
|
||||
@ -90,11 +90,11 @@ namespace ReaxFF {
|
||||
coef[i-1].a = f[i];
|
||||
}
|
||||
|
||||
sfree(error_ptr, a, "cubic_spline:a");
|
||||
sfree(error_ptr, b, "cubic_spline:b");
|
||||
sfree(error_ptr, c, "cubic_spline:c");
|
||||
sfree(error_ptr, d, "cubic_spline:d");
|
||||
sfree(error_ptr, v, "cubic_spline:v");
|
||||
sfree(a);
|
||||
sfree(b);
|
||||
sfree(c);
|
||||
sfree(d);
|
||||
sfree(v);
|
||||
}
|
||||
|
||||
void Complete_Cubic_Spline(LAMMPS_NS::Error* error_ptr, const double *h,
|
||||
@ -138,11 +138,11 @@ namespace ReaxFF {
|
||||
coef[i-1].a = f[i];
|
||||
}
|
||||
|
||||
sfree(error_ptr, a, "cubic_spline:a");
|
||||
sfree(error_ptr, b, "cubic_spline:b");
|
||||
sfree(error_ptr, c, "cubic_spline:c");
|
||||
sfree(error_ptr, d, "cubic_spline:d");
|
||||
sfree(error_ptr, v, "cubic_spline:v");
|
||||
sfree(a);
|
||||
sfree(b);
|
||||
sfree(c);
|
||||
sfree(d);
|
||||
sfree(v);
|
||||
}
|
||||
|
||||
void Init_Lookup_Tables(reax_system *system, control_params *control,
|
||||
@ -276,16 +276,16 @@ namespace ReaxFF {
|
||||
for (i = 0; i < ntypes; ++i) {
|
||||
for (j = i; j < ntypes; ++j)
|
||||
if (LR[i][j].n) {
|
||||
sfree(system->error_ptr, LR[i][j].y, "LR[i,j].y");
|
||||
sfree(system->error_ptr, LR[i][j].H, "LR[i,j].H");
|
||||
sfree(system->error_ptr, LR[i][j].vdW, "LR[i,j].vdW");
|
||||
sfree(system->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd");
|
||||
sfree(system->error_ptr, LR[i][j].ele, "LR[i,j].ele");
|
||||
sfree(system->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb");
|
||||
sfree(LR[i][j].y);
|
||||
sfree(LR[i][j].H);
|
||||
sfree(LR[i][j].vdW);
|
||||
sfree(LR[i][j].CEvd);
|
||||
sfree(LR[i][j].ele);
|
||||
sfree(LR[i][j].CEclmb);
|
||||
}
|
||||
sfree(system->error_ptr, LR[i], "LR[i]");
|
||||
sfree(LR[i]);
|
||||
}
|
||||
sfree(system->error_ptr, LR, "LR");
|
||||
sfree(LR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -233,8 +233,8 @@ namespace ReaxFF {
|
||||
flag = 0;
|
||||
|
||||
/* kinetic energy terms */
|
||||
double xcut = 0.5 * ( system->reax_param.sbp[ system->my_atoms[i].type ].bcut_acks2
|
||||
+ system->reax_param.sbp[ system->my_atoms[j].type ].bcut_acks2 );
|
||||
double xcut = 0.5 * (system->reax_param.sbp[system->my_atoms[i].type].bcut_acks2
|
||||
+ system->reax_param.sbp[system->my_atoms[j].type].bcut_acks2);
|
||||
|
||||
if(nbr_pj->d <= xcut) {
|
||||
if (j < natoms) flag = 1;
|
||||
@ -409,8 +409,8 @@ namespace ReaxFF {
|
||||
flag = 0;
|
||||
|
||||
/* kinetic energy terms */
|
||||
double xcut = 0.5 * ( system->reax_param.sbp[ system->my_atoms[i].type ].bcut_acks2
|
||||
+ system->reax_param.sbp[ system->my_atoms[j].type ].bcut_acks2 );
|
||||
double xcut = 0.5 * (system->reax_param.sbp[ system->my_atoms[i].type ].bcut_acks2
|
||||
+ system->reax_param.sbp[ system->my_atoms[j].type ].bcut_acks2);
|
||||
|
||||
if(nbr_pj->d <= xcut) {
|
||||
if (j < natoms) flag = 1;
|
||||
|
||||
@ -96,16 +96,9 @@ void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const st
|
||||
}
|
||||
|
||||
/* safe free */
|
||||
void sfree(LAMMPS_NS::Error *error_ptr, void *ptr, const std::string &name)
|
||||
void sfree(void *ptr)
|
||||
{
|
||||
if (ptr == nullptr) {
|
||||
auto errmsg = std::string("Trying to free the already free()'d pointer: ") + name;
|
||||
if (error_ptr)
|
||||
error_ptr->one(FLERR, errmsg);
|
||||
else
|
||||
fputs(errmsg.c_str(), stderr);
|
||||
return;
|
||||
}
|
||||
if (ptr == nullptr) return;
|
||||
|
||||
free(ptr);
|
||||
ptr = nullptr;
|
||||
|
||||
@ -304,8 +304,6 @@ void PairHybrid::settings(int narg, char **arg)
|
||||
// allocate list of sub-styles as big as possibly needed if no extra args
|
||||
|
||||
styles = new Pair *[narg];
|
||||
cutmax_style = new double[narg];
|
||||
memset(cutmax_style, 0.0, narg*sizeof(double));
|
||||
keywords = new char *[narg];
|
||||
multiple = new int[narg];
|
||||
|
||||
@ -347,6 +345,10 @@ void PairHybrid::settings(int narg, char **arg)
|
||||
nstyles++;
|
||||
}
|
||||
|
||||
delete[] cutmax_style;
|
||||
cutmax_style = new double[nstyles];
|
||||
memset(cutmax_style, 0, nstyles*sizeof(double));
|
||||
|
||||
// multiple[i] = 1 to M if sub-style used multiple times, else 0
|
||||
|
||||
int num_tip4p = 0, num_coul = 0; // count sub-styles with tip4p and coulomb
|
||||
@ -582,6 +584,8 @@ void PairHybrid::init_style()
|
||||
{
|
||||
int i,m,itype,jtype,used,istyle,skip;
|
||||
|
||||
memset(cutmax_style, 0, nstyles*sizeof(double));
|
||||
|
||||
// error if a sub-style is not used
|
||||
|
||||
int ntypes = atom->ntypes;
|
||||
@ -750,7 +754,7 @@ double PairHybrid::init_one(int i, int j)
|
||||
cutmax_style[istyle] = cut;
|
||||
|
||||
for (auto &request : neighbor->get_pair_requests()) {
|
||||
if (styles[istyle] == request->get_requestor() && styles[istyle]->trim_flag) {
|
||||
if (styles[istyle] == request->get_requestor()) {
|
||||
request->set_cutoff(cutmax_style[istyle]);
|
||||
break;
|
||||
}
|
||||
@ -819,8 +823,9 @@ void PairHybrid::read_restart(FILE *fp)
|
||||
delete[] compute_tally;
|
||||
|
||||
styles = new Pair*[nstyles];
|
||||
delete[] cutmax_style;
|
||||
cutmax_style = new double[nstyles];
|
||||
memset(cutmax_style, 0.0, nstyles*sizeof(double));
|
||||
memset(cutmax_style, 0, nstyles*sizeof(double));
|
||||
keywords = new char*[nstyles];
|
||||
multiple = new int[nstyles];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user