From 7d497732944d7d980c4cbae8d1de47f3f6b84284 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Thu, 25 Feb 2021 08:22:36 -0600 Subject: [PATCH 01/10] updating the kim citation report to lammps conventions --- src/KIM/kim_command.cpp | 34 ++++++++++++++++++++++++++++++++++ src/KIM/kim_init.cpp | 31 +++++++++++++++++++++++-------- src/KIM/pair_kim.cpp | 18 ++++++++++++++++++ 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp index bce1e0d929..7e3cbe4b57 100644 --- a/src/KIM/kim_command.cpp +++ b/src/KIM/kim_command.cpp @@ -56,6 +56,7 @@ #include "kim_command.h" +#include "citeme.h" #include "error.h" // include KIM sub-command headers here @@ -69,6 +70,36 @@ using namespace LAMMPS_NS; +static constexpr const char *const cite_openkim = + "OpenKIM: https://doi.org/10.1007/s11837-011-0102-6\n\n" + "@Article{tadmor:elliott:2011,\n" + " author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller " + "and C. A. Becker},\n" + " title = {The potential of atomistic simulations and the {K}nowledgebase of " + "{I}nteratomic {M}odels},\n" + " journal = {{JOM}},\n" + " year = 2011,\n" + " volume = 63,\n" + " number = 17,\n" + " pages = {17},\n" + " doi = {10.1007/s11837-011-0102-6}\n" + "}\n\n"; + +static constexpr const char *const cite_openkim_query = + "OpenKIM query: https://doi.org/10.1063/5.0014267\n\n" + "@Article{karls:bierbaum:2020,\n" + " author = {D. S. Karls and M. Bierbaum and A. A. Alemi and R. S. Elliott " + "and J. P. Sethna and E. B. Tadmor},\n" + " title = {The {O}pen{KIM} processing pipeline: {A} cloud-based automatic " + "material property computation engine},\n" + " journal = {{T}he {J}ournal of {C}hemical {P}hysics},\n" + " year = 2020,\n" + " volume = 153,\n" + " number = 6,\n" + " pages = {064104},\n" + " doi = {10.1063/5.0014267}\n" + "}\n\n"; + /* ---------------------------------------------------------------------- */ void KimCommand::command(int narg, char **arg) @@ -79,6 +110,8 @@ void KimCommand::command(int narg, char **arg) narg--; arg++; + if (lmp->citeme) lmp->citeme->add(cite_openkim); + if (subcmd == "init") { std::unique_ptr cmd(new KimInit(lmp)); cmd->command(narg, arg); @@ -92,6 +125,7 @@ void KimCommand::command(int narg, char **arg) std::unique_ptr cmd(new KimProperty(lmp)); cmd->command(narg, arg); } else if (subcmd == "query") { + if (lmp->citeme) lmp->citeme->add(cite_openkim_query); std::unique_ptr cmd(new KimQuery(lmp)); cmd->command(narg, arg); } else error->all(FLERR, fmt::format("Unknown kim subcommand {}", subcmd)); diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index c97a720e6c..f05fc7c18c 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -70,6 +70,7 @@ #include "variable.h" #include +#include extern "C" { #include "KIM_SimulatorHeaders.h" @@ -489,7 +490,15 @@ void KimInit::do_variables(const std::string &from, const std::string &to) void KimInit::write_log_cite(char *model_name) { - KIM_Collections * collections; + if (!lmp->citeme) return; + + std::string model_name_str(model_name); + std::regex re("[MOS]{2}_[0-9]{12}_[0-9]{3}"); + std::smatch sm; + + if (!std::regex_search(model_name_str, sm, re)) return; + + KIM_Collections *collections; int err = KIM_Collections_Create(&collections); if (err) return; @@ -514,19 +523,25 @@ void KimInit::write_log_cite(char *model_name) return; } + auto pos = sm.prefix().length(); + auto cite_openkim_potential = fmt::format("OpenKIM potential: " + "https://openkim.org/cite/{}#item-citation\n\n", + model_name_str.substr(pos, 19)); + for (int i = 0; i < extent; ++i) { - char const * fileName; + char const *fileName; int availableAsString; - char const * fileString; + char const *fileString; err = KIM_Collections_GetItemMetadataFile( - collections, i, &fileName, nullptr, nullptr, - &availableAsString, &fileString); + collections, i, &fileName, nullptr, nullptr, + &availableAsString, &fileString); if (err) continue; - if (0 == strncmp("kimcite", fileName, 7)) { - if ((lmp->citeme) && (availableAsString)) lmp->citeme->add(fileString); - } + if ((strncmp("kimcite", fileName, 7) == 0) and availableAsString) + cite_openkim_potential += fileString; } + lmp->citeme->add(cite_openkim_potential.c_str()); + KIM_Collections_Destroy(&collections); } diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index b9c3f83147..6ba3c290f2 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -57,6 +57,7 @@ #include "pair_kim.h" #include "atom.h" +#include "citeme.h" #include "comm.h" #include "domain.h" #include "error.h" @@ -73,6 +74,21 @@ using namespace LAMMPS_NS; +static constexpr const char *const cite_openkim = + "OpenKIM: https://doi.org/10.1007/s11837-011-0102-6\n\n" + "@Article{tadmor:elliott:2011,\n" + " author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller " + "and C. A. Becker},\n" + " title = {The potential of atomistic simulations and the {K}nowledgebase of " + "{I}nteratomic {M}odels},\n" + " journal = {{JOM}},\n" + " year = 2011,\n" + " volume = 63,\n" + " number = 17,\n" + " pages = {17},\n" + " doi = {10.1007/s11837-011-0102-6}\n" + "}\n\n"; + /* ---------------------------------------------------------------------- */ PairKIM::PairKIM(LAMMPS *lmp) : @@ -120,6 +136,8 @@ PairKIM::PairKIM(LAMMPS *lmp) : // (used by kim_free(), etc.) kim_init_ok = false; kim_particle_codes_ok = false; + + if (lmp->citeme) lmp->citeme->add(cite_openkim); // END } From c16064d4934b430dfc877afd7d87214934480154 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Thu, 25 Feb 2021 08:23:26 -0600 Subject: [PATCH 02/10] update kim examples log files --- .../kim/log.10Feb21.in.kim-ex.melt.clang.1 | 40 ++++++--- .../kim/log.10Feb21.in.kim-ex.melt.clang.4 | 42 ++++++--- .../log.10Feb21.in.kim-pm-property.clang.1 | 23 ++++- .../log.10Feb21.in.kim-pm-property.clang.4 | 19 +++- .../log.10Feb21.in.kim-pm-query.melt.clang.1 | 46 ++++++++-- .../log.10Feb21.in.kim-pm-query.melt.clang.4 | 48 +++++++--- .../kim/log.10Feb21.in.kim-pm.melt.clang.1 | 35 +++++--- .../kim/log.10Feb21.in.kim-pm.melt.clang.4 | 35 +++++--- examples/kim/log.10Feb21.in.kim-query.clang.1 | 89 ++++++------------- .../kim/log.10Feb21.in.kim-sm.melt.clang.1 | 43 ++++++--- .../kim/log.10Feb21.in.kim-sm.melt.clang.4 | 45 ++++++---- .../kim/log.10Feb21.in.lammps.melt.clang.1 | 18 ++-- .../kim/log.10Feb21.in.lammps.melt.clang.4 | 18 ++-- 13 files changed, 327 insertions(+), 174 deletions(-) diff --git a/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 index dcf8727fc0..da76a296a9 100644 --- a/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 @@ -44,8 +44,8 @@ Created 32000 atoms kim interactions Ar #=== BEGIN kim interactions ================================== pair_style kim LennardJones_Ar -WARNING: KIM Model does not provide 'partialParticleEnergy'; energy per atom will be zero (src/KIM/pair_kim.cpp:1139) -WARNING: KIM Model does not provide 'partialParticleVirial'; virial per atom will be zero (src/KIM/pair_kim.cpp:1145) +WARNING: KIM Model does not provide 'partialParticleEnergy'; energy per atom will be zero (src/KIM/pair_kim.cpp:1153) +WARNING: KIM Model does not provide 'partialParticleVirial'; virial per atom will be zero (src/KIM/pair_kim.cpp:1159) pair_coeff * * Ar #=== END kim interactions ==================================== @@ -60,6 +60,26 @@ fix 1 all nve #fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + Neighbor list info ... update every 1 steps, delay 0 steps, check yes max neighbors/atom: 2000, page size: 100000 @@ -76,20 +96,20 @@ Per MPI rank memory allocation (min/avg/max) = 28.12 | 28.12 | 28.12 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 145069.63 0 164146.22 128015.94 100 95.179703 154939.42 0 164017.94 131602.75 -Loop time of 2.8463 on 1 procs for 100 steps with 32000 atoms +Loop time of 2.85673 on 1 procs for 100 steps with 32000 atoms -Performance: 3.036 ns/day, 7.906 hours/ns, 35.133 timesteps/s +Performance: 3.024 ns/day, 7.935 hours/ns, 35.005 timesteps/s 99.9% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 2.5046 | 2.5046 | 2.5046 | 0.0 | 88.00 -Neigh | 0.29437 | 0.29437 | 0.29437 | 0.0 | 10.34 -Comm | 0.01182 | 0.01182 | 0.01182 | 0.0 | 0.42 -Output | 7e-05 | 7e-05 | 7e-05 | 0.0 | 0.00 -Modify | 0.024522 | 0.024522 | 0.024522 | 0.0 | 0.86 -Other | | 0.01091 | | | 0.38 +Pair | 2.4805 | 2.4805 | 2.4805 | 0.0 | 86.83 +Neigh | 0.32948 | 0.32948 | 0.32948 | 0.0 | 11.53 +Comm | 0.012038 | 0.012038 | 0.012038 | 0.0 | 0.42 +Output | 7.4e-05 | 7.4e-05 | 7.4e-05 | 0.0 | 0.00 +Modify | 0.023745 | 0.023745 | 0.023745 | 0.0 | 0.83 +Other | | 0.01084 | | | 0.38 Nlocal: 32000.0 ave 32000 max 32000 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 index 476b66753b..a8f730af56 100644 --- a/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 +++ b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 @@ -44,8 +44,8 @@ Created 32000 atoms kim interactions Ar #=== BEGIN kim interactions ================================== pair_style kim LennardJones_Ar -WARNING: KIM Model does not provide 'partialParticleEnergy'; energy per atom will be zero (src/KIM/pair_kim.cpp:1139) -WARNING: KIM Model does not provide 'partialParticleVirial'; virial per atom will be zero (src/KIM/pair_kim.cpp:1145) +WARNING: KIM Model does not provide 'partialParticleEnergy'; energy per atom will be zero (src/KIM/pair_kim.cpp:1153) +WARNING: KIM Model does not provide 'partialParticleVirial'; virial per atom will be zero (src/KIM/pair_kim.cpp:1159) pair_coeff * * Ar #=== END kim interactions ==================================== @@ -60,6 +60,26 @@ fix 1 all nve #fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + Neighbor list info ... update every 1 steps, delay 0 steps, check yes max neighbors/atom: 2000, page size: 100000 @@ -76,20 +96,20 @@ Per MPI rank memory allocation (min/avg/max) = 9.791 | 9.791 | 9.791 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 145069.63 0 164146.22 128015.94 100 95.179703 154939.42 0 164017.94 131602.75 -Loop time of 0.857614 on 4 procs for 100 steps with 32000 atoms +Loop time of 0.843382 on 4 procs for 100 steps with 32000 atoms -Performance: 10.074 ns/day, 2.382 hours/ns, 116.603 timesteps/s -99.6% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 10.244 ns/day, 2.343 hours/ns, 118.570 timesteps/s +99.8% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.73048 | 0.73398 | 0.73855 | 0.3 | 85.58 -Neigh | 0.083739 | 0.083964 | 0.084335 | 0.1 | 9.79 -Comm | 0.017996 | 0.022912 | 0.026515 | 2.1 | 2.67 -Output | 2.7e-05 | 3.5e-05 | 4.5e-05 | 0.0 | 0.00 -Modify | 0.010073 | 0.010158 | 0.010271 | 0.1 | 1.18 -Other | | 0.006571 | | | 0.77 +Pair | 0.71505 | 0.71942 | 0.72345 | 0.4 | 85.30 +Neigh | 0.089886 | 0.090153 | 0.090611 | 0.1 | 10.69 +Comm | 0.016342 | 0.020141 | 0.024546 | 2.5 | 2.39 +Output | 2.4e-05 | 2.625e-05 | 3.2e-05 | 0.0 | 0.00 +Modify | 0.008197 | 0.0083267 | 0.008504 | 0.1 | 0.99 +Other | | 0.005318 | | | 0.63 Nlocal: 8000.00 ave 8018 max 7967 min Histogram: 1 0 0 0 0 0 1 0 0 2 diff --git a/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 b/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 index a00085a486..6cd2f12ac1 100644 --- a/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 @@ -96,7 +96,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_126566794224_004#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -175,9 +190,9 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 3.119 | 3.119 | 3.119 Mbytes Step Temp E_pair E_mol TotEng Press 0 0 -0.34602203 0 -0.34602203 0.00061471244 -Loop time of 0 on 1 procs for 0 steps with 4 atoms +Loop time of 3e-05 on 1 procs for 0 steps with 4 atoms -0.0% CPU use with 1 MPI tasks x no OpenMP threads +3.3% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total @@ -187,7 +202,7 @@ Neigh | 0 | 0 | 0 | 0.0 | 0.00 Comm | 0 | 0 | 0 | 0.0 | 0.00 Output | 0 | 0 | 0 | 0.0 | 0.00 Modify | 0 | 0 | 0 | 0.0 | 0.00 -Other | | 0 | | | 0.00 +Other | | 3e-05 | | |100.00 Nlocal: 4.00000 ave 4 max 4 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 b/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 index c3dd234af2..0270896de1 100644 --- a/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 +++ b/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 @@ -78,7 +78,7 @@ Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (5.2485091 5.2485091 1 by 2 by 2 MPI processor grid create_atoms 1 box Created 4 atoms - create_atoms CPU = 0.000 seconds + create_atoms CPU = 0.001 seconds mass 1 39.948 # Specify the KIM interactions @@ -96,7 +96,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_126566794224_004#item-citation + +@Comment { \documentclass{article} \usepackage{url} diff --git a/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.1 index be12cda3da..97e81df03e 100644 --- a/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.1 @@ -90,7 +90,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_405512056662_005#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -161,6 +176,19 @@ This Model originally published in \cite{MO_405512056662_005a, MO_405512056662_0 title = {Modeling Materials: {C}ontinuum, Atomistic and Multiscale Techniques}, year = {2011}, } +- OpenKIM query: https://doi.org/10.1063/5.0014267 + +@Article{karls:bierbaum:2020, + author = {D. S. Karls and M. Bierbaum and A. A. Alemi and R. S. Elliott and J. P. Sethna and E. B. Tadmor}, + title = {The {O}pen{KIM} processing pipeline: {A} cloud-based automatic material property computation engine}, + journal = {{T}he {J}ournal of {C}hemical {P}hysics}, + year = 2020, + volume = 153, + number = 6, + pages = {064104}, + doi = {10.1063/5.0014267} +} + CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Neighbor list info ... @@ -179,20 +207,20 @@ Per MPI rank memory allocation (min/avg/max) = 10.36 | 10.36 | 10.36 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 -126084.25 0 -107007.66 1528.8768 100 94.450495 -116016.03 0 -107007.07 2282.2685 -Loop time of 18.2886 on 1 procs for 100 steps with 32000 atoms +Loop time of 18.2008 on 1 procs for 100 steps with 32000 atoms -Performance: 0.472 ns/day, 50.802 hours/ns, 5.468 timesteps/s +Performance: 0.475 ns/day, 50.558 hours/ns, 5.494 timesteps/s 99.9% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 18.155 | 18.155 | 18.155 | 0.0 | 99.27 -Neigh | 0.087194 | 0.087194 | 0.087194 | 0.0 | 0.48 -Comm | 0.009477 | 0.009477 | 0.009477 | 0.0 | 0.05 -Output | 6.7e-05 | 6.7e-05 | 6.7e-05 | 0.0 | 0.00 -Modify | 0.02616 | 0.02616 | 0.02616 | 0.0 | 0.14 -Other | | 0.0111 | | | 0.06 +Pair | 18.058 | 18.058 | 18.058 | 0.0 | 99.21 +Neigh | 0.097367 | 0.097367 | 0.097367 | 0.0 | 0.53 +Comm | 0.009271 | 0.009271 | 0.009271 | 0.0 | 0.05 +Output | 6.1e-05 | 6.1e-05 | 6.1e-05 | 0.0 | 0.00 +Modify | 0.025469 | 0.025469 | 0.025469 | 0.0 | 0.14 +Other | | 0.01084 | | | 0.06 Nlocal: 32000.0 ave 32000 max 32000 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.4 index f982e79425..d0940920d9 100644 --- a/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.4 +++ b/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.4 @@ -90,7 +90,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_405512056662_005#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -161,6 +176,19 @@ This Model originally published in \cite{MO_405512056662_005a, MO_405512056662_0 title = {Modeling Materials: {C}ontinuum, Atomistic and Multiscale Techniques}, year = {2011}, } +- OpenKIM query: https://doi.org/10.1063/5.0014267 + +@Article{karls:bierbaum:2020, + author = {D. S. Karls and M. Bierbaum and A. A. Alemi and R. S. Elliott and J. P. Sethna and E. B. Tadmor}, + title = {The {O}pen{KIM} processing pipeline: {A} cloud-based automatic material property computation engine}, + journal = {{T}he {J}ournal of {C}hemical {P}hysics}, + year = 2020, + volume = 153, + number = 6, + pages = {064104}, + doi = {10.1063/5.0014267} +} + CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Neighbor list info ... @@ -179,20 +207,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.489 | 3.489 | 3.489 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 -126084.25 0 -107007.66 1528.8768 100 94.450495 -116016.03 0 -107007.07 2282.2685 -Loop time of 5.00432 on 4 procs for 100 steps with 32000 atoms +Loop time of 5.33871 on 4 procs for 100 steps with 32000 atoms -Performance: 1.727 ns/day, 13.901 hours/ns, 19.983 timesteps/s -99.7% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 1.618 ns/day, 14.830 hours/ns, 18.731 timesteps/s +99.6% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 4.9281 | 4.9366 | 4.9447 | 0.3 | 98.65 -Neigh | 0.02399 | 0.024135 | 0.024318 | 0.1 | 0.48 -Comm | 0.020646 | 0.029014 | 0.037515 | 4.3 | 0.58 -Output | 2.9e-05 | 3.325e-05 | 4.2e-05 | 0.0 | 0.00 -Modify | 0.008808 | 0.0088445 | 0.00888 | 0.0 | 0.18 -Other | | 0.005691 | | | 0.11 +Pair | 5.244 | 5.2604 | 5.2753 | 0.5 | 98.53 +Neigh | 0.027617 | 0.027767 | 0.027955 | 0.1 | 0.52 +Comm | 0.017101 | 0.031947 | 0.04856 | 6.3 | 0.60 +Output | 3.4e-05 | 4.525e-05 | 5.6e-05 | 0.0 | 0.00 +Modify | 0.011577 | 0.01165 | 0.011709 | 0.0 | 0.22 +Other | | 0.0069 | | | 0.13 Nlocal: 8000.00 ave 8029 max 7968 min Histogram: 1 1 0 0 0 0 0 0 0 2 diff --git a/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 index f27f8e6d83..0f4752f3fb 100644 --- a/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 @@ -60,7 +60,7 @@ Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 1 by 1 by 1 MPI processor grid create_atoms 1 box Created 32000 atoms - create_atoms CPU = 0.002 seconds + create_atoms CPU = 0.003 seconds kim interactions Si #=== BEGIN kim interactions ================================== @@ -84,7 +84,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_405512056662_005#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -173,20 +188,20 @@ Per MPI rank memory allocation (min/avg/max) = 10.44 | 10.44 | 10.44 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 -85249.847 0 -66173.259 -33302.387 100 253.43357 -90346.68 0 -66173.441 -14888.698 -Loop time of 17.7449 on 1 procs for 100 steps with 32000 atoms +Loop time of 17.6645 on 1 procs for 100 steps with 32000 atoms -Performance: 0.487 ns/day, 49.291 hours/ns, 5.635 timesteps/s +Performance: 0.489 ns/day, 49.068 hours/ns, 5.661 timesteps/s 99.9% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 17.64 | 17.64 | 17.64 | 0.0 | 99.41 -Neigh | 0.060149 | 0.060149 | 0.060149 | 0.0 | 0.34 -Comm | 0.008585 | 0.008585 | 0.008585 | 0.0 | 0.05 -Output | 6.3e-05 | 6.3e-05 | 6.3e-05 | 0.0 | 0.00 -Modify | 0.025324 | 0.025324 | 0.025324 | 0.0 | 0.14 -Other | | 0.01057 | | | 0.06 +Pair | 17.553 | 17.553 | 17.553 | 0.0 | 99.37 +Neigh | 0.063346 | 0.063346 | 0.063346 | 0.0 | 0.36 +Comm | 0.009667 | 0.009667 | 0.009667 | 0.0 | 0.05 +Output | 6.6e-05 | 6.6e-05 | 6.6e-05 | 0.0 | 0.00 +Modify | 0.02711 | 0.02711 | 0.02711 | 0.0 | 0.15 +Other | | 0.01088 | | | 0.06 Nlocal: 32000.0 ave 32000 max 32000 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 index 2107e3f876..e00b6d76c7 100644 --- a/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 +++ b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 @@ -84,7 +84,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_405512056662_005#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -173,20 +188,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.517 | 3.517 | 3.517 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 -85249.847 0 -66173.259 -33302.387 100 253.43357 -90346.68 0 -66173.441 -14888.698 -Loop time of 4.87378 on 4 procs for 100 steps with 32000 atoms +Loop time of 4.88034 on 4 procs for 100 steps with 32000 atoms -Performance: 1.773 ns/day, 13.538 hours/ns, 20.518 timesteps/s -99.7% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 1.770 ns/day, 13.556 hours/ns, 20.490 timesteps/s +99.9% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 4.8075 | 4.816 | 4.8244 | 0.3 | 98.81 -Neigh | 0.015902 | 0.015996 | 0.016077 | 0.1 | 0.33 -Comm | 0.018078 | 0.026375 | 0.034752 | 4.2 | 0.54 -Output | 3e-05 | 3.5e-05 | 4.4e-05 | 0.0 | 0.00 -Modify | 0.009331 | 0.0094922 | 0.009588 | 0.1 | 0.19 -Other | | 0.005919 | | | 0.12 +Pair | 4.8131 | 4.8235 | 4.8347 | 0.4 | 98.84 +Neigh | 0.017627 | 0.017731 | 0.017825 | 0.1 | 0.36 +Comm | 0.013892 | 0.025022 | 0.03536 | 5.0 | 0.51 +Output | 3.4e-05 | 4.025e-05 | 4.7e-05 | 0.0 | 0.00 +Modify | 0.008725 | 0.0087775 | 0.008862 | 0.1 | 0.18 +Other | | 0.005278 | | | 0.11 Nlocal: 8000.00 ave 8014 max 7988 min Histogram: 1 1 0 0 0 0 1 0 0 1 diff --git a/examples/kim/log.10Feb21.in.kim-query.clang.1 b/examples/kim/log.10Feb21.in.kim-query.clang.1 index 01fc8cd7dd..3f8639c168 100644 --- a/examples/kim/log.10Feb21.in.kim-query.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-query.clang.1 @@ -528,7 +528,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/MO_123629422045_005#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -589,67 +604,19 @@ This Model originally published in \cite{MO_123629422045_005a} is archived in Op volume = {26}, year = {1994}, } -- @Comment -{ -\documentclass{article} -\usepackage{url} -\begin{document} -This Model originally published in \cite{MO_004835508849_000a} is archived in OpenKIM~\cite{MO_004835508849_000, MD_120291908751_005, tadmor:elliott:2011, elliott:tadmor:2011}. -\bibliographystyle{vancouver} -\bibliography{kimcite-MO_004835508849_000.bib} -\end{document} +- OpenKIM query: https://doi.org/10.1063/5.0014267 + +@Article{karls:bierbaum:2020, + author = {D. S. Karls and M. Bierbaum and A. A. Alemi and R. S. Elliott and J. P. Sethna and E. B. Tadmor}, + title = {The {O}pen{KIM} processing pipeline: {A} cloud-based automatic material property computation engine}, + journal = {{T}he {J}ournal of {C}hemical {P}hysics}, + year = 2020, + volume = 153, + number = 6, + pages = {064104}, + doi = {10.1063/5.0014267} } -@Misc{MO_004835508849_000, - author = {Ellad Tadmor}, - title = {{F}innis-{S}inclair potential ({LAMMPS} cubic hermite tabulation) for {Z}r developed by {M}endelev and {A}ckland (2007); version 3 refitted for radiation studies v000}, - doi = {10.25950/7b7b5ab5}, - howpublished = {OpenKIM, \url{https://doi.org/10.25950/7b7b5ab5}}, - keywords = {OpenKIM, Model, MO_004835508849_000}, - publisher = {OpenKIM}, - year = 2018, -} - -@Misc{MD_120291908751_005, - author = {Ryan S. Elliott}, - title = {{EAM} {M}odel {D}river for tabulated potentials with cubic {H}ermite spline interpolation as used in {LAMMPS} v005}, - doi = {10.25950/68defa36}, - howpublished = {OpenKIM, \url{https://doi.org/10.25950/7b7b5ab5}}, - keywords = {OpenKIM, Model Driver, MD_120291908751_005}, - publisher = {OpenKIM}, - year = 2018, -} - -@Article{tadmor:elliott:2011, - author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, - title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, - journal = {{JOM}}, - year = {2011}, - volume = {63}, - number = {7}, - pages = {17}, - doi = {10.1007/s11837-011-0102-6}, -} - -@Misc{elliott:tadmor:2011, - author = {Ryan S. Elliott and Ellad B. Tadmor}, - title = {{K}nowledgebase of {I}nteratomic {M}odels ({KIM}) Application Programming Interface ({API})}, - howpublished = {\url{https://openkim.org/kim-api}}, - publisher = {OpenKIM}, - year = 2011, - doi = {10.25950/ff8f563a}, -} - -@Article{MO_004835508849_000a, - author = {Mendelev, M. I. and Ackland, G. J.}, - doi = {10.1080/09500830701191393}, - journal = {Philosophical Magazine Letters}, - number = {5}, - pages = {349-359}, - title = {Development of an interatomic potential for the simulation of phase transformations in zirconium}, - volume = {87}, - year = {2007}, -} CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE -Total wall time: 0:01:58 +Total wall time: 0:01:56 diff --git a/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 index bb00b7fec4..fef3f5bc96 100644 --- a/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 @@ -58,10 +58,10 @@ Created 32000 atoms kim interactions O #=== BEGIN kim interactions ================================== variable kim_periodic equal 1 -pair_style reax/c /var/tmp/kim-shared-library-parameter-file-directory-pgBW45WFK0TI/lmp_control safezone 2.0 mincap 100 -pair_coeff * * /var/tmp/kim-shared-library-parameter-file-directory-pgBW45WFK0TI/ffield.reax.rdx O -Reading potential file /var/tmp/kim-shared-library-parameter-file-directory-pgBW45WFK0TI/ffield.reax.rdx with DATE: 2010-02-19 -fix reaxqeq all qeq/reax 1 0.0 10.0 1.0e-6 /var/tmp/kim-shared-library-parameter-file-directory-pgBW45WFK0TI/param.qeq +pair_style reax/c /var/tmp/kim-shared-library-parameter-file-directory-SLT21lwwgINS/lmp_control safezone 2.0 mincap 100 +pair_coeff * * /var/tmp/kim-shared-library-parameter-file-directory-SLT21lwwgINS/ffield.reax.rdx O +Reading potential file /var/tmp/kim-shared-library-parameter-file-directory-SLT21lwwgINS/ffield.reax.rdx with DATE: 2010-02-19 +fix reaxqeq all qeq/reax 1 0.0 10.0 1.0e-6 /var/tmp/kim-shared-library-parameter-file-directory-SLT21lwwgINS/param.qeq #=== END kim interactions ==================================== @@ -80,7 +80,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/SM_107643900657_000#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -179,20 +194,20 @@ Per MPI rank memory allocation (min/avg/max) = 1803.0 | 1803.0 | 1803.0 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 -39091.147 0 -20014.559 19501.107 100 63.198252 -26042.062 0 -20014.027 21497.661 -Loop time of 40.2545 on 1 procs for 100 steps with 32000 atoms +Loop time of 38.6526 on 1 procs for 100 steps with 32000 atoms -Performance: 0.215 ns/day, 111.818 hours/ns, 2.484 timesteps/s +Performance: 0.224 ns/day, 107.368 hours/ns, 2.587 timesteps/s 99.1% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 24.364 | 24.364 | 24.364 | 0.0 | 60.52 -Neigh | 0.4185 | 0.4185 | 0.4185 | 0.0 | 1.04 -Comm | 0.022045 | 0.022045 | 0.022045 | 0.0 | 0.05 -Output | 6.6e-05 | 6.6e-05 | 6.6e-05 | 0.0 | 0.00 -Modify | 15.438 | 15.438 | 15.438 | 0.0 | 38.35 -Other | | 0.01285 | | | 0.03 +Pair | 23.493 | 23.493 | 23.493 | 0.0 | 60.78 +Neigh | 0.4498 | 0.4498 | 0.4498 | 0.0 | 1.16 +Comm | 0.020568 | 0.020568 | 0.020568 | 0.0 | 0.05 +Output | 6.8e-05 | 6.8e-05 | 6.8e-05 | 0.0 | 0.00 +Modify | 14.677 | 14.677 | 14.677 | 0.0 | 37.97 +Other | | 0.01223 | | | 0.03 Nlocal: 32000.0 ave 32000 max 32000 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -205,4 +220,4 @@ Total # of neighbors = 3739236 Ave neighs/atom = 116.85112 Neighbor list builds = 3 Dangerous builds = 0 -Total wall time: 0:00:41 +Total wall time: 0:00:39 diff --git a/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 index 90c8adc6b0..9e9770d71b 100644 --- a/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 +++ b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 @@ -58,10 +58,10 @@ Created 32000 atoms kim interactions O #=== BEGIN kim interactions ================================== variable kim_periodic equal 1 -pair_style reax/c /var/tmp/kim-shared-library-parameter-file-directory-zYQfH0ms5WSw/lmp_control safezone 2.0 mincap 100 -pair_coeff * * /var/tmp/kim-shared-library-parameter-file-directory-zYQfH0ms5WSw/ffield.reax.rdx O -Reading potential file /var/tmp/kim-shared-library-parameter-file-directory-zYQfH0ms5WSw/ffield.reax.rdx with DATE: 2010-02-19 -fix reaxqeq all qeq/reax 1 0.0 10.0 1.0e-6 /var/tmp/kim-shared-library-parameter-file-directory-zYQfH0ms5WSw/param.qeq +pair_style reax/c /var/tmp/kim-shared-library-parameter-file-directory-hIWMxB258NXk/lmp_control safezone 2.0 mincap 100 +pair_coeff * * /var/tmp/kim-shared-library-parameter-file-directory-hIWMxB258NXk/ffield.reax.rdx O +Reading potential file /var/tmp/kim-shared-library-parameter-file-directory-hIWMxB258NXk/ffield.reax.rdx with DATE: 2010-02-19 +fix reaxqeq all qeq/reax 1 0.0 10.0 1.0e-6 /var/tmp/kim-shared-library-parameter-file-directory-hIWMxB258NXk/param.qeq #=== END kim interactions ==================================== @@ -80,7 +80,22 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- @Comment +- OpenKIM: https://doi.org/10.1007/s11837-011-0102-6 + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = 2011, + volume = 63, + number = 17, + pages = {17}, + doi = {10.1007/s11837-011-0102-6} +} + +- OpenKIM potential: https://openkim.org/cite/SM_107643900657_000#item-citation + +@Comment { \documentclass{article} \usepackage{url} @@ -179,20 +194,20 @@ Per MPI rank memory allocation (min/avg/max) = 630.2 | 630.2 | 630.2 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 -39091.147 0 -20014.559 19501.107 100 63.198252 -26042.062 0 -20014.027 21497.661 -Loop time of 15.049 on 4 procs for 100 steps with 32000 atoms +Loop time of 14.1676 on 4 procs for 100 steps with 32000 atoms -Performance: 0.574 ns/day, 41.803 hours/ns, 6.645 timesteps/s -99.0% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 0.610 ns/day, 39.355 hours/ns, 7.058 timesteps/s +99.3% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 9.8158 | 9.8159 | 9.8161 | 0.0 | 65.23 -Neigh | 0.17685 | 0.17759 | 0.17832 | 0.1 | 1.18 -Comm | 0.028692 | 0.028847 | 0.028942 | 0.1 | 0.19 -Output | 2.5e-05 | 3.575e-05 | 4.6e-05 | 0.0 | 0.00 -Modify | 5.0171 | 5.0179 | 5.0186 | 0.0 | 33.34 -Other | | 0.008715 | | | 0.06 +Pair | 9.3935 | 9.3935 | 9.3936 | 0.0 | 66.30 +Neigh | 0.15786 | 0.15879 | 0.16003 | 0.2 | 1.12 +Comm | 0.025777 | 0.025906 | 0.025992 | 0.1 | 0.18 +Output | 2.8e-05 | 3.35e-05 | 4.6e-05 | 0.0 | 0.00 +Modify | 4.5801 | 4.5814 | 4.5823 | 0.0 | 32.34 +Other | | 0.00801 | | | 0.06 Nlocal: 8000.00 ave 8010 max 7993 min Histogram: 2 0 0 0 0 1 0 0 0 1 @@ -205,4 +220,4 @@ Total # of neighbors = 4003876 Ave neighs/atom = 125.12113 Neighbor list builds = 3 Dangerous builds = 0 -Total wall time: 0:00:15 +Total wall time: 0:00:14 diff --git a/examples/kim/log.10Feb21.in.lammps.melt.clang.1 b/examples/kim/log.10Feb21.in.lammps.melt.clang.1 index eb2922f413..d227f00104 100644 --- a/examples/kim/log.10Feb21.in.lammps.melt.clang.1 +++ b/examples/kim/log.10Feb21.in.lammps.melt.clang.1 @@ -59,20 +59,20 @@ Per MPI rank memory allocation (min/avg/max) = 19.23 | 19.23 | 19.23 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 6290.8194 0 25367.408 6750.7421 100 98.747096 15900.676 0 25319.465 10184.453 -Loop time of 1.92822 on 1 procs for 100 steps with 32000 atoms +Loop time of 1.87123 on 1 procs for 100 steps with 32000 atoms -Performance: 4.481 ns/day, 5.356 hours/ns, 51.861 timesteps/s -99.8% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 4.617 ns/day, 5.198 hours/ns, 53.441 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.7377 | 1.7377 | 1.7377 | 0.0 | 90.12 -Neigh | 0.14234 | 0.14234 | 0.14234 | 0.0 | 7.38 -Comm | 0.011694 | 0.011694 | 0.011694 | 0.0 | 0.61 -Output | 6.7e-05 | 6.7e-05 | 6.7e-05 | 0.0 | 0.00 -Modify | 0.02476 | 0.02476 | 0.02476 | 0.0 | 1.28 -Other | | 0.01163 | | | 0.60 +Pair | 1.686 | 1.686 | 1.686 | 0.0 | 90.10 +Neigh | 0.14211 | 0.14211 | 0.14211 | 0.0 | 7.59 +Comm | 0.01013 | 0.01013 | 0.01013 | 0.0 | 0.54 +Output | 6.3e-05 | 6.3e-05 | 6.3e-05 | 0.0 | 0.00 +Modify | 0.022686 | 0.022686 | 0.022686 | 0.0 | 1.21 +Other | | 0.0102 | | | 0.55 Nlocal: 32000.0 ave 32000 max 32000 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/kim/log.10Feb21.in.lammps.melt.clang.4 b/examples/kim/log.10Feb21.in.lammps.melt.clang.4 index b8751c4e41..72384dc895 100644 --- a/examples/kim/log.10Feb21.in.lammps.melt.clang.4 +++ b/examples/kim/log.10Feb21.in.lammps.melt.clang.4 @@ -59,20 +59,20 @@ Per MPI rank memory allocation (min/avg/max) = 7.633 | 7.633 | 7.633 Mbytes Step Temp E_pair E_mol TotEng Press 0 200 6290.8194 0 25367.408 6750.7421 100 98.747096 15900.676 0 25319.465 10184.453 -Loop time of 0.561006 on 4 procs for 100 steps with 32000 atoms +Loop time of 0.532082 on 4 procs for 100 steps with 32000 atoms -Performance: 15.401 ns/day, 1.558 hours/ns, 178.251 timesteps/s -99.6% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 16.238 ns/day, 1.478 hours/ns, 187.941 timesteps/s +99.8% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.48486 | 0.48676 | 0.48817 | 0.2 | 86.77 -Neigh | 0.040698 | 0.04091 | 0.041066 | 0.1 | 7.29 -Comm | 0.016616 | 0.01811 | 0.0202 | 1.1 | 3.23 -Output | 3e-05 | 3.575e-05 | 4.7e-05 | 0.0 | 0.01 -Modify | 0.008934 | 0.009025 | 0.009142 | 0.1 | 1.61 -Other | | 0.006161 | | | 1.10 +Pair | 0.46077 | 0.46347 | 0.46621 | 0.3 | 87.10 +Neigh | 0.038499 | 0.038599 | 0.038759 | 0.0 | 7.25 +Comm | 0.01395 | 0.016623 | 0.019377 | 1.7 | 3.12 +Output | 3.1e-05 | 3.675e-05 | 4.7e-05 | 0.0 | 0.01 +Modify | 0.00787 | 0.007971 | 0.008083 | 0.1 | 1.50 +Other | | 0.005382 | | | 1.01 Nlocal: 8000.00 ave 8012 max 7989 min Histogram: 1 0 0 0 2 0 0 0 0 1 From 9d2408754e0d1131b63b845049d2b4881959b83f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Feb 2021 10:34:39 -0500 Subject: [PATCH 03/10] use more conventional and thus more familiar way to avoid memory leak --- src/KIM/kim_command.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp index 7e3cbe4b57..88072d1fda 100644 --- a/src/KIM/kim_command.cpp +++ b/src/KIM/kim_command.cpp @@ -66,8 +66,6 @@ #include "kim_property.h" #include "kim_query.h" -#include - using namespace LAMMPS_NS; static constexpr const char *const cite_openkim = @@ -113,20 +111,25 @@ void KimCommand::command(int narg, char **arg) if (lmp->citeme) lmp->citeme->add(cite_openkim); if (subcmd == "init") { - std::unique_ptr cmd(new KimInit(lmp)); + KimInit *cmd = new KimInit(lmp); cmd->command(narg, arg); + delete cmd; } else if (subcmd == "interactions") { - std::unique_ptr cmd(new KimInteractions(lmp)); + KimInteractions *cmd = new KimInteractions(lmp); cmd->command(narg, arg); + delete cmd; } else if (subcmd == "param") { - std::unique_ptr cmd(new KimParam(lmp)); + KimParam *cmd = new KimParam(lmp); cmd->command(narg, arg); + delete cmd; } else if (subcmd == "property") { - std::unique_ptr cmd(new KimProperty(lmp)); + KimProperty *cmd = new KimProperty(lmp); cmd->command(narg, arg); + delete cmd; } else if (subcmd == "query") { if (lmp->citeme) lmp->citeme->add(cite_openkim_query); - std::unique_ptr cmd(new KimQuery(lmp)); + KimQuery *cmd = new KimQuery(lmp); cmd->command(narg, arg); + delete cmd; } else error->all(FLERR, fmt::format("Unknown kim subcommand {}", subcmd)); } From 3f83adefa51ba75477d8b76ac57278f029cd29b3 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Thu, 25 Feb 2021 10:00:30 -0600 Subject: [PATCH 04/10] use a safer utils::strmatch instead of strncmp --- src/KIM/kim_init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index f05fc7c18c..406cb9d3df 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -537,7 +537,7 @@ void KimInit::write_log_cite(char *model_name) &availableAsString, &fileString); if (err) continue; - if ((strncmp("kimcite", fileName, 7) == 0) and availableAsString) + if (utils::strmatch(fileName, "^kimcite") && availableAsString) cite_openkim_potential += fileString; } From 06091a95d251bf7f564da7c36bebf2cfd536bb13 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Thu, 25 Feb 2021 10:11:26 -0600 Subject: [PATCH 05/10] use a safer utils::strmatch instead of strncmp --- src/KIM/kim_query.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index 365f60a094..35ace063ea 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -142,7 +142,7 @@ void KimQuery::command(int narg, char **arg) if (query_function != "get_available_models") { for (int i = 2; i < narg; ++i) { // check if the model is specified as an argument - if (strncmp("model=", arg[i], 6) == 0) { + if (utils::strmatch(arg[i], "^model=")) { ValueTokenizer values(arg[i], "=[]"); std::string key = values.next_string(); model_name = values.next_string(); From 0ad39757e2054d75e1a1471ccc0c0e9c235f399e Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Thu, 25 Feb 2021 13:55:24 -0600 Subject: [PATCH 06/10] Cleaning up legacy C-style string processing Most of the C-style strcmp in the code are replaced with string for simpler/safer/readable alternatives, --- src/KIM/fix_store_kim.cpp | 28 +++++----- src/KIM/fix_store_kim.h | 7 +-- src/KIM/kim_init.cpp | 101 ++++++++++++++++++----------------- src/KIM/kim_interactions.cpp | 25 +++++---- src/KIM/kim_param.cpp | 52 ++++++++++-------- src/KIM/kim_property.cpp | 19 ++++--- src/KIM/pair_kim.cpp | 44 ++++++++------- 7 files changed, 149 insertions(+), 127 deletions(-) diff --git a/src/KIM/fix_store_kim.cpp b/src/KIM/fix_store_kim.cpp index 3b26719a51..6b702c15d5 100644 --- a/src/KIM/fix_store_kim.cpp +++ b/src/KIM/fix_store_kim.cpp @@ -13,7 +13,8 @@ /* ---------------------------------------------------------------------- Contributing authors: Axel Kohlmeyer (Temple U), - Ryan S. Elliott (UMN) + Ryan S. Elliott (UMN), + Yaser Afshar (UMN) ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- @@ -55,11 +56,12 @@ ------------------------------------------------------------------------- */ #include "fix_store_kim.h" -#include + +#include "error.h" + extern "C" { #include "KIM_SimulatorModel.h" } -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -114,27 +116,27 @@ int FixStoreKIM::setmask() /* ---------------------------------------------------------------------- */ -void FixStoreKIM::setptr(const char *name, void *ptr) +void FixStoreKIM::setptr(const std::string &name, void *ptr) { - if (strcmp(name,"simulator_model") == 0) { + if (name == "simulator_model") { if (simulator_model) { KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); } simulator_model = ptr; - } else if (strcmp(name,"model_name") == 0) { + } else if (name == "model_name") { if (model_name) { char *mn = (char *)model_name; delete[] mn; } model_name = ptr; - } else if (strcmp(name,"model_units") == 0) { + } else if (name == "model_units") { if (model_units) { char *mu = (char *)model_units; delete[] mu; } model_units = ptr; - } else if (strcmp(name,"user_units") == 0) { + } else if (name == "user_units") { if (user_units) { char *uu = (char *)user_units; delete[] uu; @@ -145,11 +147,11 @@ void FixStoreKIM::setptr(const char *name, void *ptr) /* ---------------------------------------------------------------------- */ -void *FixStoreKIM::getptr(const char *name) +void *FixStoreKIM::getptr(const std::string &name) { - if (strcmp(name,"simulator_model") == 0) return simulator_model; - else if (strcmp(name,"model_name") == 0) return model_name; - else if (strcmp(name,"model_units") == 0) return model_units; - else if (strcmp(name,"user_units") == 0) return user_units; + if (name == "simulator_model") return simulator_model; + else if (name == "model_name") return model_name; + else if (name == "model_units") return model_units; + else if (name == "user_units") return user_units; else return nullptr; } diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 5775056876..63a2edb74e 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -13,7 +13,8 @@ /* ---------------------------------------------------------------------- Contributing authors: Axel Kohlmeyer (Temple U), - Ryan S. Elliott (UMN) + Ryan S. Elliott (UMN), + Yaser Afshar (UMN) ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- @@ -73,8 +74,8 @@ class FixStoreKIM : public Fix { ~FixStoreKIM(); int setmask(); - void setptr(const char *, void *); - void *getptr(const char *); + void setptr(const std::string &, void *); + void *getptr(const std::string &); private: void *simulator_model; // pointer to KIM simulator model class diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 406cb9d3df..02c38872c1 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -87,10 +87,12 @@ void KimInit::command(int narg, char **arg) if (domain->box_exist) error->all(FLERR, "Must use 'kim init' command before " "simulation box is defined"); + char *model_name = utils::strdup(arg[0]); char *user_units = utils::strdup(arg[1]); if (narg == 3) { - if (strcmp(arg[2], "unit_conversion_mode")==0) unit_conversion_mode = true; + auto arg_str = std::string(arg[2]); + if (arg_str == "unit_conversion_mode") unit_conversion_mode = true; else { error->all(FLERR, fmt::format("Illegal 'kim init' command.\nThe argument " "followed by unit_style {} is an optional " @@ -124,41 +126,42 @@ void get_kim_unit_names( KIM_TimeUnit & timeUnit, Error * error) { - if (strcmp(system, "real") == 0) { + const std::string system_str(system); + if (system_str == "real") { lengthUnit = KIM_LENGTH_UNIT_A; energyUnit = KIM_ENERGY_UNIT_kcal_mol; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_fs; - } else if (strcmp(system, "metal") == 0) { + } else if (system_str == "metal") { lengthUnit = KIM_LENGTH_UNIT_A; energyUnit = KIM_ENERGY_UNIT_eV; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_ps; - } else if (strcmp(system, "si") == 0) { + } else if (system_str == "si") { lengthUnit = KIM_LENGTH_UNIT_m; energyUnit = KIM_ENERGY_UNIT_J; chargeUnit = KIM_CHARGE_UNIT_C; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_s; - } else if (strcmp(system, "cgs") == 0) { + } else if (system_str == "cgs") { lengthUnit = KIM_LENGTH_UNIT_cm; energyUnit = KIM_ENERGY_UNIT_erg; chargeUnit = KIM_CHARGE_UNIT_statC; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_s; - } else if (strcmp(system, "electron") == 0) { + } else if (system_str == "electron") { lengthUnit = KIM_LENGTH_UNIT_Bohr; energyUnit = KIM_ENERGY_UNIT_Hartree; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_fs; - } else if (strcmp(system, "lj") == 0 || - strcmp(system, "micro") ==0 || - strcmp(system, "nano")==0) { + } else if ((system_str == "lj") || + (system_str == "micro") || + (system_str == "nano")) { error->all(FLERR, fmt::format("LAMMPS unit_style {} not supported " - "by KIM models", system)); + "by KIM models", system_str)); } else { error->all(FLERR, "Unknown unit_style"); } @@ -256,15 +259,16 @@ void KimInit::determine_model_type_and_units(char * model_name, int sim_fields; int sim_lines; - char const * sim_field; - char const * sim_value; + char const *sim_field; + char const *sim_value; KIM_SimulatorModel_GetNumberOfSimulatorFields(simulatorModel, &sim_fields); KIM_SimulatorModel_CloseTemplateMap(simulatorModel); - for (int i=0; i < sim_fields; ++i) { + for (int i = 0; i < sim_fields; ++i) { KIM_SimulatorModel_GetSimulatorFieldMetadata( - simulatorModel, i, &sim_lines, &sim_field); + simulatorModel, i, &sim_lines, &sim_field); - if (0 == strcmp(sim_field, "units")) { + const std::string sim_field_str(sim_field); + if (sim_field_str == "units") { KIM_SimulatorModel_GetSimulatorFieldLine( simulatorModel, i, 0, &sim_value); *model_units = utils::strdup(sim_value); @@ -273,9 +277,11 @@ void KimInit::determine_model_type_and_units(char * model_name, } KIM_SimulatorModel_Destroy(&simulatorModel); - if ((! unit_conversion_mode) && (strcmp(*model_units, user_units)!=0)) { + const std::string model_units_str(*model_units); + const std::string user_units_str(user_units); + if ((!unit_conversion_mode) && (model_units_str != user_units_str)) { error->all(FLERR, fmt::format("Incompatible units for KIM Simulator Model" - ", required units = {}", *model_units)); + ", required units = {}", model_units_str)); } } } @@ -301,12 +307,10 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, input->write_echo("#=== BEGIN kim init ===================================" "=======\n"); - KIM_SimulatorModel * simulatorModel; + KIM_SimulatorModel *simulatorModel; if (model_type == SM) { - int kim_error = - KIM_SimulatorModel_Create(model_name, &simulatorModel); - if (kim_error) - error->all(FLERR, "Unable to load KIM Simulator Model"); + int kim_error = KIM_SimulatorModel_Create(model_name, &simulatorModel); + if (kim_error) error->all(FLERR, "Unable to load KIM Simulator Model"); auto logID = fmt::format("{}_SimulatorModel", comm->me); KIM_SimulatorModel_SetLogID(simulatorModel, logID.c_str()); @@ -315,20 +319,15 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM_SimulatorModel_GetSimulatorNameAndVersion( simulatorModel, &sim_name, &sim_version); - if (0 != strcmp(sim_name, "LAMMPS")) + const std::string sim_name_str(sim_name); + if (sim_name_str != "LAMMPS") error->all(FLERR, "Incompatible KIM Simulator Model"); if (comm->me == 0) { - std::string mesg("# Using KIM Simulator Model : "); - mesg += model_name; - mesg += "\n"; - mesg += "# For Simulator : "; - mesg += std::string(sim_name) + " " + sim_version + "\n"; - mesg += "# Running on : LAMMPS "; - mesg += lmp->version; - mesg += "\n"; - mesg += "#\n"; - + auto mesg = fmt::format("# Using KIM Simulator Model : {}\n" + "# For Simulator : {} {}\n" + "# Running on : LAMMPS {}\n#\n", model_name, + sim_name_str, sim_version, lmp->version); utils::logmesg(lmp, mesg); } @@ -344,24 +343,24 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, // set units - std::string cmd("units "); - cmd += model_units; + const std::string model_units_str(model_units); + auto cmd = fmt::format("units {}", model_units_str); input->one(cmd); // Set the skin and timestep default values as // 2.0 Angstroms and 1.0 femtosecond - std::string skin_cmd = - (strcmp(model_units, "real") == 0) ? "neighbor 2.0 bin # Angstroms": - (strcmp(model_units, "metal") == 0) ? "neighbor 2.0 bin # Angstroms": - (strcmp(model_units, "si") == 0) ? "neighbor 2e-10 bin # meters": - (strcmp(model_units, "cgs") == 0) ? "neighbor 2e-8 bin # centimeters": + const std::string skin_cmd = + (model_units_str == "real") ? "neighbor 2.0 bin # Angstroms": + (model_units_str == "metal") ? "neighbor 2.0 bin # Angstroms": + (model_units_str == "si") ? "neighbor 2e-10 bin # meters": + (model_units_str == "cgs") ? "neighbor 2e-8 bin # centimeters": "neighbor 3.77945224 bin # Bohr"; - std::string step_cmd = - (strcmp(model_units, "real") == 0) ? "timestep 1.0 # femtoseconds": - (strcmp(model_units, "metal") == 0) ? "timestep 1.0e-3 # picoseconds": - (strcmp(model_units, "si") == 0) ? "timestep 1e-15 # seconds": - (strcmp(model_units, "cgs") == 0) ? "timestep 1e-15 # seconds": + const std::string step_cmd = + (model_units_str == "real") ? "timestep 1.0 # femtoseconds": + (model_units_str == "metal") ? "timestep 1.0e-3 # picoseconds": + (model_units_str == "si") ? "timestep 1e-15 # seconds": + (model_units_str == "cgs") ? "timestep 1e-15 # seconds": "timestep 1.0 # femtoseconds"; input->one(skin_cmd); input->one(step_cmd); @@ -373,13 +372,15 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, // init model - for (int i=0; i < sim_fields; ++i) { + for (int i = 0; i < sim_fields; ++i) { KIM_SimulatorModel_GetSimulatorFieldMetadata( - simulatorModel, i, &sim_lines, &sim_field); - if (0 == strcmp(sim_field, "model-init")) { - for (int j=0; j < sim_lines; ++j) { + simulatorModel, i, &sim_lines, &sim_field); + + const std::string sim_field_str(sim_field); + if (sim_field_str == "model-init") { + for (int j = 0; j < sim_lines; ++j) { KIM_SimulatorModel_GetSimulatorFieldLine( - simulatorModel, i, j, &sim_value); + simulatorModel, i, j, &sim_value); input->one(sim_value); } break; diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 59fc4d3f25..c428163688 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -97,7 +97,8 @@ void KimInteractions::command(int narg, char **arg) void KimInteractions::do_setup(int narg, char **arg) { bool fixed_types; - if ((narg == 1) && (0 == strcmp("fixed_types", arg[0]))) { + const std::string arg_str(arg[0]); + if ((narg == 1) && (arg_str == "fixed_types")) { fixed_types = true; } else if (narg != atom->ntypes) { error->all(FLERR, fmt::format("Illegal 'kim interactions' command.\nThe " @@ -178,11 +179,15 @@ void KimInteractions::do_setup(int narg, char **arg) KIM_SimulatorModel_GetSimulatorFieldMetadata( simulatorModel, i, &sim_lines, &sim_field); - if (strcmp(sim_field, "units") == 0) { + const std::string sim_field_str(sim_field); + if (sim_field_str == "units") { KIM_SimulatorModel_GetSimulatorFieldLine( simulatorModel, i, 0, &sim_value); - if (strcmp(sim_value, update->unit_style) != 0) - error->all(FLERR,"Incompatible units for KIM Simulator Model"); + + const std::string sim_value_str(sim_value); + const std::string unit_style_str(update->unit_style); + if (sim_value_str != unit_style_str) + error->all(FLERR, "Incompatible units for KIM Simulator Model"); } } @@ -190,13 +195,15 @@ void KimInteractions::do_setup(int narg, char **arg) for (int i = 0; i < sim_fields; ++i) { KIM_SimulatorModel_GetSimulatorFieldMetadata( simulatorModel, i, &sim_lines, &sim_field); - if (strcmp(sim_field, "model-defn") == 0) { - if (domain->periodicity[0]&& - domain->periodicity[1]&& + + const std::string sim_field_str(sim_field); + if (sim_field_str == "model-defn") { + if (domain->periodicity[0] && + domain->periodicity[1] && domain->periodicity[2]) input->one("variable kim_periodic equal 1"); - else if (domain->periodicity[0]&& - domain->periodicity[1]&& + else if (domain->periodicity[0] && + domain->periodicity[1] && !domain->periodicity[2]) input->one("variable kim_periodic equal 2"); else input->one("variable kim_periodic equal 0"); diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 24eb108abb..b7e3f4148e 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -90,43 +90,45 @@ void get_kim_unit_names( KIM_TimeUnit &timeUnit, Error *error) { - if ((strcmp(system, "real") == 0)) { + const std::string system_str(system); + if (system_str == "real") { lengthUnit = KIM_LENGTH_UNIT_A; energyUnit = KIM_ENERGY_UNIT_kcal_mol; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_fs; - } else if ((strcmp(system, "metal") == 0)) { + } else if (system_str == "metal") { lengthUnit = KIM_LENGTH_UNIT_A; energyUnit = KIM_ENERGY_UNIT_eV; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_ps; - } else if ((strcmp(system, "si") == 0)) { + } else if (system_str == "si") { lengthUnit = KIM_LENGTH_UNIT_m; energyUnit = KIM_ENERGY_UNIT_J; chargeUnit = KIM_CHARGE_UNIT_C; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_s; - } else if ((strcmp(system, "cgs") == 0)) { + } else if (system_str == "cgs") { lengthUnit = KIM_LENGTH_UNIT_cm; energyUnit = KIM_ENERGY_UNIT_erg; chargeUnit = KIM_CHARGE_UNIT_statC; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_s; - } else if ((strcmp(system, "electron") == 0)) { + } else if (system_str == "electron") { lengthUnit = KIM_LENGTH_UNIT_Bohr; energyUnit = KIM_ENERGY_UNIT_Hartree; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_fs; - } else if (strcmp(system, "lj") == 0 || - strcmp(system, "micro") ==0 || - strcmp(system, "nano")==0) { + } else if ((system_str == "lj") || + (system_str == "micro") || + (system_str == "nano")) { error->all(FLERR, fmt::format("LAMMPS unit_style {} not supported " - "by KIM models", system)); - } else + "by KIM models", system_str)); + } else { error->all(FLERR, "Unknown unit_style"); + } } } // namespace @@ -213,7 +215,7 @@ void KimParam::command(int narg, char **arg) if (kim_param_get_set == "get") { int kim_error; // Parameter name - char *paramname = nullptr; + std::string paramname; // Variable name std::string varname; @@ -221,7 +223,7 @@ void KimParam::command(int narg, char **arg) for (int i = 1; i < narg;) { // Parameter name if (i < narg) - paramname = arg[i++]; + paramname = std::string(arg[i++]); else break; @@ -239,7 +241,8 @@ void KimParam::command(int narg, char **arg) if (kim_error) error->all(FLERR, "KIM GetParameterMetadata returned error"); - if (strcmp(paramname, str_name) == 0) break; + const std::string str_name_str(str_name); + if (paramname == str_name_str) break; } if (param_index >= numberOfParameters) { @@ -302,8 +305,10 @@ void KimParam::command(int narg, char **arg) if (i < narg) { // Get the variable/variable_base name - varname = arg[i++]; - if (varname == "split" || varname == "list" || varname == "explicit") + varname = std::string(arg[i++]); + if ((varname == "split") || + (varname == "list") || + (varname == "explicit")) error->all(FLERR, "Illegal variable name in 'kim param get'"); } else { std::string msg("Wrong number of arguments in 'kim param get' "); @@ -316,13 +321,14 @@ void KimParam::command(int narg, char **arg) if (nvars > 1) { if (i < narg) { - if (strcmp(arg[i], "split") == 0) { + std::string formatarg(arg[i]); + if (formatarg == "split") { varsname.resize(nvars); for (int j = 0, k = nlbound; j < nvars; ++j, ++k) { varsname[j] = fmt::format("{}_{}", varname, k); } ++i; - } else if (strcmp(arg[i], "list") == 0) { + } else if (formatarg == "list") { list_requested = true; varsname.resize(1); varsname[0] = varname; @@ -332,13 +338,14 @@ void KimParam::command(int narg, char **arg) varsname.resize(nvars); --i; for (int j = 0; j < nvars; ++j, ++i) { - varsname[j] = arg[i]; + varsname[j] = std::string(arg[i]); if (varsname[j] == "split" || varsname[j] == "list" || varsname[j] == "explicit") error->all(FLERR, "Illegal variable name in 'kim param get'"); } if (i < narg) { - if (strcmp(arg[i], "explicit") == 0) ++i; + formatarg = std::string(arg[i]); + if (formatarg == "explicit") ++i; } } else { auto msg = @@ -357,13 +364,12 @@ void KimParam::command(int narg, char **arg) } else { varsname.resize(1); if (i < narg) { - if (strcmp(arg[i], "split") == 0) { + const std::string formatarg(arg[i]); + if (formatarg == "split") { varsname[0] = fmt::format("{}_{}", varname, nlbound); ++i; } else { - if ((strcmp(arg[i], "list") == 0) || - (strcmp(arg[i], "explicit") == 0)) ++i; - + if (formatarg == "list" || formatarg == "explicit") ++i; varsname[0] = varname; } } else { diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index d620356caf..cea783b729 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -85,11 +85,10 @@ void KimProperty::command(int narg, char **arg) #if LMP_PYTHON #if PY_MAJOR_VERSION >= 3 if (narg < 2) error->all(FLERR, "Invalid 'kim property' command"); - if (!(strcmp(arg[0], "create") == 0) && - !(strcmp(arg[0], "destroy") == 0) && - !(strcmp(arg[0], "modify") == 0) && - !(strcmp(arg[0], "remove") == 0) && - !(strcmp(arg[0], "dump") == 0)) { + + const std::string subcmd(arg[0]); + if ((subcmd != "create") && (subcmd != "destroy") && (subcmd != "modify") && + (subcmd != "remove") && (subcmd != "dump")) { std::string msg("Incorrect arguments in 'kim property' command.\n"); msg += "'kim property create/destroy/modify/remove/dump' is mandatory"; error->all(FLERR, msg); @@ -130,7 +129,7 @@ void KimProperty::command(int narg, char **arg) } // kim_property create 1 cohesive-potential-energy-cubic-crystal - if (strcmp(arg[0], "create") == 0) { + if (subcmd == "create") { if (narg != 3) { PyGILState_Release(gstate); error->all(FLERR, "Invalid 'kim property create' command"); @@ -196,7 +195,7 @@ void KimProperty::command(int narg, char **arg) Py_XDECREF(pArgs); Py_XDECREF(pFunc); Py_XDECREF(pValue); - } else if (strcmp(arg[0], "destroy") == 0) { + } else if (subcmd == "destroy") { if (narg != 2) { PyGILState_Release(gstate); error->all(FLERR, "Invalid 'kim property destroy' command"); @@ -256,7 +255,7 @@ void KimProperty::command(int narg, char **arg) Py_XDECREF(pArgs); Py_XDECREF(pFunc); Py_XDECREF(pValue); - } else if (strcmp(arg[0], "modify") == 0) { + } else if (subcmd == "modify") { if (narg < 6) { PyGILState_Release(gstate); error->all(FLERR, "Invalid 'kim property modify' command"); @@ -321,7 +320,7 @@ void KimProperty::command(int narg, char **arg) Py_XDECREF(pArgs); Py_XDECREF(pFunc); Py_XDECREF(pValue); - } else if (strcmp(arg[0], "remove") == 0) { + } else if (subcmd == "remove") { if (narg < 4) { PyGILState_Release(gstate); error->all(FLERR, "Invalid 'kim property remove' command"); @@ -386,7 +385,7 @@ void KimProperty::command(int narg, char **arg) Py_XDECREF(pArgs); Py_XDECREF(pFunc); Py_XDECREF(pValue); - } else if (strcmp(arg[0], "dump") == 0) { + } else if (subcmd == "dump") { if (narg != 2) { PyGILState_Release(gstate); error->all(FLERR, "Invalid 'kim property dump' command"); diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 6ba3c290f2..ccdf25116c 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -309,10 +309,11 @@ void PairKIM::settings(int narg, char **arg) init_style_call_count = 0; if (narg != 1) { - if ((narg > 0) && ((0 == strcmp("KIMvirial", arg[0])) || - (0 == strcmp("LAMMPSvirial", arg[0])))) { - error->all(FLERR,"'KIMvirial' or 'LAMMPSvirial' not " - "supported with kim-api"); + const std::string arg_str(arg[0]); + if ((narg > 0) && + ((arg_str == "KIMvirial") || (arg_str == "LAMMPSvirial"))) { + error->all(FLERR,"'KIMvirial' or 'LAMMPSvirial' not supported " + "with kim-api"); } else error->all(FLERR,"Illegal pair_style command"); } // arg[0] is the KIM Model name @@ -355,14 +356,16 @@ void PairKIM::coeff(int narg, char **arg) // insure I,J args are * * - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) + const std::string arg_0_str(arg[0]); + const std::string arg_1_str(arg[1]); + if ((arg_0_str != "*") || (arg_1_str != "*")) error->all(FLERR,"Incorrect args for pair coefficients.\nThe first two " "arguments of pair_coeff command must be * * to span " "all LAMMPS atom types"); int ilo,ihi,jlo,jhi; - utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); - utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg_0_str,1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg_1_str,1,atom->ntypes,jlo,jhi,error); // read args that map atom species to KIM elements // lmps_map_species_to_unique[i] = @@ -444,12 +447,12 @@ void PairKIM::coeff(int narg, char **arg) int kimerror; // Parameter name - char *paramname = nullptr; + std::string paramname; for (int i = 2 + atom->ntypes; i < narg;) { // Parameter name if (i < narg) - paramname = arg[i++]; + paramname = std::string(arg[i++]); else break; @@ -466,7 +469,8 @@ void PairKIM::coeff(int narg, char **arg) if (kimerror) error->all(FLERR,"KIM GetParameterMetadata returned error"); - if (strcmp(paramname, str_name) == 0) break; + const std::string str_name_str(str_name); + if (paramname == str_name_str) break; } if (param_index >= numberOfParameters) { @@ -1012,47 +1016,49 @@ void PairKIM::set_lmps_flags() if (force->pair_match("hybrid",0)) error->all(FLERR,"pair_kim does not support hybrid"); + const std::string unit_style_str(update->unit_style); + // determine unit system and set lmps_units flag - if (strcmp(update->unit_style,"real") == 0) { + if (unit_style_str == "real") { lmps_units = REAL; lengthUnit = KIM_LENGTH_UNIT_A; energyUnit = KIM_ENERGY_UNIT_kcal_mol; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_fs; - } else if (strcmp(update->unit_style,"metal") == 0) { + } else if (unit_style_str == "metal") { lmps_units = METAL; lengthUnit = KIM_LENGTH_UNIT_A; energyUnit = KIM_ENERGY_UNIT_eV; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_ps; - } else if (strcmp(update->unit_style,"si") == 0) { + } else if (unit_style_str == "si") { lmps_units = SI; lengthUnit = KIM_LENGTH_UNIT_m; energyUnit = KIM_ENERGY_UNIT_J; chargeUnit = KIM_CHARGE_UNIT_C; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_s; - } else if (strcmp(update->unit_style,"cgs") == 0) { + } else if (unit_style_str == "cgs") { lmps_units = CGS; lengthUnit = KIM_LENGTH_UNIT_cm; energyUnit = KIM_ENERGY_UNIT_erg; chargeUnit = KIM_CHARGE_UNIT_statC; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_s; - } else if (strcmp(update->unit_style,"electron") == 0) { + } else if (unit_style_str == "electron") { lmps_units = ELECTRON; lengthUnit = KIM_LENGTH_UNIT_Bohr; energyUnit = KIM_ENERGY_UNIT_Hartree; chargeUnit = KIM_CHARGE_UNIT_e; temperatureUnit = KIM_TEMPERATURE_UNIT_K; timeUnit = KIM_TIME_UNIT_fs; - } else if (strcmp(update->unit_style,"lj") == 0 || - strcmp(update->unit_style,"micro") == 0 || - strcmp(update->unit_style,"nano") == 0) { + } else if ((unit_style_str == "lj") || + (unit_style_str == "micro") || + (unit_style_str == "nano")) { error->all(FLERR,fmt::format("LAMMPS unit_style {} not supported " - "by KIM models", update->unit_style)); + "by KIM models", unit_style_str)); } else { error->all(FLERR,"Unknown unit_style"); } From 9503a089efc205b89b3b126868174b324243b5cb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 26 Feb 2021 11:20:06 -0500 Subject: [PATCH 07/10] adapt kim_init code to use the utils::strfind() and drop using std::regex --- src/KIM/kim_init.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 02c38872c1..2eb5fcde48 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -70,7 +70,6 @@ #include "variable.h" #include -#include extern "C" { #include "KIM_SimulatorHeaders.h" @@ -494,10 +493,10 @@ void KimInit::write_log_cite(char *model_name) if (!lmp->citeme) return; std::string model_name_str(model_name); - std::regex re("[MOS]{2}_[0-9]{12}_[0-9]{3}"); - std::smatch sm; + std::string re = "[MS][OM]_\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d_\\d\\d\\d"; + std::string kim_id = utils::strfind(model_name_str, re); - if (!std::regex_search(model_name_str, sm, re)) return; + if (kim_id.empty()) return; KIM_Collections *collections; int err = KIM_Collections_Create(&collections); @@ -524,10 +523,8 @@ void KimInit::write_log_cite(char *model_name) return; } - auto pos = sm.prefix().length(); - auto cite_openkim_potential = fmt::format("OpenKIM potential: " - "https://openkim.org/cite/{}#item-citation\n\n", - model_name_str.substr(pos, 19)); + auto cite_id = fmt::format("OpenKIM potential: https://openkim.org/cite/" + "{}#item-citation\n\n",kim_id); for (int i = 0; i < extent; ++i) { char const *fileName; @@ -539,10 +536,10 @@ void KimInit::write_log_cite(char *model_name) if (err) continue; if (utils::strmatch(fileName, "^kimcite") && availableAsString) - cite_openkim_potential += fileString; + cite_id += fileString; } - lmp->citeme->add(cite_openkim_potential.c_str()); + lmp->citeme->add(cite_id); KIM_Collections_Destroy(&collections); } From 820cd837131da06e70d0c7491518f90b63369ce3 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 26 Feb 2021 12:47:21 -0600 Subject: [PATCH 08/10] use utils::strmatch instead of strchr --- src/KIM/kim_query.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index 35ace063ea..cf3e6f51cf 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -130,7 +130,7 @@ void KimQuery::command(int narg, char **arg) // check the query_args format (a series of keyword=value pairs) for (int i = 2; i < narg; ++i) { - if (!strchr(arg[i], '=') || !strchr(arg[i], '[') || !strchr(arg[i], ']')) { + if (!utils::strmatch(arg[i], "[=][\\[].*[\\]]")) { auto msg = fmt::format("Illegal query format.\nInput argument " "of `{}` to 'kim query' is wrong. The query format is the " "keyword=[value], where value is always an array of one or " From e88c124da6490556cfbe97d4e09754bc5eabc377 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 26 Feb 2021 12:47:43 -0600 Subject: [PATCH 09/10] add extra cases for query unit test --- unittest/commands/test_kim_commands.cpp | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index de57edafc4..311ce6acf1 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -570,6 +570,38 @@ TEST_F(KimCommandsTest, kim_query) "one or more comma-separated items.*", lmp->input->one(squery);); + squery = "kim query a0 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=[Al,Ni, units=[angstrom]"; + TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" + "\\[Al,Ni,` to 'kim query' is wrong. The query format is " + "the keyword=\\[value\\], where value is always an array of " + "one or more comma-separated items.*", + lmp->input->one(squery);); + + squery = "kim query a0 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=Al,Ni], units=[angstrom]"; + TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" + "Al,Ni\\],` to 'kim query' is wrong. The query format is " + "the keyword=\\[value\\], where value is always an array of " + "one or more comma-separated items.*", + lmp->input->one(squery);); + + squery = "kim query a0 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=Al,\"Ni\"], units=[angstrom]"; + TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" + "Al,\"Ni\"\\],` to 'kim query' is wrong. The query format is " + "the keyword=\\[value\\], where value is always an array of " + "one or more comma-separated items.*", + lmp->input->one(squery);); + + squery = "kim query a0 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=\"Al\",Ni], units=[angstrom]"; + TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" + "\"Al\",Ni\\],` to 'kim query' is wrong. The query format is " + "the keyword=\\[value\\], where value is always an array of " + "one or more comma-separated items.*", + lmp->input->one(squery);); + squery = "kim query a0 get_lattice_constant_cubic crystal=[\"fcc\"] " "species=[\"Al\"]"; TEST_FAILURE(".*ERROR: Illegal query format.\nMust use 'kim init' before " From 335a6308d0ad1459e5f2a6f68c91ffa31f507811 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 26 Feb 2021 13:04:29 -0600 Subject: [PATCH 10/10] update kim query example log file --- examples/kim/log.10Feb21.in.kim-query.clang.1 | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/examples/kim/log.10Feb21.in.kim-query.clang.1 b/examples/kim/log.10Feb21.in.kim-query.clang.1 index 3f8639c168..42f216dfc0 100644 --- a/examples/kim/log.10Feb21.in.kim-query.clang.1 +++ b/examples/kim/log.10Feb21.in.kim-query.clang.1 @@ -617,6 +617,69 @@ This Model originally published in \cite{MO_123629422045_005a} is archived in Op doi = {10.1063/5.0014267} } +- OpenKIM potential: https://openkim.org/cite/MO_004835508849_000#item-citation + +@Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_004835508849_000a} is archived in OpenKIM~\cite{MO_004835508849_000, MD_120291908751_005, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_004835508849_000.bib} +\end{document} +} + +@Misc{MO_004835508849_000, + author = {Ellad Tadmor}, + title = {{F}innis-{S}inclair potential ({LAMMPS} cubic hermite tabulation) for {Z}r developed by {M}endelev and {A}ckland (2007); version 3 refitted for radiation studies v000}, + doi = {10.25950/7b7b5ab5}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/7b7b5ab5}}, + keywords = {OpenKIM, Model, MO_004835508849_000}, + publisher = {OpenKIM}, + year = 2018, +} + +@Misc{MD_120291908751_005, + author = {Ryan S. Elliott}, + title = {{EAM} {M}odel {D}river for tabulated potentials with cubic {H}ermite spline interpolation as used in {LAMMPS} v005}, + doi = {10.25950/68defa36}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/7b7b5ab5}}, + keywords = {OpenKIM, Model Driver, MD_120291908751_005}, + publisher = {OpenKIM}, + year = 2018, +} + +@Article{tadmor:elliott:2011, + author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller and C. A. Becker}, + title = {The potential of atomistic simulations and the {K}nowledgebase of {I}nteratomic {M}odels}, + journal = {{JOM}}, + year = {2011}, + volume = {63}, + number = {7}, + pages = {17}, + doi = {10.1007/s11837-011-0102-6}, +} + +@Misc{elliott:tadmor:2011, + author = {Ryan S. Elliott and Ellad B. Tadmor}, + title = {{K}nowledgebase of {I}nteratomic {M}odels ({KIM}) Application Programming Interface ({API})}, + howpublished = {\url{https://openkim.org/kim-api}}, + publisher = {OpenKIM}, + year = 2011, + doi = {10.25950/ff8f563a}, +} + +@Article{MO_004835508849_000a, + author = {Mendelev, M. I. and Ackland, G. J.}, + doi = {10.1080/09500830701191393}, + journal = {Philosophical Magazine Letters}, + number = {5}, + pages = {349-359}, + title = {Development of an interatomic potential for the simulation of phase transformations in zirconium}, + volume = {87}, + year = {2007}, +} CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE -Total wall time: 0:01:56 +Total wall time: 0:01:59