Merge branch 'develop' into test-fix-numdiff

This commit is contained in:
Axel Kohlmeyer
2024-01-26 23:21:44 -05:00
649 changed files with 6975 additions and 4491 deletions

View File

@ -335,7 +335,7 @@ TEST_F(LibraryProperties, setting)
EXPECT_EQ(lammps_extract_setting(lmp, "mu_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "rmass_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "radius_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "sphere_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "sphere_flag"), -1);
EXPECT_EQ(lammps_extract_setting(lmp, "ellipsoid_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "omega_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "torque_flag"), 0);

View File

@ -780,6 +780,25 @@ TEST_F(VariableTest, Format)
// TEST_FAILURE(".*ERROR: Incorrect conversion in format string.*",
// command("print \"${f1idx}\""););
}
TEST_F(VariableTest, Set)
{
BEGIN_HIDE_OUTPUT();
command("variable three string three");
command("variable ten internal 10.0");
END_HIDE_OUTPUT();
ASSERT_EQ(variable->nvar, 3);
ASSERT_THAT(variable->retrieve("three"), StrEq("three"));
ASSERT_THAT(variable->retrieve("ten"), StrEq("10"));
ASSERT_EQ(variable->internalstyle(variable->find("three")), 0);
ASSERT_EQ(variable->internalstyle(variable->find("ten")), 1);
variable->set_string("three", "new");
ASSERT_THAT(variable->retrieve("three"), StrEq("new"));
variable->internal_set(variable->find("ten"), -2.5);
ASSERT_THAT(variable->retrieve("ten"), StrEq("-2.5"));
}
} // namespace LAMMPS_NS
int main(int argc, char **argv)

View File

@ -9,7 +9,7 @@ prerequisites: ! |
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
angle_style: lepton
angle_style: lepton auto_offset
angle_coeff: ! |
1 110.1 "k*theta^2; k=75.0"
2 111.0 "k*theta^2; k=45.0"

View File

@ -0,0 +1,88 @@
---
lammps_version: 22 Dec 2022
date_generated: Fri Dec 23 15:10:29 2022
epsilon: 7.5e-13
skip_tests:
prerequisites: ! |
atom full
angle lepton
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
angle_style: lepton no_offset
angle_coeff: ! |
1 110.1 "k*theta^2; k=75.0"
2 111.0 "k*theta^2; k=45.0"
3 120.0 "k*theta^2; k=50.0"
4 108.5 "k*theta^2; k=100.0"
equilibrium: 4 1.9216075064457567 1.9373154697137058 2.0943951023931953 1.8936822384138476
extract: ! |
theta0 1
natoms: 29
init_energy: 41.53081789649104
init_stress: ! |2-
8.9723357320869297e+01 -8.7188643750026529e+01 -2.5347135708427655e+00 9.2043419883119782e+01 -2.8187238090404904e+01 -1.5291148024926793e+00
init_forces: ! |2
1 4.7865489310693540e+01 7.8760925902181516e+00 -3.2694525514709866e+01
2 -1.1124882516177341e+00 -9.0075464203887403e+00 -7.2431691227364459e+00
3 -5.9057050592859328e+00 5.3263619873546261e+01 5.2353380124691469e+01
4 -1.6032230038990633e+01 -2.4560529343731403e+01 1.2891625920422307e+01
5 -4.4802331573497639e+01 -4.8300919461089379e+01 -2.3310767889219324e+01
6 4.7083124388174824e+01 -9.5212933434476312e+00 -3.2526392870546800e+01
7 -1.6208182775476303e+01 1.4458587960739102e+01 -3.5314745459502710e+00
8 -6.5664612141881040e+00 -2.5126850154274202e+01 8.2187944731423329e+01
9 -1.5504395262358301e+01 1.6121044185227817e+01 -4.2007069622477866e-01
10 9.9863759179365275e+00 4.1873540105704549e+01 -6.6085640966037403e+01
11 -2.0441876158908627e+01 -6.5186824168985984e+00 9.0023620309811072e+00
12 -1.0772126658369565e+01 -1.0807367300158219e+01 -9.6049647456797871e+00
13 2.8847886813946291e+00 7.2973241014859198e+00 -1.0414233993842981e-01
14 1.5267407478336393e+01 -9.4754911480231776e+00 -6.6307012925544200e+00
15 1.2402914209534773e+01 -6.2644630791613967e+00 1.8484576795819933e+01
16 3.8927757686508357e-01 1.0690061587911176e+01 6.1542759189377696e+00
17 1.4664194297570785e+00 -1.9971277376602425e+00 1.0776844613215999e+00
18 1.5785371874873322e-01 1.6495665212200166e+00 -6.6944747776990434e+00
19 -1.9328033033421670e+00 -2.4078805870919706e+00 2.8669575541313534e+00
20 1.7749495845934338e+00 7.5831406587195394e-01 3.8275172235676900e+00
21 3.4186149299343742e+00 4.2795410364249484e+00 -1.2789555411020650e+01
22 -6.0875600315279677e+00 -4.1504951869796605e+00 4.5212856070195766e+00
23 2.6689451015935934e+00 -1.2904584944528752e-01 8.2682698040010738e+00
24 -1.3053945393770587e+00 5.0741459325183271e+00 -3.0209518576073018e+00
25 -1.0471133765834284e+00 -3.5082261409793856e+00 5.7374874908501228e-01
26 2.3525079159604871e+00 -1.5659197915389413e+00 2.4472031085222894e+00
27 -2.8720725187343754e-01 2.3577465459557132e+00 -8.0312673032168869e-01
28 -6.2799575211500369e-01 -1.4097313073755862e+00 3.2747938980616453e-02
29 9.1520300398844123e-01 -9.4801523858012704e-01 7.7037879134107223e-01
run_energy: 41.28323739029462
run_stress: ! |2-
8.8236221596506681e+01 -8.6492260623309562e+01 -1.7439609731970940e+00 9.0601855980531312e+01 -2.8735005690484968e+01 -2.6097632235197477e+00
run_forces: ! |2
1 4.7316793853445830e+01 8.2815577813110188e+00 -3.2021703111755464e+01
2 -1.1508196824491330e+00 -9.3814982172707460e+00 -7.5761211707510139e+00
3 -5.1083163691832576e+00 5.2667553294971619e+01 5.1784852458007592e+01
4 -1.6078177452605999e+01 -2.4156048365236213e+01 1.3140924677013103e+01
5 -4.4915734474022280e+01 -4.8095168640411821e+01 -2.3331149037574161e+01
6 4.7077916942842350e+01 -9.5906213020090156e+00 -3.2570331503075487e+01
7 -1.6228599672412471e+01 1.4485102617342370e+01 -3.5441153194985300e+00
8 -6.5097893981550730e+00 -2.5117582302614530e+01 8.2131369512416001e+01
9 -1.5527440970965937e+01 1.6147270375910470e+01 -4.0812004993325646e-01
10 1.0070812216240984e+01 4.1571532807578805e+01 -6.5968810328796337e+01
11 -2.0431584971707451e+01 -6.4817395192247664e+00 8.9879981618991636e+00
12 -1.0884695976714678e+01 -1.1067390190389006e+01 -9.1551242768940568e+00
13 2.8052913970098801e+00 7.1296301666594912e+00 1.3173039168682621e-02
14 1.5254877537873529e+01 -8.9700095533297350e+00 -6.5719846903613162e+00
15 1.2392009100170984e+01 -6.0827695435257292e+00 1.7929674392339596e+01
16 4.7158712437377481e-01 1.0631038523396533e+01 6.0960085687560355e+00
17 1.4458707962589659e+00 -1.9708579331587350e+00 1.0634586790394520e+00
18 1.4201882413835909e-01 1.4265339757773337e+00 -5.7663956896747992e+00
19 -1.6609130686729365e+00 -2.0735307593211125e+00 2.4755525101127143e+00
20 1.5188942445345774e+00 6.4699678354377899e-01 3.2908431795620849e+00
21 3.2242729509516406e+00 4.0079233768386153e+00 -1.2047892238650988e+01
22 -5.7215184687399772e+00 -3.8871624402883409e+00 4.2679223469272234e+00
23 2.4972455177883366e+00 -1.2076093655027398e-01 7.7799698917237645e+00
24 -1.1661978296905471e+00 4.5271404898674854e+00 -2.6925565853370195e+00
25 -9.2712094527152167e-01 -3.1291890525017125e+00 5.1208215565053827e-01
26 2.0933187749620688e+00 -1.3979514373657731e+00 2.1804744296864813e+00
27 -2.6804542538020537e-01 2.1830651328698103e+00 -7.3931790038945400e-01
28 -5.7927072943128310e-01 -1.3052929090347909e+00 2.8365455885795865e-02
29 8.4731615481148848e-01 -8.7777222383501941e-01 7.1095244450365813e-01
...

View File

@ -0,0 +1,89 @@
---
lammps_version: 21 Nov 2023
date_generated: Thu Jan 18 10:15:41 2024
epsilon: 2.5e-13
skip_tests:
prerequisites: ! |
atom full
bond lepton
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
bond_style: lepton no_offset
bond_coeff: ! |
1 1.5 "k*r^2; k=250.0"
2 1.1 "k2*r^2 + k3*r^3 + k4*r^4; k2=300.0; k3=-100.0; k4=50.0"
3 1.3 "k*r^2; k=350.0"
4 1.2 "k*(r-0.2)^2; k=500.0"
5 1.0 "k*r^2; k=450.0"
equilibrium: 5 1.5 1.1 1.3 1.2 1
extract: ! |
r0 1
natoms: 29
init_energy: 38.295825321689215
init_stress: ! |-
-4.7778964706834920e+01 -9.3066674567350432e+01 3.4789470658440035e+02 -3.0023920169312170e+01 -8.0421418879842847e+01 5.8592449335969732e+01
init_forces: ! |2
1 -5.9149914305071416e+00 -3.7728809612345245e+01 -2.7769433362963369e+01
2 -9.4281609567839944e+00 -7.7586487054273015e+00 1.1096676787527940e+01
3 3.2211742366572125e+01 2.7682361264425523e+01 -7.0109911672970497e+00
4 4.9260777576375503e+00 -1.3809750102765932e+00 3.4951785613141868e+00
5 -1.2606902198593501e+00 -1.9373397933007170e+00 6.4372463095041841e+00
6 -3.8858476307965482e+01 6.8567296300319640e+01 1.9889888806614337e+02
7 7.5297927100028144e+00 -3.8622600737556944e+01 -1.9268793182212875e+02
8 1.3018665172824681e+01 -1.2902789438539877e+01 3.2406676637830003e+00
9 7.4343536239661590e-01 8.0072549738604493e-01 3.2899591078538779e+00
10 6.1558871886113291e+00 -2.2419470219698296e+00 1.0080175092279852e+01
11 -3.7020922615305768e-01 -9.1704102274126453e-01 -1.5046795827370363e+00
12 5.2437190958790678e+00 3.4225915524442998e+00 -2.5523597276998897e+00
13 -1.1277007635800260e+01 4.4610677459696646e+00 2.1195215396108269e-01
14 2.9813926585641828e+00 -6.0667387499775116e-01 7.7317115100728788e+00
15 2.5872825164662799e-01 -9.9415365173790704e+00 -3.5428115826174169e+00
16 5.2775953236493464e+01 -3.1855535724919463e+01 -1.6524229620195118e+02
17 -5.8735858023559175e+01 4.0959855098908882e+01 1.5582804819495431e+02
18 -9.0963607969319646e+00 -4.3343406270234155e+00 -1.7623055551859267e+01
19 1.2597490501067170e+01 8.0591915019111742e+00 1.5261489294231819e+01
20 -3.5011297041352050e+00 -3.7248508748877587e+00 2.3615662576274494e+00
21 -1.5332952658285048e+00 5.9630208068632040e-01 -7.4967230017303281e+00
22 4.2380253233105529e+00 1.0270453290850614e+00 6.6489894421385651e+00
23 -2.7047300574820481e+00 -1.6233474097713818e+00 8.4773355959176278e-01
24 -6.6588083188726532e+00 3.5110922792825918e+00 -6.5625174267043489e+00
25 7.9844426562464141e+00 -1.2853795683286129e+00 6.7123710742192300e+00
26 -1.3256343373737607e+00 -2.2257127109539789e+00 -1.4985364751488087e-01
27 6.6999960289138851e+00 6.3808952243186141e+00 2.0100808779497248e+00
28 -8.8466157439236681e-01 3.8018717064230995e-01 -5.9857060538593476e-01
29 -5.8153344545215182e+00 -6.7610823949609244e+00 -1.4115102725637900e+00
run_energy: 37.78424389351509
run_stress: ! |-
-4.6127506998693484e+01 -9.2129732247211749e+01 3.4548310342284810e+02 -2.9841348469661163e+01 -7.8434962689387717e+01 5.9253167412123155e+01
run_forces: ! |2
1 -5.8451208652159004e+00 -3.7483084455000643e+01 -2.7706576989352534e+01
2 -9.4646964278974774e+00 -7.8058897724822449e+00 1.1098831256058579e+01
3 3.1827086102630346e+01 2.7573911030624821e+01 -6.9576662575837211e+00
4 5.1502169659901655e+00 -1.4367546726785101e+00 3.6631301025186187e+00
5 -1.2208420775139264e+00 -1.8781699435112362e+00 6.2332639085051911e+00
6 -3.8491523409043303e+01 6.8063273218541468e+01 1.9723141045830272e+02
7 7.4838209349394775e+00 -3.8394258853636330e+01 -1.9092625515909930e+02
8 1.2676329319901857e+01 -1.2475162287097550e+01 3.3659783337736577e+00
9 6.8845241565874460e-01 7.3814593866184031e-01 3.0434095400342533e+00
10 6.2545583994797553e+00 -2.9600470917047201e+00 9.4247125735981765e+00
11 -1.9554747834212524e-01 -4.8434314068172696e-01 -7.9452259566032057e-01
12 5.2092795750960841e+00 3.1431929551776721e+00 -3.1346654851373348e+00
13 -1.1496483840617872e+01 4.5245217971580018e+00 2.1348220240918236e-01
14 3.1913399826660909e+00 -6.3760720126489068e-01 8.2740980433927742e+00
15 2.7338564489784484e-01 -9.7206665011069671e+00 -3.4841809697094543e+00
16 5.2461611410918316e+01 -3.1639255494702798e+01 -1.6483607587596811e+02
17 -5.8501866653548078e+01 4.0872194473703807e+01 1.5529162691391761e+02
18 -7.0990354207248405e+00 -2.4743922643289666e+00 -1.7824398936159682e+01
19 1.2019842510974870e+01 7.7105128268768715e+00 1.4523712108141252e+01
20 -4.9208070902500296e+00 -5.2361205625479048e+00 3.3006868280184283e+00
21 -1.8548628650934149e+00 2.7467524264262122e-01 -6.7601469408617412e+00
22 3.9136757840663186e+00 9.5561415744904055e-01 6.1181929861632272e+00
23 -2.0588129189729036e+00 -1.2302894000916618e+00 6.4195395469851357e-01
24 -5.7681973234153086e+00 2.0209144998436366e+00 -5.2864044021513967e+00
25 6.3696975292216704e+00 -1.0109756418053095e+00 5.3564043759405795e+00
26 -6.0150020580636188e-01 -1.0099388580383271e+00 -6.9999973789182365e-02
27 6.8467535469188450e+00 5.7500299184200578e+00 2.2775780974490298e+00
28 -1.3929430925479587e+00 5.9772788540443345e-01 -9.4056106886485980e-01
29 -5.4538104543708865e+00 -6.3477578038244911e+00 -1.3370170285841700e+00
...

View File

@ -1,6 +1,6 @@
---
lammps_version: 22 Dec 2022
date_generated: Thu Dec 22 09:57:30 2022
lammps_version: 21 Nov 2023
date_generated: Thu Jan 18 11:01:50 2024
epsilon: 5e-14
skip_tests: intel
prerequisites: ! |
@ -23,23 +23,24 @@ pair_coeff: ! |
2 4 "4.0*eps*((sig/r)^12-(sig/r)^6);eps=0.005;sig=0.5"
2 5 "4.0*eps*((sig/r)^12-(sig/r)^6);eps=0.00866025;sig=2.05"
3 3 "4.0*eps*((sig/r)^12-(sig/r)^6);eps=0.02;sig=3.2"
3 4 "4.0*eps*((sig/r)^12-(sig/r)^6);eps=0.0173205;sig=3.15"
3 4 "-eps*r;eps=0.0173205;sig=3.15"
3 5 "4.0*eps*((sig/r)^12-(sig/r)^6);eps=0.0173205;sig=3.15"
4 4 "10.0"
extract: ! ""
natoms: 29
init_vdwl: 749.2468149791969
init_vdwl: 746.1575578155301
init_coul: 0
init_stress: ! |2-
2.1793853434038242e+03 2.1988955172192768e+03 4.6653977523326257e+03 -7.5956547636050584e+02 2.4751536734032861e+01 6.6652028436400667e+02
2.1723526811665593e+03 2.1959162890293533e+03 4.6328064825512138e+03 -7.5509180369489252e+02 9.4506578600439983e+00 6.7585028859193505e+02
init_forces: ! |2
1 -2.3333390280895912e+01 2.6994567613322641e+02 3.3272827850356805e+02
1 -2.3359983837422618e+01 2.6996030011590727e+02 3.3274783233743295e+02
2 1.5828554630414899e+02 1.3025008843535872e+02 -1.8629682358935722e+02
3 -1.3528903738169066e+02 -3.8704313358319990e+02 -1.4568978437133106e+02
4 -7.8711096705893366e+00 2.1350518625373538e+00 -5.5954532185548134e+00
5 -2.5176757268228540e+00 -4.0521510681020239e+00 1.2152704057877019e+01
6 -8.3190662465252137e+02 9.6394149462625603e+02 1.1509093566509248e+03
7 5.8203388932513583e+01 -3.3608997951626793e+02 -1.7179617996573040e+03
8 1.4451392284291535e+02 -1.0927475861088995e+02 3.9990593492420442e+02
7 6.6340523101244187e+01 -3.4078810185436379e+02 -1.7003039516942540e+03
8 1.3674478037618434e+02 -1.0517874373121482e+02 3.8291074246191346e+02
9 7.9156945283097443e+01 8.5273009783986538e+01 3.5032175698445189e+02
10 5.3118875219105360e+02 -6.1040990859419412e+02 -1.8355872642619292e+02
11 -2.3530157267965532e+00 -5.9077640073819717e+00 -9.6590723955414290e+00
@ -48,8 +49,8 @@ init_forces: ! |2
14 -3.3852721292265153e+00 6.8636181241903649e-01 -8.7507190862499868e+00
15 -2.0454999188605300e-01 8.4846165523049883e+00 3.0131615419406712e+00
16 4.6326310311812108e+02 -3.3087715736498188e+02 -1.1893024561782554e+03
17 -4.5334300923766727e+02 3.1554283255882569e+02 1.2058417793481203e+03
18 -1.8862623280672661e-02 -3.3402010907951661e-02 3.1000479299095260e-02
17 -4.5371128972368928e+02 3.1609940794953951e+02 1.2052011419527653e+03
18 8.0197172683943874e-03 -2.4939258820032362e-03 -1.0571459969936936e-02
19 3.1843079640570047e-04 -2.3918627818763426e-04 1.7427252638513439e-03
20 -9.9760831209706009e-04 -1.0209184826753090e-03 3.6910972636601454e-04
21 -7.1566125273265186e+01 -8.1615678329920655e+01 2.2589561408339890e+02
@ -61,38 +62,38 @@ init_forces: ! |2
27 5.1810388677546001e+01 -2.2705458321213797e+02 9.0849111082069669e+01
28 -1.8041307121444069e+02 7.7534042932772905e+01 -1.2206956760706598e+02
29 1.2861057254925012e+02 1.4952711274394568e+02 3.1216025556267880e+01
run_vdwl: 719.4530651193046
run_vdwl: 716.5213000416621
run_coul: 0
run_stress: ! |2-
2.1330153957371017e+03 2.1547728168285516e+03 4.3976497417710125e+03 -7.3873328448298525e+02 4.1743821105370067e+01 6.2788012209191027e+02
2.1263870112744726e+03 2.1520080341389726e+03 4.3663519512361027e+03 -7.3456213833770062e+02 2.6927285459244832e+01 6.3691834104928068e+02
run_forces: ! |2
1 -2.0299419751359164e+01 2.6686193378823020e+02 3.2358785870694015e+02
2 1.5298617928491225e+02 1.2596516341409203e+02 -1.7961292655338619e+02
3 -1.3353630652439830e+02 -3.7923748696131315e+02 -1.4291839793625817e+02
4 -7.8374717836161762e+00 2.1276610789823409e+00 -5.5845014473820616e+00
5 -2.5014258630866735e+00 -4.0250131424704412e+00 1.2103512372025639e+01
6 -8.0681462887292457e+02 9.2165637136761688e+02 1.0270795806932783e+03
7 5.5780279349903523e+01 -3.1117530951561656e+02 -1.5746991292869018e+03
8 1.3452983055535049e+02 -1.0064659350255911e+02 3.8851791558207651e+02
9 7.6746213883425980e+01 8.2501469877402130e+01 3.3944351200617882e+02
10 5.2128033527695595e+02 -5.9920098848285863e+02 -1.8126029815043339e+02
11 -2.3573118090915246e+00 -5.8616944550888359e+00 -9.6049808811326205e+00
12 1.7503975847822900e+01 1.0626930310560814e+01 -8.0603160272054968e+00
13 8.0530313322973104e+00 -3.1756495170399117e+00 -1.4618315664740528e-01
14 -3.3416065168069773e+00 6.6492606336082150e-01 -8.6345131440469700e+00
15 -2.2253843262374914e-01 8.5025661635348779e+00 3.0369735873081622e+00
16 4.3476311264989465e+02 -3.1171086735551415e+02 -1.1135217194927448e+03
17 -4.2469846140777133e+02 2.9615411776780593e+02 1.1302573488400669e+03
18 -1.8849981672825908e-02 -3.3371636477421307e-02 3.0986293443778727e-02
19 3.0940277774414027e-04 -2.4634536455373044e-04 1.7433360008861016e-03
20 -9.8648131277150790e-04 -1.0112587134526946e-03 3.6932948773965417e-04
21 -7.0490745283106378e+01 -7.9749153581142139e+01 2.2171003384646431e+02
22 -1.0638717908920071e+02 -2.5949502163177968e+01 -1.6645589526812276e+02
23 1.7686797710735027e+02 1.0571018898885514e+02 -5.5243337084099387e+01
24 3.8206017656281375e+01 -2.1022820141992960e+02 1.1260711266189014e+02
25 -1.4918881473530880e+02 2.3762151395876508e+01 -1.2549188139143085e+02
26 1.1097059498808308e+02 1.8645503634228518e+02 1.2861559677865248e+01
27 5.0800844984832125e+01 -2.2296588090685469e+02 8.8607367716323253e+01
28 -1.7694190504288886e+02 7.6029945485182026e+01 -1.1950518150242071e+02
29 1.2614894925528141e+02 1.4694250820033548e+02 3.0893386672863034e+01
1 -2.0326040164905073e+01 2.6687684422507328e+02 3.2360752654223910e+02
2 1.5298608857690186e+02 1.2596506573447739e+02 -1.7961281277841888e+02
3 -1.3353631293077220e+02 -3.7923732277833739e+02 -1.4291833260989750e+02
4 -7.8374717116975035e+00 2.1276610267113969e+00 -5.5845014524498486e+00
5 -2.5014258756924157e+00 -4.0250131713717776e+00 1.2103512280982228e+01
6 -8.0714971444536457e+02 9.2203068890526424e+02 1.0274502514782534e+03
7 6.3722543724608350e+01 -3.1586173092061807e+02 -1.5580743968587681e+03
8 1.2737293861904031e+02 -9.6945064279519002e+01 3.7231518354375891e+02
9 7.6709940036396304e+01 8.2451980339096536e+01 3.3926849385746954e+02
10 5.2123408713149831e+02 -5.9914309504622599e+02 -1.8121478407355445e+02
11 -2.3573086824741427e+00 -5.8616969504300931e+00 -9.6049799947287671e+00
12 1.7504108236707797e+01 1.0626901299509713e+01 -8.0602444903747301e+00
13 8.0530313558451159e+00 -3.1756495145404533e+00 -1.4618321144421534e-01
14 -3.3416062225209915e+00 6.6492609500227240e-01 -8.6345136470911594e+00
15 -2.2253820242887132e-01 8.5025660110994483e+00 3.0369741645942137e+00
16 4.3476708820318731e+02 -3.1171425443331651e+02 -1.1135289618967258e+03
17 -4.2507048343681140e+02 2.9671384825884064e+02 1.1296230654445915e+03
18 8.0130752607770750e-03 -2.4895867517657545e-03 -1.0574351684568857e-02
19 3.0939970262803125e-04 -2.4635874092791046e-04 1.7433490521479268e-03
20 -9.8648319666298735e-04 -1.0112621691758337e-03 3.6933139856766442e-04
21 -7.0490745298133859e+01 -7.9749153568373742e+01 2.2171003384665224e+02
22 -1.0638717908973166e+02 -2.5949502162671845e+01 -1.6645589526807785e+02
23 1.7686797710711278e+02 1.0571018898899243e+02 -5.5243337084327727e+01
24 3.8206017659583978e+01 -2.1022820135505594e+02 1.1260711269986750e+02
25 -1.4918881473631544e+02 2.3762151403215309e+01 -1.2549188138812220e+02
26 1.1097059498835199e+02 1.8645503634383900e+02 1.2861559678659969e+01
27 5.0800844960383969e+01 -2.2296588092255456e+02 8.8607367714616288e+01
28 -1.7694190504410764e+02 7.6029945484553380e+01 -1.1950518150262033e+02
29 1.2614894924957088e+02 1.4694250819500266e+02 3.0893386676150566e+01
...

View File

@ -156,7 +156,6 @@ struct AtomState {
int extra_dihedral_per_atom = 0;
int extra_improper_per_atom = 0;
int sphere_flag = 0;
int ellipsoid_flag = 0;
int line_flag = 0;
int tri_flag = 0;
@ -293,7 +292,6 @@ void ASSERT_ATOM_STATE_EQ(Atom *atom, const AtomState &expected)
ASSERT_EQ(atom->extra_dihedral_per_atom, expected.extra_dihedral_per_atom);
ASSERT_EQ(atom->extra_improper_per_atom, expected.extra_improper_per_atom);
ASSERT_EQ(atom->sphere_flag, expected.sphere_flag);
ASSERT_EQ(atom->ellipsoid_flag, expected.ellipsoid_flag);
ASSERT_EQ(atom->line_flag, expected.line_flag);
ASSERT_EQ(atom->tri_flag, expected.tri_flag);
@ -882,7 +880,6 @@ TEST_F(AtomStyleTest, sphere)
expected.atom_style = "sphere";
expected.molecular = Atom::ATOMIC;
expected.tag_enable = 1;
expected.sphere_flag = 1;
expected.rmass_flag = 1;
expected.radius_flag = 1;
expected.omega_flag = 1;
@ -1391,7 +1388,6 @@ TEST_F(AtomStyleTest, line)
expected.atom_style = "line";
expected.molecular = Atom::ATOMIC;
expected.tag_enable = 1;
expected.sphere_flag = 1;
expected.molecule_flag = 1;
expected.line_flag = 1;
expected.rmass_flag = 1;
@ -1661,7 +1657,6 @@ TEST_F(AtomStyleTest, tri)
expected.atom_style = "tri";
expected.molecular = Atom::ATOMIC;
expected.tag_enable = 1;
expected.sphere_flag = 1;
expected.molecule_flag = 1;
expected.tri_flag = 1;
expected.rmass_flag = 1;

View File

@ -32,6 +32,8 @@ using testing::StrEq;
using utils::split_words;
const double EPSILON = 5.0e-14;
#define test_name test_info_->name()
static void create_molecule_files(const std::string &h2o_filename, const std::string &co2_filename)
@ -145,7 +147,7 @@ protected:
fclose(fp);
command(fmt::format("molecule {} {} {}", name, file, args));
remove(file.c_str());
platform::unlink(file.c_str());
}
};
@ -184,7 +186,7 @@ TEST_F(MoleculeFileTest, badargs)
TEST_FAILURE(
".*Illegal molecule command.*",
run_mol_cmd(test_name, "scale", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n"););
remove("badargs.mol");
platform::unlink("moltest_badargs.mol");
}
TEST_F(MoleculeFileTest, noatom)
@ -193,14 +195,14 @@ TEST_F(MoleculeFileTest, noatom)
run_mol_cmd(test_name, "",
"Comment\n0 atoms\n1 bonds\n\n"
" Coords\n\nBonds\n\n 1 1 2\n"););
remove("noatom.mol");
platform::unlink("moltest_noatom.mol");
}
TEST_F(MoleculeFileTest, empty)
{
TEST_FAILURE(".*ERROR: Unexpected end of molecule file.*",
run_mol_cmd(test_name, "", "Comment\n\n"););
remove("empty.mol");
platform::unlink("moltest_empty.mol");
}
TEST_F(MoleculeFileTest, nospecial)
@ -210,7 +212,7 @@ TEST_F(MoleculeFileTest, nospecial)
"Comment\n3 atoms\n\n2 bonds\n\n"
" Coords\n\n 1 1.0 1.0 1.0\n 2 1.0 1.0 0.0\n 3 1.0 0.0 1.0\n"
" Bonds\n\n 1 1 1 2\n 2 1 1 3\n"););
remove("nospecial.mol");
platform::unlink("moltest_nospecial.mol");
}
TEST_F(MoleculeFileTest, minimal)
@ -218,7 +220,7 @@ TEST_F(MoleculeFileTest, minimal)
BEGIN_CAPTURE_OUTPUT();
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
}
@ -230,7 +232,7 @@ TEST_F(MoleculeFileTest, notype)
command("create_box 1 box");
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*1 atoms.*\n.*0 bonds.*"));
TEST_FAILURE(".*ERROR: Create_atoms molecule must have atom types.*",
command("create_atoms 0 single 0.0 0.0 0.0 mol notype 542465"););
@ -259,7 +261,7 @@ TEST_F(MoleculeFileTest, twomols)
" Coords\n\n 1 0.0 0.0 0.0\n 2 0.0 0.0 1.0\n"
" Molecules\n\n 1 1\n 2 2\n\n Types\n\n 1 1\n 2 2\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*2 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*2 molecules.*\n"
".*0 fragments.*\n.*2 atoms with max type 2.*\n.*0 bonds.*"));
ASSERT_EQ(lmp->atom->nmolecule, 1);
auto mols = lmp->atom->get_molecule_by_id(test_name);
@ -273,10 +275,10 @@ TEST_F(MoleculeFileTest, twofiles)
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(
output,
ContainsRegex(".*Read molecule template twomols:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template twomols:.*\n.*Water.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"
".*Read molecule template twomols:.*\n.*1 molecules.*\n"
".*Read molecule template twomols:.*\n.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
BEGIN_CAPTURE_OUTPUT();
@ -306,7 +308,7 @@ TEST_F(MoleculeFileTest, labelmap)
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(
output,
ContainsRegex(".*Read molecule template h2olabel:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template h2olabel:.*\n.*Water.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*"));
BEGIN_CAPTURE_OUTPUT();
@ -314,7 +316,7 @@ TEST_F(MoleculeFileTest, labelmap)
output = END_CAPTURE_OUTPUT();
ASSERT_THAT(
output,
ContainsRegex(".*Read molecule template co2label:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template co2label:.*\n.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
BEGIN_CAPTURE_OUTPUT();
@ -328,12 +330,12 @@ TEST_F(MoleculeFileTest, labelmap)
auto second = output.substr(mark);
ASSERT_THAT(
first,
ContainsRegex(".*Read molecule template h2onum:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template h2onum:.*\n.*Water.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 2.*\n.*2 bonds with max type 1.*\n"
".*1 angles with max type 1.*\n.*0 dihedrals.*\n.*0 impropers.*\n"));
ASSERT_THAT(
second,
ContainsRegex(".*Read molecule template co2num:.*\n.*1 molecules.*\n"
ContainsRegex(".*Read molecule template co2num:.*\n.*CO2.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n"
".*1 angles with max type 2.*\n.*0 dihedrals.*"));
ASSERT_EQ(lmp->atom->nmolecule, 4);
@ -379,7 +381,7 @@ TEST_F(MoleculeFileTest, bonds)
" 1 1 1 2\n"
" 2 2 1 3\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*1 molecules.*\n"
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Comment.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*4 atoms.*type.*2.*\n"
".*2 bonds.*type.*2.*\n.*0 angles.*"));
@ -404,6 +406,60 @@ TEST_F(MoleculeFileTest, bonds)
END_HIDE_OUTPUT();
}
TEST_F(MoleculeFileTest, dipoles)
{
if (!LAMMPS::is_installed_pkg("DIPOLE")) GTEST_SKIP();
BEGIN_CAPTURE_OUTPUT();
command("atom_style dipole");
command("region box block 0 1 0 1 0 1");
command("create_box 2 box");
run_mol_cmd(test_name, "",
"# Dumbbell with dipole molecule file.\n\n"
"2 atoms\n\n"
"Coords\n\n1 -1.0 0.0 0.0\n2 1.0 0.0 0.0\n\n"
"Types\n\n1 1\n2 2\n\n"
"Dipoles\n\n1 1.0 0.0 0.0\n2 1.0 1.0 0.0\n\n");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*Dumbbell.*\n.*1 molecules.*\n"
".*0 fragments.*\n.*2 atoms.*type.*2.*\n"));
BEGIN_CAPTURE_OUTPUT();
command("mass * 1.0");
command("create_atoms 0 single 0.5 0.5 0.5 mol dipoles 67235 rotate 90.0 0.0 0.0 1.0");
output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, ContainsRegex(".*Created 2 atoms.*"));
Molecule *mol = lmp->atom->molecules[0];
ASSERT_EQ(mol->natoms, 2);
ASSERT_EQ(lmp->atom->natoms, 2);
mol->compute_mass();
mol->compute_com();
EXPECT_NEAR(mol->masstotal, 2.0, EPSILON);
EXPECT_NEAR(mol->com[0], 0.0, EPSILON);
EXPECT_NEAR(mol->com[1], 0.0, EPSILON);
EXPECT_NEAR(mol->com[2], 0.0, EPSILON);
EXPECT_EQ(mol->comatom, 1);
ASSERT_NE(mol->mu, nullptr);
EXPECT_NEAR(mol->mu[0][0], 1.0, EPSILON);
EXPECT_NEAR(mol->mu[0][1], 0.0, EPSILON);
EXPECT_NEAR(mol->mu[0][2], 0.0, EPSILON);
EXPECT_NEAR(mol->mu[1][0], 1.0, EPSILON);
EXPECT_NEAR(mol->mu[1][1], 1.0, EPSILON);
EXPECT_NEAR(mol->mu[1][2], 0.0, EPSILON);
EXPECT_NEAR(mol->maxextent, 2.0, EPSILON);
// dipoles should be rotated by 90 degrees clockwise around the z axis
double **mu = lmp->atom->mu;
ASSERT_NE(mu, nullptr);
EXPECT_NEAR(mu[0][0], 0.0, EPSILON);
EXPECT_NEAR(mu[0][1], 1.0, EPSILON);
EXPECT_NEAR(mu[0][2], 0.0, EPSILON);
EXPECT_NEAR(mu[0][3], 1.0, EPSILON);
EXPECT_NEAR(mu[1][0], -1.0, EPSILON);
EXPECT_NEAR(mu[1][1], 1.0, EPSILON);
EXPECT_NEAR(mu[1][2], 0.0, EPSILON);
EXPECT_NEAR(mu[1][3], sqrt(2.0), EPSILON);
}
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);

View File

@ -361,15 +361,23 @@ FUNCTION f_lammps_extract_variable_vector(i) BIND(C)
f_lammps_extract_variable_vector = vector(i)
END FUNCTION f_lammps_extract_variable_vector
SUBROUTINE f_lammps_set_variable_string() BIND(C)
USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int
SUBROUTINE f_lammps_set_string_variable() BIND(C)
USE LIBLAMMPS
USE keepstuff, ONLY : lmp, f2c_string
IMPLICIT NONE
CHARACTER(LEN=40) :: string
string = "this is the new string"
CALL lmp%set_variable('str', string)
END SUBROUTINE f_lammps_set_variable_string
CALL lmp%set_string_variable('str', string)
END SUBROUTINE f_lammps_set_string_variable
SUBROUTINE f_lammps_set_internal_variable() BIND(C)
USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double
USE LIBLAMMPS
USE keepstuff, ONLY : lmp, f2c_string
IMPLICIT NONE
CALL lmp%set_internal_variable('int', -2.5_c_double)
END SUBROUTINE f_lammps_set_internal_variable
! vim: sts=2 ts=2 sw=2 et

View File

@ -43,7 +43,9 @@ double f_lammps_extract_variable_internal();
double f_lammps_extract_variable_equal();
double f_lammps_extract_variable_atom(int);
double f_lammps_extract_variable_vector(int);
void f_lammps_set_variable_string();
void f_lammps_set_string_variable();
void f_lammps_set_internal_variable();
char *c_path_join(const char *, const char *);
}
@ -155,7 +157,7 @@ TEST_F(LAMMPS_extract_variable, string)
char *fstr = f_lammps_extract_variable_string();
EXPECT_STREQ(fstr, "this is a string");
std::free(fstr);
f_lammps_set_variable_string();
f_lammps_set_string_variable();
fstr = f_lammps_extract_variable_string();
EXPECT_STREQ(fstr, "this is the new string");
std::free(fstr);
@ -254,6 +256,8 @@ TEST_F(LAMMPS_extract_variable, internal)
{
f_lammps_setup_extract_variable();
EXPECT_DOUBLE_EQ(f_lammps_extract_variable_internal(), 4.0);
f_lammps_set_internal_variable();
EXPECT_DOUBLE_EQ(f_lammps_extract_variable_internal(), -2.5);
};
TEST_F(LAMMPS_extract_variable, equal)

View File

@ -475,6 +475,26 @@ create_atoms 1 single &
a = self.lmp.extract_variable("a")
self.assertEqual(a, 3.14)
def test_extract_variable_stringstyle(self):
self.lmp.command("variable a string xxx")
a = self.lmp.extract_variable("a")
self.assertEqual(a, 'xxx')
rv = self.lmp.set_string_variable("a","20")
a = self.lmp.extract_variable("a")
self.assertEqual(a, '20')
self.assertEqual(rv, 0)
def test_extract_variable_internalstyle(self):
self.lmp.command("variable a internal 2.0")
a = self.lmp.extract_variable("a")
self.assertEqual(a, 2.0)
rv = self.lmp.set_internal_variable("a",-4.5)
a = self.lmp.extract_variable("a")
self.assertEqual(a, -4.5)
self.assertEqual(rv, 0)
def test_extract_variable_atomstyle(self):
self.lmp.command("units lj")
self.lmp.command("atom_style atomic")

View File

@ -542,6 +542,41 @@ TEST(Lepton, Optimize)
out.str("");
}
TEST(Lepton, Exception)
{
Lepton::CompiledExpression function, derivative;
auto parsed = Lepton::Parser::parse("x*x");
function = parsed.createCompiledExpression();
derivative = parsed.differentiate("x").createCompiledExpression();
double x = 1.5;
EXPECT_NO_THROW(function.getVariableReference("x") = x;);
EXPECT_NO_THROW(derivative.getVariableReference("x") = x;);
EXPECT_DOUBLE_EQ(function.evaluate(), 2.25);
EXPECT_DOUBLE_EQ(derivative.evaluate(), 3.0);
parsed = Lepton::Parser::parse("x");
function = parsed.createCompiledExpression();
derivative = parsed.differentiate("x").createCompiledExpression();
x = 2.5;
EXPECT_NO_THROW(function.getVariableReference("x") = x;);
EXPECT_THROW(derivative.getVariableReference("x") = x;, Lepton::Exception);
EXPECT_DOUBLE_EQ(function.evaluate(), 2.5);
EXPECT_DOUBLE_EQ(derivative.evaluate(), 1.0);
parsed = Lepton::Parser::parse("1.0");
function = parsed.createCompiledExpression();
derivative = parsed.differentiate("x").createCompiledExpression();
x = 0.5;
EXPECT_THROW(function.getVariableReference("x") = x;, Lepton::Exception);
EXPECT_THROW(derivative.getVariableReference("x") = x;, Lepton::Exception);
EXPECT_DOUBLE_EQ(function.evaluate(), 1.0);
EXPECT_DOUBLE_EQ(derivative.evaluate(), 0.0);
}
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);