From a5ecef708f6cf85c4ac8cf6c27dcc7502334b49a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Dec 2022 09:59:55 -0500 Subject: [PATCH] correctly compute offsets. update unit test files. --- src/LEPTON/bond_lepton.cpp | 2 +- src/LEPTON/pair_lepton.cpp | 2 +- unittest/force-styles/tests/bond-lepton.yaml | 9 ++++----- unittest/force-styles/tests/mol-pair-lepton.yaml | 12 ++++++------ unittest/force-styles/tests/mol-pair-lj_cut.yaml | 9 +++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/LEPTON/bond_lepton.cpp b/src/LEPTON/bond_lepton.cpp index 3f764e4456..fb55571ca1 100644 --- a/src/LEPTON/bond_lepton.cpp +++ b/src/LEPTON/bond_lepton.cpp @@ -179,7 +179,7 @@ void BondLepton::coeff(int narg, char **arg) auto bondforce = parsed.differentiate("r").createCompiledExpression(); double &r_pot = bondpot.getVariableReference("r"); double &r_for = bondforce.getVariableReference("r"); - r_for = r_pot = r0_one; + r_for = r_pot = 0.0; offset_one = bondpot.evaluate(); bondforce.evaluate(); } catch (std::exception &e) { diff --git a/src/LEPTON/pair_lepton.cpp b/src/LEPTON/pair_lepton.cpp index c159db6388..39b5ade806 100644 --- a/src/LEPTON/pair_lepton.cpp +++ b/src/LEPTON/pair_lepton.cpp @@ -257,7 +257,7 @@ double PairLepton::init_one(int i, int j) auto parsed = LMP_Lepton::Parser::parse(expressions[type2expression[i][j]]); auto pairpot = parsed.createCompiledExpression(); double &r_pot = pairpot.getVariableReference("r"); - r_pot = 1.0; + r_pot = cut[i][j]; offset[i][j] = pairpot.evaluate(); } else offset[i][j] = 0.0; diff --git a/unittest/force-styles/tests/bond-lepton.yaml b/unittest/force-styles/tests/bond-lepton.yaml index a220dd8b0c..32d0d1453c 100644 --- a/unittest/force-styles/tests/bond-lepton.yaml +++ b/unittest/force-styles/tests/bond-lepton.yaml @@ -1,7 +1,6 @@ --- -lammps_version: 3 Nov 2022 -tags: generated -date_generated: Thu Dec 22 02:03:59 2022 +lammps_version: 22 Dec 2022 +date_generated: Thu Dec 22 09:47:41 2022 epsilon: 2.5e-13 skip_tests: prerequisites: ! | @@ -21,7 +20,7 @@ equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | r0 1 natoms: 29 -init_energy: 38.295825321689215 +init_energy: -1.7041746783107878 init_stress: ! |- -4.7778964706834920e+01 -9.3066674567350432e+01 3.4789470658440035e+02 -3.0023920169312170e+01 -8.0421418879842847e+01 5.8592449335969732e+01 init_forces: ! |2 @@ -54,7 +53,7 @@ init_forces: ! |2 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_energy: -2.215756106484914 run_stress: ! |- -4.6127506998693484e+01 -9.2129732247211749e+01 3.4548310342284810e+02 -2.9841348469661163e+01 -7.8434962689387717e+01 5.9253167412123155e+01 run_forces: ! |2 diff --git a/unittest/force-styles/tests/mol-pair-lepton.yaml b/unittest/force-styles/tests/mol-pair-lepton.yaml index d58780b1fe..81d8286588 100644 --- a/unittest/force-styles/tests/mol-pair-lepton.yaml +++ b/unittest/force-styles/tests/mol-pair-lepton.yaml @@ -1,7 +1,6 @@ --- -lammps_version: 3 Nov 2022 -tags: generated -date_generated: Wed Dec 21 20:29:34 2022 +lammps_version: 22 Dec 2022 +date_generated: Thu Dec 22 09:57:30 2022 epsilon: 5e-14 skip_tests: prerequisites: ! | @@ -9,7 +8,8 @@ prerequisites: ! | pair lepton pre_commands: ! | variable write_data_pair index ij -post_commands: ! "" +post_commands: ! | + pair_modify shift yes input_file: in.fourmol pair_style: lepton 8.0 pair_coeff: ! | @@ -27,7 +27,7 @@ pair_coeff: ! | 3 5 "4.0*eps*((sig/r)^12-(sig/r)^6);eps=0.0173205;sig=3.15" extract: ! "" natoms: 29 -init_vdwl: 749.2370315373564 +init_vdwl: 749.2468149791969 init_coul: 0 init_stress: ! |2- 2.1793853434038242e+03 2.1988955172192768e+03 4.6653977523326257e+03 -7.5956547636050584e+02 2.4751536734032861e+01 6.6652028436400667e+02 @@ -61,7 +61,7 @@ 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.4432816774653 +run_vdwl: 719.4530651193046 run_coul: 0 run_stress: ! |2- 2.1330153957371017e+03 2.1547728168285516e+03 4.3976497417710125e+03 -7.3873328448298525e+02 4.1743821105370067e+01 6.2788012209191027e+02 diff --git a/unittest/force-styles/tests/mol-pair-lj_cut.yaml b/unittest/force-styles/tests/mol-pair-lj_cut.yaml index 58bb0abf08..68bba170fe 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 17 Feb 2022 -date_generated: Fri Mar 18 22:17:31 2022 +lammps_version: 22 Dec 2022 +date_generated: Thu Dec 22 09:53:54 2022 epsilon: 5e-14 skip_tests: prerequisites: ! | @@ -9,6 +9,7 @@ prerequisites: ! | pre_commands: ! "" post_commands: ! | pair_modify mix arithmetic + pair_modify shift yes input_file: in.fourmol pair_style: lj/cut 8.0 pair_coeff: ! | @@ -22,7 +23,7 @@ extract: ! | epsilon 2 sigma 2 natoms: 29 -init_vdwl: 749.2372261744105 +init_vdwl: 749.2470096189502 init_coul: 0 init_stress: ! |2- 2.1793857186503233e+03 2.1988957679770601e+03 4.6653994738862330e+03 -7.5956544622684294e+02 2.4751393539192360e+01 6.6652061873806701e+02 @@ -56,7 +57,7 @@ init_forces: ! |2 27 5.1810412832327984e+01 -2.2705468907750401e+02 9.0849153441059272e+01 28 -1.8041315533250560e+02 7.7534079082878250e+01 -1.2206962452216491e+02 29 1.2861063251415729e+02 1.4952718246094855e+02 3.1216040111076961e+01 -run_vdwl: 719.4434555542921 +run_vdwl: 719.4532389988314 run_coul: 0 run_stress: ! |2- 2.1330157554553721e+03 2.1547730555430498e+03 4.3976512412988704e+03 -7.3873325485023690e+02 4.1743707190786367e+01 6.2788040986774604e+02