Merging to stay up-to-date

Merge remote-tracking branch 'lammps_upstream/master' into log_spacing
This commit is contained in:
Vishnu V. Krishnan
2019-06-01 10:33:27 +05:30
48 changed files with 670 additions and 214 deletions

View File

@ -87,7 +87,8 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
# this is fast, so check for it all the time
message(STATUS "Running check for auto-generated files from make-based build system")
file(GLOB SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/style_*.h)
list(APPEND SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/lmpinstalledpkgs.h ${LAMMPS_SOURCE_DIR}/lmpgitversion.h)
file(GLOB SRC_AUTOGEN_PACKAGES ${LAMMPS_SOURCE_DIR}/packages_*.h)
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${LAMMPS_SOURCE_DIR}/lmpinstalledpkgs.h ${LAMMPS_SOURCE_DIR}/lmpgitversion.h)
foreach(_SRC ${SRC_AUTOGEN_FILES})
get_filename_component(FILENAME "${_SRC}" NAME)
if(EXISTS ${LAMMPS_SOURCE_DIR}/${FILENAME})
@ -172,21 +173,17 @@ set(LAMMPS_LINK_LIBS)
set(LAMMPS_DEPS)
set(LAMMPS_API_DEFINES)
set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR
KSPACE MANYBODY MC MESSAGE MISC MOLECULE PERI REPLICA RIGID SHOCK
SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI POEMS LATTE USER-ATC USER-AWPMD
USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD
USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF
USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC USER-SCAFACOS
USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK
USER-QUIP USER-QMMM USER-YAFF USER-ADIOS)
set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MOLECULE PERI POEMS QEQ
REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB
USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE
USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC
USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF
USER-VTK USER-QUIP USER-QMMM USER-YAFF USER-ADIOS)
set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU)
set(OTHER_PACKAGES CORESHELL QEQ)
foreach(PKG ${DEFAULT_PACKAGES})
option(PKG_${PKG} "Build ${PKG} Package" OFF)
endforeach()
foreach(PKG ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
option(PKG_${PKG} "Build ${PKG} Package" OFF)
endforeach()
@ -203,7 +200,6 @@ endif()
include_directories(${LAMMPS_SOURCE_DIR})
if(PKG_USER-ADIOS)
# The search for ADIOS2 must come before MPI because
# it includes its own MPI search with the latest FindMPI.cmake
@ -213,7 +209,6 @@ if(PKG_USER-ADIOS)
list(APPEND LAMMPS_LINK_LIBS adios2::adios2)
endif()
# do MPI detection after language activation, if MPI for these language is required
find_package(MPI QUIET)
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
@ -233,7 +228,6 @@ else()
list(APPEND LAMMPS_LINK_LIBS mpi_stubs)
endif()
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
@ -322,7 +316,18 @@ pkg_depends(USER-SCAFACOS MPI)
include(CheckIncludeFileCXX)
find_package(OpenMP QUIET)
option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND})
# TODO: this is a temporary workaround until a better solution is found. AK 2019-05-30
# GNU GCC 9.x uses settings incompatible with our use of 'default(none)' in OpenMP pragmas
# where we assume older GCC semantics. For the time being, we disable OpenMP by default
# for GCC 9.x and beyond. People may manually turn it on, but need to run the script
# src/USER-OMP/hack_openmp_for_pgi_gcc9.sh on all sources to make it compatible with gcc 9.
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0.0))
option(BUILD_OMP "Build with OpenMP support" OFF)
else()
option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND})
endif()
if(BUILD_OMP)
find_package(OpenMP REQUIRED)
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
@ -446,7 +451,6 @@ else()
set(CUDA_REQUEST_PIC)
endif()
if(PKG_VORONOI)
find_package(VORO)
if(VORO_FOUND)
@ -895,6 +899,8 @@ foreach(PKG ${DEFAULT_PACKAGES})
list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
include_directories(${${PKG}_SOURCES_DIR})
endif()
RegisterPackages(${${PKG}_SOURCES_DIR})
endforeach()
# packages that need defines set
@ -913,6 +919,8 @@ foreach(PKG ${ACCEL_PACKAGES})
# check for package files in src directory due to old make system
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
RegisterPackages(${${PKG}_SOURCES_DIR})
endforeach()
##############################################
@ -961,7 +969,6 @@ if(PKG_USER-H5MD)
include_directories(${HDF5_INCLUDE_DIRS})
endif()
######################################################################
# packages which selectively include variants based on enabled styles
# e.g. accelerator packages
@ -1438,10 +1445,12 @@ endif()
######################################################
# Generate style headers based on global list of
# styles registered during package selection
# Generate packages headers from all packages
######################################################
set(LAMMPS_STYLE_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/styles)
GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR})
GeneratePackagesHeaders(${LAMMPS_STYLE_HEADERS_DIR})
include_directories(${LAMMPS_STYLE_HEADERS_DIR})
@ -1450,7 +1459,7 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR})
######################################
set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n")
set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] = {\n")
set(temp_PKG_LIST ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
set(temp_PKG_LIST ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
list(SORT temp_PKG_LIST)
foreach(PKG ${temp_PKG_LIST})
if(PKG_${PKG})
@ -1529,8 +1538,6 @@ if(BUILD_EXE)
endif()
###############################################################################
# Build documentation
###############################################################################
@ -1683,7 +1690,7 @@ endif()
###############################################################################
# Print package summary
###############################################################################
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
if(PKG_${PKG})
message(STATUS "Building package: ${PKG}")
endif()

View File

@ -181,3 +181,88 @@ function(DetectBuildSystemConflict lammps_src_dir)
endforeach()
endif()
endfunction(DetectBuildSystemConflict)
function(FindPackagesHeaders path style_class file_pattern headers)
file(GLOB files "${path}/${file_pattern}*.h")
get_property(plist GLOBAL PROPERTY ${headers})
foreach(file_name ${files})
file(STRINGS ${file_name} is_style LIMIT_COUNT 1 REGEX ${style_class})
if(is_style)
list(APPEND plist ${file_name})
endif()
endforeach()
set_property(GLOBAL PROPERTY ${headers} "${plist}")
endfunction(FindPackagesHeaders)
function(RegisterPackages search_path)
FindPackagesHeaders(${search_path} ANGLE_CLASS angle_ PKGANGLE ) # angle ) # force
FindPackagesHeaders(${search_path} ATOM_CLASS atom_vec_ PKGATOM_VEC ) # atom ) # atom atom_vec_hybrid
FindPackagesHeaders(${search_path} BODY_CLASS body_ PKGBODY ) # body ) # atom_vec_body
FindPackagesHeaders(${search_path} BOND_CLASS bond_ PKGBOND ) # bond ) # force
FindPackagesHeaders(${search_path} COMMAND_CLASS "[^.]" PKGCOMMAND ) # command ) # input
FindPackagesHeaders(${search_path} COMPUTE_CLASS compute_ PKGCOMPUTE ) # compute ) # modify
FindPackagesHeaders(${search_path} DIHEDRAL_CLASS dihedral_ PKGDIHEDRAL ) # dihedral ) # force
FindPackagesHeaders(${search_path} DUMP_CLASS dump_ PKGDUMP ) # dump ) # output write_dump
FindPackagesHeaders(${search_path} FIX_CLASS fix_ PKGFIX ) # fix ) # modify
FindPackagesHeaders(${search_path} IMPROPER_CLASS improper_ PKGIMPROPER ) # improper ) # force
FindPackagesHeaders(${search_path} INTEGRATE_CLASS "[^.]" PKGINTEGRATE ) # integrate ) # update
FindPackagesHeaders(${search_path} KSPACE_CLASS "[^.]" PKGKSPACE ) # kspace ) # force
FindPackagesHeaders(${search_path} MINIMIZE_CLASS min_ PKGMINIMIZE ) # minimize ) # update
FindPackagesHeaders(${search_path} NBIN_CLASS nbin_ PKGNBIN ) # nbin ) # neighbor
FindPackagesHeaders(${search_path} NPAIR_CLASS npair_ PKGNPAIR ) # npair ) # neighbor
FindPackagesHeaders(${search_path} NSTENCIL_CLASS nstencil_ PKGNSTENCIL ) # nstencil ) # neighbor
FindPackagesHeaders(${search_path} NTOPO_CLASS ntopo_ PKGNTOPO ) # ntopo ) # neighbor
FindPackagesHeaders(${search_path} PAIR_CLASS pair_ PKGPAIR ) # pair ) # force
FindPackagesHeaders(${search_path} READER_CLASS reader_ PKGREADER ) # reader ) # read_dump
FindPackagesHeaders(${search_path} REGION_CLASS region_ PKGREGION ) # region ) # domain
endfunction(RegisterPackages)
function(CreatePackagesHeader path filename)
set(temp "")
if(ARGC GREATER 2)
list(REMOVE_AT ARGV 0 1)
foreach(FNAME ${ARGV})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${FNAME}")
get_filename_component(DNAME ${FNAME} DIRECTORY)
get_filename_component(DNAME ${DNAME} NAME)
get_filename_component(FNAME ${FNAME} NAME)
set(temp "${temp}#undef PACKAGE\n#define PACKAGE \"${DNAME}\"\n")
set(temp "${temp}#include \"${DNAME}/${FNAME}\"\n")
endforeach()
endif()
message(STATUS "Generating ${filename}...")
file(WRITE "${path}/${filename}.tmp" "${temp}" )
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${path}/${filename}.tmp" "${path}/${filename}")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${path}/${filename}")
endfunction(CreatePackagesHeader)
function(GeneratePackagesHeader path property style)
get_property(files GLOBAL PROPERTY ${property})
CreatePackagesHeader("${path}" "packages_${style}.h" ${files})
endfunction(GeneratePackagesHeader)
function(GeneratePackagesHeaders output_path)
GeneratePackagesHeader(${output_path} PKGANGLE angle ) # force
GeneratePackagesHeader(${output_path} PKGATOM_VEC atom ) # atom atom_vec_hybrid
GeneratePackagesHeader(${output_path} PKGBODY body ) # atom_vec_body
GeneratePackagesHeader(${output_path} PKGBOND bond ) # force
GeneratePackagesHeader(${output_path} PKGCOMMAND command ) # input
GeneratePackagesHeader(${output_path} PKGCOMPUTE compute ) # modify
GeneratePackagesHeader(${output_path} PKGDIHEDRAL dihedral ) # force
GeneratePackagesHeader(${output_path} PKGDUMP dump ) # output write_dump
GeneratePackagesHeader(${output_path} PKGFIX fix ) # modify
GeneratePackagesHeader(${output_path} PKGIMPROPER improper ) # force
GeneratePackagesHeader(${output_path} PKGINTEGRATE integrate ) # update
GeneratePackagesHeader(${output_path} PKGKSPACE kspace ) # force
GeneratePackagesHeader(${output_path} PKGMINIMIZE minimize ) # update
GeneratePackagesHeader(${output_path} PKGNBIN nbin ) # neighbor
GeneratePackagesHeader(${output_path} PKGNPAIR npair ) # neighbor
GeneratePackagesHeader(${output_path} PKGNSTENCIL nstencil ) # neighbor
GeneratePackagesHeader(${output_path} PKGNTOPO ntopo ) # neighbor
GeneratePackagesHeader(${output_path} PKGPAIR pair ) # force
GeneratePackagesHeader(${output_path} PKGREADER reader ) # read_dump
GeneratePackagesHeader(${output_path} PKGREGION region ) # domain
endfunction(GeneratePackagesHeaders)

View File

@ -1,4 +1,4 @@
.TH LAMMPS "15 May 2019" "2019-05-15"
.TH LAMMPS "31 May 2019" "2019-05-31"
.SH NAME
.B LAMMPS
\- Molecular Dynamics Simulator.

View File

@ -5828,6 +5828,12 @@ Must have periodic x,y dimensions and non-periodic z dimension to use
Must have periodic x,y dimensions and non-periodic z dimension to use
2d slab option with pppm/disp. :dd
{Incorrect conversion in format string} :dt
A format style variable was not using either a %f, a %g, or a %e conversion.
Or an immediate variable with format suffix was not using either
a %f, a %g or a %e conversion in the format suffix. :dd
{Incorrect element names in ADP potential file} :dt
The element names in the ADP file do not match those requested. :dd
@ -7448,6 +7454,11 @@ The Atoms section of a data file must come before a Triangles section. :dd
The Atoms section of a data file must come before a Velocities
section. :dd
{Must re-specify non-restarted pair style (xxx) after read_restart} :dt
For pair styles, that do not store their settings in a restart file,
it must be defined with a new 'pair_style' command after read_restart. :dd
{Must set both respa inner and outer} :dt
Cannot use just the inner or outer option with respa without using the
@ -10049,19 +10060,19 @@ create_box command. :dd
A universe or uloop style variable must specify a number of values >= to the
number of processor partitions. :dd
{Unknown angle style} :dt
{Unrecognized angle style} :dt
The choice of angle style is unknown. :dd
{Unknown atom style} :dt
{Unrecognized atom style} :dt
The choice of atom style is unknown. :dd
{Unknown body style} :dt
{Unrecognized body style} :dt
The choice of body style is unknown. :dd
{Unknown bond style} :dt
{Unrecognized bond style} :dt
The choice of bond style is unknown. :dd
@ -10077,23 +10088,23 @@ Self-explanatory. :dd
Self-explanatory. :dd
{Unknown command: %s} :dt
{Unrecognized command: %s} :dt
The command is not known to LAMMPS. Check the input script. :dd
{Unknown compute style} :dt
{Unrecognized compute style} :dt
The choice of compute style is unknown. :dd
{Unknown dihedral style} :dt
{Unrecognized dihedral style} :dt
The choice of dihedral style is unknown. :dd
{Unknown dump reader style} :dt
{Unrecognized dump reader style} :dt
The choice of dump reader style via the format keyword is unknown. :dd
{Unknown dump style} :dt
{Unrecognized dump style} :dt
The choice of dump style is unknown. :dd
@ -10101,7 +10112,7 @@ The choice of dump style is unknown. :dd
Self-explanatory. :dd
{Unknown fix style} :dt
{Unrecognized fix style} :dt
The choice of fix style is unknown. :dd
@ -10109,7 +10120,7 @@ The choice of fix style is unknown. :dd
A section of the data file cannot be read by LAMMPS. :dd
{Unknown improper style} :dt
{Unrecognized improper style} :dt
The choice of improper style is unknown. :dd
@ -10117,7 +10128,7 @@ The choice of improper style is unknown. :dd
One or more specified keywords are not recognized. :dd
{Unknown kspace style} :dt
{Unrecognized kspace style} :dt
The choice of kspace style is unknown. :dd
@ -10133,7 +10144,7 @@ Self-explanatory. :dd
Self-explanatory. :dd
{Unknown pair style} :dt
{Unrecognized pair style} :dt
The choice of pair style is unknown. :dd
@ -10141,7 +10152,7 @@ The choice of pair style is unknown. :dd
The choice of sub-style is unknown. :dd
{Unknown region style} :dt
{Unrecognized region style} :dt
The choice of region style is unknown. :dd

View File

@ -1,7 +1,7 @@
<!-- HTML_ONLY -->
<HEAD>
<TITLE>LAMMPS Users Manual</TITLE>
<META NAME="docnumber" CONTENT="15 May 2019 version">
<META NAME="docnumber" CONTENT="31 May 2019 version">
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
</HEAD>
@ -21,7 +21,7 @@
:line
LAMMPS Documentation :c,h1
15 May 2019 version :c,h2
31 May 2019 version :c,h2
"What is a LAMMPS version?"_Manual_version.html

View File

@ -208,7 +208,7 @@ available on your system.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#compress on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -358,7 +358,7 @@ developed the pair style.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#kim on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -404,7 +404,7 @@ lib/kokkos.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#kokkos on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -477,7 +477,7 @@ Cawkwell, Anders Niklasson, and Christian Negre.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#latte on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -654,7 +654,7 @@ University of Chicago.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#mscg on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -686,7 +686,7 @@ and Vincent Natoli (Stone Ridge Technolgy).
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#opt on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -743,7 +743,7 @@ connections at hinge points.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#poems on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -775,7 +775,7 @@ lib/python/README for more details.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#python on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -965,7 +965,7 @@ and LBNL.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#voronoi on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1017,7 +1017,7 @@ atomic information to continuum fields.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-atc on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1044,7 +1044,7 @@ model.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-awpmd on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1184,7 +1184,7 @@ Tribello.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-plumed on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1362,7 +1362,7 @@ H5MD format.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-h5md on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1400,7 +1400,7 @@ NOTE: the USER-INTEL package contains styles that require using the
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-intel on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1620,7 +1620,7 @@ at
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-molfile on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1660,7 +1660,7 @@ tools:
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-netcdf on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1704,7 +1704,7 @@ install/un-install the package and build LAMMPS in the usual manner:
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-omp on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1788,7 +1788,7 @@ without changes to LAMMPS itself.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-qmmm on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1846,7 +1846,7 @@ on your system.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-quip on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1964,7 +1964,7 @@ Dynamics, Ernst Mach Institute, Germany).
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-smd on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -2090,7 +2090,7 @@ system.
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-vtk on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]

View File

@ -141,11 +141,16 @@ specify if this should be done.
This fix writes the state of the fix to "binary restart
files"_restart.html. This includes information about the random
number generator seed, the next timestep for MC exchanges, etc. See
number generator seed, the next timestep for MC exchanges, the number
of exchange attempts and successes etc. See
the "read_restart"_read_restart.html command for info on how to
re-specify a fix in an input script that reads a restart file, so that
the operation of the fix continues in an uninterrupted fashion.
NOTE: For this to work correctly, the timestep must [not] be changed
after reading the restart with "reset_timestep"_reset_timestep.html.
The fix will try to detect it and stop with an error.
None of the "fix_modify"_fix_modify.html options are relevant to this
fix.

View File

@ -261,6 +261,10 @@ next timestep for deposition, etc. See the
a fix in an input script that reads a restart file, so that the
operation of the fix continues in an uninterrupted fashion.
NOTE: For this to work correctly, the timestep must [not] be changed
after reading the restart with "reset_timestep"_reset_timestep.html.
The fix will try to detect it and stop with an error.
None of the "fix_modify"_fix_modify.html options are relevant to this
fix. No global or per-atom quantities are stored by this fix for
access by various "output commands"_Howto_output.html. No parameter

View File

@ -373,11 +373,16 @@ adds all inserted atoms of the specified type to the
This fix writes the state of the fix to "binary restart
files"_restart.html. This includes information about the random
number generator seed, the next timestep for MC exchanges, etc. See
number generator seed, the next timestep for MC exchanges, the number
of MC step attempts and successes etc. See
the "read_restart"_read_restart.html command for info on how to
re-specify a fix in an input script that reads a restart file, so that
the operation of the fix continues in an uninterrupted fashion.
NOTE: For this to work correctly, the timestep must [not] be changed
after reading the restart with "reset_timestep"_reset_timestep.html.
The fix will try to detect it and stop with an error.
None of the "fix_modify"_fix_modify.html options are relevant to this
fix.

View File

@ -92,10 +92,6 @@ pairs from the neighbor list. This needs to be very carefully tested,
because it may remove pairs from the neighbor list that are still
required.
Pair style {quip} cannot be used with pair style {hybrid}, only
with {hybrid/overlay} and only the {quip} sub-style is applied to
all atom types.
[Related commands:]
"pair_coeff"_pair_coeff.html

1
src/.gitignore vendored
View File

@ -5,6 +5,7 @@
/lmp_*
/style_*.h
/packages_*.h
/lmpinstalledpkgs.h
/lmpgitversion.h

View File

@ -200,6 +200,7 @@ void NeighBondKokkos<DeviceType>::build_topology_kk()
{
atomKK->sync(execution_space, X_MASK | TAG_MASK);
int nall = atom->nlocal + atom->nghost;
int nmax = atom->nmax;
nlocal = atom->nlocal;
x = atomKK->k_x.view<DeviceType>();
@ -215,7 +216,9 @@ void NeighBondKokkos<DeviceType>::build_topology_kk()
int* map_array_host = atom->get_map_array();
int map_size = atom->get_map_size();
k_map_array = DAT::tdual_int_1d("NeighBond:map_array",map_size);
int map_maxarray = atom->get_map_maxarray();
if (map_maxarray > k_map_array.extent(0))
k_map_array = DAT::tdual_int_1d("NeighBond:map_array",map_maxarray);
for (int i=0; i<map_size; i++)
k_map_array.h_view[i] = map_array_host[i];
k_map_array.template modify<LMPHostType>();
@ -223,7 +226,8 @@ void NeighBondKokkos<DeviceType>::build_topology_kk()
map_array = k_map_array.view<DeviceType>();
int* sametag_host = atomKK->sametag;
k_sametag = DAT::tdual_int_1d("NeighBond:sametag",nall);
if (nmax > k_sametag.extent(0))
k_sametag = DAT::tdual_int_1d("NeighBond:sametag",nmax);
for (int i=0; i<nall; i++)
k_sametag.h_view[i] = sametag_host[i];
k_sametag.template modify<LMPHostType>();

View File

@ -771,10 +771,13 @@ double FixAtomSwap::memory_usage()
void FixAtomSwap::write_restart(FILE *fp)
{
int n = 0;
double list[4];
double list[6];
list[n++] = random_equal->state();
list[n++] = random_unequal->state();
list[n++] = next_reneighbor;
list[n++] = ubuf(next_reneighbor).d;
list[n++] = nswap_attempts;
list[n++] = nswap_successes;
list[n++] = ubuf(update->ntimestep).d;
if (comm->me == 0) {
int size = n * sizeof(double);
@ -798,5 +801,12 @@ void FixAtomSwap::restart(char *buf)
seed = static_cast<int> (list[n++]);
random_unequal->reset(seed);
next_reneighbor = static_cast<int> (list[n++]);
next_reneighbor = (bigint) ubuf(list[n++]).i;
nswap_attempts = static_cast<int>(list[n++]);
nswap_successes = static_cast<int>(list[n++]);
bigint ntimestep_restart = (bigint) ubuf(list[n++]).i;
if (ntimestep_restart != update->ntimestep)
error->all(FLERR,"Must not reset timestep when restarting fix atom/swap");
}

View File

@ -2531,10 +2531,19 @@ double FixGCMC::memory_usage()
void FixGCMC::write_restart(FILE *fp)
{
int n = 0;
double list[4];
double list[12];
list[n++] = random_equal->state();
list[n++] = random_unequal->state();
list[n++] = next_reneighbor;
list[n++] = ubuf(next_reneighbor).d;
list[n++] = ntranslation_attempts;
list[n++] = ntranslation_successes;
list[n++] = nrotation_attempts;
list[n++] = nrotation_successes;
list[n++] = ndeletion_attempts;
list[n++] = ndeletion_successes;
list[n++] = ninsertion_attempts;
list[n++] = ninsertion_successes;
list[n++] = ubuf(update->ntimestep).d;
if (comm->me == 0) {
int size = n * sizeof(double);
@ -2558,7 +2567,20 @@ void FixGCMC::restart(char *buf)
seed = static_cast<int> (list[n++]);
random_unequal->reset(seed);
next_reneighbor = static_cast<int> (list[n++]);
next_reneighbor = (bigint) ubuf(list[n++]).i;
ntranslation_attempts = list[n++];
ntranslation_successes = list[n++];
nrotation_attempts = list[n++];
nrotation_successes = list[n++];
ndeletion_attempts = list[n++];
ndeletion_successes = list[n++];
ninsertion_attempts = list[n++];
ninsertion_successes = list[n++];
bigint ntimestep_restart = (bigint) ubuf(list[n++]).i;
if (ntimestep_restart != update->ntimestep)
error->all(FLERR,"Must not reset timestep when restarting fix gcmc");
}
void FixGCMC::grow_molecule_arrays(int nmolatoms) {

View File

@ -798,11 +798,12 @@ void FixDeposit::options(int narg, char **arg)
void FixDeposit::write_restart(FILE *fp)
{
int n = 0;
double list[4];
double list[5];
list[n++] = random->state();
list[n++] = ninserted;
list[n++] = nfirst;
list[n++] = next_reneighbor;
list[n++] = ubuf(next_reneighbor).d;
list[n++] = ubuf(update->ntimestep).d;
if (comm->me == 0) {
int size = n * sizeof(double);
@ -823,7 +824,11 @@ void FixDeposit::restart(char *buf)
seed = static_cast<int> (list[n++]);
ninserted = static_cast<int> (list[n++]);
nfirst = static_cast<int> (list[n++]);
next_reneighbor = static_cast<int> (list[n++]);
next_reneighbor = (bigint) ubuf(list[n++]).i;
bigint ntimestep_restart = (bigint) ubuf(list[n++]).i;
if (ntimestep_restart != update->ntimestep)
error->all(FLERR,"Must not reset timestep when restarting this fix");
random->reset(seed);
}

View File

@ -55,6 +55,34 @@ style () {
fi
}
packages () {
list=`grep -sl $1 */$2*.h`
if (test -e packages_$3.tmp) then
rm -f packages_$3.tmp
fi
for file in $list; do
dir="\"`dirname $file`\""
echo "#undef PACKAGE" >> packages_$3.tmp
echo "#define PACKAGE $dir" >> packages_$3.tmp
qfile="\"$file\""
echo "#include $qfile" >> packages_$3.tmp
done
if (test ! -e packages_$3.tmp) then
if (test ! -e packages_$3.h) then
touch packages_$3.h
elif (test "`cat packages_$3.h`" != "") then
rm -f packages_$3.h
touch packages_$3.h
fi
elif (test ! -e packages_$3.h) then
mv packages_$3.tmp packages_$3.h
elif (test "`diff --brief packages_$3.h packages_$3.tmp`" != "") then
mv packages_$3.tmp packages_$3.h
else
rm -f packages_$3.tmp
fi
}
# create individual style files
# called by "make machine"
# col 1 = string to search for
@ -63,28 +91,30 @@ style () {
# col 4 = file that includes the style file
# col 5 = optional 2nd file that includes the style file
if (test $1 = "style") then
cmd=$1
style ANGLE_CLASS angle_ angle force
style ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid
style BODY_CLASS body_ body atom_vec_body
style BOND_CLASS bond_ bond force
style COMMAND_CLASS "" command input
style COMPUTE_CLASS compute_ compute modify
style DIHEDRAL_CLASS dihedral_ dihedral force
style DUMP_CLASS dump_ dump output write_dump
style FIX_CLASS fix_ fix modify
style IMPROPER_CLASS improper_ improper force
style INTEGRATE_CLASS "" integrate update
style KSPACE_CLASS "" kspace force
style MINIMIZE_CLASS min_ minimize update
style NBIN_CLASS nbin_ nbin neighbor
style NPAIR_CLASS npair_ npair neighbor
style NSTENCIL_CLASS nstencil_ nstencil neighbor
style NTOPO_CLASS ntopo_ ntopo neighbor
style PAIR_CLASS pair_ pair force
style READER_CLASS reader_ reader read_dump
style REGION_CLASS region_ region domain
if (test $cmd = "style") || (test $cmd = "packages") then
$cmd ANGLE_CLASS angle_ angle force
$cmd ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid
$cmd BODY_CLASS body_ body atom_vec_body
$cmd BOND_CLASS bond_ bond force
$cmd COMMAND_CLASS "" command input
$cmd COMPUTE_CLASS compute_ compute modify
$cmd DIHEDRAL_CLASS dihedral_ dihedral force
$cmd DUMP_CLASS dump_ dump output write_dump
$cmd FIX_CLASS fix_ fix modify
$cmd IMPROPER_CLASS improper_ improper force
$cmd INTEGRATE_CLASS "" integrate update
$cmd KSPACE_CLASS "" kspace force
$cmd MINIMIZE_CLASS min_ minimize update
$cmd NBIN_CLASS nbin_ nbin neighbor
$cmd NPAIR_CLASS npair_ npair neighbor
$cmd NSTENCIL_CLASS nstencil_ nstencil neighbor
$cmd NTOPO_CLASS ntopo_ ntopo neighbor
$cmd PAIR_CLASS pair_ pair force
$cmd READER_CLASS reader_ reader read_dump
$cmd REGION_CLASS region_ region domain
# edit Makefile.lib, for creating non-shared lib
# called by "make makelib"

View File

@ -205,6 +205,7 @@ gitversion:
-f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@
@if [ ! -d $(objdir) ]; then mkdir $(objdir); fi
@$(SHELL) Make.sh style
@$(SHELL) Make.sh packages
@$(MAKE) $(MFLAGS) lmpinstalledpkgs.h gitversion
@echo 'Compiling LAMMPS for machine $@'
@if [ -f MAKE/MACHINES/Makefile.$@ ]; \

View File

@ -22,6 +22,30 @@ style_nbin.h
style_npair.h
style_nstencil.h
style_ntopo.h
# auto-generated packages files
packages_angle.h
packages_atom.h
packages_body.h
packages_bond.h
packages_command.h
packages_compute.h
packages_dihedral.h
packages_dump.h
packages_fix.h
packages_improper.h
packages_integrate.h
packages_kspace.h
packages_minimize.h
packages_pair.h
packages_reader.h
packages_region.h
packages_neigh_bin.h
packages_neigh_pair.h
packages_neigh_stencil.h
packages_nbin.h
packages_npair.h
packages_nstencil.h
packages_ntopo.h
# other auto-generated files
lmpinstalledpkgs.h
lmpgitversion.h

View File

@ -148,12 +148,20 @@ int MPI_Finalize()
double MPI_Wtime()
{
#if defined(_MSC_VER)
double t;
t = GetTickCount();
t /= 1000.0;
return t;
#else
double time;
struct timeval tv;
gettimeofday(&tv,NULL);
time = 1.0 * tv.tv_sec + 1.0e-6 * tv.tv_usec;
return time;
#endif
}
/* ---------------------------------------------------------------------- */

View File

@ -39,11 +39,16 @@ using namespace LAMMPS_NS;
PairQUIP::PairQUIP(LAMMPS *lmp) : Pair(lmp)
{
single_enable = 0;
restartinfo = 0;
one_coeff = 1;
no_virial_fdotr_compute = 1;
manybody_flag = 1;
single_enable = 0;
restartinfo = 0;
one_coeff = 1;
no_virial_fdotr_compute = 1;
manybody_flag = 1;
map = NULL;
quip_potential = NULL;
quip_file = NULL;
quip_string = NULL;
}
PairQUIP::~PairQUIP()
@ -52,8 +57,10 @@ PairQUIP::~PairQUIP()
memory->destroy(setflag);
memory->destroy(cutsq);
delete [] map;
delete [] quip_potential;
}
delete [] quip_potential;
delete [] quip_file;
delete [] quip_string;
}
void PairQUIP::compute(int eflag, int vflag)
@ -100,14 +107,14 @@ void PairQUIP::compute(int eflag, int vflag)
jnum = numneigh[i];
for (jj = 0; jj < jnum; jj++) {
quip_neigh[iquip] = (jlist[jj] & NEIGHMASK) + 1;
iquip++;
quip_neigh[iquip] = (jlist[jj] & NEIGHMASK) + 1;
iquip++;
}
}
atomic_numbers = new int[ntotal];
for (ii = 0; ii < ntotal; ii++)
atomic_numbers[ii] = map[type[ii]-1];
atomic_numbers[ii] = map[type[ii]];
quip_local_e = new double [ntotal];
quip_force = new double [ntotal*3];
@ -211,17 +218,20 @@ void PairQUIP::compute(int eflag, int vflag)
global settings
------------------------------------------------------------------------- */
void PairQUIP::settings(int narg, char **/*arg*/)
void PairQUIP::settings(int narg, char ** /* arg */)
{
if (narg != 0) error->all(FLERR,"Illegal pair_style command");
if (strcmp(force->pair_style,"hybrid") == 0)
error->all(FLERR,"Pair style quip is only compatible with hybrid/overlay");
// check if linked to the correct QUIP library API version
// as of 2017-07-19 this is API_VERSION 1
if (quip_lammps_api_version() != 1)
error->all(FLERR,"QUIP LAMMPS wrapper API version is not compatible "
"with this version of LAMMPS");
// QUIP potentials are parameterized in metal units
if (strcmp("metal",update->unit_style) != 0)
error->all(FLERR,"QUIP potentials require 'metal' units");
}
/* ----------------------------------------------------------------------
@ -234,48 +244,58 @@ void PairQUIP::allocate()
setflag = memory->create(setflag,n+1,n+1,"pair:setflag");
cutsq = memory->create(cutsq,n+1,n+1,"pair:cutsq");
map = new int[n];
map = new int[n+1];
}
void PairQUIP::coeff(int narg, char **arg)
{
if (!allocated) allocate();
if (!allocated) allocate();
int n = atom->ntypes;
int n = atom->ntypes;
if (narg != (4+n)) {
char str[1024];
sprintf(str,"Number of arguments %d is not correct, it should be %d", narg, 4+n);
error->all(FLERR,str);
}
// ensure I,J args are * *
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++) {
setflag[i][j] = 1;
if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0)
error->all(FLERR,"Incorrect args for pair coefficients");
n_quip_file = strlen(arg[2]);
quip_file = new char[n_quip_file+1];
strcpy(quip_file,arg[2]);
n_quip_string = strlen(arg[3]);
quip_string = new char[n_quip_string+1];
strcpy(quip_string,arg[3]);
for (int i = 4; i < narg; i++) {
if (strcmp(arg[i],"NULL") == 0)
map[i-3] = -1;
else
map[i-3] = force->inumeric(FLERR,arg[i]);
}
// clear setflag since coeff() called once with I,J = * *
n = atom->ntypes;
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
setflag[i][j] = 0;
// set setflag i,j for type pairs where both are mapped to elements
int count = 0;
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
if (map[i] >= 0 && map[j] >= 0) {
setflag[i][j] = 1;
count++;
}
}
if (narg != (4+n)) {
char str[1024];
sprintf(str,"Number of arguments %d is not correct, it should be %d", narg, 4+n);
error->all(FLERR,str);
}
if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0)
error->all(FLERR,"Incorrect args for pair coefficients");
n_quip_file = strlen(arg[2]);
quip_file = new char[n_quip_file+1];
strcpy(quip_file,arg[2]);
n_quip_string = strlen(arg[3]);
quip_string = new char[n_quip_string+1];
strcpy(quip_string,arg[3]);
for (int i = 4; i < narg; i++) {
if (0 == sscanf(arg[i],"%d",&map[i-4])) {
char str[1024];
sprintf(str,"Incorrect atomic number %s at position %d",arg[i],i);
error->all(FLERR,str);
}
}
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
// Initialise potential
// First call initialises potential via the fortran code in memory, and returns the necessary size

View File

@ -26,10 +26,10 @@ extern "C"
{
int quip_lammps_api_version();
void quip_lammps_wrapper(int*, int*, int*, int*,
int*, int*, int*,
int*, int*, double*,
int*, int*, double*,
double*, double*, double*, double*, double*);
int*, int*, int*,
int*, int*, double*,
int*, int*, double*,
double*, double*, double*, double*, double*);
void quip_lammps_potential_initialise(int*, int*, double*, char*, int*, char*, int*);
}

View File

@ -34,8 +34,16 @@ double t_end;
double Get_Time( )
{
#if defined(_MSC_VER)
double t;
t = GetTickCount();
t /= 1000.0;
return t;
#else
gettimeofday(&tim, NULL );
return( tim.tv_sec + (tim.tv_usec / 1000000.0) );
#endif
}
int Tokenize( char* s, char*** tok )

View File

@ -39,6 +39,7 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
#ifdef LMP_USER_INTEL
#include "neigh_request.h"
@ -509,7 +510,7 @@ AtomVec *Atom::new_avec(const char *style, int trysuffix, int &sflag)
return avec_creator(lmp);
}
error->all(FLERR,"Unknown atom style");
error->all(FLERR,utils::check_packages_for_style("atom",style,lmp).c_str());
return NULL;
}

View File

@ -286,6 +286,7 @@ class Atom : protected Pointers {
inline int* get_map_array() {return map_array;};
inline int get_map_size() {return map_tag_max+1;};
inline int get_map_maxarray() {return map_maxarray+1;};
bigint memory_usage();
int memcheck(const char *);
@ -361,7 +362,7 @@ E: Atom IDs must be used for molecular systems
Atom IDs are used to identify and find partner atoms in bonds.
E: Unknown atom style
E: Unrecognized atom style
The choice of atom style is unknown.

View File

@ -25,6 +25,7 @@
#include "fix.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
@ -96,7 +97,7 @@ void AtomVecBody::process_args(int narg, char **arg)
#undef BodyStyle
#undef BODY_CLASS
else error->all(FLERR,"Unknown body style");
else error->all(FLERR,utils::check_packages_for_style("body",arg[0],lmp).c_str());
bptr->avec = this;
icp = bptr->icp;

View File

@ -130,7 +130,7 @@ E: Invalid atom_style body command
No body style argument was provided.
E: Unknown body style
E: Unrecognized body style
The choice of body style is unknown.

View File

@ -40,6 +40,7 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
using namespace MathConst;
@ -1715,6 +1716,9 @@ void Domain::add_region(int narg, char **arg)
return;
}
if (strcmp(arg[1],"none") == 0)
error->all(FLERR,"Unrecognized region style 'none'");
if (find_region(arg[0]) >= 0) error->all(FLERR,"Reuse of region ID");
// extend Region list if necessary
@ -1753,12 +1757,10 @@ void Domain::add_region(int narg, char **arg)
}
}
if (strcmp(arg[1],"none") == 0) error->all(FLERR,"Unknown region style");
if (region_map->find(arg[1]) != region_map->end()) {
RegionCreator region_creator = (*region_map)[arg[1]];
regions[nregion] = region_creator(lmp, narg, arg);
}
else error->all(FLERR,"Unknown region style");
} else error->all(FLERR,utils::check_packages_for_style("region",arg[1],lmp).c_str());
// initialize any region variables via init()
// in case region is used between runs, e.g. to print a variable

View File

@ -269,7 +269,7 @@ E: Reuse of region ID
A region ID cannot be used twice.
E: Unknown region style
E: Unrecognized region style
The choice of region style is unknown.

View File

@ -258,9 +258,7 @@ Pair *Force::new_pair(const char *style, int trysuffix, int &sflag)
return pair_creator(lmp);
}
char str[128];
sprintf(str,"Unknown pair style %s",style);
error->all(FLERR,str);
error->all(FLERR,utils::check_packages_for_style("pair",style,lmp).c_str());
return NULL;
}
@ -373,9 +371,7 @@ Bond *Force::new_bond(const char *style, int trysuffix, int &sflag)
return bond_creator(lmp);
}
char str[128];
sprintf(str,"Unknown bond style %s",style);
error->all(FLERR,str);
error->all(FLERR,utils::check_packages_for_style("bond",style,lmp).c_str());
return NULL;
}
@ -454,9 +450,7 @@ Angle *Force::new_angle(const char *style, int trysuffix, int &sflag)
return angle_creator(lmp);
}
char str[128];
sprintf(str,"Unknown angle style %s",style);
error->all(FLERR,str);
error->all(FLERR,utils::check_packages_for_style("angle",style,lmp).c_str());
return NULL;
}
@ -536,9 +530,7 @@ Dihedral *Force::new_dihedral(const char *style, int trysuffix, int &sflag)
return dihedral_creator(lmp);
}
char str[128];
sprintf(str,"Unknown dihedral style %s",style);
error->all(FLERR,str);
error->all(FLERR,utils::check_packages_for_style("dihedral",style,lmp).c_str());
return NULL;
}
@ -617,9 +609,7 @@ Improper *Force::new_improper(const char *style, int trysuffix, int &sflag)
return improper_creator(lmp);
}
char str[128];
sprintf(str,"Unknown improper style %s",style);
error->all(FLERR,str);
error->all(FLERR,utils::check_packages_for_style("improper",style,lmp).c_str());
return NULL;
}
@ -702,9 +692,7 @@ KSpace *Force::new_kspace(const char *style, int trysuffix, int &sflag)
return kspace_creator(lmp);
}
char str[128];
sprintf(str,"Unknown kspace style %s",style);
error->all(FLERR,str);
error->all(FLERR,utils::check_packages_for_style("kspace",style,lmp).c_str());
return NULL;
}

View File

@ -159,35 +159,36 @@ class Force : protected Pointers {
E: Must re-specify non-restarted pair style (%s) after read_restart
UNDOCUMENTED
For pair styles, that do not store their settings in a restart file,
it must be defined with a new 'pair_style' command after read_restart.
E: Unknown pair style %s
E: Unrecognized pair style %s
UNDOCUMENTED
The choice of pair style is unknown.
E: Unknown bond style %s
E: Unrecognized bond style %s
UNDOCUMENTED
The choice of bond style is unknown.
E: Unknown angle style %s
E: Unrecognized angle style %s
UNDOCUMENTED
The choice of angle style is unknown.
E: Unknown dihedral style %s
E: Unrecognized dihedral style %s
UNDOCUMENTED
The choice of dihedral style is unknown.
E: Unknown improper style %s
E: Unrecognized improper style %s
UNDOCUMENTED
The choice of improper style is unknown.
E: Cannot yet use KSpace solver with grid with comm style tiled
This is current restriction in LAMMPS.
E: Unknown kspace style %s
E: Unrecognized kspace style %s
UNDOCUMENTED
The choice of kspace style is unknown.
E: Illegal ... command

View File

@ -50,6 +50,7 @@
#include "accelerator_kokkos.h"
#include "error.h"
#include "memory.h"
#include "utils.h"
#ifdef _OPENMP
#include <omp.h>
@ -526,6 +527,11 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
*fmtflag='\0';
}
// quick check for proper format string
if (!utils::strmatch(fmtstr,"%[0-9 ]*\\.[0-9]+[efgEFG]"))
error->all(FLERR,"Incorrect conversion in format string");
snprintf(immediate,256,fmtstr,variable->compute_equal(var));
value = immediate;

View File

@ -173,6 +173,11 @@ E: Unbalanced quotes in input line
No matching end double quote was found following a leading double
quote.
E: Incorrect conversion in format string
An immediate variable with format suffix was not using
either a %f, a %g, or a %e conversion in the format suffix.
E: Input line quote not followed by white-space
An end quote must be followed by white-space.

View File

@ -14,6 +14,8 @@
#include <mpi.h>
#include <cstring>
#include <cctype>
#include <map>
#include <string>
#include "lammps.h"
#include "style_angle.h"
#include "style_atom.h"
@ -54,10 +56,29 @@
#include "lmpinstalledpkgs.h"
#include "lmpgitversion.h"
using namespace LAMMPS_NS;
static void print_style(FILE *fp, const char *str, int &pos);
struct LAMMPS_NS::package_styles_lists {
std::map<std::string,std::string> angle_styles;
std::map<std::string,std::string> atom_styles;
std::map<std::string,std::string> body_styles;
std::map<std::string,std::string> bond_styles;
std::map<std::string,std::string> command_styles;
std::map<std::string,std::string> compute_styles;
std::map<std::string,std::string> dihedral_styles;
std::map<std::string,std::string> dump_styles;
std::map<std::string,std::string> fix_styles;
std::map<std::string,std::string> improper_styles;
std::map<std::string,std::string> integrate_styles;
std::map<std::string,std::string> kspace_styles;
std::map<std::string,std::string> minimize_styles;
std::map<std::string,std::string> pair_styles;
std::map<std::string,std::string> reader_styles;
std::map<std::string,std::string> region_styles;
};
using namespace LAMMPS_NS;
/* ----------------------------------------------------------------------
start up LAMMPS
allocate fundamental classes (memory, error, universe, input)
@ -86,6 +107,8 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
initclock = MPI_Wtime();
init_pkg_lists();
// check if -mpi is first arg
// if so, then 2 apps were launched with one mpirun command
// this means passed communicator (e.g. MPI_COMM_WORLD) is bigger than LAMMPS
@ -693,6 +716,8 @@ LAMMPS::~LAMMPS()
delete universe;
delete error;
delete memory;
delete pkg_lists;
}
/* ----------------------------------------------------------------------
@ -867,6 +892,149 @@ void LAMMPS::destroy()
python = NULL;
}
/* ----------------------------------------------------------------------
initialize lists of styles in packages
------------------------------------------------------------------------- */
void LAMMPS::init_pkg_lists()
{
pkg_lists = new package_styles_lists;
#define PACKAGE "UNKNOWN"
#define ANGLE_CLASS
#define AngleStyle(key,Class) \
pkg_lists->angle_styles[#key] = PACKAGE;
#include "packages_angle.h"
#undef AngleStyle
#undef ANGLE_CLASS
#define ATOM_CLASS
#define AtomStyle(key,Class) \
pkg_lists->atom_styles[#key] = PACKAGE;
#include "packages_atom.h"
#undef AtomStyle
#undef ATOM_CLASS
#define BODY_CLASS
#define BodyStyle(key,Class) \
pkg_lists->body_styles[#key] = PACKAGE;
#include "packages_body.h"
#undef BodyStyle
#undef BODY_CLASS
#define BOND_CLASS
#define BondStyle(key,Class) \
pkg_lists->bond_styles[#key] = PACKAGE;
#include "packages_bond.h"
#undef BondStyle
#undef BOND_CLASS
#define COMMAND_CLASS
#define CommandStyle(key,Class) \
pkg_lists->command_styles[#key] = PACKAGE;
#include "packages_command.h"
#undef CommandStyle
#undef COMMAND_CLASS
#define COMPUTE_CLASS
#define ComputeStyle(key,Class) \
pkg_lists->compute_styles[#key] = PACKAGE;
#include "packages_compute.h"
#undef ComputeStyle
#undef COMPUTE_CLASS
#define DIHEDRAL_CLASS
#define DihedralStyle(key,Class) \
pkg_lists->dihedral_styles[#key] = PACKAGE;
#include "packages_dihedral.h"
#undef DihedralStyle
#undef DIHEDRAL_CLASS
#define DUMP_CLASS
#define DumpStyle(key,Class) \
pkg_lists->dump_styles[#key] = PACKAGE;
#include "packages_dump.h"
#undef DumpStyle
#undef DUMP_CLASS
#define FIX_CLASS
#define FixStyle(key,Class) \
pkg_lists->fix_styles[#key] = PACKAGE;
#include "packages_fix.h"
#undef FixStyle
#undef FIX_CLASS
#define IMPROPER_CLASS
#define ImproperStyle(key,Class) \
pkg_lists->improper_styles[#key] = PACKAGE;
#include "packages_improper.h"
#undef ImproperStyle
#undef IMPROPER_CLASS
#define INTEGRATE_CLASS
#define IntegrateStyle(key,Class) \
pkg_lists->integrate_styles[#key] = PACKAGE;
#include "packages_integrate.h"
#undef IntegrateStyle
#undef INTEGRATE_CLASS
#define KSPACE_CLASS
#define KSpaceStyle(key,Class) \
pkg_lists->kspace_styles[#key] = PACKAGE;
#include "packages_kspace.h"
#undef KSpaceStyle
#undef KSPACE_CLASS
#define MINIMIZE_CLASS
#define MinimizeStyle(key,Class) \
pkg_lists->minimize_styles[#key] = PACKAGE;
#include "packages_minimize.h"
#undef MinimizeStyle
#undef MINIMIZE_CLASS
#define PAIR_CLASS
#define PairStyle(key,Class) \
pkg_lists->pair_styles[#key] = PACKAGE;
#include "packages_pair.h"
#undef PairStyle
#undef PAIR_CLASS
#define READER_CLASS
#define ReaderStyle(key,Class) \
pkg_lists->reader_styles[#key] = PACKAGE;
#include "packages_reader.h"
#undef ReaderStyle
#undef READER_CLASS
#define REGION_CLASS
#define RegionStyle(key,Class) \
pkg_lists->region_styles[#key] = PACKAGE;
#include "packages_region.h"
#undef RegionStyle
#undef REGION_CLASS
}
bool LAMMPS::is_installed_pkg(const char *pkg)
{
for (int i=0; installed_packages[i] != NULL; ++i)
if (strcmp(installed_packages[i],pkg) == 0) return true;
return false;
}
#define check_for_match(style,list,name) \
if (strcmp(list,#style) == 0) { \
std::map<std::string,std::string> &styles(pkg_lists-> style ## _styles); \
if (styles.find(name) != styles.end()) { \
return styles[name].c_str(); \
} \
}
const char *LAMMPS::match_style(const char *style, const char *name)
{
check_for_match(angle,style,name);
check_for_match(atom,style,name);
check_for_match(body,style,name);
check_for_match(bond,style,name);
check_for_match(command,style,name);
check_for_match(compute,style,name);
check_for_match(dump,style,name);
check_for_match(fix,style,name);
check_for_match(compute,style,name);
check_for_match(improper,style,name);
check_for_match(integrate,style,name);
check_for_match(kspace,style,name);
check_for_match(minimize,style,name);
check_for_match(pair,style,name);
check_for_match(reader,style,name);
check_for_match(region,style,name);
return NULL;
}
/* ----------------------------------------------------------------------
help message for command line options and styles present in executable
------------------------------------------------------------------------- */

View File

@ -63,7 +63,9 @@ class LAMMPS {
class CiteMe *citeme; // citation info
const char *match_style(const char *style, const char *name);
static const char * installed_packages[];
static bool is_installed_pkg(const char *pkg);
static const bool has_git_info;
static const char git_commit[];
@ -79,6 +81,8 @@ class LAMMPS {
void print_config(FILE *); // print compile time settings
private:
struct package_styles_lists *pkg_lists;
void init_pkg_lists();
void help();
LAMMPS() {}; // prohibit using the default constructor
LAMMPS(const LAMMPS &) {}; // prohibit using the copy constructor

View File

@ -18,8 +18,8 @@
#define pclose _pclose
#define strdup _strdup
// the following functions ared defined to get rid of
// 'ambiguous call to overloaded function' error in VSS for mismathched type arguments
// the following functions are defined to get rid of
// 'ambiguous call to overloaded function' error in VSS for mismatched type arguments
#if !defined(__MINGW32__)
inline double pow(int i, int j){
return pow((double)i,j);

View File

@ -893,11 +893,8 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
fix[ifix] = fix_creator(lmp,narg,arg);
}
if (fix[ifix] == NULL) {
char str[128];
snprintf(str,128,"Unknown fix style %s",arg[2]);
error->all(FLERR,str);
}
if (fix[ifix] == NULL)
error->all(FLERR,utils::check_packages_for_style("fix",arg[2],lmp).c_str());
// check if Fix is in restart_global list
// if yes, pass state info to the Fix so it can reset itself
@ -1195,11 +1192,8 @@ void Modify::add_compute(int narg, char **arg, int trysuffix)
compute[ncompute] = compute_creator(lmp,narg,arg);
}
if (compute[ncompute] == NULL) {
char str[128];
snprintf(str,128,"Unknown compute style %s",arg[2]);
error->all(FLERR,str);
}
if (compute[ncompute] == NULL)
error->all(FLERR,utils::check_packages_for_style("compute",arg[2],lmp).c_str());
ncompute++;
}

View File

@ -224,9 +224,9 @@ The ID and style of a fix match for a fix you are changing with a fix
command, but the new group you are specifying does not match the old
group.
E: Unknown fix style %s
E: Unrecognized fix style %s
UNDOCUMENTED
The choice of fix style is unknown.
E: Could not find fix_modify ID
@ -240,9 +240,9 @@ E: Reuse of compute ID
A compute ID cannot be used twice.
E: Unknown compute style %s
E: Unrecognized compute style %s
UNDOCUMENTED
The choice of compute style is unknown.
E: Could not find compute_modify ID

View File

@ -32,6 +32,7 @@
#include "write_restart.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
@ -585,8 +586,7 @@ void Output::add_dump(int narg, char **arg)
if (dump_map->find(arg[2]) != dump_map->end()) {
DumpCreator dump_creator = (*dump_map)[arg[2]];
dump[ndump] = dump_creator(lmp, narg, arg);
}
else error->all(FLERR,"Unknown dump style");
} else error->all(FLERR,utils::check_packages_for_style("dump",arg[2],lmp).c_str());
every_dump[ndump] = force->inumeric(FLERR,arg[3]);
if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command");

View File

@ -152,7 +152,7 @@ E: Invalid dump frequency
Dump frequency must be 1 or greater.
E: Unknown dump style
E: Unrecognized dump style
The choice of dump style is unknown.

View File

@ -40,6 +40,7 @@
#include "variable.h"
#include "error.h"
#include "memory.h"
#include "utils.h"
using namespace LAMMPS_NS;
@ -266,7 +267,7 @@ void ReadDump::setup_reader(int narg, char **arg)
// unrecognized style
else error->all(FLERR,"Unknown dump reader style");
else error->all(FLERR,utils::check_packages_for_style("reader",readerstyle,lmp).c_str());
// pass any arguments to readers

View File

@ -134,7 +134,7 @@ E: Dump file does not contain requested snapshot
Self-explanatory.
E: Unknown dump reader style
E: Unrecognized dump reader style
The choice of dump reader style via the format keyword is unknown.

View File

@ -11,8 +11,10 @@
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include <mpi.h>
#include <cstring>
#include "utils.h"
#include "lammps.h"
#include "error.h"
/*! \file utils.cpp */
@ -123,6 +125,24 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size,
/* ------------------------------------------------------------------ */
std::string utils::check_packages_for_style(std::string style,
std::string name, LAMMPS *lmp)
{
std::string errmsg = "Unrecognized " + style + " style '" + name + "'";
const char *pkg = lmp->match_style(style.c_str(),name.c_str());
if (pkg) {
errmsg += " is part of the " + std::string(pkg) + " package";
if (lmp->is_installed_pkg(pkg))
errmsg += ", but seems to be missing because of a dependency";
else
errmsg += " which is not enabled in this LAMMPS binary.";
}
return errmsg;
}
/* ------------------------------------------------------------------ */
extern "C" {
/* Typedef'd pointer to get abstract datatype. */
typedef struct regex_t *re_t;

View File

@ -23,6 +23,7 @@ namespace LAMMPS_NS {
// forward declarations
class Error;
class LAMMPS;
namespace utils {
@ -66,6 +67,15 @@ namespace LAMMPS_NS {
*/
void sfgets(const char *srcname, int srcline, char *s, int size,
FILE *fp, const char *filename, Error *error);
/** \brief Report if a requested style is in a package or may have a typo
*
* \param style type of style that is to be checked for
* \param name name of style that was not found
* \param lmp pointer to top-level LAMMPS class instance
* \return string usable for error messages
*/
std::string check_packages_for_style(std::string style, std::string name, LAMMPS *lmp);
}
}

View File

@ -38,6 +38,7 @@
#include "memory.h"
#include "info.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
using namespace MathConst;
@ -383,6 +384,8 @@ void Variable::set(int narg, char **arg)
num[nvar] = 3;
which[nvar] = 0;
pad[nvar] = 0;
if (!utils::strmatch(arg[3],"%[0-9 ]*\\.[0-9]+[efgEFG]"))
error->all(FLERR,"Incorrect conversion in format string");
data[nvar] = new char*[num[nvar]];
copy(2,&arg[2],data[nvar]);
data[nvar][2] = new char[VALUELENGTH];

View File

@ -210,6 +210,10 @@ E: Invalid variable style with next command
Variable styles {equal} and {world} cannot be used in a next
command.
E: Incorrect conversion in format string
A format style variable was not using either a %f, a %g, or a %e conversion.
E: Next command must list all universe and uloop variables
This is to insure they stay in sync.

View File

@ -1 +1 @@
#define LAMMPS_VERSION "15 May 2019"
#define LAMMPS_VERSION "31 May 2019"

View File

@ -26,6 +26,7 @@
#include "input.h"
#include "update.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
@ -64,7 +65,7 @@ void WriteDump::command(int narg, char **arg)
#include "style_dump.h"
#undef DUMP_CLASS
else error->all(FLERR,"Unknown dump style");
else error->all(FLERR,utils::check_packages_for_style("dump",arg[1],lmp).c_str());
if (modindex < narg) dump->modify_params(narg-modindex-1,&arg[modindex+1]);

View File

@ -43,7 +43,7 @@ Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Unknown dump style
E: Unrecognized dump style
The choice of dump style is unknown.