test more /chunk computes
This commit is contained in:
@ -23,8 +23,10 @@
|
|||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
static constexpr double EPSILON = 1.0e-6;
|
|
||||||
|
// we compare floating point numbers with 8 digits precision after the decimal point
|
||||||
|
static constexpr double EPSILON = 1.0e-8;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
@ -237,30 +239,80 @@ TEST_F(ComputeChunkTest, ChunkComputes)
|
|||||||
command("compute ang all angmom/chunk mols");
|
command("compute ang all angmom/chunk mols");
|
||||||
command("compute com all com/chunk mols");
|
command("compute com all com/chunk mols");
|
||||||
command("compute dip all dipole/chunk mols geometry");
|
command("compute dip all dipole/chunk mols geometry");
|
||||||
command("fix hist1 all ave/time 1 1 1 c_ang[*] c_com[*] c_dip[*] mode vector");
|
command("compute gyr all gyration/chunk mols");
|
||||||
|
command("compute mom all inertia/chunk mols");
|
||||||
|
command("compute omg all omega/chunk mols");
|
||||||
|
command("compute tmp all temp/chunk mols com yes");
|
||||||
|
command("compute trq all torque/chunk mols");
|
||||||
|
command("compute vcm all vcm/chunk mols");
|
||||||
|
command("fix hist1 all ave/time 1 1 1 c_ang[*] c_com[*] c_dip[*] c_gyr c_mom[*] c_omg[*] "
|
||||||
|
"c_trq[*] c_vcm[*] mode vector file all_chunk.dat format %15.8f");
|
||||||
|
command("fix hist2 all ave/time 1 1 1 c_tmp mode vector file vec_chunk.dat format %15.8f");
|
||||||
command("run 0 post no");
|
command("run 0 post no");
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
auto cang = get_array("ang");
|
auto cang = get_array("ang");
|
||||||
auto ccom = get_array("com");
|
auto ccom = get_array("com");
|
||||||
auto cdip = get_array("dip");
|
auto cdip = get_array("dip");
|
||||||
EXPECT_NEAR(cang[0][0], -0.0190698, EPSILON);
|
auto cgyr = get_vector("gyr");
|
||||||
EXPECT_NEAR(cang[0][1], -0.0281453, EPSILON);
|
auto cmom = get_array("mom");
|
||||||
EXPECT_NEAR(cang[0][2], -0.0335739, EPSILON);
|
auto comg = get_array("omg");
|
||||||
|
auto ctmp = get_vector("tmp");
|
||||||
|
auto ctrq = get_array("trq");
|
||||||
|
auto cvcm = get_array("vcm");
|
||||||
|
EXPECT_NEAR(cang[0][0], -0.01906982, EPSILON);
|
||||||
|
EXPECT_NEAR(cang[0][1], -0.02814532, EPSILON);
|
||||||
|
EXPECT_NEAR(cang[0][2], -0.03357393, EPSILON);
|
||||||
EXPECT_NEAR(cang[5][0], 0.00767837, EPSILON);
|
EXPECT_NEAR(cang[5][0], 0.00767837, EPSILON);
|
||||||
EXPECT_NEAR(cang[5][1], -0.00303138, EPSILON);
|
EXPECT_NEAR(cang[5][1], -0.00303138, EPSILON);
|
||||||
EXPECT_NEAR(cang[5][2], 0.00740977, EPSILON);
|
EXPECT_NEAR(cang[5][2], 0.00740977, EPSILON);
|
||||||
EXPECT_NEAR(ccom[1][0], 2.2705137, EPSILON);
|
EXPECT_NEAR(ccom[1][0], 2.27051374, EPSILON);
|
||||||
EXPECT_NEAR(ccom[1][1], -1.2103888, EPSILON);
|
EXPECT_NEAR(ccom[1][1], -1.21038876, EPSILON);
|
||||||
EXPECT_NEAR(ccom[1][2], -0.585817, EPSILON);
|
EXPECT_NEAR(ccom[1][2], -0.58581655, EPSILON);
|
||||||
EXPECT_NEAR(ccom[5][0], -1.9828469, EPSILON);
|
EXPECT_NEAR(ccom[5][0], -1.98284693, EPSILON);
|
||||||
EXPECT_NEAR(ccom[5][1], -4.1735122, EPSILON);
|
EXPECT_NEAR(ccom[5][1], -4.17351226, EPSILON);
|
||||||
EXPECT_NEAR(ccom[5][2], 2.0485, EPSILON);
|
EXPECT_NEAR(ccom[5][2], 2.04850072, EPSILON);
|
||||||
EXPECT_NEAR(cdip[0][3], 0.359122, EPSILON);
|
EXPECT_NEAR(cmom[2][0], 4.28810281, EPSILON);
|
||||||
EXPECT_NEAR(cdip[1][3], 0.684537, EPSILON);
|
EXPECT_NEAR(cmom[2][1], 4.99562488, EPSILON);
|
||||||
EXPECT_NEAR(cdip[2][3], 0.502726, EPSILON);
|
EXPECT_NEAR(cmom[2][2], 5.34954800, EPSILON);
|
||||||
EXPECT_NEAR(cdip[3][3], 0.508459, EPSILON);
|
EXPECT_NEAR(cmom[5][0], 3.06867233, EPSILON);
|
||||||
EXPECT_NEAR(cdip[4][3], 0.497574, EPSILON);
|
EXPECT_NEAR(cmom[5][1], 5.24202887, EPSILON);
|
||||||
EXPECT_NEAR(cdip[5][3], 0.49105, EPSILON);
|
EXPECT_NEAR(cmom[5][2], 6.06478557, EPSILON);
|
||||||
|
EXPECT_NEAR(comg[3][0], -0.00349423, EPSILON);
|
||||||
|
EXPECT_NEAR(comg[3][1], -0.00025062, EPSILON);
|
||||||
|
EXPECT_NEAR(comg[3][2], -0.00323573, EPSILON);
|
||||||
|
EXPECT_NEAR(comg[5][0], 0.00437315, EPSILON);
|
||||||
|
EXPECT_NEAR(comg[5][1], 0.00029335, EPSILON);
|
||||||
|
EXPECT_NEAR(comg[5][2], 0.00268517, EPSILON);
|
||||||
|
EXPECT_NEAR(ctrq[4][0], -0.94086086, EPSILON);
|
||||||
|
EXPECT_NEAR(ctrq[4][1], 0.56227336, EPSILON);
|
||||||
|
EXPECT_NEAR(ctrq[4][2], 0.75139995, EPSILON);
|
||||||
|
EXPECT_NEAR(ctrq[5][0], -0.07066910, EPSILON);
|
||||||
|
EXPECT_NEAR(ctrq[5][1], -0.58556032, EPSILON);
|
||||||
|
EXPECT_NEAR(ctrq[5][2], -0.81513604, EPSILON);
|
||||||
|
EXPECT_NEAR(cvcm[0][0], -0.00011274, EPSILON);
|
||||||
|
EXPECT_NEAR(cvcm[0][1], 0.00071452, EPSILON);
|
||||||
|
EXPECT_NEAR(cvcm[0][2], -0.00017908, EPSILON);
|
||||||
|
EXPECT_NEAR(cvcm[5][0], -0.00063326, EPSILON);
|
||||||
|
EXPECT_NEAR(cvcm[5][1], 0.00007092, EPSILON);
|
||||||
|
EXPECT_NEAR(cvcm[5][2], 0.00045545, EPSILON);
|
||||||
|
EXPECT_NEAR(cdip[0][3], 0.35912150, EPSILON);
|
||||||
|
EXPECT_NEAR(cdip[1][3], 0.68453713, EPSILON);
|
||||||
|
EXPECT_NEAR(cdip[2][3], 0.50272643, EPSILON);
|
||||||
|
EXPECT_NEAR(cdip[3][3], 0.50845862, EPSILON);
|
||||||
|
EXPECT_NEAR(cdip[4][3], 0.49757365, EPSILON);
|
||||||
|
EXPECT_NEAR(cdip[5][3], 0.49105019, EPSILON);
|
||||||
|
EXPECT_NEAR(cgyr[0], 1.48351858, EPSILON);
|
||||||
|
EXPECT_NEAR(cgyr[1], 1.56649567, EPSILON);
|
||||||
|
EXPECT_NEAR(cgyr[2], 0.55196552, EPSILON);
|
||||||
|
EXPECT_NEAR(cgyr[3], 0.54573649, EPSILON);
|
||||||
|
EXPECT_NEAR(cgyr[4], 0.54793875, EPSILON);
|
||||||
|
EXPECT_NEAR(cgyr[5], 0.54708204, EPSILON);
|
||||||
|
EXPECT_NEAR(ctmp[0], 1.08268576, EPSILON);
|
||||||
|
EXPECT_NEAR(ctmp[1], 1.61905718, EPSILON);
|
||||||
|
EXPECT_NEAR(ctmp[2], 1.41991778, EPSILON);
|
||||||
|
EXPECT_NEAR(ctmp[3], 0.55484671, EPSILON);
|
||||||
|
EXPECT_NEAR(ctmp[4], -0.06062938, EPSILON);
|
||||||
|
EXPECT_NEAR(ctmp[5], -0.09219489, EPSILON);
|
||||||
}
|
}
|
||||||
} // namespace LAMMPS_NS
|
} // namespace LAMMPS_NS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user