Merge pull request #3322 from akohlmey/collected-small-fixes
Collected small fixes
This commit is contained in:
@ -6,6 +6,9 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||
"Please remove CMakeCache.txt and CMakeFiles first.")
|
||||
endif()
|
||||
|
||||
set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty"
|
||||
CACHE STRING "URL for thirdparty package downloads")
|
||||
|
||||
# global LAMMPS/plugin build settings
|
||||
set(LAMMPS_SOURCE_DIR "" CACHE PATH "Location of LAMMPS sources folder")
|
||||
if(NOT LAMMPS_SOURCE_DIR)
|
||||
@ -78,6 +81,13 @@ function(get_newest_file path variable)
|
||||
set(${variable} ${_bestfile} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# get LAMMPS version date
|
||||
function(get_lammps_version version_header variable)
|
||||
file(STRINGS ${version_header} line REGEX LAMMPS_VERSION)
|
||||
string(REGEX REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z]+) ([0-9]+)\"" "\\1\\2\\3" date "${line}")
|
||||
set(${variable} "${date}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#################################################################################
|
||||
# LAMMPS C++ interface. We only need the header related parts except on windows.
|
||||
add_library(lammps INTERFACE)
|
||||
@ -89,6 +99,7 @@ endif()
|
||||
################################################################################
|
||||
# MPI configuration
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
find_package(MPI QUIET)
|
||||
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||
else()
|
||||
|
||||
@ -27,6 +27,9 @@ dump command
|
||||
:doc:`dump custom/adios <dump_adios>` command
|
||||
=============================================
|
||||
|
||||
:doc:`dump cfg/uef <dump_cfg_uef>` command
|
||||
==========================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
@ -36,7 +39,7 @@ Syntax
|
||||
|
||||
* ID = user-assigned name for the dump
|
||||
* group-ID = ID of the group of atoms to be dumped
|
||||
* style = *atom* or *atom/gz* or *atom/zstd or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* or *yaml*
|
||||
* style = *atom* or *atom/gz* or *atom/zstd or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* or *yaml*
|
||||
* N = dump every this many timesteps
|
||||
* file = name of file to write dump info to
|
||||
* args = list of arguments for a particular style
|
||||
@ -47,22 +50,23 @@ Syntax
|
||||
*atom/gz* args = none
|
||||
*atom/zstd* args = none
|
||||
*atom/mpiio* args = none
|
||||
*atom/adios* args = none, discussed on :doc:`dump atom/adios <dump_adios>` doc page
|
||||
*atom/adios* args = none, discussed on :doc:`dump atom/adios <dump_adios>` page
|
||||
*cfg* args = same as *custom* args, see below
|
||||
*cfg/gz* args = same as *custom* args, see below
|
||||
*cfg/zstd* args = same as *custom* args, see below
|
||||
*cfg/mpiio* args = same as *custom* args, see below
|
||||
*cfg/uef* args = same as *custom* args, discussed on :doc:`dump cfg/uef <dump_cfg_uef>` page
|
||||
*custom*, *custom/gz*, *custom/zstd*, *custom/mpiio* args = see below
|
||||
*custom/adios* args = same as *custom* args, discussed on :doc:`dump custom/adios <dump_adios>` doc page
|
||||
*custom/adios* args = same as *custom* args, discussed on :doc:`dump custom/adios <dump_adios>` page
|
||||
*dcd* args = none
|
||||
*h5md* args = discussed on :doc:`dump h5md <dump_h5md>` doc page
|
||||
*image* args = discussed on :doc:`dump image <dump_image>` doc page
|
||||
*h5md* args = discussed on :doc:`dump h5md <dump_h5md>` page
|
||||
*image* args = discussed on :doc:`dump image <dump_image>` page
|
||||
*local*, *local/gz*, *local/zstd* args = see below
|
||||
*molfile* args = discussed on :doc:`dump molfile <dump_molfile>` doc page
|
||||
*movie* args = discussed on :doc:`dump image <dump_image>` doc page
|
||||
*netcdf* args = discussed on :doc:`dump netcdf <dump_netcdf>` doc page
|
||||
*netcdf/mpiio* args = discussed on :doc:`dump netcdf <dump_netcdf>` doc page
|
||||
*vtk* args = same as *custom* args, see below, also :doc:`dump vtk <dump_vtk>` doc page
|
||||
*molfile* args = discussed on :doc:`dump molfile <dump_molfile>` page
|
||||
*movie* args = discussed on :doc:`dump image <dump_image>` page
|
||||
*netcdf* args = discussed on :doc:`dump netcdf <dump_netcdf>` page
|
||||
*netcdf/mpiio* args = discussed on :doc:`dump netcdf <dump_netcdf>` page
|
||||
*vtk* args = same as *custom* args, see below, also :doc:`dump vtk <dump_vtk>` page
|
||||
*xtc* args = none
|
||||
*xyz* args = none
|
||||
*xyz/gz* args = none
|
||||
@ -155,7 +159,7 @@ timesteps in one of several styles. The *image* and *movie* styles are
|
||||
the exception: the *image* style renders a JPG, PNG, or PPM image file
|
||||
of the atom configuration every N timesteps while the *movie* style
|
||||
combines and compresses them into a movie file; both are discussed in
|
||||
detail on the :doc:`dump image <dump_image>` doc page. The timesteps on
|
||||
detail on the :doc:`dump image <dump_image>` page. The timesteps on
|
||||
which dump output is written can also be controlled by a variable.
|
||||
See the :doc:`dump_modify every <dump_modify>` command.
|
||||
|
||||
@ -194,7 +198,7 @@ or multiple smaller files).
|
||||
For the *atom*, *custom*, *cfg*, and *local* styles, sorting is off by
|
||||
default. For the *dcd*, *xtc*, *xyz*, and *molfile* styles, sorting
|
||||
by atom ID is on by default. See the :doc:`dump_modify <dump_modify>`
|
||||
doc page for details.
|
||||
page for details.
|
||||
|
||||
The *atom/gz*, *cfg/gz*, *custom/gz*, *local/gz*, and *xyz/gz* styles
|
||||
are identical in command syntax to the corresponding styles without
|
||||
@ -204,7 +208,7 @@ alternative approach to writing compressed files via a pipe, as done
|
||||
by the regular dump styles, which may be required on clusters where
|
||||
the interface to the high-speed network disallows using the fork()
|
||||
library call (which is needed for a pipe). For the remainder of this
|
||||
doc page, you should thus consider the *atom* and *atom/gz* styles
|
||||
page, you should thus consider the *atom* and *atom/gz* styles
|
||||
(etc) to be inter-changeable, with the exception of the required
|
||||
filename suffix.
|
||||
|
||||
@ -218,7 +222,7 @@ As explained below, the *atom/mpiio*, *cfg/mpiio*, *custom/mpiio*, and
|
||||
*xyz/mpiio* styles are identical in command syntax and in the format
|
||||
of the dump files they create, to the corresponding styles without
|
||||
"mpiio", except the single dump file they produce is written in
|
||||
parallel via the MPI-IO library. For the remainder of this doc page,
|
||||
parallel via the MPI-IO library. For the remainder of this page,
|
||||
you should thus consider the *atom* and *atom/mpiio* styles (etc) to
|
||||
be inter-changeable. The one exception is how the filename is
|
||||
specified for the MPI-IO styles, as explained below.
|
||||
@ -664,7 +668,7 @@ so that each value is 0.0 to 1.0. If the simulation box is triclinic
|
||||
(tilted), then all atom coords will still be between 0.0 and 1.0.
|
||||
I.e. actual unscaled (x,y,z) = xs\*A + ys\*B + zs\*C, where (A,B,C) are
|
||||
the non-orthogonal vectors of the simulation box edges, as discussed
|
||||
on the :doc:`Howto triclinic <Howto_triclinic>` doc page.
|
||||
on the :doc:`Howto triclinic <Howto_triclinic>` page.
|
||||
|
||||
Use *xu*, *yu*, *zu* if you want the coordinates "unwrapped" by the
|
||||
image flags for each atom. Unwrapped means that if the atom has
|
||||
@ -787,7 +791,7 @@ more info.
|
||||
The *atom/mpiio*, *cfg/mpiio*, *custom/mpiio*, and *xyz/mpiio* styles
|
||||
are part of the MPIIO package. They are only enabled if LAMMPS was
|
||||
built with that package. See the :doc:`Build package <Build_package>`
|
||||
doc page for more info.
|
||||
page for more info.
|
||||
|
||||
The *xtc*, *dcd* and *yaml* styles are part of the EXTRA-DUMP package.
|
||||
They are only enabled if LAMMPS was built with that package. See the
|
||||
@ -797,12 +801,12 @@ Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`dump atom/adios <dump_adios>`, :doc:`dump custom/adios <dump_adios>`,
|
||||
:doc:`dump h5md <dump_h5md>`, :doc:`dump image <dump_image>`,
|
||||
:doc:`dump molfile <dump_molfile>`, :doc:`dump_modify <dump_modify>`,
|
||||
:doc:`undump <undump>`
|
||||
:doc:`dump cfg/uef <dump_cfg_uef>`, :doc:`dump h5md <dump_h5md>`,
|
||||
:doc:`dump image <dump_image>`, :doc:`dump molfile <dump_molfile>`,
|
||||
:doc:`dump_modify <dump_modify>`, :doc:`undump <undump>`, :doc:`write_dump <write_dump>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The defaults for the *image* and *movie* styles are listed on the
|
||||
:doc:`dump image <dump_image>` doc page.
|
||||
:doc:`dump image <dump_image>` page.
|
||||
|
||||
@ -31,6 +31,23 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
|
||||
endif()
|
||||
|
||||
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION)
|
||||
find_program(MAKENSIS_PATH makensis)
|
||||
if(MAKENSIS_PATH)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/lammps.ico
|
||||
${CMAKE_SOURCE_DIR}/lammps-text-logo-wide.bmp ${CMAKE_SOURCE_DIR}/paceplugin.nsis ${CMAKE_BINARY_DIR})
|
||||
if(BUILD_MPI)
|
||||
add_custom_target(package ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MPI paceplugin.nsis
|
||||
DEPENDS paceplugin
|
||||
BYPRODUCTS LAMMPS-ML-PACE-plugin-${LAMMPS_VERSION}-MPI.exe)
|
||||
else()
|
||||
add_custom_target(package ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION} paceplugin.nsis
|
||||
COMMAND ${CMAKE_COMMAND} -E echo ${PWD}
|
||||
DEPENDS paceplugin lammps.ico lammps-text-logo-wide.bmp paceplugin.nsis
|
||||
BYPRODUCTS LAMMPS-ML-PACE-plugin-${LAMMPS_VERSION}.exe)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-rdynamic")
|
||||
endif()
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
# Cmake script code to define the LAMMPS C++ interface
|
||||
# settings required for building LAMMPS plugins
|
||||
|
||||
set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty"
|
||||
CACHE STRING "URL for thirdparty package downloads")
|
||||
|
||||
################################################################################
|
||||
# helper function
|
||||
function(validate_option name values)
|
||||
@ -37,10 +40,56 @@ else()
|
||||
endif()
|
||||
|
||||
if(BUILD_MPI)
|
||||
find_package(MPI REQUIRED)
|
||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||
if(LAMMPS_LONGLONG_TO_LONG)
|
||||
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
# do not include the (obsolete) MPI C++ bindings which makes
|
||||
# for leaner object files and avoids namespace conflicts
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||
# Download and configure custom MPICH files for Windows
|
||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
else()
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
else()
|
||||
find_package(MPI REQUIRED)
|
||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||
if(LAMMPS_LONGLONG_TO_LONG)
|
||||
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(lammps INTERFACE MPI::MPI_CXX)
|
||||
else()
|
||||
|
||||
@ -4803,6 +4803,7 @@ double Variable::evaluate_boolean(char *str)
|
||||
} else if (opprevious == LT) {
|
||||
if (flag1 || flag2)
|
||||
error->all(FLERR,"If command boolean can only operate on numbers");
|
||||
if (value1 < value2) argstack[nargstack].value = 1.0;
|
||||
else argstack[nargstack].value = 0.0;
|
||||
} else if (opprevious == LE) {
|
||||
if (flag1 || flag2)
|
||||
|
||||
@ -403,11 +403,36 @@ TEST_F(VariableTest, IfCommand)
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*nope\?.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if 0<1 then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if 2<1 then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*nope\?.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*nope\?.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (0<=0) then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (0>=1) then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*nope\?.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (1>=1) then 'print \"bingo!\"' else 'print \"nope?\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(text, ContainsRegex(".*bingo!.*"));
|
||||
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'");
|
||||
text = END_CAPTURE_OUTPUT();
|
||||
|
||||
@ -10,11 +10,6 @@ if(NOT CMAKE_Fortran_COMPILER_ID)
|
||||
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: cannot identify Fortran compiler")
|
||||
return()
|
||||
endif()
|
||||
find_package(MPI QUIET)
|
||||
if(BUILD_MPI AND NOT MPI_Fortran)
|
||||
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no MPI support for Fortran")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER)
|
||||
enable_language(C)
|
||||
@ -22,6 +17,10 @@ if(CMAKE_Fortran_COMPILER)
|
||||
get_filename_component(LAMMPS_FORTRAN_MODULE ${LAMMPS_SOURCE_DIR}/../fortran/lammps.f90 ABSOLUTE)
|
||||
if(BUILD_MPI)
|
||||
find_package(MPI REQUIRED)
|
||||
if((NOT MPI_Fortran) OR (NOT MPI_Fortran_HAVE_F77_HEADER) OR (NOT MPI_Fortran_HAVE_F90_MODULE))
|
||||
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no MPI support for Fortran")
|
||||
return()
|
||||
endif()
|
||||
else()
|
||||
add_library(fmpi_stubs STATIC mpi_stubs.f90)
|
||||
add_library(MPI::MPI_Fortran ALIAS fmpi_stubs)
|
||||
|
||||
Reference in New Issue
Block a user