Merge branch 'master' into refactor-reaxff-parser

# Conflicts:
#	doc/src/fix_qeq_reax.rst
#	src/OPENMP/reaxc_bond_orders_omp.h
#	src/OPENMP/reaxc_bonds_omp.h
#	src/OPENMP/reaxc_forces_omp.h
#	src/OPENMP/reaxc_hydrogen_bonds_omp.h
#	src/OPENMP/reaxc_init_md_omp.cpp
#	src/OPENMP/reaxc_init_md_omp.h
#	src/OPENMP/reaxc_multi_body_omp.h
#	src/OPENMP/reaxc_nonbonded_omp.h
#	src/OPENMP/reaxc_torsion_angles_omp.h
#	src/OPENMP/reaxc_valence_angles_omp.h
#	src/OPENMP/reaxff_omp.h
#	src/Purge.list
#	src/QEQ/fix_qeq.cpp
#	src/QEQ/fix_qeq.h
#	src/QEQ/fix_qeq_dynamic.cpp
#	src/QEQ/fix_qeq_fire.cpp
#	src/REAXFF/fix_qeq_reax.cpp
#	src/REAXFF/reaxc_allocate.h
#	src/REAXFF/reaxc_bond_orders.h
#	src/REAXFF/reaxc_bonds.h
#	src/REAXFF/reaxc_control.h
#	src/REAXFF/reaxc_defs.h
#	src/REAXFF/reaxc_ffield.h
#	src/REAXFF/reaxc_forces.h
#	src/REAXFF/reaxc_hydrogen_bonds.h
#	src/REAXFF/reaxc_init_md.cpp
#	src/REAXFF/reaxc_init_md.h
#	src/REAXFF/reaxc_io_tools.cpp
#	src/REAXFF/reaxc_io_tools.h
#	src/REAXFF/reaxc_list.h
#	src/REAXFF/reaxc_lookup.h
#	src/REAXFF/reaxc_multi_body.h
#	src/REAXFF/reaxc_nonbonded.h
#	src/REAXFF/reaxc_reset_tools.h
#	src/REAXFF/reaxc_system_props.cpp
#	src/REAXFF/reaxc_system_props.h
#	src/REAXFF/reaxc_tool_box.h
#	src/REAXFF/reaxc_torsion_angles.h
#	src/REAXFF/reaxc_traj.cpp
#	src/REAXFF/reaxc_traj.h
#	src/REAXFF/reaxc_types.h
#	src/REAXFF/reaxc_valence_angles.h
#	src/REAXFF/reaxc_vector.cpp
#	src/REAXFF/reaxc_vector.h
#	src/REAXFF/reaxff_api.h
#	src/REAXFF/reaxff_defs.h
#	src/REAXFF/reaxff_inline.h
#	src/REAXFF/reaxff_types.h
#	src/text_file_reader.cpp
#	src/text_file_reader.h
#	unittest/force-styles/tests/atomic-pair-reax_c.yaml
#	unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml
#	unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml
This commit is contained in:
Axel Kohlmeyer
2021-07-12 13:58:09 -04:00
6013 changed files with 162244 additions and 78636 deletions

View File

@ -1,6 +1,6 @@
# build LAMMPS plugins, but not on Windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND PKG_PLUGIN)
if((NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows")) AND PKG_PLUGIN)
ExternalProject_Add(plugins
SOURCE_DIR "${LAMMPS_DIR}/examples/plugins"
BINARY_DIR ${CMAKE_BINARY_DIR}/build-plugins
@ -56,3 +56,10 @@ add_executable(test_reset_ids test_reset_ids.cpp)
target_compile_definitions(test_reset_ids PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_reset_ids PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME ResetIDs COMMAND test_reset_ids WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(BUILD_MPI)
add_executable(test_mpi_load_balancing test_mpi_load_balancing.cpp)
target_link_libraries(test_mpi_load_balancing PRIVATE lammps GTest::GTest GTest::GMock)
target_compile_definitions(test_mpi_load_balancing PRIVATE ${TEST_CONFIG_DEFS})
add_mpi_test(NAME MPILoadBalancing NUM_PROCS 4 COMMAND $<TARGET_FILE:test_mpi_load_balancing>)
endif()

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract

View File

@ -0,0 +1,257 @@
// unit tests for checking LAMMPS MPI load balancing
#define LAMMPS_LIB_MPI 1
#include "lammps.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "neighbor.h"
#include "input.h"
#include "timer.h"
#include "info.h"
#include <string>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/test_mpi_main.h"
using ::testing::ExitedWithCode;
using ::testing::HasSubstr;
using ::testing::StartsWith;
using ::testing::StrEq;
namespace LAMMPS_NS
{
class MPILoadBalanceTest : public ::testing::Test {
public:
void command(const std::string &line) { lmp->input->one(line); }
protected:
const char *testbinary = "LAMMPSTest";
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {testbinary, "-log", "none", "-echo", "screen", "-nocite"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
if (!verbose) ::testing::internal::CaptureStdout();
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
InitSystem();
if (!verbose) ::testing::internal::GetCapturedStdout();
}
virtual void InitSystem()
{
command("boundary f f f");
command("units lj");
command("atom_style atomic");
command("atom_modify map yes");
command("region box block 0 20 0 20 0 20");
command("create_box 1 box");
command("mass 1 1.0");
command("pair_style lj/cut 2.5");
command("pair_coeff 1 1 1.0 1.0 2.5");
command("neighbor 0.3 bin");
command("neigh_modify every 20 delay 0 check no");
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
lmp = nullptr;
if (!verbose) ::testing::internal::GetCapturedStdout();
}
};
TEST_F(MPILoadBalanceTest, grid_yz)
{
command("create_atoms 1 single 0 0 0");
command("create_atoms 1 single 0 0 5");
command("create_atoms 1 single 0 5 0");
command("create_atoms 1 single 0 5 5");
command("create_atoms 1 single 5 0 0");
command("create_atoms 1 single 5 0 5");
command("create_atoms 1 single 5 5 0");
command("create_atoms 1 single 5 5 5");
ASSERT_EQ(lmp->atom->natoms, 8);
ASSERT_EQ(lmp->comm->nprocs, 4);
// initial state
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
command("balance 1 x uniform y 0.125 z uniform");
// state after balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 4);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 4);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
command("balance 1 x uniform y 0.125 z 0.125");
// state after second balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
}
}
TEST_F(MPILoadBalanceTest, rcb)
{
command("comm_style tiled");
command("create_atoms 1 single 0 0 0");
command("create_atoms 1 single 0 0 5");
command("create_atoms 1 single 0 5 0");
command("create_atoms 1 single 0 5 5");
command("create_atoms 1 single 5 0 0");
command("create_atoms 1 single 5 0 5");
command("create_atoms 1 single 5 5 0");
command("create_atoms 1 single 5 5 5");
// initial state
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
command("balance 1 rcb");
// state after balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
}
// box dimensions should have minimal size
double dx = lmp->domain->subhi[0] - lmp->domain->sublo[0];
double dy = lmp->domain->subhi[1] - lmp->domain->sublo[1];
double dz = lmp->domain->subhi[2] - lmp->domain->sublo[2];
ASSERT_GT(dx, lmp->neighbor->skin);
ASSERT_GT(dy, lmp->neighbor->skin);
ASSERT_GT(dz, lmp->neighbor->skin);
}
TEST_F(MPILoadBalanceTest, rcb_min_size)
{
GTEST_SKIP();
// TODO minimum domain size is not enforced right now
// skipping for now to allow other MPI tests to get merged
command("comm_style tiled");
command("create_atoms 1 single 0 0 0");
command("create_atoms 1 single 0 0 0.25");
command("create_atoms 1 single 0 0.25 0");
command("create_atoms 1 single 0 0.25 0.25");
command("create_atoms 1 single 0.25 0 0");
command("create_atoms 1 single 0.25 0 0.25");
command("create_atoms 1 single 0.25 0.25 0");
command("create_atoms 1 single 0.25 0.25 0.25");
// initial state
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
// this should fail and not change the boxes
// or keep them at a minimum size
command("balance 1 rcb");
// state after balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
// box dimensions should have minimal size
double dx = lmp->domain->subhi[0] - lmp->domain->sublo[0];
double dy = lmp->domain->subhi[1] - lmp->domain->sublo[1];
double dz = lmp->domain->subhi[2] - lmp->domain->sublo[2];
ASSERT_GT(dx, lmp->neighbor->skin);
ASSERT_GT(dy, lmp->neighbor->skin);
ASSERT_GT(dz, lmp->neighbor->skin);
}
}

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -14,6 +14,7 @@
#include "lammps.h"
#include "citeme.h"
#include "comm.h"
#include "force.h"
#include "info.h"
#include "input.h"
@ -25,6 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include "../testing/utils.h"
#include <cstdio>
#include <cstring>
@ -174,6 +176,38 @@ TEST_F(SimpleCommandsTest, Partition)
ASSERT_THAT(text, StrEq(""));
}
TEST_F(SimpleCommandsTest, Processors)
{
// default setting is "*" for all dimensions
ASSERT_EQ(lmp->comm->user_procgrid[0], 0);
ASSERT_EQ(lmp->comm->user_procgrid[1], 0);
ASSERT_EQ(lmp->comm->user_procgrid[2], 0);
BEGIN_HIDE_OUTPUT();
command("processors 1 1 1");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->comm->user_procgrid[0], 1);
ASSERT_EQ(lmp->comm->user_procgrid[1], 1);
ASSERT_EQ(lmp->comm->user_procgrid[2], 1);
BEGIN_HIDE_OUTPUT();
command("processors * 1 *");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->comm->user_procgrid[0], 0);
ASSERT_EQ(lmp->comm->user_procgrid[1], 1);
ASSERT_EQ(lmp->comm->user_procgrid[2], 0);
BEGIN_HIDE_OUTPUT();
command("processors 0 0 0");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->comm->user_procgrid[0], 0);
ASSERT_EQ(lmp->comm->user_procgrid[1], 0);
ASSERT_EQ(lmp->comm->user_procgrid[2], 0);
TEST_FAILURE(".*ERROR: Illegal processors command .*", command("processors -1 0 0"););
TEST_FAILURE(".*ERROR: Specified processors != physical processors.*", command("processors 100 100 100"););
}
TEST_F(SimpleCommandsTest, Quit)
{
BEGIN_HIDE_OUTPUT();

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -105,8 +105,8 @@ protected:
"# comments only\n five\n#END\n",
fp);
fclose(fp);
fp = fopen("test_variable.atomfile", "w");
fp = fopen("test_variable.atomfile", "w");
fputs("# test file for atomfile style variable\n\n"
"4 # four lines\n4 0.5 #with comment\n"
"2 -0.5 \n3 1.5\n1 -1.5\n\n"