Merge branch 'master' into collected-small-changes

# Conflicts:
#	src/REAXFF/fix_reaxff_species.cpp
This commit is contained in:
Axel Kohlmeyer 2021-10-11 21:24:11 -04:00
commit 9cf6b927cb
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
201 changed files with 3188 additions and 1763 deletions

33
.github/workflows/compile-msvc.yml vendored Normal file
View File

@ -0,0 +1,33 @@
# GitHub action to build LAMMPS on Windows with Visual C++
name: "Native Windows Compilation"
on:
push:
branches: [master]
jobs:
build:
name: Windows Compilation Test
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Building LAMMPS via CMake
shell: bash
run: |
cmake -C cmake/presets/windows.cmake \
-S cmake -B build \
-D BUILD_SHARED_LIBS=on \
-D LAMMPS_EXCEPTIONS=on
cmake --build build --config Release
- name: Run LAMMPS executable
shell: bash
run: |
./build/Release/lmp.exe -h
./build/Release/lmp.exe -in bench/in.lj

7
.gitignore vendored
View File

@ -37,8 +37,8 @@ vgcore.*
.Trashes
ehthumbs.db
Thumbs.db
.clang-format
.lammps_history
.vs
#cmake
/build*
@ -49,3 +49,8 @@ Thumbs.db
/Testing
/cmake_install.cmake
/lmp
out/Debug
out/RelWithDebInfo
out/Release
out/x86
out/x64

View File

@ -82,6 +82,16 @@ include(CheckIncludeFileCXX)
# set required compiler flags and compiler/CPU arch specific optimizations
if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM"))
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
set(CMAKE_TUNE_DEFAULT "/QxCOMMON-AVX512")
else()
set(CMAKE_TUNE_DEFAULT "/QxHost")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
@ -89,6 +99,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "
set(CMAKE_TUNE_DEFAULT "-xHost")
endif()
endif()
endif()
# we require C++11 without extensions. Kokkos requires at least C++14 (currently)
set(CMAKE_CXX_STANDARD 11)
@ -97,9 +108,13 @@ if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14))
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
# ugly hack for MSVC which by default always reports an old C++ standard in the __cplusplus macro
# 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()
# export all symbols when building a .dll file on windows
@ -284,6 +299,11 @@ else()
target_include_directories(mpi_stubs PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
if(BUILD_SHARED_LIBS)
target_link_libraries(lammps PRIVATE mpi_stubs)
if(MSVC)
target_link_libraries(lmp PRIVATE mpi_stubs)
target_include_directories(lmp INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
target_compile_definitions(lmp INTERFACE $<INSTALL_INTERFACE:LAMMPS_LIB_NO_MPI>)
endif(MSVC)
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
target_compile_definitions(lammps INTERFACE $<INSTALL_INTERFACE:LAMMPS_LIB_NO_MPI>)
else()
@ -471,9 +491,12 @@ foreach(HEADER cmath)
endif(NOT FOUND_${HEADER})
endforeach(HEADER)
set(MATH_LIBRARIES "m" CACHE STRING "math library")
mark_as_advanced( MATH_LIBRARIES )
target_link_libraries(lammps PRIVATE ${MATH_LIBRARIES})
# make the standard math library overrideable and autodetected (for systems that don't have it)
find_library(STANDARD_MATH_LIB m DOC "Standard Math library")
mark_as_advanced(STANDARD_MATH_LIB)
if(STANDARD_MATH_LIB)
target_link_libraries(lammps PRIVATE ${STANDARD_MATH_LIB})
endif()
######################################
# Generate Basic Style files
@ -611,7 +634,7 @@ endif()
# and after everything else that is compiled locally
######################################################################
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(lammps PRIVATE -lwsock32 -lpsapi)
target_link_libraries(lammps PRIVATE "wsock32;psapi")
endif()
######################################################

55
cmake/CMakeSettings.json Normal file
View File

@ -0,0 +1,55 @@
{
"configurations": [
{
"name": "x64-Debug-MSVC",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${workspaceRoot}\\install\\${name}",
"cmakeCommandArgs": "-S ${workspaceRoot}\\cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "BUILD_SHARED_LIBS",
"value": "True",
"type": "BOOL"
},
{
"name": "BUILD_TOOLS",
"value": "True",
"type": "BOOL"
},
{
"name": "LAMMPS_EXCEPTIONS",
"value": "True",
"type": "BOOL"
}
]
},
{
"name": "x64-Debug-Clang",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${workspaceRoot}\\install\\${name}",
"cmakeCommandArgs": "-S ${workspaceRoot}\\cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64" ],
"variables": [
{
"name": "BUILD_TOOLS",
"value": "True",
"type": "BOOL"
},
{
"name": "LAMMPS_EXCEPTIONS",
"value": "True",
"type": "BOOL"
}
]
}
]
}

View File

@ -25,7 +25,9 @@ if(BUILD_TOOLS)
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
add_executable(msi2lmp ${MSI2LMP_SOURCES})
target_link_libraries(msi2lmp PRIVATE ${MATH_LIBRARIES})
if(STANDARD_MATH_LIB)
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
endif()
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()

View File

@ -0,0 +1,64 @@
set(WIN_PACKAGES
ASPHERE
BOCS
BODY
BROWNIAN
CG-DNA
CG-SDK
CLASS2
COLLOID
COLVARS
CORESHELL
DIELECTRIC
DIFFRACTION
DIPOLE
DPD-BASIC
DPD-MESO
DPD-REACT
DPD-SMOOTH
DRUDE
EFF
EXTRA-COMPUTE
EXTRA-DUMP
EXTRA-FIX
EXTRA-MOLECULE
EXTRA-PAIR
FEP
GRANULAR
INTERLAYER
KSPACE
MANIFOLD
MANYBODY
MC
MEAM
MISC
ML-IAP
ML-SNAP
MOFFF
MOLECULE
MOLFILE
OPENMP
ORIENT
PERI
PHONON
POEMS
PTM
QEQ
QTB
REACTION
REAXFF
REPLICA
RIGID
SHOCK
SMTBQ
SPH
SPIN
SRD
TALLY
UEF
YAFF)
foreach(PKG ${WIN_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()

View File

@ -435,6 +435,8 @@ INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \
@LAMMPS_SOURCE_DIR@/my_pool_chunk.cpp \
@LAMMPS_SOURCE_DIR@/my_pool_chunk.h \
@LAMMPS_SOURCE_DIR@/math_eigen.h \
@LAMMPS_SOURCE_DIR@/platform.h \
@LAMMPS_SOURCE_DIR@/platform.cpp \
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded

View File

@ -354,8 +354,10 @@ Read or write compressed files
-----------------------------------------
If this option is enabled, large files can be read or written with
gzip compression by several LAMMPS commands, including
:doc:`read_data <read_data>`, :doc:`rerun <rerun>`, and :doc:`dump <dump>`.
compression by ``gzip`` or similar tools by several LAMMPS commands,
including :doc:`read_data <read_data>`, :doc:`rerun <rerun>`, and
:doc:`dump <dump>`. Currently supported compression tools are:
``gzip``, ``bzip2``, ``zstd``, and ``lzma``.
.. tabs::
@ -364,8 +366,7 @@ gzip compression by several LAMMPS commands, including
.. code-block:: bash
-D WITH_GZIP=value # yes or no
# default is yes if CMake can find gzip, else no
-D GZIP_EXECUTABLE=path # path to gzip executable if CMake cannot find it
# default is yes if CMake can find the gzip program, else no
.. tab:: Traditional make
@ -373,14 +374,15 @@ gzip compression by several LAMMPS commands, including
LMP_INC = -DLAMMPS_GZIP
This option requires that your operating system fully supports the "popen()"
function in the standard runtime library and that a ``gzip`` executable can be
found by LAMMPS during a run.
This option requires that your operating system fully supports the
"popen()" function in the standard runtime library and that a ``gzip``
or other executable can be found by LAMMPS in the standard search path
during a run.
.. note::
On some clusters with high-speed networks, using the "fork()" library
call (required by "popen()") can interfere with the fast communication
On clusters with high-speed networks, using the "fork()" library call
(required by "popen()") can interfere with the fast communication
library and lead to simulations using compressed output or input to
hang or crash. For selected operations, compressed file I/O is also
available using a compression library instead, which is what the

View File

@ -4,6 +4,7 @@ Notes for building LAMMPS on Windows
* :ref:`General remarks <generic>`
* :ref:`Running Linux on Windows <linux>`
* :ref:`Using GNU GCC ported to Windows <gnu>`
* :ref:`Using Visual Studio <msvc>`
* :ref:`Using a cross-compiler <cross>`
----------
@ -31,13 +32,13 @@ pre-compiled Windows binary packages are sufficient for your needs. If
it is necessary for you to compile LAMMPS on a Windows machine
(e.g. because it is your main desktop), please also consider using a
virtual machine software and compile and run LAMMPS in a Linux virtual
machine, or - if you have a sufficiently up-to-date Windows 10
installation - consider using the Windows subsystem for Linux. This
optional Windows feature allows you to run the bash shell from Ubuntu
from within Windows and from there on, you can pretty much use that
shell like you are running on an Ubuntu Linux machine (e.g. installing
software via apt-get and more). For more details on that, please see
:doc:`this tutorial <Howto_wsl>`.
machine, or - if you have a sufficiently up-to-date Windows 10 or
Windows 11 installation - consider using the Windows subsystem for
Linux. This optional Windows feature allows you to run the bash shell
from Ubuntu from within Windows and from there on, you can pretty much
use that shell like you are running on an Ubuntu Linux machine
(e.g. installing software via apt-get and more). For more details on
that, please see :doc:`this tutorial <Howto_wsl>`.
.. _gnu:
@ -67,6 +68,35 @@ requiring changes to the LAMMPS source code, or figure out corrections
yourself, please report them on the lammps-users mailing list, or file
them as an issue or pull request on the LAMMPS GitHub project.
.. _msvc:
Using Microsoft Visual Studio
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Following the integration of the :doc:`platform namespace
<Developer_platform>` into the LAMMPS code base, portability of LAMMPS
to be compiled on Windows using Visual Studio has been significantly
improved. This has been tested with Visual Studio 2019 (aka version
16). Not all features and packages in LAMMPS are currently supported
out of the box, but a preset ``cmake/presets/windows.cmake`` is provided
that contains the packages that have been compiled successfully. You
must use the CMake based build procedure, and either use the integrated
CMake support of Visual Studio or use an external CMake installation to
create build files for the Visual Studio build system. Please note that
on launching Visual Studio it will scan the directory tree and likely
miss the correct master ``CMakeLists.txt``. Try to open the
``cmake/CMakeSettings.json`` and use those CMake configurations as a
starting point. It is also possible to configure and compile LAMMPS
from the command line with a CMake binary from `cmake.org <https://cmake.org>`_.
To support running in parallel you can compile with OpenMP enabled using
the OPENMP package or install Microsoft MPI (including the SDK) and compile
LAMMPS with MPI enabled.
This is work in progress and you should contact the LAMMPS developers
via GitHub, the forum, or the mailing list, if you have questions or
LAMMPS specific problems.
.. _cross:
Using a cross-compiler

View File

@ -18,4 +18,5 @@ of time and requests from the LAMMPS user community.
Developer_plugins
Developer_unittest
Classes
Developer_platform
Developer_utils

View File

@ -0,0 +1,149 @@
Platform abstraction functions
------------------------------
The ``platform`` sub-namespace inside the ``LAMMPS_NS`` namespace
provides a collection of wrapper and convenience functions and utilities
that perform common tasks for which platform specific code would be
required or for which a more high-level abstraction would be convenient
and reduce duplicated code. This reduces redundant implementations and
encourages consistent behavior and thus has some overlap with the
:doc:`"utils" sub-namespace <Developer_utils>`.
Time functions
^^^^^^^^^^^^^^
.. doxygenfunction:: cputime
:project: progguide
.. doxygenfunction:: walltime
:project: progguide
.. doxygenfunction:: usleep
:project: progguide
Platform information functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: os_info
:project: progguide
.. doxygenfunction:: compiler_info
:project: progguide
.. doxygenfunction:: cxx_standard
:project: progguide
.. doxygenfunction:: openmp_standard
:project: progguide
.. doxygenfunction:: mpi_vendor
:project: progguide
.. doxygenfunction:: mpi_info
:project: progguide
File and path functions and global constants
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenvariable:: filepathsep
:project: progguide
.. doxygenvariable:: pathvarsep
:project: progguide
.. doxygenfunction:: guesspath
:project: progguide
.. doxygenfunction:: path_basename
:project: progguide
.. doxygenfunction:: path_join
:project: progguide
.. doxygenfunction:: file_is_readable
:project: progguide
.. doxygenfunction:: is_console
:project: progguide
.. doxygenfunction:: path_is_directory
:project: progguide
.. doxygenfunction:: current_directory
:project: progguide
.. doxygenfunction:: list_directory
:project: progguide
.. doxygenfunction:: chdir
:project: progguide
.. doxygenfunction:: mkdir
:project: progguide
.. doxygenfunction:: rmdir
:project: progguide
.. doxygenfunction:: unlink
:project: progguide
Standard I/O function wrappers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenvariable:: END_OF_FILE
:project: progguide
.. doxygenfunction:: ftell
:project: progguide
.. doxygenfunction:: fseek
:project: progguide
.. doxygenfunction:: ftruncate
:project: progguide
.. doxygenfunction:: popen
:project: progguide
.. doxygenfunction:: pclose
:project: progguide
Environment variable functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: putenv
:project: progguide
.. doxygenfunction:: list_pathenv
:project: progguide
.. doxygenfunction:: find_exe_path
:project: progguide
Dynamically loaded object or library functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: dlopen
:project: progguide
.. doxygenfunction:: dlclose
:project: progguide
.. doxygenfunction:: dlsym
:project: progguide
.. doxygenfunction:: dlerror
:project: progguide
Compressed file I/O functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: has_compress_extension
:project: progguide
.. doxygenfunction:: compressed_read
:project: progguide
.. doxygenfunction:: compressed_write
:project: progguide

View File

@ -7,7 +7,9 @@ a collection of convenience functions and utilities that perform common
tasks that are required repeatedly throughout the LAMMPS code like
reading or writing to files with error checking or translation of
strings into specific types of numbers with checking for validity. This
reduces redundant implementations and encourages consistent behavior.
reduces redundant implementations and encourages consistent behavior and
thus has some overlap with the :doc:`"platform" sub-namespace
<Developer_platform>`.
I/O with status check and similar functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -101,6 +103,12 @@ and parsing files or arguments.
.. doxygenfunction:: strdup
:project: progguide
.. doxygenfunction:: lowercase
:project: progguide
.. doxygenfunction:: uppercase
:project: progguide
.. doxygenfunction:: trim
:project: progguide
@ -143,21 +151,6 @@ and parsing files or arguments.
.. doxygenfunction:: is_double
:project: progguide
File and path functions
^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: guesspath
:project: progguide
.. doxygenfunction:: path_basename
:project: progguide
.. doxygenfunction:: path_join
:project: progguide
.. doxygenfunction:: file_is_readable
:project: progguide
Potential file functions
^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -28,7 +28,6 @@ Syntax
Nstart = start averaging on this timestep
*file* arg = filename
filename = name of file to output time averages to
*overwrite* arg = none = overwrite output file with only latest output
Examples
""""""""
@ -161,10 +160,6 @@ the *file* keyword and this string is appended with _N.vtk where N is
an index (0,1,2...) to account for situations with multiple diffraction
intensity outputs.
The *overwrite* keyword will continuously overwrite the output file
with the latest output, so that it only contains one timestep worth of
output. This option can only be used with the *ave running* setting.
Restart, fix_modify, output, run start/stop, minimize info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

View File

@ -1135,6 +1135,7 @@ Germann
Germano
gerolf
Gerolf
getrusage
Gershgorin
getter
gettimeofday
@ -1222,6 +1223,7 @@ Guo
gw
gyromagnetic
gz
gzip
gzipped
Haak
Hafskjold
@ -1809,6 +1811,7 @@ lyon
Lysogorskiy
Lyulin
lz
lzma
Maaravi
MACHDYN
machdyn
@ -2762,6 +2765,7 @@ REAXFF
ReaxFF
reaxff
rebo
recurse
recursing
Ree
refactored
@ -3441,6 +3445,7 @@ usec
uSemiParallel
userguide
username
usleep
usr
util
utils

View File

@ -14,6 +14,15 @@ endif()
project(plugins VERSION 1.0 LANGUAGES CXX)
# 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()
# NOTE: the next line should be commented out when used outside of the LAMMPS package
get_filename_component(LAMMPS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../src ABSOLUTE)
set(LAMMPS_HEADER_DIR ${LAMMPS_SOURCE_DIR} CACHE PATH "Location of LAMMPS headers")
@ -36,11 +45,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
endif()
# bail out on windows
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
include(CheckIncludeFileCXX)
include(LAMMPSInterfaceCXX)
@ -62,12 +66,21 @@ add_library(zero2plugin MODULE zero2plugin.cpp pair_zero2.cpp bond_zero2.cpp
angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp)
target_link_libraries(zero2plugin PRIVATE lammps)
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
PREFIX ""
LINK_FLAGS "-rdynamic")
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES PREFIX "")
# MacOS seems to need this
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin
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(morse2plugin nve2plugin helloplugin zero2plugin
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(CMAKE_CROSSCOMPILING)
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin
PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
endif()
else()
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
LINK_FLAGS "-rdynamic")
endif()

View File

@ -23,7 +23,9 @@ endfunction(validate_option)
# LAMMPS C++ interface. We only need the header related parts.
add_library(lammps INTERFACE)
target_include_directories(lammps INTERFACE ${LAMMPS_HEADER_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)

View File

@ -481,7 +481,7 @@ int UCL_Device::set_platform(int pid) {
cl_device_id *subdevice_list = new cl_device_id[num_subdevices];
CL_SAFE_CALL(clCreateSubDevices(device_list[i], props, num_subdevices,
subdevice_list, &num_subdevices));
for (int j=0; j<num_subdevices; j++) {
for (cl_uint j=0; j<num_subdevices; j++) {
_cl_devices.push_back(device_list[i]);
add_properties(device_list[i]);
_num_devices++;
@ -635,7 +635,7 @@ void UCL_Device::add_properties(cl_device_id device_list) {
size_t ext_str_size_ret;
CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_EXTENSIONS, 0, nullptr,
&ext_str_size_ret));
char buffer2[ext_str_size_ret];
char *buffer2 = new char[ext_str_size_ret];
CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_EXTENSIONS,
ext_str_size_ret, buffer2, nullptr));
#if defined(CL_VERSION_2_1) || defined(CL_VERSION_3_0)
@ -666,6 +666,7 @@ void UCL_Device::add_properties(cl_device_id device_list) {
if (arch >= 3.0)
op.has_shuffle_support=true;
}
delete[] buffer2;
#endif
_properties.push_back(op);
@ -836,7 +837,7 @@ int UCL_Device::auto_set_platform(const enum UCL_DEVICE_TYPE type,
bool vendor_match=false;
bool type_match=false;
int max_cus=0;
unsigned int max_cus=0;
int best_platform=0;
std::string vendor_upper=vendor;

View File

@ -303,7 +303,7 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
me = comm->me;
root2root = MPI_COMM_NULL;
conf_file = strdup(arg[3]);
conf_file = utils::strdup(arg[3]);
rng_seed = 1966;
unwrap_flag = 1;
@ -319,22 +319,22 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Missing argument to keyword");
if (0 == strcmp(arg[iarg], "input")) {
inp_name = strdup(arg[iarg+1]);
inp_name = utils::strdup(arg[iarg+1]);
} else if (0 == strcmp(arg[iarg], "output")) {
out_name = strdup(arg[iarg+1]);
out_name = utils::strdup(arg[iarg+1]);
} else if (0 == strcmp(arg[iarg], "seed")) {
rng_seed = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
} else if (0 == strcmp(arg[iarg], "unwrap")) {
unwrap_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
} else if (0 == strcmp(arg[iarg], "tstat")) {
tmp_name = strdup(arg[iarg+1]);
tmp_name = utils::strdup(arg[iarg+1]);
} else {
error->all(FLERR,"Unknown fix colvars parameter");
}
++iarg; ++iarg;
}
if (!out_name) out_name = strdup("out");
if (!out_name) out_name = utils::strdup("out");
/* initialize various state variables. */
tstat_id = -1;
@ -359,10 +359,10 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
FixColvars::~FixColvars()
{
memory->sfree(conf_file);
memory->sfree(inp_name);
memory->sfree(out_name);
memory->sfree(tmp_name);
delete[] conf_file;
delete[] inp_name;
delete[] out_name;
delete[] tmp_name;
memory->sfree(comm_buf);
if (proxy) {
@ -430,17 +430,15 @@ void FixColvars::one_time_init()
// create and initialize the colvars proxy
if (me == 0) {
if (screen) fputs("colvars: Creating proxy instance\n",screen);
if (logfile) fputs("colvars: Creating proxy instance\n",logfile);
utils::logmesg(lmp,"colvars: Creating proxy instance\n");
#ifdef LAMMPS_BIGBIG
if (screen) fputs("colvars: cannot handle atom ids > 2147483647\n",screen);
if (logfile) fputs("colvars: cannot handle atom ids > 2147483647\n",logfile);
utils::logmesg(lmp,"colvars: cannot handle atom ids > 2147483647\n");
#endif
if (inp_name) {
if (strcmp(inp_name,"NULL") == 0) {
memory->sfree(inp_name);
delete[] inp_name;
inp_name = nullptr;
}
}
@ -458,8 +456,7 @@ void FixColvars::one_time_init()
}
}
proxy = new colvarproxy_lammps(lmp,inp_name,out_name,
rng_seed,t_target,root2root);
proxy = new colvarproxy_lammps(lmp,inp_name,out_name,rng_seed,t_target,root2root);
proxy->init(conf_file);
num_coords = (proxy->modify_atom_positions()->size());

View File

@ -33,7 +33,7 @@ DumpAtomGZ::~DumpAtomGZ() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -35,7 +35,7 @@ DumpCFGGZ::~DumpCFGGZ() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -33,7 +33,7 @@ DumpCustomGZ::~DumpCustomGZ() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -45,7 +45,7 @@ DumpCustomZstd::~DumpCustomZstd()
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -33,7 +33,7 @@ DumpLocalGZ::~DumpLocalGZ() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -39,7 +39,7 @@ DumpLocalZstd::~DumpLocalZstd() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -32,7 +32,7 @@ DumpXYZGZ::~DumpXYZGZ() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -38,7 +38,7 @@ DumpXYZZstd::~DumpXYZZstd() {}
/* ----------------------------------------------------------------------
generic opening of a dump file
ASCII or binary or gzipped
ASCII or binary or compressed
some derived classes override this function
------------------------------------------------------------------------- */

View File

@ -31,7 +31,6 @@
#include <cmath>
#include <cstring>
#include <strings.h> // for strcasecmp()
#include "omp_compat.h"
using namespace LAMMPS_NS;
@ -86,7 +85,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) :
}
for (int i=0; i<ntypes; i++) {
for (int j = 0; j < SAEDmaxType; j++) {
if (strcasecmp(arg[iarg],SAEDtypeList[j]) == 0) {
if (utils::lowercase(arg[iarg]) == utils::lowercase(SAEDtypeList[j])) {
ztype[i] = j;
}
}
@ -348,7 +347,7 @@ void ComputeSAED::compute_vector()
if (me == 0 && echo)
utils::logmesg(lmp,"-----\nComputing SAED intensities");
double t0 = MPI_Wtime();
double t0 = platform::walltime();
double *Fvec = new double[2*nRows]; // Strct factor (real & imaginary)
// -- Note, vector entries correspond to different RELP
@ -491,7 +490,7 @@ void ComputeSAED::compute_vector()
vector[i] = (scratch[2*i] * scratch[2*i] + scratch[2*i+1] * scratch[2*i+1]) / natoms;
}
double t2 = MPI_Wtime();
double t2 = platform::walltime();
// compute memory usage per processor
double bytes = memory_usage();

View File

@ -32,7 +32,6 @@
#include <cmath>
#include <cstring>
#include <strings.h> // for strcasecmp()
#include "omp_compat.h"
using namespace LAMMPS_NS;
@ -87,7 +86,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) :
}
for (int i = 0; i < ntypes; i++) {
for (int j = 0; j < XRDmaxType; j++) {
if (strcasecmp(arg[iarg],XRDtypeList[j]) == 0) {
if (utils::lowercase(arg[iarg]) == utils::lowercase(XRDtypeList[j])) {
ztype[i] = j;
}
}
@ -300,7 +299,7 @@ void ComputeXRD::compute_array()
if (me == 0 && echo) utils::logmesg(lmp, "-----\nComputing XRD intensities");
double t0 = MPI_Wtime();
double t0 = platform::walltime();
double *Fvec = new double[2*size_array_rows]; // Strct factor (real & imaginary)
// -- Note: array rows correspond to different RELP
@ -496,7 +495,7 @@ void ComputeXRD::compute_array()
array[i][1] = (scratch[2*i] * scratch[2*i] + scratch[2*i+1] * scratch[2*i+1]) / natoms;
}
double t2 = MPI_Wtime();
double t2 = platform::walltime();
// compute memory usage per processor
double bytes = memory_usage();

View File

@ -31,6 +31,7 @@
#include <cstring>
#include <cmath>
using namespace LAMMPS_NS;
using namespace FixConst;
@ -100,8 +101,6 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Illegal fix saed/vtk command");
if (nfreq % nevery || nrepeat*nevery > nfreq)
error->all(FLERR,"Illegal fix saed/vtk command");
if (ave != RUNNING && overwrite)
error->all(FLERR,"Illegal fix saed/vtk command");
// allocate memory for averaging
@ -391,8 +390,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
fp = fopen(nName.c_str(),"w");
if (fp == nullptr)
error->one(FLERR,"Cannot open fix saed/vtk file {}: {}",
nName,utils::getsyserror());
error->one(FLERR,"Cannot open fix saed/vtk file {}: {}", nName,utils::getsyserror());
}
fprintf(fp,"# vtk DataFile Version 3.0 c_%s\n",ids);
@ -406,9 +404,6 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
fprintf(fp,"SCALARS intensity float\n");
fprintf(fp,"LOOKUP_TABLE default\n");
filepos = ftell(fp);
if (overwrite) fseek(fp,filepos,SEEK_SET);
// Finding the intersection of the reciprical space and Ewald sphere
int NROW1 = 0;
@ -497,7 +492,6 @@ void FixSAEDVTK::options(int narg, char **arg)
fp = nullptr;
ave = ONE;
startstep = 0;
overwrite = 0;
// optional args
int iarg = 7;
@ -534,9 +528,6 @@ void FixSAEDVTK::options(int narg, char **arg)
if (iarg+2 > narg) error->all(FLERR,"Illegal fix saed/vtk command");
startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"overwrite") == 0) {
overwrite = 1;
iarg += 1;
} else error->all(FLERR,"Illegal fix saed/vtk command");
}
}

View File

@ -43,8 +43,6 @@ class FixSAEDVTK : public Fix {
int nrows;
int ave, nwindow, nsum, startstep;
int overwrite;
long filepos;
int norm, iwindow, window_limit;
double *vector;

View File

@ -19,19 +19,19 @@
#include "pair_mdpd.h"
#include "atom.h"
#include "citeme.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "random_mars.h"
#include "update.h"
#include <cmath>
#include <ctime>
#include "atom.h"
#include "comm.h"
#include "update.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "random_mars.h"
#include "citeme.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
@ -217,12 +217,13 @@ void PairMDPD::settings(int narg, char **arg)
seed = utils::inumeric(FLERR,arg[2],false,lmp);
// initialize Marsaglia RNG with processor-unique seed
// create a positive seed based on the system clock, if requested.
if (seed <= 0) {
struct timespec time;
clock_gettime( CLOCK_REALTIME, &time );
seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed
constexpr double LARGE_NUM = 2<<30;
seed = int(fmod(platform::walltime() * LARGE_NUM, LARGE_NUM)) + 1;
}
delete random;
random = new RanMars(lmp,(seed + comm->me) % 900000000);

View File

@ -18,19 +18,19 @@
------------------------------------------------------------------------- */
#include "pair_tdpd.h"
#include <cmath>
#include <ctime>
#include "atom.h"
#include "comm.h"
#include "update.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "random_mars.h"
#include "citeme.h"
#include "memory.h"
#include "error.h"
#include "atom.h"
#include "citeme.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "random_mars.h"
#include "update.h"
#include <cmath>
using namespace LAMMPS_NS;
@ -239,12 +239,13 @@ void PairTDPD::settings(int narg, char **arg)
seed = utils::inumeric(FLERR,arg[2],false,lmp);
// initialize Marsaglia RNG with processor-unique seed
// create a positive seed based on the system clock, if requested.
if (seed <= 0) {
struct timespec time;
clock_gettime( CLOCK_REALTIME, &time );
seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed
constexpr double LARGE_NUM = 2<<30;
seed = int(fmod(platform::walltime() * LARGE_NUM, LARGE_NUM)) + 1;
}
delete random;
random = new RanMars(lmp,(seed + comm->me) % 900000000);

View File

@ -58,7 +58,7 @@ namespace /* anonymous */
{
typedef double TimerType;
TimerType getTimeStamp() { return MPI_Wtime(); }
TimerType getTimeStamp() { return platform::walltime(); }
double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; }
} // end namespace
@ -126,7 +126,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR, errmsg);
}
if (comm->me == 0 and Verbosity > 1) {
if (comm->me == 0 && Verbosity > 1) {
std::string msg = "FixRX: matrix format is ";
if (useSparseKinetics)
msg += std::string("sparse");
@ -172,7 +172,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) :
char *word = arg[iarg++];
minSteps = atoi( word );
if (comm->me == 0 and Verbosity > 1) {
if (comm->me == 0 && Verbosity > 1) {
char msg[128];
sprintf(msg, "FixRX: RK4 numSteps= %d", minSteps);
error->message(FLERR, msg);
@ -197,7 +197,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) :
// maxIters must be at least minSteps.
maxIters = std::max( minSteps, maxIters );
if (comm->me == 0 and Verbosity > 1) {
if (comm->me == 0 && Verbosity > 1) {
//printf("FixRX: RKF45 minSteps= %d maxIters= %d absTol= %e relTol= %e\n", minSteps, maxIters, absTol, relTol);
char msg[128];
sprintf(msg, "FixRX: RKF45 minSteps= %d maxIters= %d relTol= %.1e absTol= %.1e diagnosticFrequency= %d", minSteps, maxIters, relTol, absTol, diagnosticFrequency);
@ -371,7 +371,7 @@ void FixRX::initSparse()
{
const int Verbosity = 1;
if (comm->me == 0 and Verbosity > 1) {
if (comm->me == 0 && Verbosity > 1) {
for (int k = 0; k < nspecies; ++k)
printf("atom->dvname[%d]= %s\n", k, atom->dvname[k]);
@ -421,7 +421,7 @@ void FixRX::initSparse()
std::string pstr, rstr;
bool allAreIntegral = true;
for (int k = 0; k < nspecies; ++k) {
if (stoichReactants[i][k] == 0 and stoichProducts[i][k] == 0)
if (stoichReactants[i][k] == 0 && stoichProducts[i][k] == 0)
nzeros++;
if (stoichReactants[i][k] > 0.0) {
@ -448,7 +448,7 @@ void FixRX::initSparse()
pstr += atom->dvname[k];
}
}
if (comm->me == 0 and Verbosity > 1)
if (comm->me == 0 && Verbosity > 1)
printf("rx%3d: %d %d %d ... %s %s %s\n", i, nreac_i, nprod_i, allAreIntegral, rstr.c_str(), /*reversible[i]*/ (false) ? "<=>" : "=", pstr.c_str());
mxreac = std::max( mxreac, nreac_i );
@ -457,7 +457,7 @@ void FixRX::initSparse()
if (allAreIntegral) nIntegral++;
}
if (comm->me == 0 and Verbosity > 1) {
if (comm->me == 0 && Verbosity > 1) {
char msg[256];
sprintf(msg, "FixRX: Sparsity of Stoichiometric Matrix= %.1f%% non-zeros= %d nspecies= %d nreactions= %d maxReactants= %d maxProducts= %d maxSpecies= %d integralReactions= %d", 100*(double(nzeros) / (nspecies * nreactions)), nzeros, nspecies, nreactions, mxreac, mxprod, (mxreac + mxprod), SparseKinetics_enableIntegralReactions);
error->message(FLERR, msg);
@ -539,7 +539,7 @@ void FixRX::initSparse()
sparseKinetics_isIntegralReaction[i] = isIntegral_i;
}
if (comm->me == 0 and Verbosity > 1) {
if (comm->me == 0 && Verbosity > 1) {
for (int i = 1; i < nu_bin.size(); ++i)
if (nu_bin[i] > 0)
printf("nu_bin[%d] = %d\n", i, nu_bin[i]);
@ -554,7 +554,7 @@ void FixRX::initSparse()
rstr += " + ";
char digit[6];
if (SparseKinetics_enableIntegralReactions and sparseKinetics_isIntegralReaction[i])
if (SparseKinetics_enableIntegralReactions && sparseKinetics_isIntegralReaction[i])
sprintf(digit,"%d ", sparseKinetics_inu[i][kk]);
else
sprintf(digit,"%4.1f ", sparseKinetics_nu[i][kk]);
@ -570,7 +570,7 @@ void FixRX::initSparse()
pstr += " + ";
char digit[6];
if (SparseKinetics_enableIntegralReactions and sparseKinetics_isIntegralReaction[i])
if (SparseKinetics_enableIntegralReactions && sparseKinetics_isIntegralReaction[i])
sprintf(digit,"%d ", sparseKinetics_inu[i][kk]);
else
sprintf(digit,"%4.1f ", sparseKinetics_nu[i][kk]);
@ -578,7 +578,7 @@ void FixRX::initSparse()
pstr += atom->dvname[k];
}
}
if (comm->me == 0 and Verbosity > 1)
if (comm->me == 0 && Verbosity > 1)
printf("rx%3d: %s %s %s\n", i, rstr.c_str(), /*reversible[i]*/ (false) ? "<=>" : "=", pstr.c_str());
}
// end for nreactions

View File

@ -761,7 +761,7 @@ void FixTGNHDrude::setup_mol_mass_dof() {
dof_mol, dof_int, dof_drude);
}
}
if (dof_mol <=0 or dof_int <=0 or dof_drude <=0)
if (dof_mol <=0 || dof_int <=0 || dof_drude <=0)
error->all(FLERR, "TGNHC thermostat requires DOFs of molecules, atoms and dipoles larger than 0");
}

View File

@ -59,7 +59,7 @@ extern "C" {
typedef int bool_t;
#if defined(__MINGW32__) || defined(__APPLE__) || defined(__FreeBSD__) || \
#if defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
typedef char *caddr_t;
typedef unsigned int u_int;

View File

@ -36,7 +36,6 @@
#include <cmath>
#include <cstring>
#include <unistd.h>
using namespace LAMMPS_NS;
using namespace FixConst;
@ -260,7 +259,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg):
fprintf(fp," %s*%s",arg[5+i],arg[5+j]);
fprintf(fp,"\n");
}
filepos = ftell(fp);
filepos = platform::ftell(fp);
}
delete[] title1;
@ -467,7 +466,7 @@ void FixAveCorrelateLong::end_of_step()
evaluate();
if (fp && me == 0) {
if (overwrite) fseek(fp,filepos,SEEK_SET);
if (overwrite) platform::fseek(fp,filepos);
fprintf(fp,"# Timestep: " BIGINT_FORMAT "\n", ntimestep);
for (unsigned int i=0;i<npcorr;++i) {
fprintf(fp, "%lg ", t[i]*update->dt*nevery);
@ -478,9 +477,9 @@ void FixAveCorrelateLong::end_of_step()
}
fflush(fp);
if (overwrite) {
long fileend = ftell(fp);
if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
bigint fileend = platform::ftell(fp);
if ((fileend > 0) && (platform::ftruncate(fp,fileend)))
error->warning(FLERR,"Error while tuncating output: {}", utils::getsyserror());
}
}

View File

@ -66,7 +66,7 @@ class FixAveCorrelateLong : public Fix {
FILE *fp;
int type, startstep, overwrite;
long filepos;
bigint filepos;
int npair; // number of correlation pairs to calculate
double *values;

View File

@ -123,7 +123,10 @@ nfileevery(0), fp(nullptr), xf(nullptr), xold(nullptr)
FixTMD::~FixTMD()
{
if (nfileevery && me == 0) fclose(fp);
if (nfileevery && me == 0) {
if (compressed) platform::pclose(fp);
else fclose(fp);
}
// unregister callbacks to this fix from Atom class
@ -492,7 +495,7 @@ void FixTMD::readfile(char *file)
delete [] buffer;
if (me == 0) {
if (compressed) pclose(fp);
if (compressed) platform::pclose(fp);
else fclose(fp);
}
@ -514,33 +517,21 @@ void FixTMD::readfile(char *file)
/* ----------------------------------------------------------------------
proc 0 opens TMD data file
test if gzipped
test if compressed
------------------------------------------------------------------------- */
void FixTMD::open(char *file)
void FixTMD::open(const std::string &file)
{
if (utils::strmatch(file,"\\.gz$")) {
if (platform::has_compress_extension(file)) {
compressed = 1;
#ifdef LAMMPS_GZIP
auto gunzip = fmt::format("gzip -c -d {}",file);
#ifdef _WIN32
fp = _popen(gunzip.c_str(),"rb");
#else
fp = popen(gunzip.c_str(),"r");
#endif
#else
error->one(FLERR,"Cannot open gzipped file without gzip support");
#endif
fp = platform::compressed_read(file);
if (!fp) error->one(FLERR,"Cannot open compressed file for reading");
} else {
compressed = 0;
fp = fopen(file,"r");
fp = fopen(file.c_str(),"r");
}
if (fp == nullptr)
error->one(FLERR,"Cannot open file {}: {}",file, utils::getsyserror());
if (!fp) error->one(FLERR,"Cannot open file {}: {}", file, utils::getsyserror());
}
/* ---------------------------------------------------------------------- */

View File

@ -52,7 +52,7 @@ class FixTMD : public Fix {
double **xf, **xold;
void readfile(char *);
void open(char *);
void open(const std::string &);
};
} // namespace LAMMPS_NS

View File

@ -643,7 +643,7 @@ void PairE3B::checkInputs(const double &bondL)
if (k2 == NOT_SET) error->all(FLERR, "K2 keyword missing");
//now test that values are within acceptable ranges
if (k2 < 0.0 or k3 < 0.0) error->all(FLERR, "exponential decay is negative");
if (k2 < 0.0 || k3 < 0.0) error->all(FLERR, "exponential decay is negative");
if (bondL < 0.0) error->all(FLERR, "OH bond length is negative");
if (rc2 < 0.0 || rc3 < 0.0 || rs < 0.0) error->all(FLERR, "potential cutoff is negative");
if (rs > rc3) error->all(FLERR, "potential switching distance is larger than cutoff");

View File

@ -120,9 +120,9 @@ void PairBeckGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -143,9 +143,9 @@ void PairBornCoulLongCSGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -138,9 +138,9 @@ void PairBornCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -133,9 +133,9 @@ void PairBornCoulWolfCSGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -131,9 +131,9 @@ void PairBornCoulWolfGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -122,9 +122,9 @@ void PairBornGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -125,9 +125,9 @@ void PairBuckCoulCutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -134,9 +134,9 @@ void PairBuckCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -120,9 +120,9 @@ void PairBuckGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -121,9 +121,9 @@ void PairColloidGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -122,9 +122,9 @@ void PairCoulCutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -123,9 +123,9 @@ void PairCoulDebyeGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -134,9 +134,9 @@ void PairCoulDSFGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -136,9 +136,9 @@ void PairCoulLongCSGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -131,9 +131,9 @@ void PairCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -267,9 +267,9 @@ void PairDPDGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -286,9 +286,9 @@ void PairDPDTstatGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -118,9 +118,9 @@ void PairGaussGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -145,9 +145,9 @@ void PairGayBerneGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start < inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -117,9 +117,9 @@ void PairLJ96CutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -115,9 +115,9 @@ void PairLJCharmmCoulCharmmGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -136,9 +136,9 @@ void PairLJCharmmCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -133,9 +133,9 @@ void PairLJClass2CoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -117,9 +117,9 @@ void PairLJClass2GPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -123,9 +123,9 @@ void PairLJCubicGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -124,9 +124,9 @@ void PairLJCutCoulCutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -126,9 +126,9 @@ void PairLJCutCoulDebyeGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -135,9 +135,9 @@ void PairLJCutCoulDSFGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -136,9 +136,9 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -127,9 +127,9 @@ void PairLJCutCoulMSMGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -128,9 +128,9 @@ void PairLJCutDipoleCutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -140,9 +140,9 @@ void PairLJCutDipoleLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -121,9 +121,9 @@ void PairLJCutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -150,9 +150,9 @@ void PairLJCutTIP4PLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
// if (host_start<inum) {
// cpu_time = MPI_Wtime();
// cpu_time = platform::walltime();
// cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
// cpu_time = MPI_Wtime() - cpu_time;
// cpu_time = platform::walltime() - cpu_time;
// }
}

View File

@ -136,9 +136,9 @@ void PairLJExpandCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -120,9 +120,9 @@ void PairLJExpandGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -122,9 +122,9 @@ void PairLJGromacsGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -139,12 +139,12 @@ void PairLJSDKCoulLongGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
if (evflag) {
if (eflag) cpu_compute<1,1>(host_start, inum, ilist, numneigh, firstneigh);
else cpu_compute<1,0>(host_start, inum, ilist, numneigh, firstneigh);
} else cpu_compute<0,0>(host_start, inum, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -122,12 +122,12 @@ void PairLJSDKGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
if (evflag) {
if (eflag) cpu_compute<1,1>(host_start, inum, ilist, numneigh, firstneigh);
else cpu_compute<1,0>(host_start, inum, ilist, numneigh, firstneigh);
} else cpu_compute<0,0>(host_start, inum, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -127,9 +127,9 @@ void PairLJSFDipoleSFGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -115,9 +115,9 @@ void PairLJSmoothGPU::compute(int eflag, int vflag)
if (!success) error->one(FLERR, "Insufficient memory on accelerator");
if (host_start < inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
//fprintf("LJ_SMOOTH_GPU");
}

View File

@ -118,9 +118,9 @@ void PairMIECutGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -116,9 +116,9 @@ void PairMorseGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -147,9 +147,9 @@ void PairRESquaredGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start < inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -121,9 +121,9 @@ void PairSoftGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -120,9 +120,9 @@ void PairTableGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -122,9 +122,9 @@ void PairUFMGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -126,9 +126,9 @@ void PairYukawaColloidGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -118,9 +118,9 @@ void PairYukawaGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -120,9 +120,9 @@ void PairZBLGPU::compute(int eflag, int vflag)
error->one(FLERR,"Insufficient memory on accelerator");
if (host_start<inum) {
cpu_time = MPI_Wtime();
cpu_time = platform::walltime();
cpu_compute(host_start, inum, eflag, vflag, ilist, numneigh, firstneigh);
cpu_time = MPI_Wtime() - cpu_time;
cpu_time = platform::walltime() - cpu_time;
}
}

View File

@ -245,7 +245,7 @@ void PPPMGPU::compute(int eflag, int vflag)
if (triclinic) make_rho();
double t3 = MPI_Wtime();
double t3 = platform::walltime();
// all procs communicate density values from their ghost cells
// to fully sum contribution in their 3d bricks
@ -288,7 +288,7 @@ void PPPMGPU::compute(int eflag, int vflag)
FORWARD_IK_PERATOM,gc_buf1,gc_buf2,MPI_FFT_SCALAR);
}
poisson_time += MPI_Wtime()-t3;
poisson_time += platform::walltime()-t3;
// calculate the force on my particles

View File

@ -911,7 +911,7 @@ template <class ft, class acc_t>
void FixIntel::add_off_results(const ft * _noalias const f_in,
const acc_t * _noalias const ev_global) {
if (_offload_balance < 0.0)
_balance_other_time = MPI_Wtime() - _balance_other_time;
_balance_other_time = platform::walltime() - _balance_other_time;
start_watch(TIME_OFFLOAD_WAIT);
#ifdef _LMP_INTEL_OFFLOAD

View File

@ -377,7 +377,7 @@ char *do_query(const std::string &qfunction, const std::string &mname,
}
auto user_agent = fmt::format("kim query--LAMMPS/{} ({})",
LAMMPS_VERSION, Info::get_os_info());
LAMMPS_VERSION, platform::os_info());
curl_easy_setopt(handle, CURLOPT_USERAGENT, user_agent.c_str());
curl_easy_setopt(handle, CURLOPT_URL, url.c_str());

View File

@ -68,14 +68,14 @@ void BondClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
//if(k_eatom.extent(0)<maxeatom) { // won't work without adding zero functor
memoryKK->destroy_kokkos(k_eatom,eatom);
memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"improper:eatom");
d_eatom = k_eatom.template view<DeviceType>();
d_eatom = k_eatom.template view<KKDeviceType>();
//}
}
if (vflag_atom) {
//if(k_vatom.extent(0)<maxvatom) { // won't work without adding zero functor
memoryKK->destroy_kokkos(k_vatom,vatom);
memoryKK->create_kokkos(k_vatom,vatom,maxvatom,"improper:vatom");
d_vatom = k_vatom.template view<DeviceType>();
d_vatom = k_vatom.template view<KKDeviceType>();
//}
}
@ -210,10 +210,10 @@ void BondClass2Kokkos<DeviceType>::coeff(int narg, char **arg)
BondClass2::coeff(narg, arg);
int n = atom->nbondtypes;
Kokkos::DualView<F_FLOAT*,DeviceType> k_k2("BondClass2::k2",n+1);
Kokkos::DualView<F_FLOAT*,DeviceType> k_k3("BondClass2::k3",n+1);
Kokkos::DualView<F_FLOAT*,DeviceType> k_k4("BondClass2::k4",n+1);
Kokkos::DualView<F_FLOAT*,DeviceType> k_r0("BondClass2::r0",n+1);
typename AT::tdual_ffloat_1d k_k2("BondClass2::k2",n+1);
typename AT::tdual_ffloat_1d k_k3("BondClass2::k3",n+1);
typename AT::tdual_ffloat_1d k_k4("BondClass2::k4",n+1);
typename AT::tdual_ffloat_1d k_r0("BondClass2::r0",n+1);
d_k2 = k_k2.template view<DeviceType>();
d_k3 = k_k3.template view<DeviceType>();
@ -247,10 +247,10 @@ void BondClass2Kokkos<DeviceType>::read_restart(FILE *fp)
BondClass2::read_restart(fp);
int n = atom->nbondtypes;
Kokkos::DualView<F_FLOAT*,DeviceType> k_k2("BondClass2::k2",n+1);
Kokkos::DualView<F_FLOAT*,DeviceType> k_k3("BondClass2::k3",n+1);
Kokkos::DualView<F_FLOAT*,DeviceType> k_k4("BondClass2::k4",n+1);
Kokkos::DualView<F_FLOAT*,DeviceType> k_r0("BondClass2::r0",n+1);
typename AT::tdual_ffloat_1d k_k2("BondClass2::k2",n+1);
typename AT::tdual_ffloat_1d k_k3("BondClass2::k3",n+1);
typename AT::tdual_ffloat_1d k_k4("BondClass2::k4",n+1);
typename AT::tdual_ffloat_1d k_r0("BondClass2::r0",n+1);
d_k2 = k_k2.template view<DeviceType>();
d_k3 = k_k3.template view<DeviceType>();

View File

@ -67,10 +67,11 @@ class BondClass2Kokkos : public BondClass2 {
typename Kokkos::View<double*[3],typename AT::t_f_array::array_layout,typename KKDevice<DeviceType>::value,Kokkos::MemoryTraits<Kokkos::Atomic> > f;
typename AT::t_int_2d bondlist;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,DeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,DeviceType> k_vatom;
Kokkos::View<E_FLOAT*,Kokkos::LayoutRight,typename KKDevice<DeviceType>::value,Kokkos::MemoryTraits<Kokkos::Atomic> > d_eatom;
Kokkos::View<F_FLOAT*[6],Kokkos::LayoutRight,typename KKDevice<DeviceType>::value,Kokkos::MemoryTraits<Kokkos::Atomic> > d_vatom;
typedef typename KKDevice<DeviceType>::value KKDeviceType;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
Kokkos::View<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > d_eatom;
Kokkos::View<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > d_vatom;
int nlocal,newton_bond;
int eflag,vflag;

View File

@ -173,8 +173,6 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::compute_peratom()
x = atomKK->k_x.view<DeviceType>();
mask = atomKK->k_mask.view<DeviceType>();
Kokkos::deep_copy(d_qnm,{0.0,0.0});
int vector_length_default = 1;
int team_size_default = 1;
if (!host_flag)
@ -185,6 +183,8 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::compute_peratom()
if (chunk_size > inum - chunk_offset)
chunk_size = inum - chunk_offset;
Kokkos::deep_copy(d_qnm,{0.0,0.0});
//Neigh
{
int vector_length = vector_length_default;
@ -286,7 +286,7 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::operator() (TagComputeOrientOrder
const int i = d_ilist[ii + chunk_offset];
const int ncount = d_ncount(ii);
// if not nnn neighbors, order parameter = 0;
// if not nnn neighbors, order parameter = 0
if ((ncount == 0) || (ncount < nnn)) {
for (int jj = 0; jj < ncol; jj++)
@ -316,7 +316,7 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::operator() (TagComputeOrientOrder
const int ncount = d_ncount(ii);
if (jj >= ncount) return;
// if not nnn neighbors, order parameter = 0;
// if not nnn neighbors, order parameter = 0
if ((ncount == 0) || (ncount < nnn))
return;
@ -328,6 +328,12 @@ template<class DeviceType>
KOKKOS_INLINE_FUNCTION
void ComputeOrientOrderAtomKokkos<DeviceType>::operator() (TagComputeOrientOrderAtomBOOP2,const int& ii) const {
const int ncount = d_ncount(ii);
// if not nnn neighbors, order parameter = 0
if ((ncount == 0) || (ncount < nnn))
return;
calc_boop2(ncount, ii);
}

View File

@ -54,7 +54,7 @@ namespace /* anonymous */
{
typedef double TimerType;
TimerType getTimeStamp(void) { return MPI_Wtime(); }
TimerType getTimeStamp(void) { return platform::walltime(); }
double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; }
} // end namespace
@ -2075,7 +2075,7 @@ void FixRxKokkos<DeviceType>::computeLocalTemperature()
// Local list views. (This isn't working!)
NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list);
if (not(list->kokkos))
if (!list->kokkos)
error->one(FLERR,"list is not a Kokkos list\n");
//typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors = k_list->d_neighbors;

View File

@ -23,7 +23,15 @@
#include <cstring>
#include <cctype>
#include <csignal>
#include <unistd.h>
#if defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> // for _getpid()
#else
#include <unistd.h> // for getpid()
#endif
#ifdef LMP_KOKKOS_GPU
@ -591,6 +599,10 @@ int KokkosLMP::neigh_count(int m)
void KokkosLMP::my_signal_handler(int sig)
{
if (sig == SIGSEGV) {
#if defined(_WIN32)
kill(_getpid(),SIGABRT);
#else
kill(getpid(),SIGABRT);
#endif
}
}

View File

@ -38,7 +38,20 @@ ModifyKokkos::ModifyKokkos(LAMMPS *lmp) : Modify(lmp)
void ModifyKokkos::setup(int vflag)
{
// compute setup needs to come before fix setup
// b/c NH fixes need use DOF of temperature computes
// b/c NH fixes need DOF of temperature computes
// fix group setup() is special case since populates a dynamic group
// needs to be done before temperature compute setup
for (int i = 0; i < nfix; i++) {
if (strcmp(fix[i]->style,"GROUP") == 0) {
atomKK->sync(fix[i]->execution_space,fix[i]->datamask_read);
int prev_auto_sync = lmp->kokkos->auto_sync;
if (!fix[i]->kokkosable) lmp->kokkos->auto_sync = 1;
fix[i]->setup(vflag);
lmp->kokkos->auto_sync = prev_auto_sync;
atomKK->modified(fix[i]->execution_space,fix[i]->datamask_modify);
}
}
for (int i = 0; i < ncompute; i++) compute[i]->setup();
@ -124,6 +137,37 @@ void ModifyKokkos::setup_pre_neighbor()
}
}
/* ----------------------------------------------------------------------
setup post_neighbor call, only for fixes that define post_neighbor
called from Verlet, RESPA
------------------------------------------------------------------------- */
void ModifyKokkos::setup_post_neighbor()
{
if (update->whichflag == 1)
for (int i = 0; i < n_post_neighbor; i++) {
atomKK->sync(fix[list_post_neighbor[i]]->execution_space,
fix[list_post_neighbor[i]]->datamask_read);
int prev_auto_sync = lmp->kokkos->auto_sync;
if (!fix[list_post_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
fix[list_post_neighbor[i]]->setup_post_neighbor();
lmp->kokkos->auto_sync = prev_auto_sync;
atomKK->modified(fix[list_post_neighbor[i]]->execution_space,
fix[list_post_neighbor[i]]->datamask_modify);
}
else if (update->whichflag == 2)
for (int i = 0; i < n_min_post_neighbor; i++) {
atomKK->sync(fix[list_min_post_neighbor[i]]->execution_space,
fix[list_min_post_neighbor[i]]->datamask_read);
int prev_auto_sync = lmp->kokkos->auto_sync;
if (!fix[list_min_post_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
fix[list_min_post_neighbor[i]]->setup_post_neighbor();
lmp->kokkos->auto_sync = prev_auto_sync;
atomKK->modified(fix[list_min_post_neighbor[i]]->execution_space,
fix[list_min_post_neighbor[i]]->datamask_modify);
}
}
/* ----------------------------------------------------------------------
setup pre_force call, only for fixes that define pre_force
called from Verlet, RESPA, Min
@ -258,6 +302,24 @@ void ModifyKokkos::pre_neighbor()
}
}
/* ----------------------------------------------------------------------
post_neighbor call, only for relevant fixes
------------------------------------------------------------------------- */
void ModifyKokkos::post_neighbor()
{
for (int i = 0; i < n_post_neighbor; i++) {
atomKK->sync(fix[list_post_neighbor[i]]->execution_space,
fix[list_post_neighbor[i]]->datamask_read);
int prev_auto_sync = lmp->kokkos->auto_sync;
if (!fix[list_post_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
fix[list_post_neighbor[i]]->post_neighbor();
lmp->kokkos->auto_sync = prev_auto_sync;
atomKK->modified(fix[list_post_neighbor[i]]->execution_space,
fix[list_post_neighbor[i]]->datamask_modify);
}
}
/* ----------------------------------------------------------------------
pre_force call, only for relevant fixes
------------------------------------------------------------------------- */
@ -420,6 +482,12 @@ void ModifyKokkos::post_run()
atomKK->modified(fix[i]->execution_space,
fix[i]->datamask_modify);
}
// must reset this to its default value, since computes may be added
// or removed between runs and with this change we will redirect any
// calls to addstep_compute() to addstep_compute_all() instead.
n_timeflag = -1;
}
/* ----------------------------------------------------------------------
@ -567,6 +635,24 @@ void ModifyKokkos::min_pre_neighbor()
}
}
/* ----------------------------------------------------------------------
minimizer post-neighbor call, only for relevant fixes
------------------------------------------------------------------------- */
void ModifyKokkos::min_post_neighbor()
{
for (int i = 0; i < n_min_post_neighbor; i++) {
atomKK->sync(fix[list_min_post_neighbor[i]]->execution_space,
fix[list_min_post_neighbor[i]]->datamask_read);
int prev_auto_sync = lmp->kokkos->auto_sync;
if (!fix[list_min_post_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
fix[list_min_post_neighbor[i]]->min_post_neighbor();
lmp->kokkos->auto_sync = prev_auto_sync;
atomKK->modified(fix[list_min_post_neighbor[i]]->execution_space,
fix[list_min_post_neighbor[i]]->datamask_modify);
}
}
/* ----------------------------------------------------------------------
minimizer pre-force call, only for relevant fixes
------------------------------------------------------------------------- */
@ -646,7 +732,7 @@ double ModifyKokkos::min_energy(double *fextra)
}
/* ----------------------------------------------------------------------
store current state of extra dof, only for relevant fixes
store current state of extra minimizer dof, only for relevant fixes
------------------------------------------------------------------------- */
void ModifyKokkos::min_store()
@ -664,7 +750,7 @@ void ModifyKokkos::min_store()
}
/* ----------------------------------------------------------------------
mange state of extra dof on a stack, only for relevant fixes
manage state of extra minimizer dof on a stack, only for relevant fixes
------------------------------------------------------------------------- */
void ModifyKokkos::min_clearstore()
@ -710,7 +796,7 @@ void ModifyKokkos::min_popstore()
}
/* ----------------------------------------------------------------------
displace extra dof along vector hextra, only for relevant fixes
displace extra minimizer dof along vector hextra, only for relevant fixes
------------------------------------------------------------------------- */
void ModifyKokkos::min_step(double alpha, double *hextra)
@ -755,7 +841,7 @@ double ModifyKokkos::max_alpha(double *hextra)
}
/* ----------------------------------------------------------------------
extract extra dof for minimization, only for relevant fixes
extract extra minimizer dof, only for relevant fixes
------------------------------------------------------------------------- */
int ModifyKokkos::min_dof()
@ -775,7 +861,7 @@ int ModifyKokkos::min_dof()
}
/* ----------------------------------------------------------------------
reset reference state of fix, only for relevant fixes
reset minimizer reference state of fix, only for relevant fixes
------------------------------------------------------------------------- */
int ModifyKokkos::min_reset_ref()
@ -788,8 +874,8 @@ int ModifyKokkos::min_reset_ref()
int prev_auto_sync = lmp->kokkos->auto_sync;
if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
itmp = fix[list_min_energy[i]]->min_reset_ref();
lmp->kokkos->auto_sync = prev_auto_sync;
if (itmp) itmpall = 1;
lmp->kokkos->auto_sync = prev_auto_sync;
atomKK->modified(fix[list_min_energy[i]]->execution_space,
fix[list_min_energy[i]]->datamask_modify);
}

View File

@ -26,6 +26,7 @@ class ModifyKokkos : public Modify {
void setup(int);
void setup_pre_exchange();
void setup_pre_neighbor();
void setup_post_neighbor();
void setup_pre_force(int);
void setup_pre_reverse(int, int);
void initial_integrate(int);
@ -33,6 +34,7 @@ class ModifyKokkos : public Modify {
void pre_decide();
void pre_exchange();
void pre_neighbor();
void post_neighbor();
void pre_force(int);
void pre_reverse(int,int);
void post_force(int);
@ -52,6 +54,7 @@ class ModifyKokkos : public Modify {
void min_pre_exchange();
void min_pre_neighbor();
void min_post_neighbor();
void min_pre_force(int);
void min_pre_reverse(int,int);
void min_post_force(int);

Some files were not shown because too many files have changed in this diff Show More