Merge pull request #2336 from akohlmey/collected-small-changes

Collected small changes for the next patch release
This commit is contained in:
Axel Kohlmeyer 2020-09-04 15:22:31 -04:00 committed by GitHub
commit e6592d2324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 149 additions and 95 deletions

View File

@ -218,10 +218,9 @@ if(BUILD_OMP)
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
endif()
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.99.9)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.99.9)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.99.9))
)
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=4)

View File

@ -55,8 +55,8 @@ if(DOWNLOAD_PLUMED)
endif()
include(ExternalProject)
ExternalProject_Add(plumed_build
URL https://github.com/plumed/plumed2/releases/download/v2.6.0/plumed-src-2.6.0.tgz
URL_MD5 204d2edae58d9b10ba3ad460cad64191
URL https://github.com/plumed/plumed2/releases/download/v2.6.1/plumed-src-2.6.1.tgz
URL_MD5 89a9a450fc6025299fe16af235957163
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
${CONFIGURE_REQUEST_PIC}

View File

@ -105,7 +105,7 @@ keyword with a value of *yes*\ . This will invoke extra communication
when ghost atoms are created (at every re-neighboring) to insure the
new properties are also defined for the ghost atoms.
.. note::
.. admonition:: Properties on ghost atoms
If you use this command with the *mol*\ , *q* or *rmass* vectors,
then you most likely want to set *ghost* yes, since these properties
@ -115,7 +115,7 @@ new properties are also defined for the ghost atoms.
atoms to have these values. LAMMPS will issue a warning it you define
those vectors but do not set *ghost* yes.
.. note::
.. admonition:: Limitations on ghost atom properties
The properties for ghost atoms are not updated every timestep,
but only once every few steps when neighbor lists are re-built. Thus
@ -126,12 +126,6 @@ new properties are also defined for the ghost atoms.
that can be invoked from within a :doc:`pair style <pair_style>` or
:doc:`fix <fix>` or :doc:`compute <compute>` that you write.
.. note::
If this fix is defined **after** the simulation box is created,
a 'run 0' command should be issued to properly initialize the storage
created by this fix.
----------
This fix is one of a small number that can be defined in an input
@ -139,6 +133,12 @@ script before the simulation box is created or atoms are defined.
This is so it can be used with the :doc:`read_data <read_data>` command
as described below.
.. note::
If this fix is defined **after** the simulation box is created,
a 'run 0' command may be needed to properly initialize the storage
created by this fix.
Per-atom properties that are defined by the :doc:`atom style <atom_style>` are initialized when atoms are created, e.g. by
the :doc:`read_data <read_data>` or :doc:`create_atoms <create_atoms>`
commands. The per-atom properties defined by this fix are not. So
@ -271,11 +271,21 @@ example to heavy water:
Restart, fix_modify, output, run start/stop, minimize info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
This fix writes the per-atom values it stores to :doc:`binary restart files <restart>`, so that the values can be restored when a
simulation is restarted. See the :doc:`read_restart <read_restart>`
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.
This fix writes the per-atom values it stores to :doc:`binary restart
files <restart>`, so that the values can be restored when a simulation
is restarted. See the :doc:`read_restart <read_restart>` 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.
.. warning::
When reading data from a restart, the fix command has to be specified
**exactly** the same way as before. LAMMPS will only check whether a
fix is of the same style and has the same fix ID and in case of a match
will then try to initialize the fix with the data stored in the binary
restart file. If the fix property/atom command does not match exactly,
data can be corrupted or LAMMPS may crash.
None of the :doc:`fix_modify <fix_modify>` options are relevant to this
fix. No global or per-atom quantities are stored by this fix for

View File

@ -111,6 +111,15 @@ 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.
.. warning::
When reading data from a restart, the fix command has to be specified
**exactly** the same way as before. LAMMPS will only check whether a
fix is of the same style and has the same fix ID and in case of a match
will then try to initialize the fix with the data stored in the binary
restart file. If the fix store/state command does not match exactly,
data can be corrupted or LAMMPS may crash.
None of the :doc:`fix_modify <fix_modify>` options are relevant to this
fix.

View File

@ -909,6 +909,9 @@ Convenience functions
.. doxygenfunction:: timespec2seconds
:project: progguide
.. doxygenfunction:: date2num
:project: progguide
---------------------------
Tokenizer classes

View File

@ -42,16 +42,24 @@ Similar to :doc:`dump <dump>` files, the data filename can contain a "\*"
wild-card character. The "\*" is replaced with the current timestep
value.
.. note::
.. admonition:: Data in Coeff sections
The write-data command is not yet fully implemented in two
respects. First, most pair styles do not yet write their coefficient
information into the data file. This means you will need to specify
that information in your input script that reads the data file, via
the :doc:`pair_coeff <pair_coeff>` command. Second, a few of the :doc:`atom styles <atom_style>` (body, ellipsoid, line, tri) that store
auxiliary "bonus" information about aspherical particles, do not yet
write the bonus info into the data file. Both these functionalities
will be added to the write_data command later.
The write_data command may not always write all coefficient settings
to the corresponding Coeff sections of the data file. This can have
one of multiple reasons. 1) A few styles may be missing the code that
would write those sections (if you come across one, please notify
the LAMMPS developers). 2) Some pair styles require a single pair_coeff
statement and those are not compatible with data files. 3) The
default for write_data is to write a PairCoeff section, which has
only entries for atom types i == j. The remaining coefficients would
be inferred through the currently selected mixing rule. If there has
been a pair_coeff command with i != j, this setting would be lost.
LAMMPS will detect this and print a warning message unless *pair ij*
is appended to the write_data command. This will request writing a
PairIJCoeff section which has information for all pairs of atom types.
In cases where the coefficient data in the data file is incomplete,
you will need to re-specify that information in your input script
that reads the data file.
Because a data file is in text format, if you use a data file written
out by this command to restart a simulation, the initial state of the

View File

@ -17,7 +17,7 @@ parser = ArgumentParser(prog='Install.py',
# settings
version = "2.6.0"
version = "2.6.1"
mode = "static"
# help message
@ -48,6 +48,7 @@ checksums = { \
'2.5.3' : 'de30d6e7c2dcc0973298e24a6da24286', \
'2.5.4' : 'f31b7d16a4be2e30aa7d5c19c3d37853', \
'2.6.0' : '204d2edae58d9b10ba3ad460cad64191', \
'2.6.1' : '89a9a450fc6025299fe16af235957163', \
}
# parse and process arguments

View File

@ -237,7 +237,7 @@ void FixNEB::init()
if (atom->nmax > maxlocal) reallocate();
if (MULTI_PROC && counts == NULL) {
if ((cmode == MULTI_PROC) && (counts == NULL)) {
memory->create(xsendall,ntotal,3,"neb:xsendall");
memory->create(xrecvall,ntotal,3,"neb:xrecvall");
memory->create(fsendall,ntotal,3,"neb:fsendall");

View File

@ -24,8 +24,6 @@ using namespace LAMMPS_NS;
#define MAXLINE 256
static char *date2num(const char *version);
/* ----------------------------------------------------------------------
create & initialize the universe of processors in communicator
------------------------------------------------------------------------- */
@ -33,7 +31,9 @@ static char *date2num(const char *version);
Universe::Universe(LAMMPS *lmp, MPI_Comm communicator) : Pointers(lmp)
{
version = (const char *) LAMMPS_VERSION;
num_ver = date2num(version);
auto tmp_ver = new char[10];
snprintf(tmp_ver,10,"%08d",utils::date2num(version));
num_ver = tmp_ver;
uworld = uorig = communicator;
MPI_Comm_rank(uworld,&me);
@ -234,43 +234,3 @@ int Universe::consistent()
if (n == nprocs) return 1;
else return 0;
}
// helper function to convert the LAMMPS date string to a version id
// that can be used for both string and numerical comparisons
// where newer versions are larger than older ones.
char *date2num(const char *version)
{
int day,month,year;
day = month = year = 0;
if (version) {
day = atoi(version);
while (*version != '\0' && (isdigit(*version) || *version == ' '))
++version;
if (strncmp(version,"Jan",3) == 0) month = 1;
if (strncmp(version,"Feb",3) == 0) month = 2;
if (strncmp(version,"Mar",3) == 0) month = 3;
if (strncmp(version,"Apr",3) == 0) month = 4;
if (strncmp(version,"May",3) == 0) month = 5;
if (strncmp(version,"Jun",3) == 0) month = 6;
if (strncmp(version,"Jul",3) == 0) month = 7;
if (strncmp(version,"Aug",3) == 0) month = 8;
if (strncmp(version,"Sep",3) == 0) month = 9;
if (strncmp(version,"Oct",3) == 0) month = 10;
if (strncmp(version,"Nov",3) == 0) month = 11;
if (strncmp(version,"Dec",3) == 0) month = 12;
while (*version != '\0' && !isdigit(*version))
++version;
year = atoi(version);
}
char *ver = new char[12];
snprintf(ver,12,"%04d%02d%02d", year % 10000, month, day % 100);
return ver;
}

View File

@ -983,6 +983,34 @@ double utils::timespec2seconds(const std::string &timespec)
return vals[0];
}
/* ----------------------------------------------------------------------
convert a LAMMPS version date (1Jan01) to a number
------------------------------------------------------------------------- */
int utils::date2num(const std::string &date)
{
std::size_t found = date.find_first_not_of("0123456789 ");
int num = strtol(date.substr(0,found).c_str(),NULL,10);
auto month = date.substr(found);
found = month.find_first_of("0123456789 ");
num += strtol(month.substr(found).c_str(),NULL,10)*10000;
if (num < 1000000) num += 20000000;
if (strmatch(month,"^Jan")) num += 100;
else if (strmatch(month,"^Feb")) num += 200;
else if (strmatch(month,"^Mar")) num += 300;
else if (strmatch(month,"^Apr")) num += 400;
else if (strmatch(month,"^May")) num += 500;
else if (strmatch(month,"^Jun")) num += 600;
else if (strmatch(month,"^Jul")) num += 700;
else if (strmatch(month,"^Aug")) num += 800;
else if (strmatch(month,"^Sep")) num += 900;
else if (strmatch(month,"^Oct")) num += 1000;
else if (strmatch(month,"^Nov")) num += 1100;
else if (strmatch(month,"^Dec")) num += 1200;
return num;
}
/* ------------------------------------------------------------------ */
extern "C" {

View File

@ -371,6 +371,24 @@ namespace LAMMPS_NS {
* \return total in seconds
*/
double timespec2seconds(const std::string &timespec);
/** Convert a LAMMPS version date to a number
*
* This will generate a number YYYYMMDD from a date string
* (with or without blanks) that is suitable for numerical
* comparisons, i.e. later dates will generate a larger number.
*
* The day may or may not have a leading zero, the month
* is identified by the first 3 letters (so there may be more)
* and the year may be 2 or 4 digits (the missing 2 digits will
* be assumed as 20. That is 04 corresponds to 2004).
*
* No check is made whether the date is valid.
*
* \param date string in the format (Day Month Year)
* \return date code
*/
int date2num(const std::string &date);
}
}

View File

@ -1,13 +1,13 @@
add_executable(library-open library-open.cpp)
target_link_libraries(library-open PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(LibraryOpen library-open)
add_executable(test_library_open test_library_open.cpp)
target_link_libraries(test_library_open PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(LibraryOpen test_library_open)
add_executable(library-commands library-commands.cpp)
target_link_libraries(library-commands PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(LibraryCommands library-commands)
add_executable(test_library_commands test_library_commands.cpp)
target_link_libraries(test_library_commands PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(LibraryCommands test_library_commands)
add_executable(library-properties library-properties.cpp)
target_link_libraries(library-properties PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(LibraryProperties library-properties)
add_executable(test_library_properties test_library_properties.cpp)
target_link_libraries(test_library_properties PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(LibraryProperties test_library_properties)

View File

@ -1,8 +1,8 @@
add_executable(lammps-class lammps-class.cpp)
target_link_libraries(lammps-class PRIVATE lammps GTest::GMockMain GTest::GTest GTest::GMock)
add_test(LammpsClass lammps-class)
add_executable(test_lammps_class test_lammps_class.cpp)
target_link_libraries(test_lammps_class PRIVATE lammps GTest::GMockMain GTest::GTest GTest::GMock)
add_test(LammpsClass test_lammps_class)
add_executable(input-class input-class.cpp)
target_link_libraries(input-class PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(InputClass input-class)
add_executable(test_input_class test_input_class.cpp)
target_link_libraries(test_input_class PRIVATE lammps GTest::GTest GTest::GTestMain)
add_test(InputClass test_input_class)

View File

@ -5,6 +5,7 @@ epsilon: 5e-13
prerequisites: ! |
atom full
pair coul/streitz
kspace ewald
pre_commands: ! |
variable units index metal
variable newton_pair delete

View File

@ -61,7 +61,7 @@ TEST_F(DumpCfgZstdTest, compressed_run0)
auto compressed_file = "dump_cfg_zstd_compressed_run0.melt.cfg.zst";
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
generate_text_and_compressed_dump(text_files, compressed_files, "cfg/gz", fields, "", 0);
generate_text_and_compressed_dump(text_files, compressed_files, "cfg/zstd", fields, "", 0);
TearDown();

View File

@ -18,13 +18,13 @@ if(CMAKE_Fortran_COMPILER)
add_library(flammps STATIC ${LAMMPS_FORTRAN_MODULE})
add_executable(fortran-create wrap-create.cpp fortran-create.f90)
target_link_libraries(fortran-create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
add_test(FortranOpen fortran-create)
add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90)
target_link_libraries(test_fortran_create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
add_test(FortranOpen test_fortran_create)
add_executable(fortran-commands wrap-commands.cpp fortran-commands.f90)
target_link_libraries(fortran-commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
add_test(FortranCommands fortran-commands)
add_executable(test_fortran_commands wrap_commands.cpp test_fortran_commands.f90)
target_link_libraries(test_fortran_commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
add_test(FortranCommands test_fortran_commands)
else()
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran compiler")
endif()

View File

@ -611,3 +611,20 @@ TEST(Utils, timespec2seconds_hhmmss)
{
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:10:45"), 7845.0);
}
TEST(Utils, date2num)
{
ASSERT_EQ(utils::date2num("1Jan05"),20050101);
ASSERT_EQ(utils::date2num("10Feb2005"),20050210);
ASSERT_EQ(utils::date2num("02Mar10"),20100302);
ASSERT_EQ(utils::date2num(" 5Apr1900"),19000405);
ASSERT_EQ(utils::date2num("10May22 "),20220510);
ASSERT_EQ(utils::date2num("1 Jun 05"),20050601);
ASSERT_EQ(utils::date2num("10 Jul 2005"),20050710);
ASSERT_EQ(utils::date2num("02 Aug 10"),20100802);
ASSERT_EQ(utils::date2num(" 5 September 99"),20990905);
ASSERT_EQ(utils::date2num("10October22 "),20221010);
ASSERT_EQ(utils::date2num("30November 02"),20021130);
ASSERT_EQ(utils::date2num("31December100"),1001231);
}