diff --git a/src/GPU/pair_lj_cubic_gpu.cpp b/src/GPU/pair_lj_cubic_gpu.cpp index a669d52a19..35062a5d71 100644 --- a/src/GPU/pair_lj_cubic_gpu.cpp +++ b/src/GPU/pair_lj_cubic_gpu.cpp @@ -16,10 +16,11 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cubic_gpu.h" + #include #include - #include + #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -36,6 +37,8 @@ #include "gpu_extra.h" #include "suffix.h" +#include "pair_lj_cubic_const.h" + using namespace LAMMPS_NS; using namespace PairLJCubicConstants; diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 872574a3b2..e96b3d0a79 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -23,6 +23,8 @@ #include #include "omp_compat.h" +#include "pair_lj_cubic_const.h" + using namespace LAMMPS_NS; using namespace PairLJCubicConstants; diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index 7fe4757358..c5f1f5b257 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -26,6 +26,7 @@ #include "memory.h" #include "error.h" +#include "pair_lj_cubic_const.h" using namespace LAMMPS_NS; using namespace PairLJCubicConstants; diff --git a/src/pair_lj_cubic.h b/src/pair_lj_cubic.h index d0af06c0a0..4b5edf7e97 100644 --- a/src/pair_lj_cubic.h +++ b/src/pair_lj_cubic.h @@ -46,20 +46,6 @@ class PairLJCubic : public Pair { void allocate(); }; - -namespace PairLJCubicConstants { - - // LJ quantities scaled by epsilon and rmin = sigma*2^1/6 - - static const double RT6TWO = 1.1224621; // 2^1/6 - static const double SS = 1.1086834; // inflection point (13/7)^1/6 - static const double PHIS = -0.7869823; // energy at s - static const double DPHIDS = 2.6899009; // gradient at s - static const double A3 = 27.93357; // cubic coefficient - static const double SM = 1.5475375; // cubic cutoff = s*67/48 - -} - } #endif diff --git a/src/pair_lj_cubic_const.h b/src/pair_lj_cubic_const.h new file mode 100644 index 0000000000..5fc773ac3c --- /dev/null +++ b/src/pair_lj_cubic_const.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_PAIR_LJ_CUBIC_CONST_H +#define LMP_PAIR_LJ_CUBIC_CONST_H + +namespace LAMMPS_NS { +namespace PairLJCubicConstants { + + // LJ quantities scaled by epsilon and rmin = sigma*2^1/6 + + static constexpr double RT6TWO = 1.1224620483093730; // 2^1/6 + static constexpr double SS = 1.1086834179687215; // inflection point (13/7)^1/6 + static constexpr double PHIS = -0.7869822485207097; // energy at s + static constexpr double DPHIDS = 2.6899008972047196; // gradient at s + static constexpr double A3 = 27.9335700460986445; // cubic coefficient + static constexpr double SM = 1.5475372709146737; // cubic cutoff = s*67/48} +} +} +#endif + +// python script to compute the constants +// +// sixth = 1.0/6.0 +// rmin = pow(2.0,sixth) +// rs = pow(26.0/7.0,sixth) +// ss = rs/rmin +// pow6 = pow(1.0/rs,6.0) +// phis = 4.0*pow6*(pow6-1.0) +// dpds = -24.0*pow6*(2.0*pow6-1.0)/rs*rmin +// a3 = 8.0*pow(dpds,3)/(9.0*phis*phis) +// sm = 67.0/48.0*ss +// print("static constexpr double RT6TWO = %19.16f; // 2^1/6" % rmin) +// print("static constexpr double SS = %19.16f; // inflection point (13/7)^1/6" % ss) +// print("static constexpr double PHIS = %19.16f; // energy at s" % phis) +// print("static constexpr double DPHIDS = %19.16f; // gradient at s" % dpds) +// print("static constexpr double A3 = %19.16f; // cubic coefficient" % a3) +// print("static constexpr double SM = %19.16f; // cubic cutoff = s*67/48" % sm) diff --git a/unittest/force-styles/tests/mol-pair-lj_cubic.yaml b/unittest/force-styles/tests/mol-pair-lj_cubic.yaml index ad7f0666ca..6d23998ad5 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cubic.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cubic.yaml @@ -1,7 +1,7 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 -epsilon: 2e-13 +lammps_version: 30 Nov 2020 +date_generated: Fri Dec 18 22:30:42 202 +epsilon: 1e-13 prerequisites: ! | atom full pair lj/cubic @@ -19,72 +19,72 @@ pair_coeff: ! | 5 5 0.015 3.1 extract: ! "" natoms: 29 -init_vdwl: 166.005266308562 +init_vdwl: 166.005266338502 init_coul: 0 init_stress: ! |2- - 4.5860676757908186e+02 4.8091912919212928e+02 1.0767204080701006e+03 -2.1005546139122362e+02 -2.9491286717936713e+00 1.6145675857120941e+02 + 4.5860676760613336e+02 4.8091912923656065e+02 1.0767204080957010e+03 -2.1005546139899724e+02 -2.9491286649299440e+00 1.6145675855773089e+02 init_forces: ! |2 - 1 9.1849370411551270e+00 7.6268937957720553e+01 6.1726872441625311e+01 - 2 2.2858712118514426e+01 1.8809274242266209e+01 -2.6905829837199740e+01 - 3 -3.2016987482543328e+01 -9.4135849525427091e+01 -3.4799279593035926e+01 - 4 -5.5341015869901478e-01 1.5206999898436971e-01 -3.9418368928369890e-01 - 5 -1.8042057425348118e-01 -3.0459951056385326e-01 8.7068483241007189e-01 - 6 -2.0038994438822397e+02 2.3344446299945159e+02 2.8487343926572851e+02 - 7 8.0909912172413883e+00 -7.8410849891085633e+01 -4.3214084684451740e+02 - 8 4.7943581255133857e+01 -2.1287511456246008e+01 1.4094503445180061e+02 - 9 1.1447552368270737e+01 1.2328709806786962e+01 5.0656476982000299e+01 - 10 1.3071496571967870e+02 -1.4589264560693914e+02 -4.4748155922123622e+01 - 11 -1.6551880116149281e-01 -4.1534332040572380e-01 -6.8284765241715795e-01 - 12 1.7721533626133388e+00 6.3456329073685158e-01 -8.2372301448028962e-01 - 13 5.6789360334118277e-01 -2.2634410312439054e-01 -9.7536738055328392e-03 - 14 -2.4337021468262635e-01 4.6659433642728905e-02 -6.1110664501270184e-01 - 15 -2.1936997101927893e-02 5.9238263972968364e-01 2.1493099548264527e-01 - 16 1.1121534968449923e+02 -7.8056927924992834e+01 -2.9249212971206231e+02 - 17 -1.1020604609843586e+02 7.6481296254913858e+01 2.9430701446263464e+02 - 18 -1.6570656719723909e-02 -2.7996966177077785e-02 2.6456326954440619e-02 - 19 7.4243353115058947e-04 6.3524893127716046e-04 1.8675586277048476e-04 - 20 -7.4243353115058947e-04 -6.3524893127716046e-04 -1.8675586277048476e-04 + 1 9.1849370400954342e+00 7.6268937960282486e+01 6.1726872440953251e+01 + 2 2.2858712118557477e+01 1.8809274242339992e+01 -2.6905829837209875e+01 + 3 -3.2016987482586380e+01 -9.4135849525500873e+01 -3.4799279593025787e+01 + 4 -5.5341015917141478e-01 1.5206999930354809e-01 -3.9418368927471259e-01 + 5 -1.8042057490785210e-01 -3.0459951013385317e-01 8.7068483295449139e-01 + 6 -2.0038994438983289e+02 2.3344446299845976e+02 2.8487343926562755e+02 + 7 8.0909912152126484e+00 -7.8410849888970290e+01 -4.3214084684693944e+02 + 8 4.7943581253518161e+01 -2.1287511458762772e+01 1.4094503445043824e+02 + 9 1.1447552368334570e+01 1.2328709806695397e+01 5.0656476981938759e+01 + 10 1.3071496571895125e+02 -1.4589264560750766e+02 -4.4748155921681018e+01 + 11 -1.6551880130741767e-01 -4.1534332035668403e-01 -6.8284765271893910e-01 + 12 1.7721533633976141e+00 6.3456328808910523e-01 -8.2372301296999062e-01 + 13 5.6789360517170440e-01 -2.2634410322310763e-01 -9.7536744156455080e-03 + 14 -2.4337021462140446e-01 4.6659433737428486e-02 -6.1110664517858926e-01 + 15 -2.1936996885396808e-02 5.9238264018028652e-01 2.1493099542010694e-01 + 16 1.1121534968641315e+02 -7.8056927926703892e+01 -2.9249212971001145e+02 + 17 -1.1020604609471918e+02 7.6481296251709367e+01 2.9430701446464468e+02 + 18 -1.6570656172995385e-02 -2.7996961634495443e-02 2.6456324093123054e-02 + 19 7.4243314752471426e-04 6.3524860303507949e-04 1.8675576627109685e-04 + 20 -7.4243314752471426e-04 -6.3524860303507949e-04 -1.8675576627109685e-04 21 -1.1415041486189516e+01 -1.3016363071591645e+01 3.6007276733401099e+01 - 22 -1.7227422089792942e+01 -4.1746638094950628e+00 -2.7029162034499002e+01 - 23 2.8642463575982458e+01 1.7191026881086707e+01 -8.9781146989020968e+00 - 24 5.8150644491939154e+00 -3.3774314134628064e+01 1.7867788752379695e+01 - 25 -2.3666545027773044e+01 3.8106021846559952e+00 -1.9896269873584632e+01 - 26 1.7843812244577855e+01 2.9960339884741117e+01 2.0167430316952100e+00 - 27 8.2825859209946024e+00 -3.6194570066818969e+01 1.4492694351988913e+01 - 28 -2.8773892796642542e+01 1.2366374307374247e+01 -1.9468877181285176e+01 - 29 2.0497044211022661e+01 2.3831279505404666e+01 4.9748677441078746e+00 -run_vdwl: 164.176727313193 + 22 -1.7227422090167991e+01 -4.1746638096674396e+00 -2.7029162034658786e+01 + 23 2.8642463576357507e+01 1.7191026881259084e+01 -8.9781146987423170e+00 + 24 5.8150644495067958e+00 -3.3774314132751599e+01 1.7867788754173183e+01 + 25 -2.3666545028156815e+01 3.8106021844353424e+00 -1.9896269873795571e+01 + 26 1.7843812244961626e+01 2.9960339884961773e+01 2.0167430319061479e+00 + 27 8.2825859198612442e+00 -3.6194570067428131e+01 1.4492694352248694e+01 + 28 -2.8773892797077618e+01 1.2366374307246014e+01 -1.9468877181493664e+01 + 29 2.0497044211457737e+01 2.3831279505532898e+01 4.9748677443163629e+00 +run_vdwl: 164.176727343123 run_coul: 0 run_stress: ! |2- - 4.5696669905868288e+02 4.7904134871830234e+02 1.0582153129928076e+03 -2.0794233475912671e+02 -2.0206236780739086e+00 1.5948889983617320e+02 + 4.5696669908578690e+02 4.7904134876274537e+02 1.0582153130184231e+03 -2.0794233476691440e+02 -2.0206236712071677e+00 1.5948889982266843e+02 run_forces: ! |2 - 1 9.2483453892728740e+00 7.5945844239974676e+01 6.1367289784738311e+01 - 2 2.2732852134554197e+01 1.8737493288759875e+01 -2.6669600068587577e+01 - 3 -3.1964986246503269e+01 -9.3734416340601200e+01 -3.4671255449722295e+01 - 4 -5.5001585694065913e-01 1.5070776418957152e-01 -3.9275226164990551e-01 - 5 -1.7969915375876547e-01 -3.0362292678324765e-01 8.6793365916706400e-01 - 6 -1.9796806590003533e+02 2.2990162655369829e+02 2.7501790745035373e+02 - 7 7.9109888171861886e+00 -7.6524641847864288e+01 -4.2032627555539375e+02 - 8 4.5992175211879918e+01 -1.9873148355500923e+01 1.3922798515578887e+02 - 9 1.1403303962503362e+01 1.2231165268449960e+01 5.0409090529604853e+01 - 10 1.3047784096912977e+02 -1.4556513307073578e+02 -4.4756481385998420e+01 - 11 -1.6346238349194633e-01 -4.0922088697872150e-01 -6.7303941060221573e-01 - 12 1.7689668574627495e+00 6.3166692380469824e-01 -8.3233385524693426e-01 - 13 5.6480104331071312e-01 -2.2395151872256039e-01 -9.5790993973179691e-03 - 14 -2.4030540495346994e-01 4.5179188229734012e-02 -6.0304369153488313e-01 - 15 -2.3220111317111478e-02 5.9408611078423390e-01 2.1676726911830960e-01 - 16 1.0963039832302356e+02 -7.7096357855469549e+01 -2.8842624961188653e+02 - 17 -1.0862142117090467e+02 7.5521002117836630e+01 2.9024023117219969e+02 - 18 -1.6565212275867415e-02 -2.7990268691876326e-02 2.6458602067006932e-02 - 19 7.1473709241289744e-04 6.1248437925700357e-04 1.7889258733572757e-04 - 20 -7.1473709241289744e-04 -6.1248437925700357e-04 -1.7889258733572757e-04 - 21 -1.1536904971247665e+01 -1.3021625993962397e+01 3.6108894191673429e+01 - 22 -1.7333879764643559e+01 -4.2314763344327275e+00 -2.7103019136756011e+01 - 23 2.8870784735891224e+01 1.7253102328395126e+01 -9.0058750549174214e+00 - 24 6.1437425316795213e+00 -3.4297207023632204e+01 1.8296742414004438e+01 - 25 -2.4276461284621075e+01 3.8560435260643189e+00 -2.0415720860228767e+01 - 26 1.8125049871956215e+01 3.0437790982988908e+01 2.1072387594169975e+00 - 27 8.4078124309265192e+00 -3.6323119973255714e+01 1.4505938075037919e+01 - 28 -2.8937319168272772e+01 1.2421253477627801e+01 -1.9540501416079319e+01 - 29 2.0535244350189391e+01 2.3904950625827414e+01 5.0332497948309163e+00 + 1 9.2483453882111135e+00 7.5945844242532630e+01 6.1367289784064468e+01 + 2 2.2732852134599622e+01 1.8737493288836678e+01 -2.6669600068598680e+01 + 3 -3.1964986246546172e+01 -9.3734416340673434e+01 -3.4671255449709932e+01 + 4 -5.5001585741105219e-01 1.5070776450703974e-01 -3.9275226164162935e-01 + 5 -1.7969915441332354e-01 -3.0362292635308630e-01 8.6793365971015668e-01 + 6 -1.9796806590165264e+02 2.2990162655270728e+02 2.7501790745023669e+02 + 7 7.9109888151537930e+00 -7.6524641845739424e+01 -4.2032627555780203e+02 + 8 4.5992175210254615e+01 -1.9873148358014198e+01 1.3922798515443196e+02 + 9 1.1403303962567387e+01 1.2231165268357689e+01 5.0409090529541324e+01 + 10 1.3047784096840681e+02 -1.4556513307130629e+02 -4.4756481385556341e+01 + 11 -1.6346238363922402e-01 -4.0922088693014880e-01 -6.7303941090576869e-01 + 12 1.7689668582530251e+00 6.3166692115802814e-01 -8.3233385373913271e-01 + 13 5.6480104514758445e-01 -2.2395151881989347e-01 -9.5791000096411370e-03 + 14 -2.4030540489083232e-01 4.5179188324553629e-02 -6.0304369170302041e-01 + 15 -2.3220111102749796e-02 5.9408611123108124e-01 2.1676726905655996e-01 + 16 1.0963039832494319e+02 -7.7096357857185083e+01 -2.8842624960984045e+02 + 17 -1.0862142116718823e+02 7.5521002114629724e+01 2.9024023117422536e+02 + 18 -1.6565211729771653e-02 -2.7990264151000276e-02 2.6458599205916818e-02 + 19 7.1473670261989000e-04 6.1248404522910675e-04 1.7889248977386897e-04 + 20 -7.1473670261989000e-04 -6.1248404522910675e-04 -1.7889248977386897e-04 + 21 -1.1536904971247079e+01 -1.3021625993961788e+01 3.6108894191671638e+01 + 22 -1.7333879765020438e+01 -4.2314763346057394e+00 -2.7103019136915339e+01 + 23 2.8870784736267517e+01 1.7253102328567529e+01 -9.0058750547563005e+00 + 24 6.1437425319896413e+00 -3.4297207021755547e+01 1.8296742415795482e+01 + 25 -2.4276461285000558e+01 3.8560435258438814e+00 -2.0415720860437396e+01 + 26 1.8125049872338021e+01 3.0437790983209180e+01 2.1072387596271578e+00 + 27 8.4078124297937791e+00 -3.6323119973862774e+01 1.4505938075297303e+01 + 28 -2.8937319168706676e+01 1.2421253477499173e+01 -1.9540501416287395e+01 + 29 2.0535244350622666e+01 2.3904950625953887e+01 5.0332497950390769e+00 ...