From d23755085467590d5382322139f6cd933b64c302 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 14:33:52 -0500 Subject: [PATCH 01/89] Replace runtime direction in Kokkos SNAP ComputeFusedDeidrj with compile time templated version. --- src/KOKKOS/pair_snap_kokkos.h | 4 +++- src/KOKKOS/pair_snap_kokkos_impl.h | 26 ++++++++++++++++---------- src/KOKKOS/sna_kokkos.h | 8 +------- src/KOKKOS/sna_kokkos_impl.h | 12 ++---------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index 416cc1b888..0426893c88 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -50,6 +50,7 @@ struct TagPairSNAPBeta{}; struct TagPairSNAPComputeBi{}; struct TagPairSNAPTransformBi{}; // re-order blist from AoSoA to AoS struct TagPairSNAPComputeYi{}; +template struct TagPairSNAPComputeFusedDeidrj{}; // CPU backend only @@ -139,8 +140,9 @@ public: KOKKOS_INLINE_FUNCTION void operator() (TagPairSNAPComputeYi,const int iatom_mod, const int idxz, const int iatom_div) const; + template KOKKOS_INLINE_FUNCTION - void operator() (TagPairSNAPComputeFusedDeidrj,const typename Kokkos::TeamPolicy::member_type& team) const; + void operator() (TagPairSNAPComputeFusedDeidrj,const typename Kokkos::TeamPolicy >::member_type& team) const; // CPU backend only KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index b1352446fa..15c880c10b 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -279,7 +279,6 @@ void PairSNAPKokkos::compute(int eflag_in, int team_size = team_size_default; typename Kokkos::TeamPolicy policy_duidrj_cpu(((chunk_size+team_size-1)/team_size)*max_neighs,team_size,vector_length); - snaKK.set_dir(-1); // technically doesn't do anything Kokkos::parallel_for("ComputeDuidrjCPU",policy_duidrj_cpu,*this); typename Kokkos::TeamPolicy policy_deidrj_cpu(((chunk_size+team_size-1)/team_size)*max_neighs,team_size,vector_length); @@ -375,7 +374,6 @@ void PairSNAPKokkos::compute(int eflag_in, Kokkos::parallel_for("TransformBi",policy_transform_bi,*this); } - //ComputeYi in AoSoA data layout, transform to AoS for ComputeFusedDeidrj //Note zeroing `ylist` is fused into `TransformUi`. { //Compute beta = dE_i/dB_i for all i in list @@ -411,13 +409,20 @@ void PairSNAPKokkos::compute(int eflag_in, int n_teams = chunk_size_div * max_neighs * (twojmax + 1); int n_teams_div = (n_teams + team_size - 1) / team_size; - typename Kokkos::TeamPolicy policy_fused_deidrj(n_teams_div,team_size,vector_length); - policy_fused_deidrj = policy_fused_deidrj.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + // x direction + typename Kokkos::TeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size,vector_length); + policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrj<0>",policy_fused_deidrj_x,*this); - for (int k = 0; k < 3; k++) { - snaKK.set_dir(k); - Kokkos::parallel_for("ComputeFusedDeidrj",policy_fused_deidrj,*this); - } + // y direction + typename Kokkos::TeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size,vector_length); + policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrj<1>",policy_fused_deidrj_y,*this); + + // z direction + typename Kokkos::TeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size,vector_length); + policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrj<2>",policy_fused_deidrj_z,*this); } @@ -853,8 +858,9 @@ void PairSNAPKokkos::operator() (TagPairSN } template +template KOKKOS_INLINE_FUNCTION -void PairSNAPKokkos::operator() (TagPairSNAPComputeFusedDeidrj,const typename Kokkos::TeamPolicy::member_type& team) const { +void PairSNAPKokkos::operator() (TagPairSNAPComputeFusedDeidrj,const typename Kokkos::TeamPolicy >::member_type& team) const { SNAKokkos my_sna = snaKK; // extract flattened atom_div / neighbor number / bend location @@ -874,7 +880,7 @@ void PairSNAPKokkos::operator() (TagPairSN const int ninside = d_ninside(ii); if (jj >= ninside) return; - my_sna.compute_fused_deidrj(team, iatom_mod, jbend, jj, iatom_div); + my_sna.template compute_fused_deidrj(team, iatom_mod, jbend, jj, iatom_div); }); diff --git a/src/KOKKOS/sna_kokkos.h b/src/KOKKOS/sna_kokkos.h index f183acdb57..55983f2a90 100644 --- a/src/KOKKOS/sna_kokkos.h +++ b/src/KOKKOS/sna_kokkos.h @@ -141,6 +141,7 @@ inline void compute_bi_cpu(const typename Kokkos::TeamPolicy::member_type& team, int); // ForceSNAP // functions for derivatives, GPU only + template KOKKOS_INLINE_FUNCTION void compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int, const int); //ForceSNAP @@ -164,10 +165,6 @@ inline static KOKKOS_FORCEINLINE_FUNCTION void sincos_wrapper(float x, float* sin_, float *cos_) { sincosf(x, sin_, cos_); } - // Set the direction for split ComputeDuidrj - KOKKOS_INLINE_FUNCTION - void set_dir(int); - #ifdef TIMING_INFO double* timers; timespec starttime, endtime; @@ -298,9 +295,6 @@ inline int bzero_flag; // 1 if bzero subtracted from barray Kokkos::View bzero; // array of B values for isolated atoms - - // for per-direction dulist calculation, specify the direction. - int dir; }; } diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index cd560d2665..667cc60690 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -886,8 +886,9 @@ void SNAKokkos::compute_yi(int iatom_mod, ------------------------------------------------------------------------- */ template +template KOKKOS_INLINE_FUNCTION -void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) +void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) { // get shared memory offset // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer @@ -2160,15 +2161,6 @@ void SNAKokkos::compute_s_dsfac(const real } else { sfac = zero; dsfac = zero; } } -/* ---------------------------------------------------------------------- */ - -// set direction of batched Duidrj -template -KOKKOS_FORCEINLINE_FUNCTION -void SNAKokkos::set_dir(int dir_) { - dir = dir_; -} - /* ---------------------------------------------------------------------- memory usage of arrays ------------------------------------------------------------------------- */ From fc572a0ca8a6cd0e711899896dff2431c9b790fa Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 15:16:06 -0500 Subject: [PATCH 02/89] Cleanup of "magic" numbers in Kokkos SNAP, making team and tile sizes `static constexpr int` in a centralized place. Various other cleanup. --- src/KOKKOS/pair_snap_kokkos.h | 15 +++- src/KOKKOS/pair_snap_kokkos_impl.h | 106 +++++++++++++---------------- 2 files changed, 62 insertions(+), 59 deletions(-) diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index 0426893c88..ec59df49aa 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -79,8 +79,16 @@ public: using real_type = real_type_; using complex = SNAComplex; - // type-dependent team sizes + // Static team/tile sizes for device offload + static constexpr int team_size_compute_neigh = 4; + static constexpr int tile_size_compute_ck = 4; + static constexpr int tile_size_pre_ui = 4; static constexpr int team_size_compute_ui = sizeof(real_type) == 4 ? 8 : 4; + static constexpr int tile_size_transform_ui = 4; + static constexpr int tile_size_compute_zi = 4; + static constexpr int tile_size_compute_bi = 4; + static constexpr int tile_size_transform_bi = 4; + static constexpr int tile_size_compute_yi = 4; static constexpr int team_size_compute_fused_deidrj = sizeof(real_type) == 4 ? 4 : 2; PairSNAPKokkos(class LAMMPS *); @@ -254,6 +262,11 @@ inline double dist2(double* x,double* y); friend void pair_virial_fdotr_compute(PairSNAPKokkos*); + // Utility routine which wraps computing per-team scratch size requirements for + // ComputeNeigh, ComputeUi, and ComputeFusedDeidrj + template + int scratch_size_helper(int values_per_team); + }; diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index 15c880c10b..d9ab2420dc 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -290,87 +290,77 @@ void PairSNAPKokkos::compute(int eflag_in, #ifdef LMP_KOKKOS_GPU + // Pre-compute ceil(chunk_size / vector_length) for code cleanliness + const int chunk_size_div = (chunk_size + vector_length - 1) / vector_length; + //ComputeNeigh { - constexpr int team_size = 4; + // team_size_compute_neigh is defined in `pair_snap_kokkos.h` + int scratch_size = scratch_size_helper(team_size_compute_neigh * max_neighs); - // scratch size: max_neighs * sizeof(int) * number of threads per team - typedef Kokkos::View< int*, - Kokkos::DefaultExecutionSpace::scratch_memory_space, - Kokkos::MemoryTraits > - ScratchViewType; - int scratch_size = ScratchViewType::shmem_size(team_size * max_neighs); - - typename Kokkos::TeamPolicy policy_neigh(chunk_size,team_size,vector_length); + typename Kokkos::TeamPolicy policy_neigh(chunk_size,team_size_compute_neigh,vector_length); policy_neigh = policy_neigh.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeNeigh",policy_neigh,*this); } //ComputeCayleyKlein { + // tile_size_compute_ck is defined in `pair_snap_kokkos.h` typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeCayleyKlein> - policy_compute_ck({0,0,0},{vector_length,max_neighs,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + policy_compute_ck({0,0,0},{vector_length,max_neighs,chunk_size_div},{vector_length,tile_size_compute_ck,1}); Kokkos::parallel_for("ComputeCayleyKlein",policy_compute_ck,*this); } //PreUi { + // tile_size_pre_ui is defined in `pair_snap_kokkos.h` typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPPreUi> - policy_preui({0,0,0},{vector_length,twojmax+1,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + policy_preui({0,0,0},{vector_length,twojmax+1,chunk_size_div},{vector_length,tile_size_pre_ui,1}); Kokkos::parallel_for("PreUi",policy_preui,*this); - } // ComputeUi w/vector parallelism, shared memory, direct atomicAdd into ulisttot { - // new AoSoA form - // team_size_compute_ui is defined in `pair_snap_kokkos.h` - constexpr int team_size = team_size_compute_ui; - + // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer const int tile_size = vector_length * (twojmax + 1); - typedef Kokkos::View< complex*, - Kokkos::DefaultExecutionSpace::scratch_memory_space, - Kokkos::MemoryTraits > - ScratchViewType; - int scratch_size = ScratchViewType::shmem_size(team_size * tile_size); + const int scratch_size = scratch_size_helper(team_size_compute_ui * tile_size); - // total number of teams needed - int chunk_size_div = (chunk_size + vector_length - 1) / vector_length; + // total number of teams needed: (natoms / 32) * (max_neighs) * ("bend" locations) + const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); + const int n_teams_div = (n_teams + team_size_compute_ui - 1) / team_size_compute_ui; - // (natoms / 32) * (max_neighs) * ("bend" locations) - int n_teams = chunk_size_div * max_neighs * (twojmax + 1); - int n_teams_div = (n_teams + team_size - 1) / team_size; - - typename Kokkos::TeamPolicy policy_ui(n_teams_div, team_size, vector_length); + typename Kokkos::TeamPolicy policy_ui(n_teams_div, team_size_compute_ui, vector_length); policy_ui = policy_ui.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); - Kokkos::parallel_for("ComputeUi",policy_ui,*this); + } - // un-"fold" ulisttot, zero ylist - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPTransformUi> policy_transform_ui({0,0,0},{vector_length,snaKK.idxu_max,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + //TransformUi: un-"fold" ulisttot, zero ylist + { + // team_size_transform_ui is defined in `pair_snap_kokkos.h` + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPTransformUi> policy_transform_ui({0,0,0},{vector_length,snaKK.idxu_max,chunk_size_div},{vector_length,tile_size_transform_ui,1}); Kokkos::parallel_for("TransformUi",policy_transform_ui,*this); - } //Compute bispectrum in AoSoA data layout, transform Bi if (quadraticflag || eflag) { + // team_size_[compute_zi, compute_bi, transform_bi] are defined in `pair_snap_kokkos.h` + //ComputeZi - int idxz_max = snaKK.idxz_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeZi> policy_compute_zi({0,0,0},{vector_length,idxz_max,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + const int idxz_max = snaKK.idxz_max; + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeZi> policy_compute_zi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_zi,1}); Kokkos::parallel_for("ComputeZi",policy_compute_zi,*this); //ComputeBi - int idxb_max = snaKK.idxb_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeBi> policy_compute_bi({0,0,0},{vector_length,idxb_max,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + const int idxb_max = snaKK.idxb_max; + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeBi> policy_compute_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_compute_bi,1}); Kokkos::parallel_for("ComputeBi",policy_compute_bi,*this); //Transform data layout of blist out of AoSoA - //We need this b/c `blist` gets used in ComputeForce which doesn't - //take advantage of AoSoA (which at best would only be beneficial - //on the margins) - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPTransformBi> policy_transform_bi({0,0,0},{vector_length,idxb_max,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + //We need this because `blist` gets used in ComputeForce which doesn't + //take advantage of AoSoA, which at best would only be beneficial on the margins + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPTransformBi> policy_transform_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_transform_bi,1}); Kokkos::parallel_for("TransformBi",policy_transform_bi,*this); } @@ -381,46 +371,37 @@ void PairSNAPKokkos::compute(int eflag_in, Kokkos::parallel_for("ComputeBeta",policy_beta,*this); //ComputeYi + // team_size_compute_yi is defined in `pair_snap_kokkos.h` const int idxz_max = snaKK.idxz_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeYi> policy_compute_yi({0,0,0},{vector_length,idxz_max,(chunk_size + vector_length - 1) / vector_length},{vector_length,4,1}); + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeYi> policy_compute_yi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_yi,1}); Kokkos::parallel_for("ComputeYi",policy_compute_yi,*this); } // Fused ComputeDuidrj, ComputeDeidrj { - // new AoSoA form - // team_size_compute_fused_deidrj is defined in `pair_snap_kokkos.h` - constexpr int team_size = team_size_compute_fused_deidrj; // scratch size: 32 atoms * (twojmax+1) cached values * 2 for u, du, no double buffer const int tile_size = vector_length * (twojmax + 1); - typedef Kokkos::View< complex*, - Kokkos::DefaultExecutionSpace::scratch_memory_space, - Kokkos::MemoryTraits > - ScratchViewType; - int scratch_size = ScratchViewType::shmem_size(2 * team_size * tile_size); + const int scratch_size = scratch_size_helper(2 * team_size_compute_fused_deidrj * tile_size); - // total number of teams needed - int chunk_size_div = (chunk_size + vector_length - 1) / vector_length; - - // (natoms / 32) * (max_neighs) * ("bend" locations) - int n_teams = chunk_size_div * max_neighs * (twojmax + 1); - int n_teams_div = (n_teams + team_size - 1) / team_size; + // total number of teams needed: (natoms / 32) * (max_neighs) * ("bend" locations) + const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); + const int n_teams_div = (n_teams + team_size_compute_fused_deidrj - 1) / team_size_compute_fused_deidrj; // x direction - typename Kokkos::TeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size,vector_length); + typename Kokkos::TeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<0>",policy_fused_deidrj_x,*this); // y direction - typename Kokkos::TeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size,vector_length); + typename Kokkos::TeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<1>",policy_fused_deidrj_y,*this); // z direction - typename Kokkos::TeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size,vector_length); + typename Kokkos::TeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<2>",policy_fused_deidrj_z,*this); @@ -1344,6 +1325,15 @@ void PairSNAPKokkos::check_team_size_reduc team_size = team_size_max/vector_length; } +template +template +int PairSNAPKokkos::scratch_size_helper(int values_per_team) { + typedef Kokkos::View > ScratchViewType; + + return ScratchViewType::shmem_size(values_per_team); +} + + /* ---------------------------------------------------------------------- routines used by template reference classes From dd2fc5df62f1406a61b842aaf5d8931ef26a9573 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 15:40:22 -0500 Subject: [PATCH 03/89] Introduction of Kokkos::LaunchBounds in Kokkos SNAP. --- src/KOKKOS/pair_snap_kokkos_impl.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index d9ab2420dc..c72793d789 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -298,7 +298,7 @@ void PairSNAPKokkos::compute(int eflag_in, // team_size_compute_neigh is defined in `pair_snap_kokkos.h` int scratch_size = scratch_size_helper(team_size_compute_neigh * max_neighs); - typename Kokkos::TeamPolicy policy_neigh(chunk_size,team_size_compute_neigh,vector_length); + typename Kokkos::TeamPolicy,TagPairSNAPComputeNeigh> policy_neigh(chunk_size,team_size_compute_neigh,vector_length); policy_neigh = policy_neigh.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeNeigh",policy_neigh,*this); } @@ -306,7 +306,7 @@ void PairSNAPKokkos::compute(int eflag_in, //ComputeCayleyKlein { // tile_size_compute_ck is defined in `pair_snap_kokkos.h` - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeCayleyKlein> + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeCayleyKlein> policy_compute_ck({0,0,0},{vector_length,max_neighs,chunk_size_div},{vector_length,tile_size_compute_ck,1}); Kokkos::parallel_for("ComputeCayleyKlein",policy_compute_ck,*this); } @@ -314,7 +314,7 @@ void PairSNAPKokkos::compute(int eflag_in, //PreUi { // tile_size_pre_ui is defined in `pair_snap_kokkos.h` - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPPreUi> + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPPreUi> policy_preui({0,0,0},{vector_length,twojmax+1,chunk_size_div},{vector_length,tile_size_pre_ui,1}); Kokkos::parallel_for("PreUi",policy_preui,*this); } @@ -322,7 +322,7 @@ void PairSNAPKokkos::compute(int eflag_in, // ComputeUi w/vector parallelism, shared memory, direct atomicAdd into ulisttot { // team_size_compute_ui is defined in `pair_snap_kokkos.h` - + // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer const int tile_size = vector_length * (twojmax + 1); const int scratch_size = scratch_size_helper(team_size_compute_ui * tile_size); @@ -331,7 +331,7 @@ void PairSNAPKokkos::compute(int eflag_in, const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); const int n_teams_div = (n_teams + team_size_compute_ui - 1) / team_size_compute_ui; - typename Kokkos::TeamPolicy policy_ui(n_teams_div, team_size_compute_ui, vector_length); + typename Kokkos::TeamPolicy,TagPairSNAPComputeUi> policy_ui(n_teams_div, team_size_compute_ui, vector_length); policy_ui = policy_ui.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeUi",policy_ui,*this); } @@ -339,7 +339,7 @@ void PairSNAPKokkos::compute(int eflag_in, //TransformUi: un-"fold" ulisttot, zero ylist { // team_size_transform_ui is defined in `pair_snap_kokkos.h` - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPTransformUi> policy_transform_ui({0,0,0},{vector_length,snaKK.idxu_max,chunk_size_div},{vector_length,tile_size_transform_ui,1}); + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPTransformUi> policy_transform_ui({0,0,0},{vector_length,snaKK.idxu_max,chunk_size_div},{vector_length,tile_size_transform_ui,1}); Kokkos::parallel_for("TransformUi",policy_transform_ui,*this); } @@ -349,18 +349,18 @@ void PairSNAPKokkos::compute(int eflag_in, //ComputeZi const int idxz_max = snaKK.idxz_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeZi> policy_compute_zi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_zi,1}); + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeZi> policy_compute_zi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_zi,1}); Kokkos::parallel_for("ComputeZi",policy_compute_zi,*this); //ComputeBi const int idxb_max = snaKK.idxb_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeBi> policy_compute_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_compute_bi,1}); + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeBi> policy_compute_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_compute_bi,1}); Kokkos::parallel_for("ComputeBi",policy_compute_bi,*this); //Transform data layout of blist out of AoSoA //We need this because `blist` gets used in ComputeForce which doesn't //take advantage of AoSoA, which at best would only be beneficial on the margins - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPTransformBi> policy_transform_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_transform_bi,1}); + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPTransformBi> policy_transform_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_transform_bi,1}); Kokkos::parallel_for("TransformBi",policy_transform_bi,*this); } @@ -373,7 +373,7 @@ void PairSNAPKokkos::compute(int eflag_in, //ComputeYi // team_size_compute_yi is defined in `pair_snap_kokkos.h` const int idxz_max = snaKK.idxz_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, TagPairSNAPComputeYi> policy_compute_yi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_yi,1}); + typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeYi> policy_compute_yi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_yi,1}); Kokkos::parallel_for("ComputeYi",policy_compute_yi,*this); } @@ -391,17 +391,17 @@ void PairSNAPKokkos::compute(int eflag_in, const int n_teams_div = (n_teams + team_size_compute_fused_deidrj - 1) / team_size_compute_fused_deidrj; // x direction - typename Kokkos::TeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); + typename Kokkos::TeamPolicy,TagPairSNAPComputeFusedDeidrj<0> > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<0>",policy_fused_deidrj_x,*this); // y direction - typename Kokkos::TeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); + typename Kokkos::TeamPolicy,TagPairSNAPComputeFusedDeidrj<1> > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<1>",policy_fused_deidrj_y,*this); // z direction - typename Kokkos::TeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); + typename Kokkos::TeamPolicy,TagPairSNAPComputeFusedDeidrj<2> > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<2>",policy_fused_deidrj_z,*this); From ca39dea58bb657893322ce68f446b9e32ec1e644 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 16:07:11 -0500 Subject: [PATCH 04/89] Various cleanup in Kokkos SNAP, replacing verbose Kokkos MDRangePolicy and TeamPolicy types with simpler `using` definitions. No performance implications. --- src/KOKKOS/pair_snap_kokkos.h | 13 +++++++++++++ src/KOKKOS/pair_snap_kokkos_impl.h | 29 +++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index ec59df49aa..e4da89edec 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -91,6 +91,19 @@ public: static constexpr int tile_size_compute_yi = 4; static constexpr int team_size_compute_fused_deidrj = sizeof(real_type) == 4 ? 4 : 2; + // Custom MDRangePolicy, Rank3, to reduce verbosity of kernel launches + // This hides the Kokkos::IndexType and Kokkos::Rank<3...> + // and reduces the verbosity of the LaunchBound by hiding the explicit + // multiplication by vector_length + template + using Snap3DRangePolicy = typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAP>; + + // Custom SnapAoSoATeamPolicy to reduce the verbosity of kernel launches + // This hides the LaunchBounds abstraction by hiding the explicit + // multiplication by vector length + template + using SnapAoSoATeamPolicy = typename Kokkos::TeamPolicy, TagPairSNAP>; + PairSNAPKokkos(class LAMMPS *); ~PairSNAPKokkos(); diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index c72793d789..2578f3d47c 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -298,7 +298,7 @@ void PairSNAPKokkos::compute(int eflag_in, // team_size_compute_neigh is defined in `pair_snap_kokkos.h` int scratch_size = scratch_size_helper(team_size_compute_neigh * max_neighs); - typename Kokkos::TeamPolicy,TagPairSNAPComputeNeigh> policy_neigh(chunk_size,team_size_compute_neigh,vector_length); + SnapAoSoATeamPolicy policy_neigh(chunk_size,team_size_compute_neigh,vector_length); policy_neigh = policy_neigh.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeNeigh",policy_neigh,*this); } @@ -306,7 +306,7 @@ void PairSNAPKokkos::compute(int eflag_in, //ComputeCayleyKlein { // tile_size_compute_ck is defined in `pair_snap_kokkos.h` - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeCayleyKlein> + Snap3DRangePolicy policy_compute_ck({0,0,0},{vector_length,max_neighs,chunk_size_div},{vector_length,tile_size_compute_ck,1}); Kokkos::parallel_for("ComputeCayleyKlein",policy_compute_ck,*this); } @@ -314,7 +314,7 @@ void PairSNAPKokkos::compute(int eflag_in, //PreUi { // tile_size_pre_ui is defined in `pair_snap_kokkos.h` - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPPreUi> + Snap3DRangePolicy policy_preui({0,0,0},{vector_length,twojmax+1,chunk_size_div},{vector_length,tile_size_pre_ui,1}); Kokkos::parallel_for("PreUi",policy_preui,*this); } @@ -331,7 +331,7 @@ void PairSNAPKokkos::compute(int eflag_in, const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); const int n_teams_div = (n_teams + team_size_compute_ui - 1) / team_size_compute_ui; - typename Kokkos::TeamPolicy,TagPairSNAPComputeUi> policy_ui(n_teams_div, team_size_compute_ui, vector_length); + SnapAoSoATeamPolicy policy_ui(n_teams_div, team_size_compute_ui, vector_length); policy_ui = policy_ui.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeUi",policy_ui,*this); } @@ -339,7 +339,8 @@ void PairSNAPKokkos::compute(int eflag_in, //TransformUi: un-"fold" ulisttot, zero ylist { // team_size_transform_ui is defined in `pair_snap_kokkos.h` - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPTransformUi> policy_transform_ui({0,0,0},{vector_length,snaKK.idxu_max,chunk_size_div},{vector_length,tile_size_transform_ui,1}); + Snap3DRangePolicy + policy_transform_ui({0,0,0},{vector_length,snaKK.idxu_max,chunk_size_div},{vector_length,tile_size_transform_ui,1}); Kokkos::parallel_for("TransformUi",policy_transform_ui,*this); } @@ -349,18 +350,21 @@ void PairSNAPKokkos::compute(int eflag_in, //ComputeZi const int idxz_max = snaKK.idxz_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeZi> policy_compute_zi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_zi,1}); + Snap3DRangePolicy + policy_compute_zi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_zi,1}); Kokkos::parallel_for("ComputeZi",policy_compute_zi,*this); //ComputeBi const int idxb_max = snaKK.idxb_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeBi> policy_compute_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_compute_bi,1}); + Snap3DRangePolicy + policy_compute_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_compute_bi,1}); Kokkos::parallel_for("ComputeBi",policy_compute_bi,*this); //Transform data layout of blist out of AoSoA //We need this because `blist` gets used in ComputeForce which doesn't //take advantage of AoSoA, which at best would only be beneficial on the margins - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPTransformBi> policy_transform_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_transform_bi,1}); + Snap3DRangePolicy + policy_transform_bi({0,0,0},{vector_length,idxb_max,chunk_size_div},{vector_length,tile_size_transform_bi,1}); Kokkos::parallel_for("TransformBi",policy_transform_bi,*this); } @@ -373,7 +377,8 @@ void PairSNAPKokkos::compute(int eflag_in, //ComputeYi // team_size_compute_yi is defined in `pair_snap_kokkos.h` const int idxz_max = snaKK.idxz_max; - typename Kokkos::MDRangePolicy, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left>, Kokkos::LaunchBounds, TagPairSNAPComputeYi> policy_compute_yi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_yi,1}); + Snap3DRangePolicy + policy_compute_yi({0,0,0},{vector_length,idxz_max,chunk_size_div},{vector_length,tile_size_compute_yi,1}); Kokkos::parallel_for("ComputeYi",policy_compute_yi,*this); } @@ -391,17 +396,17 @@ void PairSNAPKokkos::compute(int eflag_in, const int n_teams_div = (n_teams + team_size_compute_fused_deidrj - 1) / team_size_compute_fused_deidrj; // x direction - typename Kokkos::TeamPolicy,TagPairSNAPComputeFusedDeidrj<0> > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); + SnapAoSoATeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<0>",policy_fused_deidrj_x,*this); // y direction - typename Kokkos::TeamPolicy,TagPairSNAPComputeFusedDeidrj<1> > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); + SnapAoSoATeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<1>",policy_fused_deidrj_y,*this); // z direction - typename Kokkos::TeamPolicy,TagPairSNAPComputeFusedDeidrj<2> > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); + SnapAoSoATeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); Kokkos::parallel_for("ComputeFusedDeidrj<2>",policy_fused_deidrj_z,*this); From 4ee614b5c268693fb9fbc16dae289c3f42f2b170 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 16:16:09 -0500 Subject: [PATCH 05/89] fix whitespace --- src/KOKKOS/pair_snap_kokkos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index e4da89edec..2665c3c2ac 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -278,7 +278,7 @@ inline double dist2(double* x,double* y); // Utility routine which wraps computing per-team scratch size requirements for // ComputeNeigh, ComputeUi, and ComputeFusedDeidrj template - int scratch_size_helper(int values_per_team); + int scratch_size_helper(int values_per_team); }; From 8e8ef0cf63330504b2a71602fbeb293648bcf3b1 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 16:51:06 -0500 Subject: [PATCH 06/89] Re-tune tile size for Kokkos SNAP ComputeYi/Zi. --- src/KOKKOS/pair_snap_kokkos.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index 2665c3c2ac..9acf3011ce 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -85,10 +85,10 @@ public: static constexpr int tile_size_pre_ui = 4; static constexpr int team_size_compute_ui = sizeof(real_type) == 4 ? 8 : 4; static constexpr int tile_size_transform_ui = 4; - static constexpr int tile_size_compute_zi = 4; + static constexpr int tile_size_compute_zi = 8; static constexpr int tile_size_compute_bi = 4; static constexpr int tile_size_transform_bi = 4; - static constexpr int tile_size_compute_yi = 4; + static constexpr int tile_size_compute_yi = 8; static constexpr int team_size_compute_fused_deidrj = sizeof(real_type) == 4 ? 4 : 2; // Custom MDRangePolicy, Rank3, to reduce verbosity of kernel launches From 334c0d9969a1c164b39654258cbd083a85c5ca46 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Wed, 10 Feb 2021 22:26:40 -0500 Subject: [PATCH 07/89] Fix compiler error uncovered by a host-only Kokkos build --- src/KOKKOS/sna_kokkos_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index 667cc60690..2a44f943d3 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -888,7 +888,7 @@ void SNAKokkos::compute_yi(int iatom_mod, template template KOKKOS_INLINE_FUNCTION -void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) +void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) { // get shared memory offset // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer From 7da64cba891b4e3272655f9a6bc367402f01a6e7 Mon Sep 17 00:00:00 2001 From: Plimpton Date: Wed, 10 Feb 2021 16:21:25 -0700 Subject: [PATCH 08/89] fix issues with multiple uses of create_bonds command --- doc/src/create_bonds.rst | 10 ++++++++++ src/create_bonds.cpp | 2 +- src/neigh_request.cpp | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/src/create_bonds.rst b/doc/src/create_bonds.rst index b69fd909f0..056b60c7aa 100644 --- a/doc/src/create_bonds.rst +++ b/doc/src/create_bonds.rst @@ -125,6 +125,16 @@ cannot appear in the neighbor list, to avoid creation of duplicate bonds. The neighbor list for all atom type pairs must also extend to a distance that encompasses the *rmax* for new bonds to create. +.. note:: + + If you want to create bonds between pairs of 1-3 or 1-4 atoms in + the current bond topology, then you need to use :doc:`special_bonds + lj 0 1 1 ` to insure those pairs appear in the + neighbor list. They will not appear with the default special_bonds + settings which are zero for 1-2, 1-3, and 1-4 atoms. 1-3 or 1-4 + atoms are those which are 2 hops or 3 hops apart in the bond + topology. + An additional requirement for this style is that your system must be ready to perform a simulation. This means, for example, that all :doc:`pair_style ` coefficients be set via the diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 7ee17bcfcc..e5274d2cf8 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -233,7 +233,7 @@ void CreateBonds::many() // build neighbor list this command needs based on earlier request NeighList *list = neighbor->lists[irequest]; - neighbor->build_one(list); + neighbor->build_one(list,1); // loop over all neighs of each atom // compute distance between two atoms consistently on both procs diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 0d4818fbe1..2339783d14 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -225,6 +225,8 @@ void NeighRequest::copy_request(NeighRequest *other, int skipflag) int i,j; int ntypes = atom->ntypes; + skip = other->skip; + if (other->iskip) { iskip = new int[ntypes+1]; for (i = 1; i <= ntypes; i++) From 258452d1d4ba18604ed4e413996eb525a44a0d09 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 10 Feb 2021 18:40:25 -0500 Subject: [PATCH 09/89] whitespace --- src/neigh_request.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 2339783d14..8c8168952e 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -226,7 +226,7 @@ void NeighRequest::copy_request(NeighRequest *other, int skipflag) int ntypes = atom->ntypes; skip = other->skip; - + if (other->iskip) { iskip = new int[ntypes+1]; for (i = 1; i <= ntypes; i++) From d83827508fd4c66737318f44c1e21728651d22af Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 10 Feb 2021 20:14:19 -0500 Subject: [PATCH 10/89] use neighbor->nrequest to be safer, since neighbor->nlist may be larger --- src/USER-INTEL/npair_skip_intel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/USER-INTEL/npair_skip_intel.cpp b/src/USER-INTEL/npair_skip_intel.cpp index 4f6648ddc1..53900f116f 100644 --- a/src/USER-INTEL/npair_skip_intel.cpp +++ b/src/USER-INTEL/npair_skip_intel.cpp @@ -55,8 +55,8 @@ void NPairSkipIntel::copy_neighbor_info() { NPair::copy_neighbor_info(); if (_full_props) delete []_full_props; - _full_props = new int[neighbor->nlist]; - for (int i = 0; i < neighbor->nlist; i++) + _full_props = new int[neighbor->nrequest]; + for (int i = 0; i < neighbor->nrequest; i++) _full_props[i] = neighbor->requests[i]->full; } From bd547a3c4285549d822aaf30c23636a442898ad7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 6 Feb 2021 18:28:18 -0500 Subject: [PATCH 11/89] Step version strings for next patch release --- doc/lammps.1 | 2 +- src/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lammps.1 b/doc/lammps.1 index 299f8538b0..12cff4eeec 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "24 December 2020" "2020-12-24" +.TH LAMMPS "9 February 2021" "2021-02-09" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. diff --git a/src/version.h b/src/version.h index f812b62821..c04929c145 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "24 Dec 2020" +#define LAMMPS_VERSION "9 Feb 2021" From a742935817e891e99a672befae9ba999e0a21528 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 9 Feb 2021 21:34:08 -0500 Subject: [PATCH 12/89] change version strings to 10 Feb 2021 --- doc/lammps.1 | 2 +- src/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lammps.1 b/doc/lammps.1 index 12cff4eeec..9351ba5636 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "9 February 2021" "2021-02-09" +.TH LAMMPS "10 February 2021" "2021-02-10" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. diff --git a/src/version.h b/src/version.h index c04929c145..84541d4456 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "9 Feb 2021" +#define LAMMPS_VERSION "10 Feb 2021" From 45ba0bd3133c265f3020aab7d89654496114ef0f Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:24:29 -0600 Subject: [PATCH 13/89] refactor kim commands by @akohlmey --- src/KIM/kim_init.h | 7 ------- src/KIM/kim_interactions.h | 7 ------- src/KIM/kim_param.h | 7 ------- src/KIM/kim_property.cpp | 4 ++-- src/KIM/kim_property.h | 11 ++--------- src/KIM/kim_query.h | 7 ------- 6 files changed, 4 insertions(+), 39 deletions(-) diff --git a/src/KIM/kim_init.h b/src/KIM/kim_init.h index 8fa3247b22..6937ab7677 100644 --- a/src/KIM/kim_init.h +++ b/src/KIM/kim_init.h @@ -56,12 +56,6 @@ Designed for use with the kim-api-2.1.0 (and newer) package ------------------------------------------------------------------------- */ -#ifdef COMMAND_CLASS - -CommandStyle(kim_init,KimInit) - -#else - #ifndef LMP_KIM_INIT_H #define LMP_KIM_INIT_H @@ -89,7 +83,6 @@ class KimInit : protected Pointers { } -#endif #endif /* ERROR/WARNING messages: diff --git a/src/KIM/kim_interactions.h b/src/KIM/kim_interactions.h index 071e5b284f..8790f2df14 100644 --- a/src/KIM/kim_interactions.h +++ b/src/KIM/kim_interactions.h @@ -56,12 +56,6 @@ Designed for use with the kim-api-2.1.0 (and newer) package ------------------------------------------------------------------------- */ -#ifdef COMMAND_CLASS - -CommandStyle(kim_interactions,KimInteractions) - -#else - #ifndef LMP_KIM_INTERACTIONS_H #define LMP_KIM_INTERACTIONS_H @@ -81,7 +75,6 @@ class KimInteractions : protected Pointers { } -#endif #endif /* ERROR/WARNING messages: diff --git a/src/KIM/kim_param.h b/src/KIM/kim_param.h index 3e20207cca..bfc27a71bf 100644 --- a/src/KIM/kim_param.h +++ b/src/KIM/kim_param.h @@ -55,12 +55,6 @@ Designed for use with the kim-api-2.1.0 (and newer) package ------------------------------------------------------------------------- */ -#ifdef COMMAND_CLASS - -CommandStyle(kim_param, KimParam) - -#else - #ifndef LMP_KIM_PARAM_H #define LMP_KIM_PARAM_H @@ -82,7 +76,6 @@ public: } // namespace LAMMPS_NS #endif // LMP_KIM_PARAM_H -#endif // COMMAND_CLASS /* ERROR/WARNING messages: diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index 17d8778c7a..3fb46d442f 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -70,7 +70,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -kimProperty::kimProperty(LAMMPS *lmp) : Pointers(lmp) +KimProperty::KimProperty(LAMMPS *lmp) : Pointers(lmp) { // one-time initialization of Python interpreter python->init(); @@ -82,7 +82,7 @@ kimProperty::kimProperty(LAMMPS *lmp) : Pointers(lmp) } } -void kimProperty::command(int narg, char **arg) +void KimProperty::command(int narg, char **arg) { #if LMP_PYTHON #if PY_MAJOR_VERSION >= 3 diff --git a/src/KIM/kim_property.h b/src/KIM/kim_property.h index ff5faa6781..11729433b5 100644 --- a/src/KIM/kim_property.h +++ b/src/KIM/kim_property.h @@ -53,12 +53,6 @@ Designed for use with the kim-api-2.1.0 (and newer) package ------------------------------------------------------------------------- */ -#ifdef COMMAND_CLASS - -CommandStyle(kim_property, kimProperty) - -#else - #ifndef LMP_KIM_PROPERTY_H #define LMP_KIM_PROPERTY_H @@ -67,10 +61,10 @@ CommandStyle(kim_property, kimProperty) namespace LAMMPS_NS { -class kimProperty : protected Pointers +class KimProperty : protected Pointers { public: - kimProperty(class LAMMPS *lmp); + KimProperty(class LAMMPS *lmp); void command(int, char **); }; @@ -78,7 +72,6 @@ public: } // namespace LAMMPS_NS #endif // LMP_KIM_PROPERTY_H -#endif // COMMAND_CLASS /* ERROR/WARNING messages: diff --git a/src/KIM/kim_query.h b/src/KIM/kim_query.h index f2523f5a98..ce59e2f67f 100644 --- a/src/KIM/kim_query.h +++ b/src/KIM/kim_query.h @@ -55,12 +55,6 @@ Designed for use with the kim-api-2.1.0 (and newer) package ------------------------------------------------------------------------- */ -#ifdef COMMAND_CLASS - -CommandStyle(kim_query,KimQuery) - -#else - #ifndef LMP_KIM_QUERY_H #define LMP_KIM_QUERY_H @@ -76,7 +70,6 @@ class KimQuery : protected Pointers { } -#endif #endif /* ERROR/WARNING messages: From 856c9064fb9633629dfd3882c2a549175b9585e8 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 06:16:19 -0600 Subject: [PATCH 14/89] prototype implementation for KIM wrapper command by @akohlmey --- src/KIM/kim_command.cpp | 96 +++++++++++++++++++++++++++++++++++++++++ src/KIM/kim_command.h | 83 +++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 src/KIM/kim_command.cpp create mode 100644 src/KIM/kim_command.h diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp new file mode 100644 index 0000000000..699aa4371b --- /dev/null +++ b/src/KIM/kim_command.cpp @@ -0,0 +1,96 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, see . + + Linking LAMMPS statically or dynamically with other modules is making a + combined work based on LAMMPS. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + In addition, as a special exception, the copyright holders of LAMMPS give + you permission to combine LAMMPS with free software programs or libraries + that are released under the GNU LGPL and with code included in the standard + release of the "kim-api" under the CDDL (or modified versions of such code, + with unchanged license). You may copy and distribute such a system following + the terms of the GNU GPL for LAMMPS and the licenses of the other code + concerned, provided that you include the source code of that other code + when and as the GNU GPL requires distribution of source code. + + Note that people who make modified versions of LAMMPS are not obligated to + grant this special exception for their modified versions; it is their choice + whether to do so. The GNU General Public License gives permission to release + a modified version without this exception; this exception also makes it + possible to release a modified version which carries forward this exception. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Designed for use with the kim-api-2.1.0 (and newer) package +------------------------------------------------------------------------- */ + +#include "kim_command.h" + +#include "error.h" + +// include KIM sub-command headers here +#include "kim_init.h" +#include "kim_interactions.h" +#include "kim_param.h" +#include "kim_property.h" +#include "kim_query.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +void KimCommand::command(int narg, char **arg) +{ + if (narg < 1) error->all(FLERR,"Illegal kim command"); + + const std::string subcmd(arg[0]); + narg--; + arg++; + + if (subcmd == "init") { + KimInit *cmd = new KimInit(lmp); + cmd->command(narg,arg); + } else if (subcmd == "interactions") { + KimInteractions *cmd = new KimInteractions(lmp); + cmd->command(narg,arg); + } else if (subcmd == "param") { + KimParam *cmd = new KimParam(lmp); + cmd->command(narg,arg); + } else if (subcmd == "property") { + KimProperty *cmd = new KimProperty(lmp); + cmd->command(narg,arg); + } else if (subcmd == "query") { + KimQuery *cmd = new KimQuery(lmp); + cmd->command(narg,arg); + } else error->all(FLERR,fmt::format("Unknown kim subcommand {}",subcmd)); +} + diff --git a/src/KIM/kim_command.h b/src/KIM/kim_command.h new file mode 100644 index 0000000000..f327e4f2f3 --- /dev/null +++ b/src/KIM/kim_command.h @@ -0,0 +1,83 @@ +/* -*- 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, see . + + Linking LAMMPS statically or dynamically with other modules is making a + combined work based on LAMMPS. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + In addition, as a special exception, the copyright holders of LAMMPS give + you permission to combine LAMMPS with free software programs or libraries + that are released under the GNU LGPL and with code included in the standard + release of the "kim-api" under the CDDL (or modified versions of such code, + with unchanged license). You may copy and distribute such a system following + the terms of the GNU GPL for LAMMPS and the licenses of the other code + concerned, provided that you include the source code of that other code + when and as the GNU GPL requires distribution of source code. + + Note that people who make modified versions of LAMMPS are not obligated to + grant this special exception for their modified versions; it is their choice + whether to do so. The GNU General Public License gives permission to release + a modified version without this exception; this exception also makes it + possible to release a modified version which carries forward this exception. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Designed for use with the kim-api-2.1.0 (and newer) package +------------------------------------------------------------------------- */ + +#ifdef COMMAND_CLASS + +CommandStyle(kim,KimCommand) + +#else + +#ifndef LMP_KIM_COMMAND_H +#define LMP_KIM_COMMAND_H + +#include "pointers.h" + +namespace LAMMPS_NS { + +class KimCommand : protected Pointers { + public: + KimCommand(class LAMMPS *lmp) : Pointers(lmp) {}; + void command(int, char **); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + + +*/ From 0c5b3bc611a0a68e4336f41d5c5c23edc2dc3325 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:28:41 -0600 Subject: [PATCH 15/89] clean up and remove unnecessary comments --- src/KIM/kim_param.cpp | 2 -- src/KIM/kim_param.h | 7 ++----- src/KIM/kim_property.h | 5 ++--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 1628bb56d9..cef1dea642 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -134,8 +134,6 @@ void get_kim_unit_names( KimParam::KimParam(LAMMPS *lmp) : Pointers(lmp) {} -KimParam::~KimParam() {} - void KimParam::command(int narg, char **arg) { // kim_param is a command for diff --git a/src/KIM/kim_param.h b/src/KIM/kim_param.h index bfc27a71bf..7988e494be 100644 --- a/src/KIM/kim_param.h +++ b/src/KIM/kim_param.h @@ -67,15 +67,12 @@ class KimParam : protected Pointers { public: KimParam(class LAMMPS *lmp); - - ~KimParam(); - void command(int, char **); }; -} // namespace LAMMPS_NS +} -#endif // LMP_KIM_PARAM_H +#endif /* ERROR/WARNING messages: diff --git a/src/KIM/kim_property.h b/src/KIM/kim_property.h index 11729433b5..a804ad573c 100644 --- a/src/KIM/kim_property.h +++ b/src/KIM/kim_property.h @@ -65,13 +65,12 @@ class KimProperty : protected Pointers { public: KimProperty(class LAMMPS *lmp); - void command(int, char **); }; -} // namespace LAMMPS_NS +} -#endif // LMP_KIM_PROPERTY_H +#endif /* ERROR/WARNING messages: From dac21e5c76e92a5eb4b9e47bd8065c9cd883acbb Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:31:48 -0600 Subject: [PATCH 16/89] using unique_ptr to prevent memory leak --- src/KIM/kim_command.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp index 699aa4371b..bce1e0d929 100644 --- a/src/KIM/kim_command.cpp +++ b/src/KIM/kim_command.cpp @@ -12,7 +12,8 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Axel Kohlmeyer (Temple U) + Contributing authors: Axel Kohlmeyer (Temple U), + Yaser Afshar (UMN) ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- @@ -64,6 +65,8 @@ #include "kim_property.h" #include "kim_query.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -77,20 +80,19 @@ void KimCommand::command(int narg, char **arg) arg++; if (subcmd == "init") { - KimInit *cmd = new KimInit(lmp); - cmd->command(narg,arg); + std::unique_ptr cmd(new KimInit(lmp)); + cmd->command(narg, arg); } else if (subcmd == "interactions") { - KimInteractions *cmd = new KimInteractions(lmp); - cmd->command(narg,arg); + std::unique_ptr cmd(new KimInteractions(lmp)); + cmd->command(narg, arg); } else if (subcmd == "param") { - KimParam *cmd = new KimParam(lmp); - cmd->command(narg,arg); + std::unique_ptr cmd(new KimParam(lmp)); + cmd->command(narg, arg); } else if (subcmd == "property") { - KimProperty *cmd = new KimProperty(lmp); - cmd->command(narg,arg); + std::unique_ptr cmd(new KimProperty(lmp)); + cmd->command(narg, arg); } else if (subcmd == "query") { - KimQuery *cmd = new KimQuery(lmp); - cmd->command(narg,arg); - } else error->all(FLERR,fmt::format("Unknown kim subcommand {}",subcmd)); + std::unique_ptr cmd(new KimQuery(lmp)); + cmd->command(narg, arg); + } else error->all(FLERR, fmt::format("Unknown kim subcommand {}", subcmd)); } - From c3393cfc4bdea96a08fd2090a95652674a25535e Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:38:44 -0600 Subject: [PATCH 17/89] update the error messages to 'kim init' and clean up --- src/KIM/kim_init.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 2d639ede4c..c4e9955ac4 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -81,17 +81,17 @@ using namespace LAMMPS_NS; void KimInit::command(int narg, char **arg) { - if ((narg < 2) || (narg > 3)) error->all(FLERR,"Illegal kim_init command"); + if ((narg < 2) || (narg > 3)) error->all(FLERR,"Illegal 'kim init' command"); if (domain->box_exist) - error->all(FLERR,"Must use 'kim_init' command before " + 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; else { - error->all(FLERR,fmt::format("Illegal kim_init command.\nThe argument " + error->all(FLERR,fmt::format("Illegal 'kim init' command.\nThe argument " "followed by unit_style {} is an optional " "argument and when is used must " "be unit_conversion_mode", user_units)); @@ -283,7 +283,8 @@ void KimInit::determine_model_type_and_units(char * model_name, /* ---------------------------------------------------------------------- */ -void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM_Model *&pkim) +void KimInit::do_init(char *model_name, char *user_units, char *model_units, + KIM_Model *&pkim) { // create storage proxy fix. delete existing fix, if needed. @@ -298,7 +299,8 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM fix_store->setptr("model_units", (void *) model_units); // Begin output to log file - input->write_echo("#=== BEGIN kim-init ==========================================\n"); + input->write_echo("#=== BEGIN kim init ===================================" + "=======\n"); KIM_SimulatorModel * simulatorModel; if (model_type == SM) { @@ -407,7 +409,8 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM } // End output to log file - input->write_echo("#=== END kim-init ============================================\n\n"); + input->write_echo("#=== END kim init =====================================" + "=======\n\n"); } /* ---------------------------------------------------------------------- */ From c36a52a8f95d703fd58cb85730c85d50ccd2a2a8 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:45:25 -0600 Subject: [PATCH 18/89] clean up and add extra space after comma --- src/KIM/kim_init.cpp | 106 +++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index c4e9955ac4..43ccfda155 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -81,30 +81,28 @@ using namespace LAMMPS_NS; void KimInit::command(int narg, char **arg) { - if ((narg < 2) || (narg > 3)) error->all(FLERR,"Illegal 'kim init' command"); + if ((narg < 2) || (narg > 3)) error->all(FLERR, "Illegal 'kim init' command"); if (domain->box_exist) - error->all(FLERR,"Must use 'kim init' command before " - "simulation box is defined"); + 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; + if (strcmp(arg[2], "unit_conversion_mode")==0) unit_conversion_mode = true; else { - error->all(FLERR,fmt::format("Illegal 'kim init' command.\nThe argument " - "followed by unit_style {} is an optional " - "argument and when is used must " - "be unit_conversion_mode", user_units)); + error->all(FLERR, fmt::format("Illegal 'kim init' command.\nThe argument " + "followed by unit_style {} is an optional " + "argument and when is used must " + "be unit_conversion_mode", user_units)); } } else unit_conversion_mode = false; char *model_units; KIM_Model *pkim = nullptr; - if (universe->me == 0) - std::remove("kim.log"); - if (universe->nprocs > 1) - MPI_Barrier(universe->uworld); + if (universe->me == 0) std::remove("kim.log"); + if (universe->nprocs > 1) MPI_Barrier(universe->uworld); determine_model_type_and_units(model_name, user_units, &model_units, pkim); @@ -125,43 +123,43 @@ void get_kim_unit_names( KIM_TimeUnit & timeUnit, Error * error) { - if (strcmp(system,"real") == 0) { + if (strcmp(system, "real") == 0) { 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 (strcmp(system, "metal") == 0) { 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 (strcmp(system, "si") == 0) { 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 (strcmp(system, "cgs") == 0) { 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 (strcmp(system, "electron") == 0) { 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) { - error->all(FLERR,fmt::format("LAMMPS unit_style {} not supported " - "by KIM models", system)); + } else if (strcmp(system, "lj") == 0 || + strcmp(system, "micro") ==0 || + strcmp(system, "nano")==0) { + error->all(FLERR, fmt::format("LAMMPS unit_style {} not supported " + "by KIM models", system)); } else { - error->all(FLERR,"Unknown unit_style"); + error->all(FLERR, "Unknown unit_style"); } } } // namespace @@ -182,13 +180,13 @@ void KimInit::determine_model_type_and_units(char * model_name, int kim_error = KIM_Collections_Create(&collections); if (kim_error) - error->all(FLERR,"Unable to access KIM Collections to find Model"); + error->all(FLERR, "Unable to access KIM Collections to find Model"); auto logID = fmt::format("{}_Collections", comm->me); KIM_Collections_SetLogID(collections, logID.c_str()); kim_error = KIM_Collections_GetItemType(collections, model_name, &itemType); - if (kim_error) error->all(FLERR,"KIM Model name not found"); + if (kim_error) error->all(FLERR, "KIM Model name not found"); KIM_Collections_Destroy(&collections); if (KIM_CollectionItemType_Equal(itemType, @@ -205,7 +203,7 @@ void KimInit::determine_model_type_and_units(char * model_name, &units_accepted, &pkim); - if (kim_error) error->all(FLERR,"Unable to load KIM Simulator Model"); + if (kim_error) error->all(FLERR, "Unable to load KIM Simulator Model"); model_type = MO; @@ -239,17 +237,17 @@ void KimInit::determine_model_type_and_units(char * model_name, } KIM_Model_Destroy(&pkim); } - error->all(FLERR,"KIM Model does not support any lammps unit system"); + error->all(FLERR, "KIM Model does not support any lammps unit system"); } else { KIM_Model_Destroy(&pkim); - error->all(FLERR,"KIM Model does not support the requested unit system"); + error->all(FLERR, "KIM Model does not support the requested unit system"); } } else if (KIM_CollectionItemType_Equal( itemType, KIM_COLLECTION_ITEM_TYPE_simulatorModel)) { KIM_SimulatorModel * simulatorModel; kim_error = KIM_SimulatorModel_Create(model_name, &simulatorModel); if (kim_error) - error->all(FLERR,"Unable to load KIM Simulator Model"); + error->all(FLERR, "Unable to load KIM Simulator Model"); model_type = SM; logID = fmt::format("{}_SimulatorModel", comm->me); @@ -265,7 +263,7 @@ void KimInit::determine_model_type_and_units(char * model_name, KIM_SimulatorModel_GetSimulatorFieldMetadata( simulatorModel, i, &sim_lines, &sim_field); - if (0 == strcmp(sim_field,"units")) { + if (0 == strcmp(sim_field, "units")) { KIM_SimulatorModel_GetSimulatorFieldLine( simulatorModel, i, 0, &sim_value); *model_units = utils::strdup(sim_value); @@ -275,8 +273,8 @@ void KimInit::determine_model_type_and_units(char * model_name, KIM_SimulatorModel_Destroy(&simulatorModel); if ((! unit_conversion_mode) && (strcmp(*model_units, user_units)!=0)) { - error->all(FLERR,fmt::format("Incompatible units for KIM Simulator Model" - ", required units = {}", *model_units)); + error->all(FLERR, fmt::format("Incompatible units for KIM Simulator Model" + ", required units = {}", *model_units)); } } } @@ -307,7 +305,7 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, int kim_error = KIM_SimulatorModel_Create(model_name, &simulatorModel); if (kim_error) - error->all(FLERR,"Unable to load KIM Simulator Model"); + error->all(FLERR, "Unable to load KIM Simulator Model"); auto logID = fmt::format("{}_SimulatorModel", comm->me); KIM_SimulatorModel_SetLogID(simulatorModel, logID.c_str()); @@ -316,8 +314,8 @@ 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")) - error->all(FLERR,"Incompatible KIM Simulator Model"); + if (0 != strcmp(sim_name, "LAMMPS")) + error->all(FLERR, "Incompatible KIM Simulator Model"); if (comm->me == 0) { std::string mesg("# Using KIM Simulator Model : "); @@ -330,7 +328,7 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, mesg += "\n"; mesg += "#\n"; - utils::logmesg(lmp,mesg); + utils::logmesg(lmp, mesg); } fix_store->setptr("simulator_model", (void *) simulatorModel); @@ -358,11 +356,11 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, for (int i=0; i < sim_fields; ++i) { KIM_SimulatorModel_GetSimulatorFieldMetadata( - simulatorModel,i,&sim_lines,&sim_field); - if (0 == strcmp(sim_field,"model-init")) { + simulatorModel, i, &sim_lines, &sim_field); + if (0 == strcmp(sim_field, "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; @@ -390,17 +388,17 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, &extent, &str_name, &str_desc); max_len = MAX(max_len, (int)strlen(str_name)); } - max_len = MAX(18,max_len+1); + max_len = MAX(18, max_len + 1); mesg += fmt::format(" No. | {:<{}} | data type | extent\n", "Parameter name", max_len); - mesg += fmt::format("{:-<{}}\n","-",max_len+35); + mesg += fmt::format("{:-<{}}\n", "-", max_len + 35); for (int i = 0; i < numberOfParameters; ++i) { KIM_Model_GetParameterMetadata(pkim, i, &kim_DataType, &extent, &str_name, &str_desc); auto data_type = std::string("\""); data_type += KIM_DataType_ToString(kim_DataType) + std::string("\""); - mesg += fmt::format(" {:<8} | {:<{}} | {:<10} | {}\n",i+1,str_name, - max_len,data_type,extent); + mesg += fmt::format(" {:<8} | {:<{}} | {:<10} | {}\n", i + 1, str_name, + max_len, data_type, extent); } } else mesg += "No mutable parameters.\n"; @@ -420,7 +418,7 @@ void KimInit::do_variables(const std::string &from, const std::string &to) // refuse conversion from or to reduced units if ((from == "lj") || (to == "lj")) - error->all(FLERR,"Cannot set up conversion variables for 'lj' units"); + error->all(FLERR, "Cannot set up conversion variables for 'lj' units"); // get index to internal style variables. create, if needed. // set conversion factors for newly created variables. @@ -445,7 +443,7 @@ void KimInit::do_variables(const std::string &from, const std::string &to) nullptr}; input->write_echo(fmt::format("# Conversion factors from {} to {}:\n", - from,to)); + from, to)); auto variable = input->variable; for (int i = 0; units[i] != nullptr; ++i) { @@ -455,16 +453,14 @@ void KimInit::do_variables(const std::string &from, const std::string &to) variable->set(var_str + " internal 1.0"); v_unit = variable->find(var_str.c_str()); } - ier = lammps_unit_conversion(units[i], - from, - to, + ier = lammps_unit_conversion(units[i], from, to, conversion_factor); if (ier != 0) - error->all(FLERR,fmt::format("Unable to obtain conversion factor: " - "unit = {}; from = {}; to = {}", - units[i], from, to)); + error->all(FLERR, fmt::format("Unable to obtain conversion factor: " + "unit = {}; from = {}; to = {}", + units[i], from, to)); - variable->internal_set(v_unit,conversion_factor); + variable->internal_set(v_unit, conversion_factor); input->write_echo(fmt::format("variable {:<15s} internal {:<15.12e}\n", var_str, conversion_factor)); } @@ -486,13 +482,13 @@ void KimInit::write_log_cite(char *model_name) if (model_type == MO) { err = KIM_Collections_CacheListOfItemMetadataFiles( collections, KIM_COLLECTION_ITEM_TYPE_portableModel, - model_name,&extent); + model_name, &extent); } else if (model_type == SM) { err = KIM_Collections_CacheListOfItemMetadataFiles( collections, KIM_COLLECTION_ITEM_TYPE_simulatorModel, model_name, &extent); } else { - error->all(FLERR,"Unknown model type"); + error->all(FLERR, "Unknown model type"); } if (err) { @@ -509,7 +505,7 @@ void KimInit::write_log_cite(char *model_name) &availableAsString, &fileString); if (err) continue; - if (0 == strncmp("kimcite",fileName,7)) { + if (0 == strncmp("kimcite", fileName, 7)) { if ((lmp->citeme) && (availableAsString)) lmp->citeme->add(fileString); } } From e5efe21d90e44f819de531e78b361ea4a89fe99e Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:46:50 -0600 Subject: [PATCH 19/89] update the error messages to 'kim interactions' and clean up the code --- src/KIM/kim_interactions.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index afb1391606..626fd2b4ba 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -83,10 +83,10 @@ using namespace LAMMPS_NS; void KimInteractions::command(int narg, char **arg) { - if (narg < 1) error->all(FLERR,"Illegal kim_interactions command"); + if (narg < 1) error->all(FLERR,"Illegal 'kim interactions' command"); if (!domain->box_exist) - error->all(FLERR,"Must use 'kim_interactions' command after " + error->all(FLERR,"Must use 'kim interactions' command after " "simulation box is defined"); do_setup(narg,arg); @@ -100,10 +100,10 @@ void KimInteractions::do_setup(int narg, char **arg) if ((narg == 1) && (0 == strcmp("fixed_types",arg[0]))) { fixed_types = true; } else if (narg != atom->ntypes) { - error->all(FLERR,fmt::format("Illegal kim_interactions command.\nThe " + error->all(FLERR,fmt::format("Illegal 'kim interactions' command.\nThe " "LAMMPS simulation has {} atom type(s), but " "{} chemical species passed to the " - "kim_interactions command", + "'kim interactions' command", atom->ntypes, narg)); } else { fixed_types = false; @@ -112,7 +112,7 @@ void KimInteractions::do_setup(int narg, char **arg) char *model_name = nullptr; KIM_SimulatorModel *simulatorModel(nullptr); - // check if we had a kim_init command by finding fix STORE/KIM + // check if we had a kim init command by finding fix STORE/KIM // retrieve model name and pointer to simulator model class instance. // validate model name if not given as null pointer. @@ -121,10 +121,11 @@ void KimInteractions::do_setup(int narg, char **arg) FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; model_name = (char *)fix_store->getptr("model_name"); simulatorModel = (KIM_SimulatorModel *)fix_store->getptr("simulator_model"); - } else error->all(FLERR,"Must use 'kim_init' before 'kim_interactions'"); + } else error->all(FLERR,"Must use 'kim init' before 'kim interactions'"); // Begin output to log file - input->write_echo("#=== BEGIN kim_interactions ==================================\n"); + input->write_echo("#=== BEGIN kim interactions ===========================" + "=======\n"); if (simulatorModel) { if (!fixed_types) { @@ -211,7 +212,7 @@ void KimInteractions::do_setup(int narg, char **arg) // * This is an INTERNAL command. // * It is intended for use only by KIM Simulator Models. // * It is not possible to use this command outside of the context - // of the kim_interactions command and KIM Simulator Models. + // of the kim interactions command and KIM Simulator Models. // * The command performs a transformation from symbolic // string-based atom types to lammps numeric atom types for // the pair_coeff and charge settings. @@ -250,7 +251,8 @@ void KimInteractions::do_setup(int narg, char **arg) } // End output to log file - input->write_echo("#=== END kim_interactions ====================================\n\n"); + input->write_echo("#=== END kim interactions =============================" + "=======\n\n"); } /* ---------------------------------------------------------------------- */ From 98e734845eb21e7ad5e801206b247c0b7911856e Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:49:35 -0600 Subject: [PATCH 20/89] clean up and add extra space after comma --- src/KIM/kim_interactions.cpp | 66 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 626fd2b4ba..59fc4d3f25 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -83,13 +83,13 @@ using namespace LAMMPS_NS; void KimInteractions::command(int narg, char **arg) { - if (narg < 1) error->all(FLERR,"Illegal 'kim interactions' command"); + if (narg < 1) error->all(FLERR, "Illegal 'kim interactions' command"); if (!domain->box_exist) - error->all(FLERR,"Must use 'kim interactions' command after " - "simulation box is defined"); + error->all(FLERR, "Must use 'kim interactions' command after " + "simulation box is defined"); - do_setup(narg,arg); + do_setup(narg, arg); } /* ---------------------------------------------------------------------- */ @@ -97,14 +97,14 @@ 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]))) { + if ((narg == 1) && (0 == strcmp("fixed_types", arg[0]))) { fixed_types = true; } else if (narg != atom->ntypes) { - error->all(FLERR,fmt::format("Illegal 'kim interactions' command.\nThe " - "LAMMPS simulation has {} atom type(s), but " - "{} chemical species passed to the " - "'kim interactions' command", - atom->ntypes, narg)); + error->all(FLERR, fmt::format("Illegal 'kim interactions' command.\nThe " + "LAMMPS simulation has {} atom type(s), but " + "{} chemical species passed to the " + "'kim interactions' command", + atom->ntypes, narg)); } else { fixed_types = false; } @@ -121,7 +121,7 @@ void KimInteractions::do_setup(int narg, char **arg) FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; model_name = (char *)fix_store->getptr("model_name"); simulatorModel = (KIM_SimulatorModel *)fix_store->getptr("simulator_model"); - } else error->all(FLERR,"Must use 'kim init' before 'kim interactions'"); + } else error->all(FLERR, "Must use 'kim init' before 'kim interactions'"); // Begin output to log file input->write_echo("#=== BEGIN kim interactions ===========================" @@ -150,7 +150,7 @@ void KimInteractions::do_setup(int narg, char **arg) bool species_is_supported; char const *sim_species; KIM_SimulatorModel_GetNumberOfSupportedSpecies( - simulatorModel,&sim_num_species); + simulatorModel, &sim_num_species); for (auto atom_type_sym : utils::split_words(atom_type_sym_list)) { species_is_supported = false; @@ -161,8 +161,8 @@ void KimInteractions::do_setup(int narg, char **arg) if (atom_type_sym == sim_species) species_is_supported = true; } if (!species_is_supported) { - error->all(FLERR,fmt::format("Species '{}' is not supported by this " - "KIM Simulator Model", atom_type_sym)); + error->all(FLERR, fmt::format("Species '{}' is not supported by this " + "KIM Simulator Model", atom_type_sym)); } } } else { @@ -178,10 +178,10 @@ void KimInteractions::do_setup(int narg, char **arg) KIM_SimulatorModel_GetSimulatorFieldMetadata( simulatorModel, i, &sim_lines, &sim_field); - if (strcmp(sim_field,"units") == 0) { + if (strcmp(sim_field, "units") == 0) { KIM_SimulatorModel_GetSimulatorFieldLine( simulatorModel, i, 0, &sim_value); - if (strcmp(sim_value,update->unit_style) != 0) + if (strcmp(sim_value, update->unit_style) != 0) error->all(FLERR,"Incompatible units for KIM Simulator Model"); } } @@ -190,7 +190,7 @@ 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 (strcmp(sim_field, "model-defn") == 0) { if (domain->periodicity[0]&& domain->periodicity[1]&& domain->periodicity[2]) @@ -207,7 +207,7 @@ void KimInteractions::do_setup(int narg, char **arg) for (int j = 0; j < sim_lines; ++j) { KIM_SimulatorModel_GetSimulatorFieldLine( simulatorModel, i, j, &sim_value); - if (utils::strmatch(sim_value,"^KIM_SET_TYPE_PARAMETERS")) { + if (utils::strmatch(sim_value, "^KIM_SET_TYPE_PARAMETERS")) { // Notes regarding the KIM_SET_TYPE_PARAMETERS command // * This is an INTERNAL command. // * It is intended for use only by KIM Simulator Models. @@ -228,7 +228,7 @@ void KimInteractions::do_setup(int narg, char **arg) } if (no_model_definition) - error->all(FLERR,"KIM Simulator Model has no Model definition"); + error->all(FLERR, "KIM Simulator Model has no Model definition"); KIM_SimulatorModel_OpenAndInitializeTemplateMap(simulatorModel); @@ -237,7 +237,7 @@ void KimInteractions::do_setup(int narg, char **arg) // not a simulator model. issue pair_style and pair_coeff commands. if (fixed_types) - error->all(FLERR,"fixed_types cannot be used with a KIM Portable Model"); + error->all(FLERR, "fixed_types cannot be used with a KIM Portable Model"); // NOTE: all references to arg must appear before calls to input->one() // as that will reset the argument vector. @@ -263,18 +263,18 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con const std::string key = words[1]; if (key != "pair" && key != "charge") - error->one(FLERR,fmt::format("Unrecognized KEY {} for " - "KIM_SET_TYPE_PARAMETERS command", key)); + error->one(FLERR, fmt::format("Unrecognized KEY {} for " + "KIM_SET_TYPE_PARAMETERS command", key)); std::string filename = words[2]; - std::vector species(words.begin()+3,words.end()); + std::vector species(words.begin() + 3, words.end()); if ((int)species.size() != atom->ntypes) - error->one(FLERR,"Incorrect args for KIM_SET_TYPE_PARAMETERS command"); + error->one(FLERR, "Incorrect args for KIM_SET_TYPE_PARAMETERS command"); FILE *fp = nullptr; if (comm->me == 0) { - fp = fopen(filename.c_str(),"r"); - if (fp == nullptr) error->one(FLERR,"Parameter file not found"); + fp = fopen(filename.c_str(), "r"); + if (fp == nullptr) error->one(FLERR, "Parameter file not found"); } char line[MAXLINE], *ptr; @@ -282,16 +282,16 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con while (1) { if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fp); + ptr = fgets(line, MAXLINE,fp); if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; } - MPI_Bcast(&eof,1,MPI_INT,0,world); + MPI_Bcast(&eof, 1, MPI_INT, 0, world); if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); + MPI_Bcast(&n, 1, MPI_INT, 0, world); + MPI_Bcast(line, n, MPI_CHAR, 0, world); auto trimmed = utils::trim_comment(line); if (trimmed.find_first_not_of(" \t\n\r") == std::string::npos) continue; @@ -302,13 +302,13 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con for (int ib = ia; ib < atom->ntypes; ++ib) if (((species[ia] == words[0]) && (species[ib] == words[1])) || ((species[ib] == words[0]) && (species[ia] == words[1]))) - input->one(fmt::format("pair_coeff {} {} {}",ia+1,ib+1, - fmt::join(words.begin()+2,words.end()," "))); + input->one(fmt::format("pair_coeff {} {} {}", ia + 1, ib + 1, + fmt::join(words.begin() + 2, words.end(), " "))); } } else { for (int ia = 0; ia < atom->ntypes; ++ia) if (species[ia] == words[0]) - input->one(fmt::format("set type {} charge {}",ia+1,words[1])); + input->one(fmt::format("set type {} charge {}", ia + 1, words[1])); } } } From 265650d97cd04667d680284fef8d33e06fd1e00c Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:50:37 -0600 Subject: [PATCH 21/89] update the error messages to 'kim param' and clean up the code --- src/KIM/kim_param.cpp | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index cef1dea642..9b9909b623 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -136,30 +136,29 @@ KimParam::KimParam(LAMMPS *lmp) : Pointers(lmp) {} void KimParam::command(int narg, char **arg) { - // kim_param is a command for + // kim param is a command for // getting/setting the value of a %KIM PM parameter // - // kim_param get param_name index_range variables formatarg - // kim_param set param_name index_range values + // kim param get param_name index_range variables formatarg + // kim param set param_name index_range values + // + // kim param get paramname 1 varname + // kim param get paramname index_range varname_1, ..., varname_N + // kim param get paramname index_range varname_base split + // kim param get paramname index_range varname_base list + // kim param set paramname index_range values - // kim_param get paramname 1 varname - // kim_param get paramname index_range varname_1, ..., varname_N - // kim_param get paramname index_range varname_base split - // kim_param get paramname index_range varname_base list - // kim_param set paramname index_range values - - if (narg < 4) - error->all(FLERR, "Illegal kim_param command"); + if (narg < 4) error->all(FLERR, "Illegal 'kim param' command"); std::string kim_param_get_set = arg[0]; if ((kim_param_get_set != "get") && (kim_param_get_set != "set")) { - std::string msg("Incorrect arguments in kim_param command.\n"); - msg += "'kim_param get/set' is mandatory"; + std::string msg("Incorrect arguments in 'kim param' command.\n"); + msg += "'kim param get/set' is mandatory"; error->all(FLERR, msg); } - // Check if we called a kim_init command + // Check if we called a kim init command // by finding fix STORE/KIM // retrieve model name and model units. @@ -178,15 +177,16 @@ void KimParam::command(int narg, char **arg) isPortableModel = simulatorModel ? false : true; if (!isPortableModel) - error->all(FLERR, "kim_param can only be used with a KIM Portable Model"); + error->all(FLERR, + "'kim param' can only be used with a KIM Portable Model"); model_name = (char *)fix_store->getptr("model_name"); model_units = (char *)fix_store->getptr("model_units"); } else - error->all(FLERR, "Must use 'kim_init' before 'kim_param'"); + error->all(FLERR, "Must use 'kim init' before 'kim param'"); - input->write_echo(fmt::format("#=== BEGIN kim-param {} ===================" - "==================\n",kim_param_get_set)); + input->write_echo(fmt::format("#=== BEGIN kim param {} ===================" + "==================\n", kim_param_get_set)); KIM_Model *pkim = nullptr; @@ -214,10 +214,10 @@ void KimParam::command(int narg, char **arg) "no match for kim style in lammps"); } else { if (kim_param_get_set == "set") { - std::string msg("Wrong 'kim_param set' command.\n"); + std::string msg("Wrong 'kim param set' command.\n"); msg += "To set the new parameter values, pair style must "; - msg += "be assigned.\nMust use 'kim_interactions' or"; - msg += "'pair_style kim' before 'kim_param set'"; + msg += "be assigned.\nMust use 'kim interactions' or"; + msg += "'pair_style kim' before 'kim param set'"; error->all(FLERR, msg); } else { KIM_LengthUnit lengthUnit; @@ -287,7 +287,7 @@ void KimParam::command(int narg, char **arg) } if (param_index >= numberOfParameters) { - auto msg = fmt::format("Wrong argument in kim_param get command.\n" + auto msg = fmt::format("Wrong argument in 'kim param get' command.\n" "This Model does not have the requested '{}' " "parameter", paramname); error->all(FLERR, msg); @@ -336,7 +336,7 @@ void KimParam::command(int narg, char **arg) nubound = nlbound; } } else { - std::string msg("Wrong number of arguments in 'kim_param get' "); + std::string msg("Wrong number of arguments in 'kim param get' "); msg += "command.\nIndex range after parameter name is mandatory"; error->all(FLERR, msg); } @@ -348,7 +348,7 @@ void KimParam::command(int narg, char **arg) // Get the variable/variable_base name varname = arg[i++]; } else { - std::string msg("Wrong number of arguments in 'kim_param get' "); + std::string msg("Wrong number of arguments in 'kim param get' "); msg += "command.\nThe LAMMPS variable name is mandatory"; error->all(FLERR, msg); } @@ -377,14 +377,14 @@ void KimParam::command(int narg, char **arg) } } else { auto msg = - fmt::format("Wrong number of arguments in 'kim_param get' " + fmt::format("Wrong number of arguments in 'kim param get' " "command.\nThe LAMMPS '{}' variable names or " "'{} split' is mandatory", nvars, varname); error->all(FLERR, msg); } } else { auto msg = - fmt::format("Wrong number of arguments in 'kim_param get' " + fmt::format("Wrong number of arguments in 'kim param get' " "command.\nThe LAMMPS '{}' variable names or " "'{} split/list' is mandatory", nvars, varname); error->all(FLERR, msg); @@ -498,6 +498,6 @@ void KimParam::command(int narg, char **arg) if (!isPairStyleAssigned) KIM_Model_Destroy(&pkim); - input->write_echo(fmt::format("#=== END kim-param {} =====================" - "==================\n",kim_param_get_set)); + input->write_echo(fmt::format("#=== END kim param {} =====================" + "==================\n", kim_param_get_set)); } From 2d9dcf4e8d24875f9589e842c139c54898eec480 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:52:10 -0600 Subject: [PATCH 22/89] clean up and add extra space after comma --- src/KIM/kim_param.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 9b9909b623..1ebbed62f6 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -120,11 +120,11 @@ void get_kim_unit_names( 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) { - error->all(FLERR,fmt::format("LAMMPS unit_style {} not supported " - "by KIM models", system)); + } else if (strcmp(system, "lj") == 0 || + strcmp(system, "micro") ==0 || + strcmp(system, "nano")==0) { + error->all(FLERR, fmt::format("LAMMPS unit_style {} not supported " + "by KIM models", system)); } else error->all(FLERR, "Unknown unit_style"); } @@ -227,8 +227,7 @@ void KimParam::command(int narg, char **arg) KIM_TimeUnit timeUnit; get_kim_unit_names(model_units, lengthUnit, energyUnit, - chargeUnit, temperatureUnit, timeUnit, - error); + chargeUnit, temperatureUnit, timeUnit, error); int units_accepted; From a859643bac717e5ee51c61be0b6c36a36f8cbb7d Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:53:00 -0600 Subject: [PATCH 23/89] update the error messages to 'kim property' and clean up the code --- src/KIM/kim_property.cpp | 120 ++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index 3fb46d442f..d620356caf 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -75,32 +75,28 @@ KimProperty::KimProperty(LAMMPS *lmp) : Pointers(lmp) // one-time initialization of Python interpreter python->init(); - if (!python->has_minimum_version(3, 6)) { - error->all(FLERR, "Invalid Python version.\n" - "The kim-property Python package requires Python " - "3 >= 3.6 support."); - } + if (!python->has_minimum_version(3, 6)) + error->all(FLERR, "Invalid Python version.\nThe kim-property Python " + "package requires Python 3 >= 3.6 support"); } 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 (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)) { - std::string msg("Incorrect arguments in kim_property command.\n"); - msg += "'kim_property create/destroy/modify/remove/dump' "; - msg += "is mandatory."; + std::string msg("Incorrect arguments in 'kim property' command.\n"); + msg += "'kim property create/destroy/modify/remove/dump' is mandatory"; error->all(FLERR, msg); } - input->write_echo("#=== kim-property ===========================================\n"); + input->write_echo("#=== kim property =====================================" + "======\n"); // Get the kim_str ptr to the data associated with a kim_property_str // variable @@ -115,18 +111,18 @@ void KimProperty::command(int narg, char **arg) PyObject *obj = PyUnicode_FromString("kim_property"); if (!obj) { PyGILState_Release(gstate); - error->all(FLERR, "Creating a 'PyObject'!"); + error->all(FLERR, "Failed to create a 'PyObject'"); } kim_property = PyImport_Import(obj); if (!kim_property) { PyGILState_Release(gstate); - error->all(FLERR, "Unable to import Python kim_property module!" - "\nkim-property Python package can be installed " - "with pip:\n'pip install kim-property'\n" - "See the installation instructions at\n" - "https://github.com/openkim/kim-property#installing-kim-property\n" - "for detailed information."); + std::string msg("Unable to import Python kim_property module!"); + msg += "\nkim-property Python package can be installed with pip:\n"; + msg += "'pip install kim-property'\nSee the installation instructions "; + msg += "at\nhttps://github.com/openkim/kim-property#installing-kim-"; + msg += "property\nfor detailed information"; + error->all(FLERR, msg); } // Decrementing of the reference count @@ -137,7 +133,7 @@ void KimProperty::command(int narg, char **arg) if (strcmp(arg[0], "create") == 0) { if (narg != 3) { PyGILState_Release(gstate); - error->all(FLERR, "Invalid 'kim_property create' command."); + error->all(FLERR, "Invalid 'kim property create' command"); } int const ID = utils::inumeric(FLERR, arg[1], true, lmp); @@ -151,8 +147,9 @@ void KimProperty::command(int narg, char **arg) PyObject_GetAttrString(kim_property, "kim_property_create"); if (!pFunc) { PyGILState_Release(gstate); - error->all(FLERR, "Unable to get an attribute named " - "'kim_property_create' from a kim_property object!"); + std::string msg("Unable to get an attribute named "); + msg += "'kim_property_create' from a kim_property object"; + error->all(FLERR, msg); } // Decrementing of the reference count @@ -162,7 +159,7 @@ void KimProperty::command(int narg, char **arg) PyObject *pArgs = PyTuple_New(nSize); if (!pArgs) { PyGILState_Release(gstate); - error->all(FLERR, "Could not create Python function arguments."); + error->all(FLERR, "Could not create Python function arguments"); } // Python object to set the tuple @@ -185,15 +182,16 @@ void KimProperty::command(int narg, char **arg) if (!pValue) { PyErr_Print(); PyGILState_Release(gstate); - error->one(FLERR, "Python 'kim_property_create' function " - "evaluation failed!"); + std::string msg("Python 'kim_property_create' function "); + msg += "evaluation failed"; + error->one(FLERR, msg); } // Python function returned a string value const char *pystr = PyUnicode_AsUTF8(pValue); if (kim_str) input->variable->set_string("kim_property_str", pystr); - else input->variable->set(std::string("kim_property_str string '") - + pystr + std::string("'")); + else + input->variable->set(fmt::format("kim_property_str string '{}'", pystr)); Py_XDECREF(pArgs); Py_XDECREF(pFunc); @@ -201,7 +199,7 @@ void KimProperty::command(int narg, char **arg) } else if (strcmp(arg[0], "destroy") == 0) { if (narg != 2) { PyGILState_Release(gstate); - error->all(FLERR, "Invalid 'kim_property destroy' command."); + error->all(FLERR, "Invalid 'kim property destroy' command"); } if (!kim_str) { @@ -212,13 +210,15 @@ void KimProperty::command(int narg, char **arg) int const ID = utils::inumeric(FLERR, arg[1], true, lmp); // Python function - // This is the equivalent of the Python expression kim_property.kim_property_destroy + // This is the equivalent of the Python expression + // kim_property.kim_property_destroy PyObject *pFunc = PyObject_GetAttrString(kim_property, "kim_property_destroy"); if (!pFunc) { PyGILState_Release(gstate); - error->all(FLERR, "Unable to get an attribute named " - "'kim_property_destroy' from a kim_property object!"); + std::string msg("Unable to get an attribute named "); + msg += "'kim_property_destroy' from a kim_property object"; + error->all(FLERR, msg); } // Decrementing of the reference count @@ -228,7 +228,7 @@ void KimProperty::command(int narg, char **arg) PyObject *pArgs = PyTuple_New(2); if (!pArgs) { PyGILState_Release(gstate); - error->all(FLERR, "Could not create Python function arguments."); + error->all(FLERR, "Could not create Python function arguments"); } // Python object to set the tuple @@ -244,8 +244,9 @@ void KimProperty::command(int narg, char **arg) if (!pValue) { PyErr_Print(); PyGILState_Release(gstate); - error->one(FLERR, "Python 'kim_property_destroy' function " - "evaluation failed!"); + std::string msg("Python 'kim_property_destroy' function "); + msg += "evaluation failed"; + error->one(FLERR, msg); } // Python function returned a string value @@ -258,13 +259,12 @@ void KimProperty::command(int narg, char **arg) } else if (strcmp(arg[0], "modify") == 0) { if (narg < 6) { PyGILState_Release(gstate); - error->all(FLERR, "Invalid 'kim_property modify' command."); + error->all(FLERR, "Invalid 'kim property modify' command"); } if (!kim_str) { PyGILState_Release(gstate); - error->all(FLERR, "There is no property instance to modify " - "the content."); + error->all(FLERR, "There is no property instance to modify the content"); } int const ID = utils::inumeric(FLERR, arg[1], true, lmp); @@ -276,8 +276,9 @@ void KimProperty::command(int narg, char **arg) PyObject_GetAttrString(kim_property, "kim_property_modify"); if (!pFunc) { PyGILState_Release(gstate); - error->all(FLERR, "Unable to get an attribute named " - "'kim_property_modify' from a kim_property object!"); + std::string msg("Unable to get an attribute named "); + msg += "'kim_property_modify' from a kim_property object"; + error->all(FLERR, msg); } // Decrementing of the reference count @@ -287,7 +288,7 @@ void KimProperty::command(int narg, char **arg) PyObject *pArgs = PyTuple_New(static_cast(narg)); if (!pArgs) { PyGILState_Release(gstate); - error->all(FLERR, "Could not create Python function arguments."); + error->all(FLERR, "Could not create Python function arguments"); } // Python object to set the tuple @@ -308,8 +309,9 @@ void KimProperty::command(int narg, char **arg) if (!pValue) { PyErr_Print(); PyGILState_Release(gstate); - error->one(FLERR, "Python 'kim_property_modify' function " - "evaluation failed!"); + std::string msg("Python 'kim_property_modify' function "); + msg += "evaluation failed"; + error->one(FLERR, msg); } // Python function returned a string value @@ -322,13 +324,12 @@ void KimProperty::command(int narg, char **arg) } else if (strcmp(arg[0], "remove") == 0) { if (narg < 4) { PyGILState_Release(gstate); - error->all(FLERR, "Invalid 'kim_property remove' command."); + error->all(FLERR, "Invalid 'kim property remove' command"); } if (!kim_str) { PyGILState_Release(gstate); - error->all(FLERR, "There is no property instance to remove " - "the content."); + error->all(FLERR, "There is no property instance to remove the content"); } int const ID = utils::inumeric(FLERR, arg[1], true, lmp); @@ -340,8 +341,9 @@ void KimProperty::command(int narg, char **arg) PyObject_GetAttrString(kim_property, "kim_property_remove"); if (!pFunc) { PyGILState_Release(gstate); - error->all(FLERR, "Unable to get an attribute named " - "'kim_property_remove' from a kim_property object!"); + std::string msg("Unable to get an attribute named "); + msg += "'kim_property_remove' from a kim_property object"; + error->all(FLERR, msg); } // Decrementing of the reference count @@ -351,7 +353,7 @@ void KimProperty::command(int narg, char **arg) PyObject *pArgs = PyTuple_New(static_cast(narg)); if (!pArgs) { PyGILState_Release(gstate); - error->all(FLERR, "Could not create Python function arguments."); + error->all(FLERR, "Could not create Python function arguments"); } // Python object to set the tuple @@ -372,8 +374,9 @@ void KimProperty::command(int narg, char **arg) if (!pValue) { PyErr_Print(); PyGILState_Release(gstate); - error->one(FLERR, "Python 'kim_property_remove' function " - "evaluation failed!"); + std::string msg("Python 'kim_property_remove' function "); + msg += "evaluation failed"; + error->one(FLERR, msg); } // Python function returned a string value @@ -386,13 +389,12 @@ void KimProperty::command(int narg, char **arg) } else if (strcmp(arg[0], "dump") == 0) { if (narg != 2) { PyGILState_Release(gstate); - error->all(FLERR, "Invalid 'kim_property dump' command."); + error->all(FLERR, "Invalid 'kim property dump' command"); } if (!kim_str) { PyGILState_Release(gstate); - error->all(FLERR, "There is no property instance to dump " - "the content."); + error->all(FLERR, "There is no property instance to dump the content."); } // Python function @@ -402,8 +404,9 @@ void KimProperty::command(int narg, char **arg) PyObject_GetAttrString(kim_property, "kim_property_dump"); if (!pFunc) { PyGILState_Release(gstate); - error->all(FLERR, "Unable to get an attribute named " - "'kim_property_dump' from a kim_property object!"); + std::string msg("Unable to get an attribute named "); + msg += "'kim_property_dump' from a kim_property object"; + error->all(FLERR, msg); } // Decrementing of the reference count @@ -413,7 +416,7 @@ void KimProperty::command(int narg, char **arg) PyObject *pArgs = PyTuple_New(2); if (!pArgs) { PyGILState_Release(gstate); - error->all(FLERR, "Could not create Python function arguments."); + error->all(FLERR, "Could not create Python function arguments"); } // Python object to set the tuple @@ -430,8 +433,9 @@ void KimProperty::command(int narg, char **arg) if (!pValue) { PyErr_Print(); PyGILState_Release(gstate); - error->one(FLERR, "Python 'kim_property_dump' function " - "evaluation failed!"); + std::string msg("Python 'kim_property_dump' function "); + msg += "evaluation failed"; + error->one(FLERR, msg); } } else pValue = nullptr; From 7d7c433fd7c815fed0d3a519ffa2cbca6002cfd4 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:54:33 -0600 Subject: [PATCH 24/89] update the error messages to 'kim query' and clean up the code --- src/KIM/kim_query.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index faf1d26909..ef4b7572d3 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -96,9 +96,9 @@ static size_t write_callback(void *, size_t, size_t, void *); void KimQuery::command(int narg, char **arg) { - if (narg < 2) error->all(FLERR,"Illegal kim_query command"); + if (narg < 2) error->all(FLERR,"Illegal 'kim query' command"); - // check if we had a kim_init command by finding fix STORE/KIM + // check if we had a kim init command by finding fix STORE/KIM // retrieve model name. char *model_name; @@ -106,17 +106,17 @@ void KimQuery::command(int narg, char **arg) if (ifix >= 0) { FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; model_name = (char *)fix_store->getptr("model_name"); - } else error->all(FLERR,"Must use 'kim_init' before 'kim_query'"); + } else error->all(FLERR,"Must use 'kim init' before 'kim query'"); char *varname = arg[0]; bool split = false; if (strcmp("split",arg[1]) == 0) { - if (narg == 2) error->all(FLERR,"Illegal kim_query command.\nThe keyword " + if (narg == 2) error->all(FLERR,"Illegal 'kim query' command.\nThe keyword " "'split' must be followed by the name of " "the query function"); if (strcmp("list",arg[2]) == 0) - error->all(FLERR,"Illegal kim_query command.\nThe 'list' keyword " + error->all(FLERR,"Illegal 'kim query' command.\nThe 'list' keyword " "can not be used after 'split'"); split = true; arg++; @@ -126,7 +126,7 @@ void KimQuery::command(int narg, char **arg) // The “list” is the default setting // the result is returned as a space-separated list of values in variable if (strcmp("list",arg[1]) == 0) { - if (narg == 2) error->all(FLERR,"Illegal kim_query command.\nThe 'list' " + if (narg == 2) error->all(FLERR,"Illegal 'kim query' command.\nThe 'list' " "keyword must be followed by ('split' " "and) the name of the query function"); arg++; @@ -136,11 +136,11 @@ void KimQuery::command(int narg, char **arg) char *function = arg[1]; for (int i = 2; i < narg; ++i) { if (strncmp("model=",arg[i],6) == 0) - error->all(FLERR,"Illegal 'model' key in kim_query command"); + error->all(FLERR,"Illegal 'model' key in 'kim query' command"); if (!strchr(arg[i], '=') || !strchr(arg[i], '[') || !strchr(arg[i], ']')) error->all(FLERR,fmt::format("Illegal query format.\nInput argument of " - "`{}` to kim_query is wrong. The query " + "`{}` 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", arg[i])); @@ -161,7 +161,8 @@ void KimQuery::command(int narg, char **arg) error->all(FLERR,fmt::format("OpenKIM query returned no results")); } - input->write_echo("#=== BEGIN kim-query =========================================\n"); + input->write_echo("#=== BEGIN kim query ==================================" + "=======\n"); ValueTokenizer values(value, ","); if (split) { int counter = 1; @@ -182,11 +183,12 @@ void KimQuery::command(int narg, char **arg) input->variable->set(setcmd); input->write_echo(fmt::format("variable {}\n", setcmd)); } - input->write_echo("#=== END kim-query ===========================================\n\n"); + input->write_echo("#=== END kim query ====================================" + "=======\n\n"); delete[] value; #else - error->all(FLERR,"Cannot use 'kim_query' command when KIM package " + error->all(FLERR,"Cannot use 'kim query' command when KIM package " "is compiled without support for libcurl"); #endif } @@ -292,7 +294,7 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, } } - std::string user_agent = fmt::format("kim_query--LAMMPS/{} ({})", + std::string user_agent = fmt::format("kim query--LAMMPS/{} ({})", LAMMPS_VERSION, Info::get_os_info()); curl_easy_setopt(handle, CURLOPT_USERAGENT, user_agent.c_str()); From 6769ded03c87aebabe773d5777b31908e2f88bf5 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 05:55:36 -0600 Subject: [PATCH 25/89] update the unittests with the latest interface changes --- unittest/commands/test_kim_commands.cpp | 334 ++++++++++++------------ 1 file changed, 173 insertions(+), 161 deletions(-) diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 275a9eae3a..5ea458de59 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -79,31 +79,51 @@ protected: } }; +TEST_F(KimCommandsTest, kim) +{ + if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); + + TEST_FAILURE(".*ERROR: Illegal kim command.*", + lmp->input->one("kim");); + TEST_FAILURE(".*ERROR: Unknown kim subcommand.*", + lmp->input->one("kim unknown");); + TEST_FAILURE(".*ERROR: Unknown command: kim_init.*", + lmp->input->one("kim_init");); + TEST_FAILURE(".*ERROR: Unknown command: kim_interactions.*", + lmp->input->one("kim_interactions");); + TEST_FAILURE(".*ERROR: Unknown command: kim_param.*", + lmp->input->one("kim_param");); + TEST_FAILURE(".*ERROR: Unknown command: kim_property.*", + lmp->input->one("kim_property");); + TEST_FAILURE(".*ERROR: Unknown command: kim_query.*", + lmp->input->one("kim_query");); +} + TEST_F(KimCommandsTest, kim_init) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal kim_init command.*", - lmp->input->one("kim_init");); - TEST_FAILURE(".*ERROR: Illegal kim_init command.*", - lmp->input->one("kim_init LennardJones_Ar real si");); + TEST_FAILURE(".*ERROR: Illegal 'kim init' command.*", + lmp->input->one("kim init");); + TEST_FAILURE(".*ERROR: Illegal 'kim init' command.*", + lmp->input->one("kim init LennardJones_Ar real si");); TEST_FAILURE(".*ERROR: LAMMPS unit_style lj not supported by KIM models.*", - lmp->input->one("kim_init LennardJones_Ar lj");); + lmp->input->one("kim init LennardJones_Ar lj");); TEST_FAILURE(".*ERROR: LAMMPS unit_style micro not supported by KIM models.*", - lmp->input->one("kim_init LennardJones_Ar micro");); + lmp->input->one("kim init LennardJones_Ar micro");); TEST_FAILURE(".*ERROR: LAMMPS unit_style nano not supported by KIM models.*", - lmp->input->one("kim_init LennardJones_Ar nano");); + lmp->input->one("kim init LennardJones_Ar nano");); TEST_FAILURE(".*ERROR: Unknown unit_style.*", - lmp->input->one("kim_init LennardJones_Ar new_style");); + lmp->input->one("kim init LennardJones_Ar new_style");); TEST_FAILURE(".*ERROR: KIM Model name not found.*", - lmp->input->one("kim_init Unknown_Model real");); + lmp->input->one("kim init Unknown_Model real");); TEST_FAILURE(".*ERROR: Incompatible units for KIM Simulator Model, required units = metal.*", - lmp->input->one("kim_init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu real");); + lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu real");); // TEST_FAILURE(".*ERROR: KIM Model does not support the requested unit system.*", - // lmp->input->one("kim_init ex_model_Ar_P_Morse real");); + // lmp->input->one("kim init ex_model_Ar_P_Morse real");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim_init LennardJones_Ar real"); + lmp->input->one("kim init LennardJones_Ar real"); if (!verbose) ::testing::internal::GetCapturedStdout(); int ifix = lmp->modify->find_fix("KIM_MODEL_STORE"); @@ -114,27 +134,27 @@ TEST_F(KimCommandsTest, kim_interactions) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal kim_interactions command.*", - lmp->input->one("kim_interactions");); + TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", + lmp->input->one("kim interactions");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim_init LennardJones_Ar real"); + lmp->input->one("kim init LennardJones_Ar real"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Must use 'kim_interactions' command " + TEST_FAILURE(".*ERROR: Must use 'kim interactions' command " "after simulation box is defined.*", - lmp->input->one("kim_interactions Ar");); + lmp->input->one("kim interactions Ar");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim_init LennardJones_Ar real"); + lmp->input->one("kim init LennardJones_Ar real"); lmp->input->one("lattice fcc 4.4300"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); lmp->input->one("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal kim_interactions command.*", - lmp->input->one("kim_interactions Ar Ar");); + TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", + lmp->input->one("kim interactions Ar Ar");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); @@ -144,8 +164,8 @@ TEST_F(KimCommandsTest, kim_interactions) lmp->input->one("create_atoms 4 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal kim_interactions command.*", - lmp->input->one("kim_interactions Ar Ar");); + TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", + lmp->input->one("kim interactions Ar Ar");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); @@ -155,12 +175,12 @@ TEST_F(KimCommandsTest, kim_interactions) lmp->input->one("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Must use 'kim_init' before 'kim_interactions'.*", - lmp->input->one("kim_interactions Ar");); + TEST_FAILURE(".*ERROR: Must use 'kim init' before 'kim interactions'.*", + lmp->input->one("kim interactions Ar");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones_Ar real"); + lmp->input->one("kim init LennardJones_Ar real"); lmp->input->one("lattice fcc 4.4300"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); @@ -168,7 +188,7 @@ TEST_F(KimCommandsTest, kim_interactions) if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: fixed_types cannot be used with a KIM Portable Model.*", - lmp->input->one("kim_interactions fixed_types");); + lmp->input->one("kim interactions fixed_types");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); @@ -181,7 +201,7 @@ TEST_F(KimCommandsTest, kim_interactions) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); + lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); lmp->input->one("lattice fcc 4.920"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); @@ -189,31 +209,31 @@ TEST_F(KimCommandsTest, kim_interactions) if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Species 'Ar' is not supported by this KIM Simulator Model.*", - lmp->input->one("kim_interactions Ar");); + lmp->input->one("kim interactions Ar");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); + lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); lmp->input->one("lattice fcc 4.08"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim_interactions Au"); + lmp->input->one("kim interactions Au"); if (!verbose) ::testing::internal::GetCapturedStdout(); // ASSERT_EQ(lmp->output->var_kim_periodic, 1); // TEST_FAILURE(".*ERROR: Incompatible units for KIM Simulator Model.*", - // lmp->input->one("kim_interactions Au");); + // lmp->input->one("kim interactions Au");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones_Ar real"); + lmp->input->one("kim init LennardJones_Ar real"); lmp->input->one("lattice fcc 4.4300"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim_interactions Ar"); + lmp->input->one("kim interactions Ar"); lmp->input->one("mass 1 39.95"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -222,15 +242,15 @@ TEST_F(KimCommandsTest, kim_interactions) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones_Ar real"); + lmp->input->one("kim init LennardJones_Ar real"); lmp->input->one("lattice fcc 4.4300"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim_interactions Ar"); + lmp->input->one("kim interactions Ar"); lmp->input->one("mass 1 39.95"); lmp->input->one("run 1"); - lmp->input->one("kim_interactions Ar"); + lmp->input->one("kim interactions Ar"); lmp->input->one("run 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); } @@ -239,94 +259,95 @@ TEST_F(KimCommandsTest, kim_param) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal kim_param command.*", lmp->input->one("kim_param");); - TEST_FAILURE(".*ERROR: Incorrect arguments in kim_param command.\n" - "'kim_param get/set' is mandatory.*", - lmp->input->one("kim_param unknown shift 1 shift");); - TEST_FAILURE(".*ERROR: Must use 'kim_init' before 'kim_param'.*", - lmp->input->one("kim_param get shift 1 shift");); + TEST_FAILURE(".*ERROR: Illegal 'kim param' command.*", + lmp->input->one("kim param");); + TEST_FAILURE(".*ERROR: Incorrect arguments in 'kim param' command.\n" + "'kim param get/set' is mandatory.*", + lmp->input->one("kim param unknown shift 1 shift");); + TEST_FAILURE(".*ERROR: Must use 'kim init' before 'kim param'.*", + lmp->input->one("kim param get shift 1 shift");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); + lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: kim_param can only be used with a KIM Portable Model.*", - lmp->input->one("kim_param get shift 1 shift");); + TEST_FAILURE(".*ERROR: 'kim param' can only be used with a KIM Portable Model.*", + lmp->input->one("kim param get shift 1 shift");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Illegal index '0' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim_param get shift 0 shift");); + lmp->input->one("kim param get shift 0 shift");); TEST_FAILURE(".*ERROR: Illegal index '2' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim_param get shift 2 shift");); + lmp->input->one("kim param get shift 2 shift");); TEST_FAILURE(".*ERROR: Illegal index_range.\nExpected integer " "parameter\\(s\\) instead of '1.' in index_range.*", - lmp->input->one("kim_param get shift 1. shift");); + lmp->input->one("kim param get shift 1. shift");); TEST_FAILURE(".*ERROR: Illegal index_range '1-2' for 'shift' " "parameter with the extent of '1'.*", - lmp->input->one("kim_param get shift 1:2 shift");); + lmp->input->one("kim param get shift 1:2 shift");); TEST_FAILURE(".*ERROR: Illegal index_range.\nExpected integer " "parameter\\(s\\) instead of '1-2' in index_range.*", - lmp->input->one("kim_param get shift 1-2 shift");); - TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim_param " + lmp->input->one("kim param get shift 1-2 shift");); + TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param " "get' command.\nThe LAMMPS '3' variable names or " "'s1 split' is mandatory.*", - lmp->input->one("kim_param get sigmas 1:3 s1 s2");); - TEST_FAILURE(".*ERROR: Wrong argument in kim_param get command.\nThis " + lmp->input->one("kim param get sigmas 1:3 s1 s2");); + TEST_FAILURE(".*ERROR: Wrong argument in 'kim param get' command.\nThis " "Model does not have the requested 'unknown' parameter.*", - lmp->input->one("kim_param get unknown 1 unknown");); - TEST_FAILURE(".*ERROR: Wrong 'kim_param set' command.\n" + lmp->input->one("kim param get unknown 1 unknown");); + TEST_FAILURE(".*ERROR: Wrong 'kim param set' command.\n" "To set the new parameter values, pair style must " - "be assigned.\nMust use 'kim_interactions' or" - "'pair_style kim' before 'kim_param set'.*", - lmp->input->one("kim_param set shift 1 2");); + "be assigned.\nMust use 'kim interactions' or" + "'pair_style kim' before 'kim param set'.*", + lmp->input->one("kim param set shift 1 2");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim_param get shift 1 shift"); + lmp->input->one("kim param get shift 1 shift"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_FALSE(lmp->input->variable->find("shift") == -1); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == std::string("1")); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "1"); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); lmp->input->one("lattice fcc 4.4300"); lmp->input->one("region box block 0 10 0 10 0 10"); lmp->input->one("create_box 1 box"); lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim_interactions Ar"); + lmp->input->one("kim interactions Ar"); lmp->input->one("mass 1 39.95"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Illegal index '2' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim_param set shift 2 2");); + lmp->input->one("kim param set shift 2 2");); TEST_FAILURE(".*ERROR: Illegal index_range.\nExpected integer " "parameter\\(s\\) instead of '1.' in index_range.*", - lmp->input->one("kim_param set shift 1. shift");); + lmp->input->one("kim param set shift 1. shift");); TEST_FAILURE(".*ERROR: Illegal index_range '1-2' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim_param set shift 1:2 2");); + lmp->input->one("kim param set shift 1:2 2");); TEST_FAILURE(".*ERROR: Wrong number of variable values for pair coefficients.*", - lmp->input->one("kim_param set sigmas 1:3 0.5523570 0.4989030");); + lmp->input->one("kim param set sigmas 1:3 0.5523570 0.4989030");); TEST_FAILURE(".*ERROR: Wrong argument for pair coefficients.\nThis " "Model does not have the requested '0.4989030' parameter.*", - lmp->input->one("kim_param set sigmas 1:1 0.5523570 0.4989030");); + lmp->input->one("kim param set sigmas 1:1 0.5523570 0.4989030");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("variable new_shift equal 2"); - lmp->input->one("kim_param set shift 1 ${new_shift}"); - lmp->input->one("kim_param get shift 1 shift"); + lmp->input->one("kim param set shift 1 ${new_shift}"); + lmp->input->one("kim param get shift 1 shift"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == std::string("2")); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "2"); } TEST_F(KimCommandsTest, kim_property) @@ -338,168 +359,159 @@ TEST_F(KimCommandsTest, kim_property) TEST_FAILURE(".*ERROR: Invalid Python version.\n" "The kim-property Python package requires Python " "3 >= 3.6 support.*", - lmp->input->one("kim_property");); + lmp->input->one("kim property");); } else { - TEST_FAILURE(".*ERROR: Invalid kim_property command.*", - lmp->input->one("kim_property");); - TEST_FAILURE(".*ERROR: Invalid kim_property command.*", - lmp->input->one("kim_property create");); - TEST_FAILURE(".*ERROR: Incorrect arguments in kim_property command.\n" - "'kim_property create/destroy/modify/remove/dump' " + TEST_FAILURE(".*ERROR: Invalid 'kim property' command.*", + lmp->input->one("kim property");); + TEST_FAILURE(".*ERROR: Invalid 'kim property' command.*", + lmp->input->one("kim property create");); + TEST_FAILURE(".*ERROR: Incorrect arguments in 'kim property' command." + "\n'kim property create/destroy/modify/remove/dump' " "is mandatory.*", - lmp->input->one("kim_property unknown 1 atomic-mass");); + lmp->input->one("kim property unknown 1 atomic-mass");); } #if defined(KIM_EXTRA_UNITTESTS) - TEST_FAILURE(".*ERROR: Invalid 'kim_property create' command.*", - lmp->input->one("kim_property create 1");); - TEST_FAILURE(".*ERROR: Invalid 'kim_property destroy' command.*", - lmp->input->one("kim_property destroy 1 cohesive-potential-energy-cubic-crystal");); - TEST_FAILURE(".*ERROR: Invalid 'kim_property modify' command.*", - lmp->input->one("kim_property modify 1 key short-name");); - TEST_FAILURE(".*ERROR: There is no property instance to modify the content.*", - lmp->input->one("kim_property modify 1 key short-name source-value 1 fcc");); - TEST_FAILURE(".*ERROR: Invalid 'kim_property remove' command.*", - lmp->input->one("kim_property remove 1 key");); - TEST_FAILURE(".*ERROR: There is no property instance to remove the content.*", - lmp->input->one("kim_property remove 1 key short-name");); - TEST_FAILURE(".*ERROR: There is no property instance to dump the content.*", - lmp->input->one("kim_property dump results.edn");); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones612_UniversalShifted__MO_959249795837_003 real"); - lmp->input->one("kim_property create 1 cohesive-potential-energy-cubic-crystal"); - lmp->input->one("kim_property modify 1 key short-name source-value 1 fcc"); - lmp->input->one("kim_property destroy 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + TEST_FAILURE(".*ERROR: Invalid 'kim property create' command.*", + lmp->input->one("kim property create 1");); + TEST_FAILURE(".*ERROR: Invalid 'kim property destroy' command.*", + lmp->input->one("kim property destroy 1 cohesive-potential-energy-cubic-crystal");); + TEST_FAILURE(".*ERROR: Invalid 'kim property modify' command.*", + lmp->input->one("kim property modify 1 key short-name");); + TEST_FAILURE(".*ERROR: There is no property instance to modify the content.*", + lmp->input->one("kim property modify 1 key short-name source-value 1 fcc");); + TEST_FAILURE(".*ERROR: Invalid 'kim property remove' command.*", + lmp->input->one("kim property remove 1 key");); + TEST_FAILURE(".*ERROR: There is no property instance to remove the content.*", + lmp->input->one("kim property remove 1 key short-name");); + TEST_FAILURE(".*ERROR: There is no property instance to dump the content.*", + lmp->input->one("kim property dump results.edn");); + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("clear"); + lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + lmp->input->one("kim property create 1 cohesive-potential-energy-cubic-crystal"); + lmp->input->one("kim property modify 1 key short-name source-value 1 fcc"); + lmp->input->one("kim property destroy 1"); + if (!verbose) ::testing::internal::GetCapturedStdout(); #endif } TEST_F(KimCommandsTest, kim_query) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - - TEST_FAILURE(".*ERROR: Illegal kim_query command.*", - lmp->input->one("kim_query");); - TEST_FAILURE(".*ERROR: Must use 'kim_init' before 'kim_query'.*", - lmp->input->one("kim_query a0 get_lattice_constant_cubic");); + + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.*", + lmp->input->one("kim query");); + TEST_FAILURE(".*ERROR: Must use 'kim init' before 'kim query'.*", + lmp->input->one("kim query a0 get_lattice_constant_cubic");); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal kim_query command.\nThe keyword 'split' " - "must be followed by the name of the query function.*", - lmp->input->one("kim_query a0 split");); - - TEST_FAILURE(".*ERROR: Illegal kim_query command.\nThe 'list' keyword " - "can not be used after 'split'.*", - lmp->input->one("kim_query a0 split list");); - - TEST_FAILURE(".*ERROR: Illegal kim_query command.\nThe 'list' keyword " + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'split' " + "must be followed by the name of the query function.*", + lmp->input->one("kim query a0 split");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'list' keyword " + "can not be used after 'split'.*", + lmp->input->one("kim query a0 split list");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'list' keyword " "must be followed by \\('split' and\\) the name of the query " - "function.*", lmp->input->one("kim_query a0 list");); - - TEST_FAILURE(".*ERROR: Illegal 'model' key in kim_query command.*", - lmp->input->one("kim_query a0 get_lattice_constant_cubic " + "function.*", lmp->input->one("kim query a0 list");); + TEST_FAILURE(".*ERROR: Illegal 'model' key in 'kim query' command.*", + lmp->input->one("kim query a0 get_lattice_constant_cubic " "model=[MO_959249795837_003]");); - TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `crystal` " - "to kim_query is wrong. The query format is the " + "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("kim_query a0 get_lattice_constant_cubic " + "or more comma-separated items.*", + lmp->input->one("kim query a0 get_lattice_constant_cubic " "crystal");); - TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" - "crystal=fcc` 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("kim_query a0 get_lattice_constant_cubic " + "crystal=fcc` 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("kim query a0 get_lattice_constant_cubic " "crystal=fcc");); - TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" - "crystal=\\[fcc` to kim_query is wrong. The query format is " + "crystal=\\[fcc` 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("kim_query a0 get_lattice_constant_cubic " + "one or more comma-separated items.*", + lmp->input->one("kim query a0 get_lattice_constant_cubic " "crystal=[fcc");); - TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" - "crystal=fcc\\]` to kim_query is wrong. The query format is " + "crystal=fcc\\]` 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("kim_query a0 get_lattice_constant_cubic " + "one or more comma-separated items.*", + lmp->input->one("kim query a0 get_lattice_constant_cubic " "crystal=fcc]");); - - std::string squery("kim_query a0 get_lattice_constant_cubic "); + + std::string 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 " + "\"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.*", + "one or more comma-separated items.*", lmp->input->one(squery);); - squery = "kim_query a0 get_lattice_constant_cubic "; + 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 " + "\"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.*", + "one or more comma-separated items.*", lmp->input->one(squery);); - squery = "kim_query a0 get_lattice_constant_cubic crystal=[fcc] " + squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] " "species=[Al]"; TEST_FAILURE(".*ERROR: OpenKIM query failed:.*", lmp->input->one(squery);); - squery = "kim_query a0 get_lattice_constant_cubic crystal=[fcc] " + squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] " "units=[\"angstrom\"]"; TEST_FAILURE(".*ERROR: OpenKIM query failed:.*", lmp->input->one(squery);); #if defined(KIM_EXTRA_UNITTESTS) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal"); - - squery = "kim_query latconst split get_lattice_constant_hexagonal "; + lmp->input->one("kim init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal"); + + squery = "kim query latconst split get_lattice_constant_hexagonal "; squery += "crystal=[\"hcp\"] species=[\"Zr\"] units=[\"angstrom\"]"; lmp->input->one(squery); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == std::string("3.234055244384789"))); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == std::string("5.167650199630013"))); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal"); - - squery = "kim_query latconst list get_lattice_constant_hexagonal "; + lmp->input->one("kim init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal"); + + squery = "kim query latconst list get_lattice_constant_hexagonal "; squery += "crystal=[hcp] species=[Zr] units=[angstrom]"; lmp->input->one(squery); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst")) == + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst")) == std::string("3.234055244384789 5.167650199630013"))); - squery = "kim_query latconst list get_lattice_constant_hexagonal "; + squery = "kim query latconst list get_lattice_constant_hexagonal "; squery += "crystal=[bcc] species=[Zr] units=[angstrom]"; TEST_FAILURE(".*ERROR: OpenKIM query failed:.*", lmp->input->one(squery);); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); - - squery = "kim_query alpha get_linear_thermal_expansion_coefficient_cubic "; + lmp->input->one("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); + + squery = "kim query alpha get_linear_thermal_expansion_coefficient_cubic "; squery += "crystal=[fcc] species=[Al] units=[1/K] temperature=[293.15] "; squery += "temperature_units=[K]"; lmp->input->one(squery); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("alpha")) == + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("alpha")) == std::string("1.654960564704273e-05"))); #endif } From 10a48f18d0db17682513c4315d54e73df16c1bf1 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 08:03:21 -0600 Subject: [PATCH 26/89] update kim command examples --- examples/kim/in.kim-ex.melt | 42 +++++++++++----------- examples/kim/in.kim-pm-property | 58 +++++++++++++++---------------- examples/kim/in.kim-pm-query.melt | 44 +++++++++++------------ examples/kim/in.kim-pm.melt | 42 +++++++++++----------- examples/kim/in.kim-sm.melt | 44 +++++++++++------------ examples/kim/in.lammps.melt | 44 +++++++++++------------ 6 files changed, 137 insertions(+), 137 deletions(-) diff --git a/examples/kim/in.kim-ex.melt b/examples/kim/in.kim-ex.melt index 5cc3dbc61b..200e2c3dcd 100644 --- a/examples/kim/in.kim-ex.melt +++ b/examples/kim/in.kim-ex.melt @@ -1,35 +1,35 @@ # 3d Lennard-Jones melt # # This example requires that the example models provided with -# the kim-api package are installed. see the ./lib/kim/README or -# ./lib/kim/Install.py files for details on how to install these +# the kim-api package are installed. see the `./lib/kim/README` or +# `./lib/kim/Install.py` files for details on how to install these # example models. # -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -kim_init LennardJones_Ar real +kim init LennardJones_Ar real -lattice fcc 4.4300 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box +lattice fcc 4.4300 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box -kim_interactions Ar +kim interactions Ar -mass 1 39.95 -velocity all create 200.0 232345 loop geom +mass 1 39.95 +velocity all create 200.0 232345 loop geom -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 -run 100 +run 100 diff --git a/examples/kim/in.kim-pm-property b/examples/kim/in.kim-pm-property index fea1527820..d69879c728 100644 --- a/examples/kim/in.kim-pm-property +++ b/examples/kim/in.kim-pm-property @@ -1,34 +1,34 @@ -# kim-property example +# kim property example # # For detailed information of this example please refer to: -# https://openkim.org/doc/evaluation/tutorial-lammps/ +# `https://openkim.org/doc/evaluation/tutorial-lammps/` # # Description: # -# This example is designed to calculate the cohesive energy corresponding to -# the equilibrium FCC lattice constant for -# `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` model for -# argon. The material properties computed in LAMMPS are represented as a -# standard KIM property instance format. (See -# https://openkim.org/doc/schema/properties-framework/ and -# https://lammps.sandia.gov/doc/kim_commands.html for further details). -# Then the created property instance is written to a file named results.edn -# using the `kim_property dump` commands. +# This example is designed to calculate the cohesive energy corresponding to +# the equilibrium FCC lattice constant for +# `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` model for +# argon. The material properties computed in LAMMPS are represented as a +# standard KIM property instance format. (See +# `https://openkim.org/doc/schema/properties-framework/` and +# `https://lammps.sandia.gov/doc/kim_commands.html` for further details). +# Then the created property instance is written to a file named `results.edn` +# using the `kim property dump` command. # # Requirement: -# -# This example requires LAMMPS built with the Python 3.6 or later package -# installed. See the `https://lammps.sandia.gov/doc/python.html` doc page for +# +# This example requires LAMMPS built with the Python 3.6 or later package +# installed. See the `https://lammps.sandia.gov/doc/python.html` doc page for # more info on building LAMMPS with the version of Python on your system. -# After successfully building LAMMPS with Python, you need to install the -# kim-property Python package, See the -# `https://lammps.sandia.gov/doc/Build_extras.html#kim` doc page for +# After successfully building LAMMPS with Python, you need to install the +# kim-property Python package, See the +# `https://lammps.sandia.gov/doc/Build_extras.html#kim` doc page for # further details. # # This example requires that the KIM Portable Model (PM) # `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` -# is installed. This can be done with the command -# `kim-api-collections-management install user LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` +# is installed. This can be done with the command +# kim-api-collections-management install user LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 # If this command does not work, you may need to setup your PATH to find the utility. # If you installed the kim-api using the LAMMPS CMake build, you can do the following # (where the current working directory is assumed to be the LAMMPS build directory) @@ -38,14 +38,14 @@ # source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate # (where you should relplace X.Y.Z with the appropriate kim-api version number). # -# Or, see https://openkim.org/doc/obtaining-models for alternative options. +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. # # Initialize interatomic potential (KIM model) and units atom_style atomic # Set the OpenKIM model that will be used -kim_init LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 metal +kim init LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 metal # the equilibrium lattice constant for the fcc structure variable lattice_constant equal 5.248509056866169 @@ -55,14 +55,14 @@ boundary p p p # Create an FCC lattice with the lattice spacing # using a single conventional (orthogonal) unit cell -lattice fcc ${lattice_constant} -region box block 0 1 0 1 0 1 units lattice -create_box 1 box +lattice fcc ${lattice_constant} +region box block 0 1 0 1 0 1 units lattice +create_box 1 box create_atoms 1 box -mass 1 39.948 +mass 1 39.948 # Specify the KIM interactions -kim_interactions Ar +kim interactions Ar # Compute energy run 0 @@ -72,10 +72,10 @@ variable natoms equal "count(all)" variable ecohesive equal "-pe/v_natoms" # Create a property instance -kim_property create 1 cohesive-potential-energy-cubic-crystal +kim property create 1 cohesive-potential-energy-cubic-crystal # Set all the key-value pairs for this property instance -kim_property modify 1 key short-name source-value 1 fcc & +kim property modify 1 key short-name source-value 1 fcc & key species source-value 1 Ar & key a source-value ${lattice_constant} & source-unit angstrom & @@ -88,4 +88,4 @@ kim_property modify 1 key short-name source-value 1 fcc source-unit eV # Dump the results in a file -kim_property dump "results.edn" +kim property dump "results.edn" diff --git a/examples/kim/in.kim-pm-query.melt b/examples/kim/in.kim-pm-query.melt index fa04d90436..9e1e04000d 100644 --- a/examples/kim/in.kim-pm-query.melt +++ b/examples/kim/in.kim-pm-query.melt @@ -1,7 +1,7 @@ # 3d Lennard-Jones melt # # This example requires that the KIM Portable Model (PM) -# SW_StillingerWeber_1985_Si__MO_405512056662_005 +# `SW_StillingerWeber_1985_Si__MO_405512056662_005` # is installed. This can be done with the command # kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 # If this command does not work, you may need to setup your PATH to find the utility. @@ -13,34 +13,34 @@ # source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate # (where you should relplace X.Y.Z with the appropriate kim-api version number). # -# Or, see https://openkim.org/doc/obtaining-models for alternative options. +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. # -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real -kim_query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Si"] units=["angstrom"] +kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real +kim query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Si"] units=["angstrom"] -lattice fcc ${a0} -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box +lattice fcc ${a0} +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box -kim_interactions Si +kim interactions Si -mass 1 39.95 -velocity all create 200.0 232345 loop geom +mass 1 39.95 +velocity all create 200.0 232345 loop geom -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 -run 100 +run 100 diff --git a/examples/kim/in.kim-pm.melt b/examples/kim/in.kim-pm.melt index 9959a66793..46150d8c54 100644 --- a/examples/kim/in.kim-pm.melt +++ b/examples/kim/in.kim-pm.melt @@ -1,7 +1,7 @@ # 3d Lennard-Jones melt # # This example requires that the KIM Portable Model (PM) -# SW_StillingerWeber_1985_Si__MO_405512056662_005 +# `SW_StillingerWeber_1985_Si__MO_405512056662_005` # is installed. This can be done with the command # kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 # If this command does not work, you may need to setup your PATH to find the utility. @@ -13,33 +13,33 @@ # source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate # (where you should relplace X.Y.Z with the appropriate kim-api version number). # -# Or, see https://openkim.org/doc/obtaining-models for alternative options. +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. # -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real +kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real -lattice fcc 4.4300 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box +lattice fcc 4.4300 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box -kim_interactions Si +kim interactions Si -mass 1 39.95 -velocity all create 200.0 232345 loop geom +mass 1 39.95 +velocity all create 200.0 232345 loop geom -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 -run 100 +run 100 diff --git a/examples/kim/in.kim-sm.melt b/examples/kim/in.kim-sm.melt index 0ee8e9a857..1c49ead229 100644 --- a/examples/kim/in.kim-sm.melt +++ b/examples/kim/in.kim-sm.melt @@ -1,8 +1,8 @@ # 3d Lennard-Jones melt # # This example requires that the KIM Simulator Model (PM) -# Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# is installed. This can be done with the command +# `Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000` +# is installed. This can be done with the command # kim-api-collections-management install user Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 # If this command does not work, you may need to setup your PATH to find the utility. # If you installed the kim-api using the LAMMPS CMake build, you can do the following @@ -13,33 +13,33 @@ # source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate # (where you should relplace X.Y.Z with the appropriate kim-api version number). # -# See https://openkim.org/doc/obtaining-models for alternative options. +# See `https://openkim.org/doc/obtaining-models` for alternative options. # -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -kim_init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real +kim init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real -lattice fcc 4.4300 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box +lattice fcc 4.4300 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box -kim_interactions O +kim interactions O -mass 1 39.95 -velocity all create 200.0 232345 loop geom +mass 1 39.95 +velocity all create 200.0 232345 loop geom -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 -run 100 +run 100 diff --git a/examples/kim/in.lammps.melt b/examples/kim/in.lammps.melt index 5792f3a5db..fbedb61985 100644 --- a/examples/kim/in.lammps.melt +++ b/examples/kim/in.lammps.melt @@ -1,33 +1,33 @@ # 3d Lennard-Jones melt -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -units real +units real -lattice fcc 4.4300 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box +lattice fcc 4.4300 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box -pair_style lj/cut 8.1500 -pair_coeff 1 1 0.0104 3.4000 +pair_style lj/cut 8.1500 +pair_coeff 1 1 0.0104 3.4000 -#pair_style kim LennardJones_Ar -#pair_coeff * * Ar +#pair_style kim LennardJones_Ar +#pair_coeff * * Ar -mass 1 39.95 -velocity all create 200.0 232345 loop geom +mass 1 39.95 +velocity all create 200.0 232345 loop geom -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 -run 100 +run 100 From 12a9b6165a0da00f67279fd8271ff9fcb904a325 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 06:01:38 -0600 Subject: [PATCH 27/89] remove old log files --- .../kim/log.7Aug19.in.kim-ex.melt.clang.1 | 107 --------------- .../kim/log.7Aug19.in.kim-ex.melt.clang.4 | 113 ---------------- .../log.7Aug19.in.kim-pm-query.melt.clang.1 | 124 ------------------ .../log.7Aug19.in.kim-pm-query.melt.clang.4 | 124 ------------------ .../kim/log.7Aug19.in.kim-pm.melt.clang.1 | 118 ----------------- .../kim/log.7Aug19.in.kim-pm.melt.clang.4 | 118 ----------------- .../kim/log.7Aug19.in.kim-sm.melt.clang.1 | 71 ---------- .../kim/log.7Aug19.in.kim-sm.melt.clang.4 | 60 --------- .../kim/log.7Aug19.in.lammps.melt.clang.1 | 92 ------------- .../kim/log.7Aug19.in.lammps.melt.clang.4 | 92 ------------- 10 files changed, 1019 deletions(-) delete mode 100644 examples/kim/log.7Aug19.in.kim-ex.melt.clang.1 delete mode 100644 examples/kim/log.7Aug19.in.kim-ex.melt.clang.4 delete mode 100644 examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.1 delete mode 100644 examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.4 delete mode 100644 examples/kim/log.7Aug19.in.kim-pm.melt.clang.1 delete mode 100644 examples/kim/log.7Aug19.in.kim-pm.melt.clang.4 delete mode 100644 examples/kim/log.7Aug19.in.kim-sm.melt.clang.1 delete mode 100644 examples/kim/log.7Aug19.in.kim-sm.melt.clang.4 delete mode 100644 examples/kim/log.7Aug19.in.lammps.melt.clang.1 delete mode 100644 examples/kim/log.7Aug19.in.lammps.melt.clang.4 diff --git a/examples/kim/log.7Aug19.in.kim-ex.melt.clang.1 b/examples/kim/log.7Aug19.in.kim-ex.melt.clang.1 deleted file mode 100644 index 17fa1bc534..0000000000 --- a/examples/kim/log.7Aug19.in.kim-ex.melt.clang.1 +++ /dev/null @@ -1,107 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the example models provided with -# the kim-api package are installed. see the ./lib/kim/README or -# ./lib/kim/Install.py files for details on how to install these -# example models. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init LennardJones_Ar real -#=== BEGIN kim-init ========================================== -units real -#=== END kim-init ============================================ - - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.004321 secs - -kim_interactions Ar -#=== BEGIN kim_interactions ================================== -pair_style kim LennardJones_Ar -WARNING: KIM Model does not provide `partialParticleEnergy'; energy per atom will be zero (../pair_kim.cpp:974) -WARNING: KIM Model does not provide `partialParticleVirial'; virial per atom will be zero (../pair_kim.cpp:979) -pair_coeff * * Ar -#=== END kim_interactions ==================================== - - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 8.45 - ghost atom cutoff = 8.45 - binsize = 4.225, bins = 21 21 21 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair kim, perpetual - attributes: full, newton off, cut 8.45 - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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 3.48256 on 1 procs for 100 steps with 32000 atoms - -Performance: 2.481 ns/day, 9.674 hours/ns, 28.715 timesteps/s -98.3% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 3.0502 | 3.0502 | 3.0502 | 0.0 | 87.59 -Neigh | 0.3646 | 0.3646 | 0.3646 | 0.0 | 10.47 -Comm | 0.01783 | 0.01783 | 0.01783 | 0.0 | 0.51 -Output | 6.8e-05 | 6.8e-05 | 6.8e-05 | 0.0 | 0.00 -Modify | 0.034349 | 0.034349 | 0.034349 | 0.0 | 0.99 -Other | | 0.01547 | | | 0.44 - -Nlocal: 32000 ave 32000 max 32000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 19911 ave 19911 max 19911 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 4.25375e+06 ave 4.25375e+06 max 4.25375e+06 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 4253750 -Ave neighs/atom = 132.93 -Neighbor list builds = 3 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/kim/log.7Aug19.in.kim-ex.melt.clang.4 b/examples/kim/log.7Aug19.in.kim-ex.melt.clang.4 deleted file mode 100644 index 8e076815fc..0000000000 --- a/examples/kim/log.7Aug19.in.kim-ex.melt.clang.4 +++ /dev/null @@ -1,113 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the example models provided with -# the kim-api package are installed. see the ./lib/kim/README or -# ./lib/kim/Install.py files for details on how to install these -# example models. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init LennardJones_Ar real -#=== BEGIN kim-init ========================================== -units real -#=== END kim-init ============================================ - - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.000989 secs - -kim_interactions Ar -#=== BEGIN kim_interactions ================================== -pair_style kim LennardJones_Ar -WARNING: KIM Model does not provide `partialParticleEnergy'; energy per atom will be zero (../pair_kim.cpp:974) -WARNING: KIM Model does not provide `partialParticleVirial'; virial per atom will be zero (../pair_kim.cpp:979) -pair_coeff * * Ar -WARNING: KIM Model does not provide `partialParticleEnergy'; energy per atom will be zero (../pair_kim.cpp:974) -WARNING: KIM Model does not provide `partialParticleVirial'; virial per atom will be zero (../pair_kim.cpp:979) -#=== END kim_interactions ==================================== - - -mass 1 39.95 -velocity all create 200.0 232345 loop geom -WARNING: KIM Model does not provide `partialParticleEnergy'; energy per atom will be zero (../pair_kim.cpp:974) -WARNING: KIM Model does not provide `partialParticleVirial'; virial per atom will be zero (../pair_kim.cpp:979) -WARNING: KIM Model does not provide `partialParticleEnergy'; energy per atom will be zero (../pair_kim.cpp:974) -WARNING: KIM Model does not provide `partialParticleVirial'; virial per atom will be zero (../pair_kim.cpp:979) - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 8.45 - ghost atom cutoff = 8.45 - binsize = 4.225, bins = 21 21 21 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair kim, perpetual - attributes: full, newton off, cut 8.45 - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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.924494 on 4 procs for 100 steps with 32000 atoms - -Performance: 9.346 ns/day, 2.568 hours/ns, 108.167 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 | 0.76434 | 0.76847 | 0.77207 | 0.3 | 83.12 -Neigh | 0.09089 | 0.094446 | 0.099911 | 1.1 | 10.22 -Comm | 0.038599 | 0.044759 | 0.051381 | 2.1 | 4.84 -Output | 3.5e-05 | 4e-05 | 4.9e-05 | 0.0 | 0.00 -Modify | 0.009396 | 0.009685 | 0.009941 | 0.2 | 1.05 -Other | | 0.00709 | | | 0.77 - -Nlocal: 8000 ave 8018 max 7967 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Nghost: 9131 ave 9164 max 9113 min -Histogram: 2 0 0 1 0 0 0 0 0 1 -Neighs: 0 ave 0 max 0 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 1.06344e+06 ave 1.06594e+06 max 1.05881e+06 min -Histogram: 1 0 0 0 0 0 1 0 0 2 - -Total # of neighbors = 4253750 -Ave neighs/atom = 132.93 -Neighbor list builds = 3 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.1 b/examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.1 deleted file mode 100644 index 1ca44c98ef..0000000000 --- a/examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.1 +++ /dev/null @@ -1,124 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the KIM Portable Model (PM) -# SW_StillingerWeber_1985_Si__MO_405512056662_005 -# is installed. This can be done with the command -# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 -# If this command does not work, you may need to setup your PATH to find the utility. -# If you installed the kim-api using the LAMMPS CMake build, you can do the following -# (where the current working directory is assumed to be the LAMMPS build directory) -# source ./kim_build-prefix/bin/kim-api-activate -# If you installed the kim-api using the LAMMPS Make build, you can do the following -# (where the current working directory is assumed to be the LAMMPS src directory) -# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate -# (where you should relplace X.Y.Z with the appropriate kim-api version number). -# -# Or, see https://openkim.org/doc/obtaining-models for alternative options. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real -#=== BEGIN kim-init ========================================== -units real -#=== END kim-init ============================================ - -kim_query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Si"] units=["angstrom"] -#=== BEGIN kim-query ========================================= -variable a0 string 4.146581932902336 -#=== END kim-query =========================================== - - -lattice fcc ${a0} -lattice fcc 4.146581932902336 -Lattice spacing in x,y,z = 4.14658 4.14658 4.14658 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (82.9316 82.9316 82.9316) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.005415 secs - -kim_interactions Si -#=== BEGIN kim_interactions ================================== -pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 -pair_coeff * * Si -#=== END kim_interactions ==================================== - - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 4.07118 - ghost atom cutoff = 4.07118 - binsize = 2.03559, bins = 41 41 41 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair kim, perpetual - attributes: full, newton off, cut 4.07118 - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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 74.6055 on 1 procs for 100 steps with 32000 atoms - -Performance: 0.116 ns/day, 207.238 hours/ns, 1.340 timesteps/s -98.6% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 74.446 | 74.446 | 74.446 | 0.0 | 99.79 -Neigh | 0.096611 | 0.096611 | 0.096611 | 0.0 | 0.13 -Comm | 0.014594 | 0.014594 | 0.014594 | 0.0 | 0.02 -Output | 7.9e-05 | 7.9e-05 | 7.9e-05 | 0.0 | 0.00 -Modify | 0.03454 | 0.03454 | 0.03454 | 0.0 | 0.05 -Other | | 0.01396 | | | 0.02 - -Nlocal: 32000 ave 32000 max 32000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 9667 ave 9667 max 9667 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 450192 ave 450192 max 450192 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 450192 -Ave neighs/atom = 14.0685 -Neighbor list builds = 3 -Dangerous builds = 0 - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:01:16 diff --git a/examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.4 b/examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.4 deleted file mode 100644 index 8c4148ce15..0000000000 --- a/examples/kim/log.7Aug19.in.kim-pm-query.melt.clang.4 +++ /dev/null @@ -1,124 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the KIM Portable Model (PM) -# SW_StillingerWeber_1985_Si__MO_405512056662_005 -# is installed. This can be done with the command -# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 -# If this command does not work, you may need to setup your PATH to find the utility. -# If you installed the kim-api using the LAMMPS CMake build, you can do the following -# (where the current working directory is assumed to be the LAMMPS build directory) -# source ./kim_build-prefix/bin/kim-api-activate -# If you installed the kim-api using the LAMMPS Make build, you can do the following -# (where the current working directory is assumed to be the LAMMPS src directory) -# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate -# (where you should relplace X.Y.Z with the appropriate kim-api version number). -# -# Or, see https://openkim.org/doc/obtaining-models for alternative options. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real -#=== BEGIN kim-init ========================================== -units real -#=== END kim-init ============================================ - -kim_query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Si"] units=["angstrom"] -#=== BEGIN kim-query ========================================= -variable a0 string 4.146581932902336 -#=== END kim-query =========================================== - - -lattice fcc ${a0} -lattice fcc 4.146581932902336 -Lattice spacing in x,y,z = 4.14658 4.14658 4.14658 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (82.9316 82.9316 82.9316) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.000946 secs - -kim_interactions Si -#=== BEGIN kim_interactions ================================== -pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 -pair_coeff * * Si -#=== END kim_interactions ==================================== - - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 4.07118 - ghost atom cutoff = 4.07118 - binsize = 2.03559, bins = 41 41 41 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair kim, perpetual - attributes: full, newton off, cut 4.07118 - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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 19.0792 on 4 procs for 100 steps with 32000 atoms - -Performance: 0.453 ns/day, 52.998 hours/ns, 5.241 timesteps/s -99.4% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 18.78 | 18.855 | 18.937 | 1.5 | 98.83 -Neigh | 0.026047 | 0.026274 | 0.0266 | 0.1 | 0.14 -Comm | 0.09039 | 0.17196 | 0.24675 | 15.9 | 0.90 -Output | 3.9e-05 | 4.975e-05 | 6.1e-05 | 0.0 | 0.00 -Modify | 0.015667 | 0.015819 | 0.016008 | 0.1 | 0.08 -Other | | 0.01008 | | | 0.05 - -Nlocal: 8000 ave 8029 max 7968 min -Histogram: 1 1 0 0 0 0 0 0 0 2 -Nghost: 4259 ave 4303 max 4202 min -Histogram: 1 0 0 0 0 0 2 0 0 1 -Neighs: 0 ave 0 max 0 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 112548 ave 113091 max 111995 min -Histogram: 1 0 0 1 0 0 0 1 0 1 - -Total # of neighbors = 450192 -Ave neighs/atom = 14.0685 -Neighbor list builds = 3 -Dangerous builds = 0 - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:20 diff --git a/examples/kim/log.7Aug19.in.kim-pm.melt.clang.1 b/examples/kim/log.7Aug19.in.kim-pm.melt.clang.1 deleted file mode 100644 index f5845d7fc4..0000000000 --- a/examples/kim/log.7Aug19.in.kim-pm.melt.clang.1 +++ /dev/null @@ -1,118 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the KIM Portable Model (PM) -# SW_StillingerWeber_1985_Si__MO_405512056662_005 -# is installed. This can be done with the command -# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 -# If this command does not work, you may need to setup your PATH to find the utility. -# If you installed the kim-api using the LAMMPS CMake build, you can do the following -# (where the current working directory is assumed to be the LAMMPS build directory) -# source ./kim_build-prefix/bin/kim-api-activate -# If you installed the kim-api using the LAMMPS Make build, you can do the following -# (where the current working directory is assumed to be the LAMMPS src directory) -# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate -# (where you should relplace X.Y.Z with the appropriate kim-api version number). -# -# Or, see https://openkim.org/doc/obtaining-models for alternative options. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real -#=== BEGIN kim-init ========================================== -units real -#=== END kim-init ============================================ - - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.003591 secs - -kim_interactions Si -#=== BEGIN kim_interactions ================================== -pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 -pair_coeff * * Si -#=== END kim_interactions ==================================== - - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 4.07118 - ghost atom cutoff = 4.07118 - binsize = 2.03559, bins = 44 44 44 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair kim, perpetual - attributes: full, newton off, cut 4.07118 - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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 74.248 on 1 procs for 100 steps with 32000 atoms - -Performance: 0.116 ns/day, 206.244 hours/ns, 1.347 timesteps/s -98.8% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 74.118 | 74.118 | 74.118 | 0.0 | 99.83 -Neigh | 0.069623 | 0.069623 | 0.069623 | 0.0 | 0.09 -Comm | 0.0137 | 0.0137 | 0.0137 | 0.0 | 0.02 -Output | 7.6e-05 | 7.6e-05 | 7.6e-05 | 0.0 | 0.00 -Modify | 0.031883 | 0.031883 | 0.031883 | 0.0 | 0.04 -Other | | 0.01433 | | | 0.02 - -Nlocal: 32000 ave 32000 max 32000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 7760 ave 7760 max 7760 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 402352 ave 402352 max 402352 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 402352 -Ave neighs/atom = 12.5735 -Neighbor list builds = 4 -Dangerous builds = 0 - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:01:14 diff --git a/examples/kim/log.7Aug19.in.kim-pm.melt.clang.4 b/examples/kim/log.7Aug19.in.kim-pm.melt.clang.4 deleted file mode 100644 index 0b4632b999..0000000000 --- a/examples/kim/log.7Aug19.in.kim-pm.melt.clang.4 +++ /dev/null @@ -1,118 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the KIM Portable Model (PM) -# SW_StillingerWeber_1985_Si__MO_405512056662_005 -# is installed. This can be done with the command -# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 -# If this command does not work, you may need to setup your PATH to find the utility. -# If you installed the kim-api using the LAMMPS CMake build, you can do the following -# (where the current working directory is assumed to be the LAMMPS build directory) -# source ./kim_build-prefix/bin/kim-api-activate -# If you installed the kim-api using the LAMMPS Make build, you can do the following -# (where the current working directory is assumed to be the LAMMPS src directory) -# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate -# (where you should relplace X.Y.Z with the appropriate kim-api version number). -# -# Or, see https://openkim.org/doc/obtaining-models for alternative options. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real -#=== BEGIN kim-init ========================================== -units real -#=== END kim-init ============================================ - - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.000997 secs - -kim_interactions Si -#=== BEGIN kim_interactions ================================== -pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 -pair_coeff * * Si -#=== END kim_interactions ==================================== - - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 4.07118 - ghost atom cutoff = 4.07118 - binsize = 2.03559, bins = 44 44 44 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair kim, perpetual - attributes: full, newton off, cut 4.07118 - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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 19.0287 on 4 procs for 100 steps with 32000 atoms - -Performance: 0.454 ns/day, 52.857 hours/ns, 5.255 timesteps/s -99.1% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 18.81 | 18.838 | 18.883 | 0.6 | 99.00 -Neigh | 0.018598 | 0.01914 | 0.020732 | 0.7 | 0.10 -Comm | 0.10341 | 0.1475 | 0.17393 | 7.1 | 0.78 -Output | 6e-05 | 6.225e-05 | 6.7e-05 | 0.0 | 0.00 -Modify | 0.014839 | 0.014925 | 0.015047 | 0.1 | 0.08 -Other | | 0.008997 | | | 0.05 - -Nlocal: 8000 ave 8014 max 7988 min -Histogram: 1 1 0 0 0 0 1 0 0 1 -Nghost: 3374.75 ave 3389 max 3361 min -Histogram: 1 0 1 0 0 0 0 1 0 1 -Neighs: 0 ave 0 max 0 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 100588 ave 100856 max 100392 min -Histogram: 1 0 1 0 1 0 0 0 0 1 - -Total # of neighbors = 402352 -Ave neighs/atom = 12.5735 -Neighbor list builds = 4 -Dangerous builds = 0 - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:19 diff --git a/examples/kim/log.7Aug19.in.kim-sm.melt.clang.1 b/examples/kim/log.7Aug19.in.kim-sm.melt.clang.1 deleted file mode 100644 index 1b77e58a3a..0000000000 --- a/examples/kim/log.7Aug19.in.kim-sm.melt.clang.1 +++ /dev/null @@ -1,71 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the KIM Simulator Model (PM) -# Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# is installed. This can be done with the command -# kim-api-collections-management install user Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# If this command does not work, you may need to setup your PATH to find the utility. -# If you installed the kim-api using the LAMMPS CMake build, you can do the following -# (where the current working directory is assumed to be the LAMMPS build directory) -# source ./kim_build-prefix/bin/kim-api-activate -# If you installed the kim-api using the LAMMPS Make build, you can do the following -# (where the current working directory is assumed to be the LAMMPS src directory) -# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate -# (where you should relplace X.Y.Z with the appropriate kim-api version number). -# -# See https://openkim.org/doc/obtaining-models for alternative options. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real -#=== BEGIN kim-init ========================================== -# Using KIM Simulator Model : Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# For Simulator : LAMMPS 28 Feb 2019 -# Running on : LAMMPS 7 Aug 2019 -# -units real -atom_style charge -neigh_modify one 4000 -#=== END kim-init ============================================ - - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.003447 secs - -kim_interactions O -#=== BEGIN kim_interactions ================================== -pair_style reax/c /var/tmp/kim-simulator-model-parameter-file-directory-6Acs1QDbXgBx/lmp_control safezone 2.0 mincap 100 -ERROR: Unrecognized pair style 'reax/c' is part of the USER-REAXC package which is not enabled in this LAMMPS binary. (../force.cpp:262) -Last command: pair_style reax/c /var/tmp/kim-simulator-model-parameter-file-directory-6Acs1QDbXgBx/lmp_control safezone 2.0 mincap 100 --------------------------------------------------------------------------- -Primary job terminated normally, but 1 process returned -a non-zero exit code. Per user-direction, the job has been aborted. --------------------------------------------------------------------------- --------------------------------------------------------------------------- -mpirun detected that one or more processes exited with non-zero status, thus causing -the job to be terminated. The first process to do so was: - - Process name: [[33054,1],0] - Exit code: 1 --------------------------------------------------------------------------- diff --git a/examples/kim/log.7Aug19.in.kim-sm.melt.clang.4 b/examples/kim/log.7Aug19.in.kim-sm.melt.clang.4 deleted file mode 100644 index 72b62beffb..0000000000 --- a/examples/kim/log.7Aug19.in.kim-sm.melt.clang.4 +++ /dev/null @@ -1,60 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt -# -# This example requires that the KIM Simulator Model (PM) -# Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# is installed. This can be done with the command -# kim-api-collections-management install user Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# If this command does not work, you may need to setup your PATH to find the utility. -# If you installed the kim-api using the LAMMPS CMake build, you can do the following -# (where the current working directory is assumed to be the LAMMPS build directory) -# source ./kim_build-prefix/bin/kim-api-activate -# If you installed the kim-api using the LAMMPS Make build, you can do the following -# (where the current working directory is assumed to be the LAMMPS src directory) -# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate -# (where you should relplace X.Y.Z with the appropriate kim-api version number). -# -# See https://openkim.org/doc/obtaining-models for alternative options. -# - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -kim_init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real -#=== BEGIN kim-init ========================================== -# Using KIM Simulator Model : Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 -# For Simulator : LAMMPS 28 Feb 2019 -# Running on : LAMMPS 7 Aug 2019 -# -units real -atom_style charge -neigh_modify one 4000 -#=== END kim-init ============================================ - - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.001307 secs - -kim_interactions O -#=== BEGIN kim_interactions ================================== -pair_style reax/c /var/tmp/kim-simulator-model-parameter-file-directory-6tmKtZEXzhgv/lmp_control safezone 2.0 mincap 100 -ERROR: Unrecognized pair style 'reax/c' is part of the USER-REAXC package which is not enabled in this LAMMPS binary. (../force.cpp:262) -Last command: pair_style reax/c /var/tmp/kim-simulator-model-parameter-file-directory-6tmKtZEXzhgv/lmp_control safezone 2.0 mincap 100 diff --git a/examples/kim/log.7Aug19.in.lammps.melt.clang.1 b/examples/kim/log.7Aug19.in.lammps.melt.clang.1 deleted file mode 100644 index f697504777..0000000000 --- a/examples/kim/log.7Aug19.in.lammps.melt.clang.1 +++ /dev/null @@ -1,92 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -units real - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.003037 secs - -pair_style lj/cut 8.1500 -pair_coeff 1 1 0.0104 3.4000 - -#pair_style kim LennardJones_Ar -#pair_coeff * * Ar - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 8.45 - ghost atom cutoff = 8.45 - binsize = 4.225, bins = 21 21 21 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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 2.43768 on 1 procs for 100 steps with 32000 atoms - -Performance: 3.544 ns/day, 6.771 hours/ns, 41.023 timesteps/s -97.8% 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.1895 | 2.1895 | 2.1895 | 0.0 | 89.82 -Neigh | 0.17546 | 0.17546 | 0.17546 | 0.0 | 7.20 -Comm | 0.021001 | 0.021001 | 0.021001 | 0.0 | 0.86 -Output | 7.9e-05 | 7.9e-05 | 7.9e-05 | 0.0 | 0.00 -Modify | 0.034253 | 0.034253 | 0.034253 | 0.0 | 1.41 -Other | | 0.01735 | | | 0.71 - -Nlocal: 32000 ave 32000 max 32000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 19911 ave 19911 max 19911 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1.96027e+06 ave 1.96027e+06 max 1.96027e+06 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1960266 -Ave neighs/atom = 61.2583 -Neighbor list builds = 3 -Dangerous builds = 0 -Total wall time: 0:00:02 diff --git a/examples/kim/log.7Aug19.in.lammps.melt.clang.4 b/examples/kim/log.7Aug19.in.lammps.melt.clang.4 deleted file mode 100644 index 2d25348b06..0000000000 --- a/examples/kim/log.7Aug19.in.lammps.melt.clang.4 +++ /dev/null @@ -1,92 +0,0 @@ -LAMMPS (7 Aug 2019) -# 3d Lennard-Jones melt - -variable x index 1 -variable y index 1 -variable z index 1 - -variable xx equal 20*$x -variable xx equal 20*1 -variable yy equal 20*$y -variable yy equal 20*1 -variable zz equal 20*$z -variable zz equal 20*1 - -units real - -lattice fcc 4.4300 -Lattice spacing in x,y,z = 4.43 4.43 4.43 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -region box block 0 20 0 ${yy} 0 ${zz} -region box block 0 20 0 20 0 ${zz} -region box block 0 20 0 20 0 20 -create_box 1 box -Created orthogonal box = (0 0 0) to (88.6 88.6 88.6) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 32000 atoms - create_atoms CPU = 0.001194 secs - -pair_style lj/cut 8.1500 -pair_coeff 1 1 0.0104 3.4000 - -#pair_style kim LennardJones_Ar -#pair_coeff * * Ar - -mass 1 39.95 -velocity all create 200.0 232345 loop geom - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 1 all nve -#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 - -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 8.45 - ghost atom cutoff = 8.45 - binsize = 4.225, bins = 21 21 21 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard -Setting up Verlet run ... - Unit style : real - Current step : 0 - Time step : 1 -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.726239 on 4 procs for 100 steps with 32000 atoms - -Performance: 11.897 ns/day, 2.017 hours/ns, 137.696 timesteps/s -98.7% 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.57617 | 0.5835 | 0.59084 | 0.9 | 80.34 -Neigh | 0.046682 | 0.047783 | 0.048641 | 0.3 | 6.58 -Comm | 0.065469 | 0.071509 | 0.07899 | 2.3 | 9.85 -Output | 3.9e-05 | 4.6e-05 | 6.1e-05 | 0.0 | 0.01 -Modify | 0.013205 | 0.01363 | 0.014044 | 0.3 | 1.88 -Other | | 0.009775 | | | 1.35 - -Nlocal: 8000 ave 8012 max 7989 min -Histogram: 1 0 0 0 2 0 0 0 0 1 -Nghost: 9131 ave 9142 max 9119 min -Histogram: 1 0 0 0 0 2 0 0 0 1 -Neighs: 490066 ave 491443 max 489273 min -Histogram: 2 0 0 0 1 0 0 0 0 1 - -Total # of neighbors = 1960266 -Ave neighs/atom = 61.2583 -Neighbor list builds = 3 -Dangerous builds = 0 -Total wall time: 0:00:00 From 7c102a6096671026a775574d0dcf5bc1e9a357d3 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 06:02:21 -0600 Subject: [PATCH 28/89] Extend the 'kim query' command Extend the 'kim query' command to get all available models meeting certain requirements. To query for KIM models the query function is `get_available_models`. Now, the 'kim query' works with the `model` argument and can also be used with no 'kim init' call requirement. --- src/KIM/kim_query.cpp | 233 +++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 96 deletions(-) diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index ef4b7572d3..db2bd47f94 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -81,125 +81,161 @@ using namespace LAMMPS_NS; #if defined(LMP_KIM_CURL) +namespace { +static constexpr int kBufSize{10240}; struct WriteBuf { char *dataptr; size_t sizeleft; }; -static char *do_query(char *, char *, int, char **, int, MPI_Comm); -static size_t write_callback(void *, size_t, size_t, void *); +static char *do_query(const std::string &, const std::string &, + int, char **, int, MPI_Comm); +static size_t write_callback(void *, size_t, size_t, void *); +} // namespace #endif /* ---------------------------------------------------------------------- */ void KimQuery::command(int narg, char **arg) { - if (narg < 2) error->all(FLERR,"Illegal 'kim query' command"); + if (narg < 2) error->all(FLERR, "Illegal 'kim query' command"); - // check if we had a kim init command by finding fix STORE/KIM - // retrieve model name. - char *model_name; - - const int ifix = modify->find_fix("KIM_MODEL_STORE"); - if (ifix >= 0) { - FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; - model_name = (char *)fix_store->getptr("model_name"); - } else error->all(FLERR,"Must use 'kim init' before 'kim query'"); - - char *varname = arg[0]; - - bool split = false; - if (strcmp("split",arg[1]) == 0) { - if (narg == 2) error->all(FLERR,"Illegal 'kim query' command.\nThe keyword " - "'split' must be followed by the name of " - "the query function"); - if (strcmp("list",arg[2]) == 0) - error->all(FLERR,"Illegal 'kim query' command.\nThe 'list' keyword " - "can not be used after 'split'"); - split = true; - arg++; - narg--; - } + std::string var_name{arg[0]}; + // format_arg = list, split, or index (optional): + std::string format_arg{arg[1]}; + if (format_arg == "split" || format_arg == "list" || format_arg == "index") { + if (narg == 2) { + auto msg = fmt::format("Illegal 'kim query' command.\nThe keyword '{}' " + "must be followed by the name of the query function", format_arg); + error->all(FLERR, msg); + } + ++arg; + --narg; // The “list” is the default setting - // the result is returned as a space-separated list of values in variable - if (strcmp("list",arg[1]) == 0) { - if (narg == 2) error->all(FLERR,"Illegal 'kim query' command.\nThe 'list' " - "keyword must be followed by ('split' " - "and) the name of the query function"); - arg++; - narg--; + // the result is returned as a space-separated list of values in a variable + } else format_arg = "list"; + + std::string query_function{arg[1]}; + if (query_function == "split" || query_function == "list" || + query_function == "index") { + auto msg = fmt::format("Illegal 'kim query' command.\nThe '{}' keyword " + "can not be used after '{}'", query_function, format_arg); + error->all(FLERR, msg); } - char *function = arg[1]; - for (int i = 2; i < narg; ++i) { - if (strncmp("model=",arg[i],6) == 0) - error->all(FLERR,"Illegal 'model' key in 'kim query' command"); + std::string model_name; - if (!strchr(arg[i], '=') || !strchr(arg[i], '[') || !strchr(arg[i], ']')) - error->all(FLERR,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 more " - "comma-separated items", arg[i])); + // 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], ']')) { + 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 " + "more comma-separated items", arg[i]); + error->all(FLERR, msg); + } + } + + 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) { + ValueTokenizer values(arg[i], "=[]"); + std::string key = values.next_string(); + model_name = values.next_string(); + break; + } + } + // if the model name is not provided by the user + if (model_name.empty()) { + // check if we had a kim init command by finding fix STORE/KIM + const int ifix = modify->find_fix("KIM_MODEL_STORE"); + if (ifix >= 0) { + FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; + char *model_name_c = (char *) fix_store->getptr("model_name"); + model_name = fmt::format("{}", model_name_c); + } else { + auto msg = fmt::format("Illegal query format.\nMust use 'kim init' " + "before 'kim query' or must provide the model name after query " + "function with the format of 'model=[model_name]'"); + error->all(FLERR, msg); + } + } } #if defined(LMP_KIM_CURL) - - char *value = do_query(function, model_name, narg-2, arg+2, comm->me, world); + char *value = do_query(query_function, model_name, + narg - 2, arg + 2, comm->me, world); // check for valid result - // on error the content of "value" is a '\0' byte - // as the first element, and then the error message - // that was returned by the web server + // on error the content of "value" is a '\0' byte as the first element, + // and then the error message that was returned by the web server if (strlen(value) == 0) { - error->all(FLERR,fmt::format("OpenKIM query failed: {}", value+1)); - } else if (strcmp(value,"EMPTY") == 0) { - error->all(FLERR,fmt::format("OpenKIM query returned no results")); + auto msg = fmt::format("OpenKIM query failed: {}", value + 1); + delete [] value; + error->all(FLERR, msg); + } else if (strcmp(value, "EMPTY") == 0) { + delete [] value; + error->all(FLERR, fmt::format("OpenKIM query returned no results")); } - input->write_echo("#=== BEGIN kim query ==================================" + input->write_echo("#=== BEGIN kim-query ==================================" "=======\n"); ValueTokenizer values(value, ","); - if (split) { + if (format_arg == "split") { int counter = 1; while (values.has_next()) { auto svalue = values.next_string(); - auto setcmd = fmt::format("{}_{} string {}", varname, counter++, svalue); + auto setcmd = fmt::format("{}_{} string {}", var_name, counter++, svalue); input->variable->set(setcmd); input->write_echo(fmt::format("variable {}\n", setcmd)); } } else { - auto svalue = values.next_string(); - std::string setcmd = fmt::format("{} string \"{}", varname, svalue); - while (values.has_next()) { - svalue = values.next_string(); - setcmd += fmt::format(" {}", svalue); + std::string setcmd; + auto svalue = utils::trim(values.next_string()); + if (format_arg == "list") { + setcmd = fmt::format("{} string \"", var_name); + setcmd += (svalue.front() == '"' && svalue.back() == '"') + ? fmt::format("{}", svalue.substr(1, svalue.size() - 2)) + : fmt::format("{}", svalue); + while (values.has_next()) { + svalue = utils::trim(values.next_string()); + setcmd += (svalue.front() == '"' && svalue.back() == '"') + ? fmt::format(" {}", svalue.substr(1, svalue.size() - 2)) + : fmt::format(" {}", svalue); + } + setcmd += "\""; + } else { + // format_arg == "index" + setcmd = fmt::format("{} index {}", var_name, svalue); + while (values.has_next()) { + svalue = values.next_string(); + setcmd += fmt::format(" {}", svalue); + } } - setcmd += "\""; input->variable->set(setcmd); input->write_echo(fmt::format("variable {}\n", setcmd)); } - input->write_echo("#=== END kim query ====================================" + input->write_echo("#=== END kim-query ====================================" "=======\n\n"); - delete[] value; + delete [] value; #else - error->all(FLERR,"Cannot use 'kim query' command when KIM package " - "is compiled without support for libcurl"); + error->all(FLERR, "Cannot use 'kim query' command when KIM package " + "is compiled without support for libcurl"); #endif } #if defined(LMP_KIM_CURL) - +namespace { // copy data to the user provided data structure, optionally in increments - size_t write_callback(void *data, size_t size, size_t nmemb, void *userp) { - struct WriteBuf *buf = (struct WriteBuf *)userp; + WriteBuf *buf = (WriteBuf *) userp; // copy chunks into the buffer for as long as there is space left if (buf->sizeleft) { @@ -211,25 +247,23 @@ size_t write_callback(void *data, size_t size, size_t nmemb, void *userp) buf->dataptr += copy_this_much; buf->sizeleft -= copy_this_much; - return copy_this_much; } return 0; // done } -char *do_query(char *qfunction, char * model_name, int narg, char **arg, - int rank, MPI_Comm comm) +char *do_query(const std::string &qfunction, const std::string &mname, + int narg, char **arg, int rank, MPI_Comm comm) { - char value[512]; + char value[kBufSize]; // run the web query from rank 0 only - if (rank == 0) { // set up and clear receive buffer - struct WriteBuf buf; + WriteBuf buf; buf.dataptr = value; - buf.sizeleft = 511; - memset(value,0,512); + buf.sizeleft = kBufSize - 1; + memset(value, 0, kBufSize); // create curl web query instance curl_global_init(CURL_GLOBAL_DEFAULT); @@ -237,17 +271,21 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, if (handle) { auto url = fmt::format("https://query.openkim.org/api/{}", qfunction); - auto query = fmt::format("model=[\"{}\"]", model_name); + auto query = mname.empty() + ? fmt::format("") + : (mname.front() == '"' && mname.back() == '"') + ? fmt::format("model=[{}]", mname) + : fmt::format("model=[\"{}\"]", mname); for (int i = 0; i < narg; ++i) { ValueTokenizer values(arg[i], "=[]"); std::string key = values.next_string(); + if (key == "model") continue; std::string val = values.next_string(); std::string::size_type n = val.find(","); if (n == std::string::npos) { if (utils::is_integer(val) || utils::is_double(val) || - (val.front() == '"' && - val.back() == '"')) { + (val.front() == '"' && val.back() == '"')) { query += fmt::format("&{}", arg[i]); } else { query += fmt::format("&{}=[\"{}\"]", key, val); @@ -258,8 +296,7 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, std::string sval = val.substr(0, n); if (utils::is_integer(sval) || utils::is_double(sval) || - (val.front() == '"' && - val.back() == '"')) { + (val.front() == '"' && val.back() == '"')) { query += fmt::format("{},", sval); } else { query += fmt::format("\"{}\",", sval); @@ -267,8 +304,11 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, val = val.substr(n + 1); n = val.find(","); } - if (val.size()) query += fmt::format("\"{}\"]", val); - else query[query.size() - 1]=']'; + if (val.size()) { + query += (val.front() == '"' && val.back() == '"') + ? fmt::format("{}]", val) + : fmt::format("\"{}\"]", val); + } else query.back() = ']'; } } @@ -294,28 +334,28 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, } } - std::string user_agent = fmt::format("kim query--LAMMPS/{} ({})", - LAMMPS_VERSION, Info::get_os_info()); + auto user_agent = fmt::format("kim query--LAMMPS/{} ({})", + LAMMPS_VERSION, Info::get_os_info()); curl_easy_setopt(handle, CURLOPT_USERAGENT, user_agent.c_str()); curl_easy_setopt(handle, CURLOPT_URL, url.c_str()); curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(handle, CURLOPT_POSTFIELDS, query.c_str()); curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_callback); - curl_easy_setopt(handle, CURLOPT_WRITEDATA,&buf); + curl_easy_setopt(handle, CURLOPT_WRITEDATA, &buf); // perform OpenKIM query and check for errors CURLcode res = curl_easy_perform(handle); if (res != CURLE_OK) { // on error we return an "empty" string but add error message after it value[0] = '\0'; - strcpy(value+1,curl_easy_strerror(res)); + strcpy(value + 1, curl_easy_strerror(res)); } curl_easy_cleanup(handle); } curl_global_cleanup(); } - MPI_Bcast(value, 512, MPI_CHAR, 0, comm); + MPI_Bcast(value, kBufSize, MPI_CHAR, 0, comm); // we must make a proper copy of the query, as the stack allocation // for "value" will go out of scope. a valid query has a '[' as @@ -330,27 +370,28 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, if (value[len] == ']') { value[len] = '\0'; retval = new char[len]; - if (strcmp(value+1, "") == 0) strcpy(retval,"EMPTY"); - else strcpy(retval,value+1); + if (strcmp(value + 1, "") == 0) strcpy(retval, "EMPTY"); + else strcpy(retval, value + 1); } else { - retval = new char[len+2]; + retval = new char[len + 2]; retval[0] = '\0'; - strcpy(retval+1,value); + strcpy(retval + 1, value); } // an error message starts with a '\0' character } else if (value[0] == '\0') { - int len = strlen(value+1)+2; + int len = strlen(value + 1) + 2; retval = new char[len]; retval[0] = '\0'; - strcpy(retval+1,value+1); + strcpy(retval + 1, value + 1); // unknown response type. we should not get here. } else { // we return an "empty" string but add error message after it - int len = strlen(value)+2; + int len = strlen(value) + 2; retval = new char[len]; retval[0] = '\0'; - strcpy(retval+1,value); + strcpy(retval + 1, value); } return retval; } +} // namespace #endif From 90e748aa5cf7fda58c57036a5cbfde1f53a93c78 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 06:03:45 -0600 Subject: [PATCH 29/89] Update the 'kim query' unittest Update the unittest with the latest extension. Replace the discontinued model of `EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000` and replace it with the identical version, `EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000` --- unittest/commands/test_kim_commands.cpp | 166 ++++++++++++++++++------ 1 file changed, 127 insertions(+), 39 deletions(-) diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 5ea458de59..9d02cdb74c 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -38,7 +38,6 @@ const bool have_openmpi = false; using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { -using ::testing::ExitedWithCode; using ::testing::MatchesRegex; using ::testing::StrEq; @@ -401,26 +400,33 @@ TEST_F(KimCommandsTest, kim_query) TEST_FAILURE(".*ERROR: Illegal 'kim query' command.*", lmp->input->one("kim query");); - TEST_FAILURE(".*ERROR: Must use 'kim init' before 'kim query'.*", - lmp->input->one("kim query a0 get_lattice_constant_cubic");); - - if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); - if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'split' " "must be followed by the name of the query function.*", lmp->input->one("kim query a0 split");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'list' " + "must be followed by the name of the query function.*", + lmp->input->one("kim query a0 list");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'index' " + "must be followed by the name of the query function.*", + lmp->input->one("kim query a0 index");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'list' keyword " "can not be used after 'split'.*", lmp->input->one("kim query a0 split list");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'index' keyword " + "can not be used after 'split'.*", + lmp->input->one("kim query a0 split index");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'split' keyword " + "can not be used after 'list'.*", + lmp->input->one("kim query a0 list split");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'index' keyword " + "can not be used after 'list'.*", + lmp->input->one("kim query a0 list index");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'list' keyword " - "must be followed by \\('split' and\\) the name of the query " - "function.*", lmp->input->one("kim query a0 list");); - TEST_FAILURE(".*ERROR: Illegal 'model' key in 'kim query' command.*", - lmp->input->one("kim query a0 get_lattice_constant_cubic " - "model=[MO_959249795837_003]");); + "can not be used after 'index'.*", + lmp->input->one("kim query a0 index list");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'split' keyword " + "can not be used after 'index'.*", + lmp->input->one("kim query a0 index split");); TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `crystal` " "to 'kim query' is wrong. The query format is the " "keyword=\\[value\\], where value is always an array of one " @@ -428,9 +434,9 @@ TEST_F(KimCommandsTest, kim_query) lmp->input->one("kim query a0 get_lattice_constant_cubic " "crystal");); TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" - "crystal=fcc` 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.*", + "crystal=fcc` 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("kim query a0 get_lattice_constant_cubic " "crystal=fcc");); TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" @@ -448,46 +454,111 @@ TEST_F(KimCommandsTest, kim_query) std::string 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=" + 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 " + 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: OpenKIM query failed:.*", 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 " + "'kim query' or must provide the model name after query " + "function with the format of 'model=\\[model_name\\]'.*", + lmp->input->one(squery);); squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] " - "units=[\"angstrom\"]"; - TEST_FAILURE(".*ERROR: OpenKIM query failed:.*", lmp->input->one(squery);); + "species=[Al]"; + TEST_FAILURE(".*ERROR: Illegal query format.\nMust use 'kim init' before " + "'kim query' or must provide the model name after query " + "function with the format of 'model=\\[model_name\\]'.*", + 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 " + "'kim query' or must provide the model name after query " + "function with the format of 'model=\\[model_name\\]'.*", + lmp->input->one(squery);); #if defined(KIM_EXTRA_UNITTESTS) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal"); - squery = "kim query latconst split get_lattice_constant_hexagonal "; - squery += "crystal=[\"hcp\"] species=[\"Zr\"] units=[\"angstrom\"]"; + squery = "kim query latconst_1 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=[Al] units=[angstrom] "; + squery += "model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005]"; lmp->input->one(squery); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == - std::string("3.234055244384789"))); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == - std::string("5.167650199630013"))); + "4.032082033157349")); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); - lmp->input->one("kim init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal"); + lmp->input->one("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); + + squery = "kim query latconst_1 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=[Al] units=[angstrom]"; + lmp->input->one(squery); + + squery = "kim query latconst_2 get_lattice_constant_cubic "; + squery += "crystal=[fcc] species=[Al] units=[angstrom] "; + squery += "model=[LennardJones612_UniversalShifted__MO_959249795837_003]"; + lmp->input->one(squery); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == + "4.032082033157349")); + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == + "3.328125931322575")); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("clear"); + lmp->input->one("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); + + squery = "kim query latconst split get_lattice_constant_hexagonal "; + squery += "crystal=[hcp] species=[Zr] units=[angstrom]"; + lmp->input->one(squery); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == + "3.234055244384789")); + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == + "5.167650199630013")); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("clear"); + + squery = "kim query latconst index get_lattice_constant_hexagonal "; + squery += "crystal=[hcp] species=[Zr] units=[angstrom] "; + squery += "model=[EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000]"; + lmp->input->one(squery); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst")) == + "3.234055244384789")); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("variable latconst delete"); + lmp->input->one("clear"); + lmp->input->one("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); squery = "kim query latconst list get_lattice_constant_hexagonal "; squery += "crystal=[hcp] species=[Zr] units=[angstrom]"; @@ -495,11 +566,7 @@ TEST_F(KimCommandsTest, kim_query) if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst")) == - std::string("3.234055244384789 5.167650199630013"))); - - squery = "kim query latconst list get_lattice_constant_hexagonal "; - squery += "crystal=[bcc] species=[Zr] units=[angstrom]"; - TEST_FAILURE(".*ERROR: OpenKIM query failed:.*", lmp->input->one(squery);); + "3.234055244384789 5.167650199630013")); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); @@ -512,7 +579,28 @@ TEST_F(KimCommandsTest, kim_query) if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_TRUE((std::string(lmp->input->variable->retrieve("alpha")) == - std::string("1.654960564704273e-05"))); + "1.654960564704273e-05")); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("clear"); + + squery = "kim query model_list list get_available_models "; + squery += "species=[Al]"; + lmp->input->one(squery); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + std::string model_list = lmp->input->variable->retrieve("model_list"); + auto n = model_list.find("EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005"); + ASSERT_TRUE(n != std::string::npos); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("clear"); + + squery = "kim query model_name index get_available_models "; + squery += "species=[Al]"; + lmp->input->one(squery); + lmp->input->one("variable model_name delete"); + if (!verbose) ::testing::internal::GetCapturedStdout(); #endif } } // namespace LAMMPS_NS From 8f55701da85bc28794412390a65eb3a06df72d28 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Fri, 12 Feb 2021 06:05:41 -0600 Subject: [PATCH 30/89] adding 'kim query' command examples --- examples/kim/in.kim-query | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 examples/kim/in.kim-query diff --git a/examples/kim/in.kim-query b/examples/kim/in.kim-query new file mode 100644 index 0000000000..a0d1379372 --- /dev/null +++ b/examples/kim/in.kim-query @@ -0,0 +1,76 @@ +# kim query example +# +# Requirement: +# +# This example requires LAMMPS is built with KIM package. A requirement for +# the KIM package, is the KIM API library that must be downloaded from the +# OpenKIM website and installed before LAMMPS is compiled. The 'kim query' +# command requires the libcurl library to be installed. See the +# `https://lammps.sandia.gov/doc/Build_extras.html#kim` doc page for further +# details +# +# This example requires that the KIM Models +# `EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005` +# and +# `EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000` +# are installed. +# +# This can be done with the commands +# `kim-api-collections-management install user `EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005` +# `kim-api-collections-management install user `EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000` +# +# If these commands do not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see https://openkim.org/doc/obtaining-models for alternative options. +# + +# ----------------------------------------------- +# Get an equilibrium fcc crystal lattice constant +# ----------------------------------------------- +kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal +kim query latconst_1 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] +print "FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = ${latconst_1}" +# Get the lattice contant from a different model +kim query latconst_2 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005] +print "FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = ${latconst_2}" +clear + + +# ----------------------------------------------- +# Get an equilibrium fcc crystal lattice constant +# ----------------------------------------------- +kim query latconst_1 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005] +kim query latconst_2 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005] +print "FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = ${latconst_1}" +print "FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = ${latconst_2}" +clear + + +# ----------------------------------------------- +# Get an equilibrium hcp crystal lattice constant +# ----------------------------------------------- +kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal +kim query latconst split get_lattice_constant_hexagonal crystal=["hcp"] species=["Zr"] units=["angstrom"] +print "HCP lattice constants = ${latconst_1}, ${latconst_2}" +clear + + +# ----------------------------------------------- +# Query for KIM models from openkim.org +# Get all the EAM models that support Al +# ----------------------------------------------- +kim query model index get_available_models species=[Al] potential_type=[eam] +label model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +print "FCC lattice constant (${model}) = ${latconst}" +next model +jump SELF model_loop +clear + From fd67f83bb7595db7ecff20fc9fc1fef4fe69c364 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 19 Feb 2021 10:27:31 -0500 Subject: [PATCH 31/89] replace atoi() with utils::inumeric() --- src/fix_addforce.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index a06544e268..07031a40a4 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -83,7 +83,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command"); - nevery = atoi(arg[iarg+1]); + nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix addforce command"); iarg += 2; } else if (strcmp(arg[iarg],"region") == 0) { From 99ff0bb4d25f17a6a18c038b8489e485272e71d8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 19 Feb 2021 16:57:49 -0500 Subject: [PATCH 32/89] fix cut-n-paste bug --- src/citeme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/citeme.cpp b/src/citeme.cpp index fdd1ee867d..41ac87f5bb 100644 --- a/src/citeme.cpp +++ b/src/citeme.cpp @@ -118,7 +118,7 @@ void CiteMe::flush() if (!citefile.empty()) logbuffer += fmt::format(cite_file,"file",citefile); if (screen_flag == VERBOSE) - scrbuffer += fmt::format(cite_file,"screen","output"); + logbuffer += fmt::format(cite_file,"screen","output"); logbuffer += cite_separator; if (logfile) fputs(logbuffer.c_str(),logfile); logbuffer.clear(); From a98177c366ca53b548556e784e2931288e3469bc Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sat, 20 Feb 2021 15:07:50 -0500 Subject: [PATCH 33/89] ring_check refactor --- src/USER-REACTION/fix_bond_react.cpp | 32 +++++++++++----------------- src/USER-REACTION/fix_bond_react.h | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 1ec29efacd..40cf2748e2 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -1627,8 +1627,8 @@ void FixBondReact::check_a_neighbor() glove_counter++; if (glove_counter == onemol->natoms) { - status = ACCEPT; - ring_check(); + if (ring_check()) status = ACCEPT; + else status = GUESSFAIL; return; } // status should still == PROCEED @@ -1679,8 +1679,8 @@ void FixBondReact::check_a_neighbor() glove_counter++; if (glove_counter == onemol->natoms) { - status = ACCEPT; - ring_check(); + if (ring_check()) status = ACCEPT; + else status = GUESSFAIL; return; // will never complete here when there are edge atoms // ...actually that could be wrong if people get creative...shouldn't affect anything @@ -1791,8 +1791,8 @@ void FixBondReact::inner_crosscheck_loop() } glove_counter++; if (glove_counter == onemol->natoms) { - status = ACCEPT; - ring_check(); + if (ring_check()) status = ACCEPT; + else status = GUESSFAIL; return; } status = CONTINUE; @@ -1803,21 +1803,17 @@ void FixBondReact::inner_crosscheck_loop() Necessary for certain ringed structures ------------------------------------------------------------------------- */ -void FixBondReact::ring_check() +int FixBondReact::ring_check() { // ring_check can be made more efficient by re-introducing 'frozen' atoms // 'frozen' atoms have been assigned and also are no longer pioneers // double check the number of neighbors match for all non-edge atoms // otherwise, atoms at 'end' of symmetric ring can behave like edge atoms - for (int i = 0; i < onemol->natoms; i++) { - if (edge[i][rxnID] == 0) { - if (onemol_nxspecial[i][0] != nxspecial[atom->map(glove[i][1])][0]) { - status = GUESSFAIL; - return; - } - } - } + for (int i = 0; i < onemol->natoms; i++) + if (edge[i][rxnID] == 0 && + onemol_nxspecial[i][0] != nxspecial[atom->map(glove[i][1])][0]) + return 0; for (int i = 0; i < onemol->natoms; i++) { for (int j = 0; j < onemol_nxspecial[i][0]; j++) { @@ -1829,12 +1825,10 @@ void FixBondReact::ring_check() break; } } - if (ring_fail == 1) { - status = GUESSFAIL; - return; - } + if (ring_fail == 1) return 0; } } + return 1; } /* ---------------------------------------------------------------------- diff --git a/src/USER-REACTION/fix_bond_react.h b/src/USER-REACTION/fix_bond_react.h index 87a5945d45..153bdd7a6d 100644 --- a/src/USER-REACTION/fix_bond_react.h +++ b/src/USER-REACTION/fix_bond_react.h @@ -171,7 +171,7 @@ class FixBondReact : public Fix { void check_a_neighbor(); void crosscheck_the_neighbor(); void inner_crosscheck_loop(); - void ring_check(); + int ring_check(); int check_constraints(); void get_IDcoords(int, int, double *); double get_temperature(tagint **, int, int); From 80ae5ba7acbd946df15732456ad6682ad2db4321 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sat, 20 Feb 2021 15:14:42 -0500 Subject: [PATCH 34/89] refactor constraints check --- src/USER-REACTION/fix_bond_react.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 40cf2748e2..0f98e74a5e 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -1385,9 +1385,9 @@ void FixBondReact::superimpose_algorithm() } } - if (status == ACCEPT && check_constraints()) { // reaction site found successfully! - glove_ghostcheck(); - } + // reaction site found successfully! + if (status == ACCEPT) glove_ghostcheck(); + hang_catch++; // let's go ahead and catch the simplest of hangs //if (hang_catch > onemol->natoms*4) @@ -1627,7 +1627,7 @@ void FixBondReact::check_a_neighbor() glove_counter++; if (glove_counter == onemol->natoms) { - if (ring_check()) status = ACCEPT; + if (ring_check() && check_constraints()) status = ACCEPT; else status = GUESSFAIL; return; } @@ -1679,7 +1679,7 @@ void FixBondReact::check_a_neighbor() glove_counter++; if (glove_counter == onemol->natoms) { - if (ring_check()) status = ACCEPT; + if (ring_check() && check_constraints()) status = ACCEPT; else status = GUESSFAIL; return; // will never complete here when there are edge atoms @@ -1791,7 +1791,7 @@ void FixBondReact::inner_crosscheck_loop() } glove_counter++; if (glove_counter == onemol->natoms) { - if (ring_check()) status = ACCEPT; + if (ring_check() && check_constraints()) status = ACCEPT; else status = GUESSFAIL; return; } From 7d9187cff8364fbf5872946996b1a62c67d6053b Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sat, 20 Feb 2021 16:24:24 -0500 Subject: [PATCH 35/89] eval reaction prob after constraints check --- src/USER-REACTION/fix_bond_react.cpp | 94 +++++++++------------------- src/USER-REACTION/fix_bond_react.h | 2 +- 2 files changed, 32 insertions(+), 64 deletions(-) diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 0f98e74a5e..173a92b7fb 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -537,7 +537,6 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : nmax = 0; partner = finalpartner = nullptr; distsq = nullptr; - probability = nullptr; maxattempt = 0; attempt = nullptr; nattempt = nullptr; @@ -585,7 +584,6 @@ FixBondReact::~FixBondReact() memory->destroy(finalpartner); memory->destroy(nattempt); memory->destroy(distsq); - memory->destroy(probability); memory->destroy(attempt); memory->destroy(edge); memory->destroy(equivalences); @@ -877,6 +875,10 @@ void FixBondReact::post_integrate() return; } + // update reaction probability + if (var_flag[PROB][rxnID]) + fraction[rxnID] = input->variable->compute_equal(var_id[PROB][rxnID]); + // acquire updated ghost atom positions // necessary b/c are calling this after integrate, but before Verlet comm @@ -890,16 +892,14 @@ void FixBondReact::post_integrate() memory->destroy(finalpartner); memory->destroy(distsq); memory->destroy(nattempt); - memory->destroy(probability); nmax = atom->nmax; memory->create(partner,nmax,"bond/react:partner"); memory->create(finalpartner,nmax,"bond/react:finalpartner"); memory->create(distsq,nmax,2,"bond/react:distsq"); memory->create(nattempt,nreacts,"bond/react:nattempt"); - memory->create(probability,nmax,"bond/react:probability"); } - // reset create counts + // reset 'attempt' counts for (int i = 0; i < nreacts; i++) { nattempt[i] = 0; } @@ -962,25 +962,14 @@ void FixBondReact::post_integrate() comm->reverse_comm_fix(this); } - // update reaction probability - if (var_flag[PROB][rxnID]) - fraction[rxnID] = input->variable->compute_equal(var_id[PROB][rxnID]); - // each atom now knows its winning partner - // for prob check, generate random value for each atom with a bond partner - // forward comm of partner and random value, so ghosts have it - - if (fraction[rxnID] < 1.0) { - for (int i = 0; i < nlocal; i++) - if (partner[i]) probability[i] = random[rxnID]->uniform(); - } + // forward comm of partner, so ghosts have it commflag = 2; comm->forward_comm_fix(this,2); // consider for reaction: // only if both atoms list each other as winning bond partner - // and probability constraint is satisfied // if other atom is owned by another proc, it should do same thing int temp_nattempt = 0; @@ -994,16 +983,6 @@ void FixBondReact::post_integrate() continue; } - // apply probability constraint using RN for atom with smallest ID - - if (fraction[rxnID] < 1.0) { - if (tag[i] < tag[j]) { - if (probability[i] >= fraction[rxnID]) continue; - } else { - if (probability[j] >= fraction[rxnID]) continue; - } - } - // store final bond partners and count the rxn possibility once finalpartner[i] = tag[j]; @@ -1345,10 +1324,14 @@ void FixBondReact::superimpose_algorithm() (nxspecial[local_atom1][0] == 0 || xspecial[local_atom1][0] == atom->tag[local_atom2]) && check_constraints()) { - status = ACCEPT; - glove_ghostcheck(); - } else - status = REJECT; + if (fraction[rxnID] < 1.0 && + random[rxnID]->uniform() >= fraction[rxnID]) { + status = REJECT; + } else { + status = ACCEPT; + glove_ghostcheck(); + } + } else status = REJECT; } avail_guesses = 0; @@ -1386,7 +1369,10 @@ void FixBondReact::superimpose_algorithm() } // reaction site found successfully! - if (status == ACCEPT) glove_ghostcheck(); + if (status == ACCEPT) + if (fraction[rxnID] < 1.0 && + random[rxnID]->uniform() >= fraction[rxnID]) status = REJECT; + else glove_ghostcheck(); hang_catch++; // let's go ahead and catch the simplest of hangs @@ -3946,20 +3932,10 @@ int FixBondReact::pack_forward_comm(int n, int *list, double *buf, m = 0; - if (commflag == 1) { - for (i = 0; i < n; i++) { - j = list[i]; - printf("hello you shouldn't be here\n"); - //buf[m++] = ubuf(bondcount[j]).d; - } - return m; - } - if (commflag == 2) { for (i = 0; i < n; i++) { j = list[i]; buf[m++] = ubuf(partner[j]).d; - buf[m++] = probability[j]; } return m; } @@ -3985,15 +3961,9 @@ void FixBondReact::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; - if (commflag == 1) { + if (commflag == 2) { for (i = first; i < last; i++) - printf("hello you shouldn't be here\n"); - // bondcount[i] = (int) ubuf(buf[m++]).i; - } else if (commflag == 2) { - for (i = first; i < last; i++) { partner[i] = (tagint) ubuf(buf[m++]).i; - probability[i] = buf[m++]; - } } else { m = 0; last = first + n; @@ -4034,20 +4004,18 @@ void FixBondReact::unpack_reverse_comm(int n, int *list, double *buf) m = 0; - if (commflag != 1) { - for (i = 0; i < n; i++) { - j = list[i]; - if (closeneigh[rxnID] != 0) { - if (buf[m+1] < distsq[j][1]) { - partner[j] = (tagint) ubuf(buf[m++]).i; - distsq[j][1] = buf[m++]; - } else m += 2; - } else { - if (buf[m+1] > distsq[j][0]) { - partner[j] = (tagint) ubuf(buf[m++]).i; - distsq[j][0] = buf[m++]; - } else m += 2; - } + for (i = 0; i < n; i++) { + j = list[i]; + if (closeneigh[rxnID] != 0) { + if (buf[m+1] < distsq[j][1]) { + partner[j] = (tagint) ubuf(buf[m++]).i; + distsq[j][1] = buf[m++]; + } else m += 2; + } else { + if (buf[m+1] > distsq[j][0]) { + partner[j] = (tagint) ubuf(buf[m++]).i; + distsq[j][0] = buf[m++]; + } else m += 2; } } } diff --git a/src/USER-REACTION/fix_bond_react.h b/src/USER-REACTION/fix_bond_react.h index 153bdd7a6d..67788df217 100644 --- a/src/USER-REACTION/fix_bond_react.h +++ b/src/USER-REACTION/fix_bond_react.h @@ -86,7 +86,7 @@ class FixBondReact : public Fix { int nmax; // max num local atoms int max_natoms; // max natoms in a molecule template tagint *partner,*finalpartner; - double **distsq,*probability; + double **distsq; int *nattempt; int maxattempt; int allnattempt; From 196b6b92730cd2a9949f158a8981258e52003eb4 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sat, 20 Feb 2021 20:22:53 -0500 Subject: [PATCH 36/89] variable probability fix --- src/USER-REACTION/fix_bond_react.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 173a92b7fb..93c9fe525b 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -868,6 +868,9 @@ void FixBondReact::post_integrate() ghostly_rxn_count[i] = 0; nlocalskips[i] = 0; nghostlyskips[i] = 0; + // update reaction probability + if (var_flag[PROB][i]) + fraction[i] = input->variable->compute_equal(var_id[PROB][i]); } if (nevery_check) { @@ -875,10 +878,6 @@ void FixBondReact::post_integrate() return; } - // update reaction probability - if (var_flag[PROB][rxnID]) - fraction[rxnID] = input->variable->compute_equal(var_id[PROB][rxnID]); - // acquire updated ghost atom positions // necessary b/c are calling this after integrate, but before Verlet comm From d9941b1648157d32bf812f9cb537cf8b5e093b25 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sat, 20 Feb 2021 20:29:39 -0500 Subject: [PATCH 37/89] Update in.tiny_nylon.stabilized_variable_probability --- .../tiny_nylon/in.tiny_nylon.stabilized_variable_probability | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/USER/reaction/tiny_nylon/in.tiny_nylon.stabilized_variable_probability b/examples/USER/reaction/tiny_nylon/in.tiny_nylon.stabilized_variable_probability index 2c101ac77c..e81fedc34a 100644 --- a/examples/USER/reaction/tiny_nylon/in.tiny_nylon.stabilized_variable_probability +++ b/examples/USER/reaction/tiny_nylon/in.tiny_nylon.stabilized_variable_probability @@ -22,7 +22,7 @@ improper_style class2 read_data tiny_nylon.data variable runsteps equal 1000 -variable prob1 equal step/v_runsteps*2 +variable prob1 equal step/v_runsteps*2+0.1 variable prob2 equal (step/v_runsteps)>0.5 velocity all create 300.0 4928459 dist gaussian From d5917652d49cd248c3aa9edab463ea2240045ec3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 20 Feb 2021 23:50:55 -0500 Subject: [PATCH 38/89] remove output that is no longer necessary. settings are adapted automatically --- cmake/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index aefa9cd597..f67699c54d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -777,9 +777,7 @@ if(PKG_GPU) message(STATUS "<<< GPU package settings >>> -- GPU API: ${GPU_API}") if(GPU_API STREQUAL "CUDA") - message(STATUS "GPU architecture: ${GPU_ARCH}") - elseif(GPU_API STREQUAL "OPENCL") - message(STATUS "OpenCL tuning: ${OCL_TUNE}") + message(STATUS "GPU default architecture: ${GPU_ARCH}") elseif(GPU_API STREQUAL "HIP") message(STATUS "HIP platform: ${HIP_PLATFORM}") message(STATUS "HIP architecture: ${HIP_ARCH}") From d025b281cf17b593bee604af787b1e5481f8e96e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 01:28:44 -0500 Subject: [PATCH 39/89] Build and link a static OpenCL loader library for all platforms --- cmake/Modules/OpenCLLoader.cmake | 54 ++++++++++++++++++++++++++++++++ cmake/Modules/Packages/GPU.cmake | 18 +++-------- 2 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 cmake/Modules/OpenCLLoader.cmake diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake new file mode 100644 index 0000000000..0460f686ef --- /dev/null +++ b/cmake/Modules/OpenCLLoader.cmake @@ -0,0 +1,54 @@ +message(STATUS "Downloading and building OpenCL loader library") + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(OPENCL_LOADER_LIB_POSTFIX d) +else() + set(OPENCL_LOADER_LIB_POSTFIX) +endif() + +include(ExternalProject) +set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020.12.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball") +mark_as_advanced(OPENCL_LOADER_URL) +ExternalProject_Add(opencl_loader + URL ${OPENCL_LOADER_URL} + URL_MD5 f1e6a084d4950382588207133965ec89 + SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src" + BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build" + CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_INSTALL_PREFIX= + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + BUILD_BYPRODUCTS /lib/${CMAKE_FIND_LIBRARY_PREFIXES}OpenCL${OPENCL_LOADER_LIB_POSTFIX}.a + LOG_DOWNLOAD ON + LOG_CONFIGURE ON + LOG_BUILD ON + INSTALL_COMMAND "" + TEST_COMMAND "") + +ExternalProject_Get_Property(opencl_loader SOURCE_DIR) +set(OPENCL_LOADER_INCLUDE_DIR ${SOURCE_DIR}/inc) + +# workaround for CMake 3.10 on ubuntu 18.04 +file(MAKE_DIRECTORY ${OPENCL_LOADER_INCLUDE_DIR}) + +ExternalProject_Get_Property(opencl_loader BINARY_DIR) + set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${OPENCL_LOADER_LIB_POSTFIX}.a") + +find_package(Threads QUIET) +if(NOT WIN32) + set(OPENCL_LOADER_DEP_LIBS "Threads::Threads;${CMAKE_DL_LIBS}") +else() + set(OPENCL_LOADER_DEP_LIBS "cfgmgr32;runtimeobject") +endif() + +add_library(OpenCL::OpenCL UNKNOWN IMPORTED) +add_dependencies(OpenCL::OpenCL opencl_loader) + +set_target_properties(OpenCL::OpenCL PROPERTIES + IMPORTED_LOCATION ${OPENCL_LOADER_LIBRARY_PATH} + INTERFACE_INCLUDE_DIRECTORIES ${OPENCL_LOADER_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES "${OPENCL_LOADER_DEP_LIBS}") + + diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 76ad4190cf..1b543eba8c 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -141,19 +141,10 @@ if(GPU_API STREQUAL "CUDA") target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS}) elseif(GPU_API STREQUAL "OPENCL") - if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - # download and unpack support binaries for compilation of windows binaries. - set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty") - file(DOWNLOAD "${LAMMPS_THIRDPARTY_URL}/opencl-win-devel.tar.gz" "${CMAKE_CURRENT_BINARY_DIR}/opencl-win-devel.tar.gz" - EXPECTED_MD5 2c00364888d5671195598b44c2e0d44d) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf opencl-win-devel.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - add_library(OpenCL::OpenCL UNKNOWN IMPORTED) - if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") - set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win32/libOpenCL.dll") - elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") - set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win64/libOpenCL.dll") - endif() - set_target_properties(OpenCL::OpenCL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/include") + option(USE_STATIC_OPENCL_LOADER "Download and include a static OpenCL ICD loader" ON) + mark_as_advanced(USE_STATIC_OPENCL_LOADER) + if (USE_STATIC_OPENCL_LOADER) + include(OpenCLLoader) else() find_package(OpenCL REQUIRED) endif() @@ -208,6 +199,7 @@ elseif(GPU_API STREQUAL "OPENCL") add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp) target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL) target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL) + add_dependencies(ocl_get_devices OpenCL::OpenCL) elseif(GPU_API STREQUAL "HIP") if(NOT DEFINED HIP_PATH) if(NOT DEFINED ENV{HIP_PATH}) From 70327861b29dbc568254d18ce07cbbfcafb5e8ac Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 09:43:56 -0500 Subject: [PATCH 40/89] update for improved OpenCL stub driver with tests --- cmake/Modules/OpenCLLoader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake index 0460f686ef..a6aac1c603 100644 --- a/cmake/Modules/OpenCLLoader.cmake +++ b/cmake/Modules/OpenCLLoader.cmake @@ -11,7 +11,7 @@ set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020 mark_as_advanced(OPENCL_LOADER_URL) ExternalProject_Add(opencl_loader URL ${OPENCL_LOADER_URL} - URL_MD5 f1e6a084d4950382588207133965ec89 + URL_MD5 d89ab1dc1121b96c9c37526b9db46df1 SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src" BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build" CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS} From 24079e9302c42fc8e559e24d3f4eefe696070253 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 10:45:01 -0500 Subject: [PATCH 41/89] update docs --- doc/src/Build_extras.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index cf15de74bd..5e3356478d 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -133,6 +133,8 @@ CMake build # value = yes (default) or no -D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon # value = yes or no (default) + -D USE_STATIC_OPENCL_LOADER=value # downloads/includes OpenCL ICD loader library, no local OpenCL headers/libs needed + # value = yes (default) or no :code:`GPU_ARCH` settings for different GPU hardware is as follows: @@ -159,6 +161,12 @@ When building with CMake, you **must NOT** build the GPU library in ``lib/gpu`` using the traditional build procedure. CMake will detect files generated by that process and will terminate with an error and a suggestion for how to remove them. +If you are compiling for OpenCL, the default setting is to download, build, and +link with a static OpenCL ICD loader library and standard OpenCL headers. This +way no local OpenCL development headers or library needs to be present and only +OpenCL compatible drivers need to be installed to use OpenCL. If this is not +desired, you can set :code:`USE_STATIC_OPENCL_LOADER` to :code:`no`. + If you are compiling with HIP, note that before running CMake you will have to set appropriate environment variables. Some variables such as :code:`HCC_AMDGPU_TARGET` or :code:`CUDA_PATH` are necessary for :code:`hipcc` From 0c6671ad64354be8197d1f784df8b35b7a67b41c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 11:06:58 -0500 Subject: [PATCH 42/89] do not always add styles that depend on other packages --- cmake/Modules/Packages/GPU.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 1b543eba8c..70014c8782 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -382,12 +382,8 @@ elseif(GPU_API STREQUAL "HIP") target_link_libraries(lammps PRIVATE gpu) endif() -# GPU package -FindStyleHeaders(${GPU_SOURCES_DIR} FIX_CLASS fix_ FIX) - set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}") - -# detects styles which have GPU version +# detect styles which have a GPU version RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) From 826c618aa9e3a69eee32abded0686b0191d5211a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 15:09:50 -0500 Subject: [PATCH 43/89] replace a few more cases of atoi()/atof() with utils::*numeric() functions --- src/atom.cpp | 2 +- src/compute_reduce.cpp | 4 ++-- src/fix_property_atom.cpp | 20 +++++++++++++------- src/kspace.cpp | 12 ++++++------ 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 75b1b07fbf..fe260309e2 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1752,7 +1752,7 @@ void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) if (lo < 1 || hi > ntypes) error->all(file,line,"Invalid type for mass set"); for (int itype = lo; itype <= hi; itype++) { - mass[itype] = atof(arg[1]); + mass[itype] = utils::numeric(FLERR,arg[1],false,lmp); mass_setflag[itype] = 1; if (mass[itype] <= 0.0) error->all(file,line,"Invalid mass value"); diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index 82d3dff458..bc9aeefe7b 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -148,8 +148,8 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : if (iarg+3 > narg) error->all(FLERR,"Illegal compute reduce command"); if (mode != MINN && mode != MAXX) error->all(FLERR,"Compute reduce replace requires min or max mode"); - int col1 = atoi(arg[iarg+1]) - 1; - int col2 = atoi(arg[iarg+2]) - 1; + int col1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; + int col2 = utils::inumeric(FLERR,arg[iarg+2],false,lmp) - 1; if (col1 < 0 || col1 >= nvalues || col2 < 0 || col2 >= nvalues) error->all(FLERR,"Illegal compute reduce command"); if (col1 == col2) error->all(FLERR,"Illegal compute reduce command"); diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index c1c52a3f8c..f18888bbfc 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -254,13 +254,19 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, if ((m = atom->map(itag)) >= 0) { for (j = 0; j < nvalue; j++) { - if (style[j] == MOLECULE) atom->molecule[m] = ATOTAGINT(values[j+1]); - else if (style[j] == CHARGE) atom->q[m] = atof(values[j+1]); - else if (style[j] == RMASS) atom->rmass[m] = atof(values[j+1]); - else if (style[j] == INTEGER) - atom->ivector[index[j]][m] = atoi(values[j+1]); - else if (style[j] == DOUBLE) - atom->dvector[index[j]][m] = atof(values[j+1]); + if (style[j] == MOLECULE) { + atom->molecule[m] = utils::tnumeric(FLERR,values[j+1],false,lmp); + } else if (style[j] == CHARGE) { + atom->q[m] = utils::numeric(FLERR,values[j+1],false,lmp); + } else if (style[j] == RMASS) { + atom->rmass[m] = utils::numeric(FLERR,values[j+1],false,lmp); + } else if (style[j] == INTEGER) { + atom->ivector[index[j]][m] = utils::inumeric(FLERR,values[j+1], + false,lmp); + } else if (style[j] == DOUBLE) { + atom->dvector[index[j]][m] = utils::numeric(FLERR,values[j+1], + true,lmp); + } } } diff --git a/src/kspace.cpp b/src/kspace.cpp index 5556a5e8d0..f44cc42aaf 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -564,9 +564,9 @@ void KSpace::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"kmax/ewald") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command"); - kx_ewald = atoi(arg[iarg+1]); - ky_ewald = atoi(arg[iarg+2]); - kz_ewald = atoi(arg[iarg+3]); + kx_ewald = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + ky_ewald = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + kz_ewald = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (kx_ewald < 0 || ky_ewald < 0 || kz_ewald < 0) error->all(FLERR,"Bad kspace_modify kmax/ewald parameter"); if (kx_ewald > 0 && ky_ewald > 0 && kz_ewald > 0) @@ -583,15 +583,15 @@ void KSpace::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"force/disp/real") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - accuracy_real_6 = atof(arg[iarg+1]); + accuracy_real_6 = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"force/disp/kspace") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - accuracy_kspace_6 = atof(arg[iarg+1]); + accuracy_kspace_6 = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"eigtol") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - splittol = atof(arg[iarg+1]); + splittol = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (splittol >= 1.0) error->all(FLERR,"Kspace_modify eigtol must be smaller than one"); iarg += 2; From 06f6766ed6dab0ac18607ea9ee9d237a09569716 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 16:20:36 -0500 Subject: [PATCH 44/89] CMAKE_FIND_LIBRARY_PREFIXES is a path. must use plain "lib" instead, but there is a variable for the suffix --- cmake/Modules/GTest.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/Modules/GTest.cmake b/cmake/Modules/GTest.cmake index 060a7e42f9..0c62291d5e 100644 --- a/cmake/Modules/GTest.cmake +++ b/cmake/Modules/GTest.cmake @@ -20,10 +20,10 @@ ExternalProject_Add(googletest -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - BUILD_BYPRODUCTS /lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${GTEST_LIB_POSTFIX}.a - /lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${GTEST_LIB_POSTFIX}.a - /lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${GTEST_LIB_POSTFIX}.a - /lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${GTEST_LIB_POSTFIX}.a + BUILD_BYPRODUCTS /lib/libgtest${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/libgmock${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/libgtest_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/libgmock_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON @@ -39,10 +39,10 @@ file(MAKE_DIRECTORY ${GTEST_INCLUDE_DIR}) file(MAKE_DIRECTORY ${GMOCK_INCLUDE_DIR}) ExternalProject_Get_Property(googletest BINARY_DIR) -set(GTEST_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${GTEST_LIB_POSTFIX}.a) -set(GMOCK_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${GTEST_LIB_POSTFIX}.a) -set(GTEST_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${GTEST_LIB_POSTFIX}.a) -set(GMOCK_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${GTEST_LIB_POSTFIX}.a) +set(GTEST_LIBRARY_PATH ${BINARY_DIR}/lib/libgtest${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(GMOCK_LIBRARY_PATH ${BINARY_DIR}/lib/libgmock${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(GTEST_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/libgtest_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(GMOCK_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/libgmock_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) # Prevent GoogleTest from overriding our compiler/linker options # when building with Visual Studio From 1a68d761a3060cfd7c8ead56b495df070a847a23 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 16:21:45 -0500 Subject: [PATCH 45/89] correct how to construct the path to the generated OpenCL lib --- cmake/Modules/OpenCLLoader.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake index a6aac1c603..290f15415a 100644 --- a/cmake/Modules/OpenCLLoader.cmake +++ b/cmake/Modules/OpenCLLoader.cmake @@ -20,7 +20,7 @@ ExternalProject_Add(opencl_loader -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - BUILD_BYPRODUCTS /lib/${CMAKE_FIND_LIBRARY_PREFIXES}OpenCL${OPENCL_LOADER_LIB_POSTFIX}.a + BUILD_BYPRODUCTS /libOpenCL${OPENCL_LOADER_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON @@ -34,7 +34,7 @@ set(OPENCL_LOADER_INCLUDE_DIR ${SOURCE_DIR}/inc) file(MAKE_DIRECTORY ${OPENCL_LOADER_INCLUDE_DIR}) ExternalProject_Get_Property(opencl_loader BINARY_DIR) - set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${OPENCL_LOADER_LIB_POSTFIX}.a") +set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${OPENCL_LOADER_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") find_package(Threads QUIET) if(NOT WIN32) From db95552f2b4c28c630c5c9a35b3a83b7892e990e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 16:42:30 -0500 Subject: [PATCH 46/89] update md5sum for updated archive (again) --- cmake/Modules/OpenCLLoader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake index 290f15415a..ecd9204d24 100644 --- a/cmake/Modules/OpenCLLoader.cmake +++ b/cmake/Modules/OpenCLLoader.cmake @@ -11,7 +11,7 @@ set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020 mark_as_advanced(OPENCL_LOADER_URL) ExternalProject_Add(opencl_loader URL ${OPENCL_LOADER_URL} - URL_MD5 d89ab1dc1121b96c9c37526b9db46df1 + URL_MD5 011cdcbd41030be94f3fced6d763a52a SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src" BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build" CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS} From e0e89c588ba0c907f60824806dcf5ea84e8090d5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 17:11:38 -0500 Subject: [PATCH 47/89] correct library prefix name use also for building libyaml --- cmake/Modules/YAML.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/YAML.cmake b/cmake/Modules/YAML.cmake index a080b566be..f2ba34e1b6 100644 --- a/cmake/Modules/YAML.cmake +++ b/cmake/Modules/YAML.cmake @@ -12,7 +12,7 @@ ExternalProject_Add(libyaml CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} --prefix= --disable-shared - BUILD_BYPRODUCTS /lib/${CMAKE_FIND_LIBRARY_PREFIXES}yaml.a + BUILD_BYPRODUCTS /lib/libyaml${CMAKE_STATIC_LIBRARY_SUFFIX} TEST_COMMAND "") ExternalProject_Get_Property(libyaml INSTALL_DIR) @@ -23,7 +23,7 @@ set(YAML_LIBRARY_DIR ${INSTALL_DIR}/lib) file(MAKE_DIRECTORY ${YAML_INCLUDE_DIR}) file(MAKE_DIRECTORY ${YAML_LIBRARY_DIR}) -set(YAML_LIBRARY_PATH ${INSTALL_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}yaml.a) +set(YAML_LIBRARY_PATH ${INSTALL_DIR}/lib/libyaml${CMAKE_STATIC_LIBRARY_SUFFIX}) add_library(Yaml::Yaml UNKNOWN IMPORTED) set_target_properties(Yaml::Yaml PROPERTIES From 4786391fad023faaa676de5957cd3ea7d3ead24f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Feb 2021 20:40:11 -0500 Subject: [PATCH 48/89] must explicitly register fix gpu --- cmake/Modules/Packages/GPU.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 70014c8782..e2586881ef 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -385,6 +385,7 @@ endif() set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}") # detect styles which have a GPU version RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES) +RegisterFixStyle(${GPU_SOURCES_DIR}/fix_gpu.h) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) From f467832e0f48d6aeb1c14fcbd3a30b27af3d537f Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 22 Feb 2021 01:29:50 -0500 Subject: [PATCH 49/89] Make PyLammps command history feature optional PyLammps so far has been saving a history for every executed command. This was originally added to allow writing out the commands of interactive PyLammps sessions as regular input scripts. This commit disables this history by default, which avoids the small, but rising memory consumption over time. It can be enabled and disabled with the enable_cmd_history property. There is also now a method to clear the history at any time. --- python/lammps/pylammps.py | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index 47a2a5a6ab..4bba9f5e94 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -400,6 +400,7 @@ class PyLammps(object): self.lmp = lammps(name=name,cmdargs=cmdargs,ptr=None,comm=comm) print("LAMMPS output is captured by PyLammps wrapper") self._cmd_history = [] + self._enable_cmd_history = False self.runs = [] def __del__(self): @@ -434,6 +435,24 @@ class PyLammps(object): """ self.lmp.file(file) + @property + def enable_cmd_history(self): + """ + :getter: Return whether command history is saved + :setter: Set if command history should be saved + :type: bool + """ + return self._enable_cmd_history + + @enable_cmd_history.setter + def enable_cmd_history(self, value): + """ + :getter: Return whether command history is saved + :setter: Set if command history should be saved + :type: bool + """ + self._enable_cmd_history = (value == True) + def write_script(self, filepath): """ Write LAMMPS script file containing all commands executed up until now @@ -445,18 +464,28 @@ class PyLammps(object): for cmd in self._cmd_history: print(cmd, file=f) + def clear_cmd_history(self): + """ + Clear LAMMPS command history up to this point + """ + self._cmd_history = [] + def command(self, cmd): """ Execute LAMMPS command - All commands executed will be stored in a command history which can be - written to a file using :py:meth:`PyLammps.write_script()` + If :py:attr:`PyLammps.enable_cmd_history` is set to ``True``, commands executed + will be recorded. The entire command history can be written to a file using + :py:meth:`PyLammps.write_script()`. To clear the command history, use + :py:meth:`PyLammps.clear_cmd_history()`. :param cmd: command string that should be executed :type: cmd: string """ self.lmp.command(cmd) - self._cmd_history.append(cmd) + + if self.enable_cmd_history: + self._cmd_history.append(cmd) def run(self, *args, **kwargs): """ From f3ee948450bbc63eef80c3bad1a2de382dda7b75 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Feb 2021 07:05:20 -0500 Subject: [PATCH 50/89] need to use column 1 in fix ave/time example --- doc/src/compute_temp_chunk.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/compute_temp_chunk.rst b/doc/src/compute_temp_chunk.rst index 77e2568fce..f1c34b42fa 100644 --- a/doc/src/compute_temp_chunk.rst +++ b/doc/src/compute_temp_chunk.rst @@ -153,7 +153,7 @@ temp/chunk calculation to a file is to use the :doc:`fix ave/time compute cc1 all chunk/atom molecule compute myChunk all temp/chunk cc1 temp - fix 1 all ave/time 100 1 100 c_myChunk file tmp.out mode vector + fix 1 all ave/time 100 1 100 c_myChunk[1] file tmp.out mode vector ---------- From ab05e9f5c1db913e32e1e2c866c1548524c0da61 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 23 Feb 2021 06:11:54 -0600 Subject: [PATCH 51/89] update the log files for the kim command examples --- .../kim/log.10Feb21.in.kim-ex.melt.clang.1 | 107 +++ .../kim/log.10Feb21.in.kim-ex.melt.clang.4 | 107 +++ .../log.10Feb21.in.kim-pm-property.clang.1 | 223 ++++++ .../log.10Feb21.in.kim-pm-property.clang.4 | 223 ++++++ .../log.10Feb21.in.kim-pm-query.melt.clang.1 | 210 ++++++ .../log.10Feb21.in.kim-pm-query.melt.clang.4 | 210 ++++++ .../kim/log.10Feb21.in.kim-pm.melt.clang.1 | 204 ++++++ .../kim/log.10Feb21.in.kim-pm.melt.clang.4 | 204 ++++++ examples/kim/log.10Feb21.in.kim-query.clang.1 | 655 ++++++++++++++++++ .../kim/log.10Feb21.in.kim-sm.melt.clang.1 | 208 ++++++ .../kim/log.10Feb21.in.kim-sm.melt.clang.4 | 208 ++++++ .../kim/log.10Feb21.in.lammps.melt.clang.1 | 88 +++ .../kim/log.10Feb21.in.lammps.melt.clang.4 | 88 +++ 13 files changed, 2735 insertions(+) create mode 100644 examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 create mode 100644 examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 create mode 100644 examples/kim/log.10Feb21.in.kim-pm-property.clang.1 create mode 100644 examples/kim/log.10Feb21.in.kim-pm-property.clang.4 create mode 100644 examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.1 create mode 100644 examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.4 create mode 100644 examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 create mode 100644 examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 create mode 100644 examples/kim/log.10Feb21.in.kim-query.clang.1 create mode 100644 examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 create mode 100644 examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 create mode 100644 examples/kim/log.10Feb21.in.lammps.melt.clang.1 create mode 100644 examples/kim/log.10Feb21.in.lammps.melt.clang.4 diff --git a/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 new file mode 100644 index 0000000000..dcf8727fc0 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.1 @@ -0,0 +1,107 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the example models provided with +# the kim-api package are installed. see the `./lib/kim/README` or +# `./lib/kim/Install.py` files for details on how to install these +# example models. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init LennardJones_Ar real +#=== BEGIN kim init ========================================== +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds + +This model has No mutable parameters. +#=== END kim init ============================================ + + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 88.600000) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.003 seconds + +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) +pair_coeff * * Ar +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 + +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.45 + ghost atom cutoff = 8.45 + binsize = 4.225, bins = 21 21 21 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 8.450000000000001 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +Performance: 3.036 ns/day, 7.906 hours/ns, 35.133 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 + +Nlocal: 32000.0 ave 32000 max 32000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 19911.0 ave 19911 max 19911 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 4.25375e+06 ave 4.25375e+06 max 4.25375e+06 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 4253750 +Ave neighs/atom = 132.92969 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 new file mode 100644 index 0000000000..476b66753b --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-ex.melt.clang.4 @@ -0,0 +1,107 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the example models provided with +# the kim-api package are installed. see the `./lib/kim/README` or +# `./lib/kim/Install.py` files for details on how to install these +# example models. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init LennardJones_Ar real +#=== BEGIN kim init ========================================== +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds + +This model has No mutable parameters. +#=== END kim init ============================================ + + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 88.600000) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.001 seconds + +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) +pair_coeff * * Ar +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 + +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.45 + ghost atom cutoff = 8.45 + binsize = 4.225, bins = 21 21 21 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 8.450000000000001 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +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 + +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 + +Nlocal: 8000.00 ave 8018 max 7967 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Nghost: 9131.00 ave 9164 max 9113 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 1.06344e+06 ave 1.06594e+06 max 1.05881e+06 min +Histogram: 1 0 0 0 0 0 1 0 0 2 + +Total # of neighbors = 4253750 +Ave neighs/atom = 132.92969 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 b/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 new file mode 100644 index 0000000000..a00085a486 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-pm-property.clang.1 @@ -0,0 +1,223 @@ +LAMMPS (10 Feb 2021) +# kim property example +# +# For detailed information of this example please refer to: +# `https://openkim.org/doc/evaluation/tutorial-lammps/` +# +# Description: +# +# This example is designed to calculate the cohesive energy corresponding to +# the equilibrium FCC lattice constant for +# `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` model for +# argon. The material properties computed in LAMMPS are represented as a +# standard KIM property instance format. (See +# `https://openkim.org/doc/schema/properties-framework/` and +# `https://lammps.sandia.gov/doc/kim_commands.html` for further details). +# Then the created property instance is written to a file named `results.edn` +# using the `kim property dump` command. +# +# Requirement: +# +# This example requires LAMMPS built with the Python 3.6 or later package +# installed. See the `https://lammps.sandia.gov/doc/python.html` doc page for +# more info on building LAMMPS with the version of Python on your system. +# After successfully building LAMMPS with Python, you need to install the +# kim-property Python package, See the +# `https://lammps.sandia.gov/doc/Build_extras.html#kim` doc page for +# further details. +# +# This example requires that the KIM Portable Model (PM) +# `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` +# is installed. This can be done with the command +# kim-api-collections-management install user LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. +# + +# Initialize interatomic potential (KIM model) and units +atom_style atomic + +# Set the OpenKIM model that will be used +kim init LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 metal +#=== BEGIN kim init ========================================== +units metal +neighbor 2.0 bin # Angstroms +timestep 1.0e-3 # picoseconds + +This model has 3 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | cutoff | "Double" | 1 + 2 | epsilon | "Double" | 1 + 3 | sigma | "Double" | 1 +#=== END kim init ============================================ + + +# the equilibrium lattice constant for the fcc structure +variable lattice_constant equal 5.248509056866169 + +# Periodic boundary conditions along all three dimensions +boundary p p p + +# Create an FCC lattice with the lattice spacing +# using a single conventional (orthogonal) unit cell +lattice fcc ${lattice_constant} +lattice fcc 5.24850905686617 +Lattice spacing in x,y,z = 5.2485091 5.2485091 5.2485091 +region box block 0 1 0 1 0 1 units lattice +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (5.2485091 5.2485091 5.2485091) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 4 atoms + create_atoms CPU = 0.000 seconds +mass 1 39.948 + +# Specify the KIM interactions +kim interactions Ar +#=== BEGIN kim interactions ================================== +pair_style kim LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 +pair_coeff * * Ar +#=== END kim interactions ==================================== + + +# Compute energy +run 0 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_126566794224_004a} is archived in OpenKIM~\cite{MO_126566794224_004, MD_498634107543_004, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_126566794224_004.bib} +\end{document} +} + +@Misc{MO_126566794224_004, + author = {Ellad Tadmor}, + title = {{L}ennard-{J}ones model (shifted) for {A}r with parameters from {B}ernardes (1958) (medium precision cutoff) v004}, + doi = {10.25950/9f98b989}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/9f98b989}}, + keywords = {OpenKIM, Model, MO_126566794224_004}, + publisher = {OpenKIM}, + year = 2020, +} + +@Misc{MD_498634107543_004, + author = {Ellad Tadmor}, + title = {{D}river for the {L}ennard-{J}ones model uniformly shifted to have zero energy at the cutoff radius v004}, + doi = {10.25950/bdffd6a6}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/9f98b989}}, + keywords = {OpenKIM, Model Driver, MD_498634107543_004}, + publisher = {OpenKIM}, + year = 2020, +} + +@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_126566794224_004a, + author = {Newton Bernardes}, + doi = {10.1103/PhysRev.112.1534}, + issue = {5}, + journal = {Physical Review}, + pages = {1534--1539}, + publisher = {American Physical Society}, + title = {Theory of Solid {N}e, {A}, {K}r, and {X}e at 0{K}}, + volume = {112}, + year = {1958}, +} +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 15.5 + ghost atom cutoff = 15.5 + binsize = 7.75, bins = 1 1 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 15.5 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +0.0% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +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 + +Nlocal: 4.00000 ave 4 max 4 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1094.00 ave 1094 max 1094 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 1712.00 ave 1712 max 1712 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1712 +Ave neighs/atom = 428.00000 +Neighbor list builds = 0 +Dangerous builds = 0 + +# Get cohesive energy +variable natoms equal "count(all)" +variable ecohesive equal "-pe/v_natoms" + +# Create a property instance +kim property create 1 cohesive-potential-energy-cubic-crystal +#=== kim property =========================================== + +# Set all the key-value pairs for this property instance +kim property modify 1 key short-name source-value 1 fcc key species source-value 1 Ar key a source-value ${lattice_constant} source-unit angstrom key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 source-value 2 1:3 0.0 0.5 0.5 source-value 3 1:3 0.5 0.0 0.5 source-value 4 1:3 0.5 0.5 0.0 key space-group source-value Fm-3m key cohesive-potential-energy source-value ${ecohesive} source-unit eV +kim property modify 1 key short-name source-value 1 fcc key species source-value 1 Ar key a source-value 5.24850905686617 source-unit angstrom key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 source-value 2 1:3 0.0 0.5 0.5 source-value 3 1:3 0.5 0.0 0.5 source-value 4 1:3 0.5 0.5 0.0 key space-group source-value Fm-3m key cohesive-potential-energy source-value ${ecohesive} source-unit eV +kim property modify 1 key short-name source-value 1 fcc key species source-value 1 Ar key a source-value 5.24850905686617 source-unit angstrom key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 source-value 2 1:3 0.0 0.5 0.5 source-value 3 1:3 0.5 0.0 0.5 source-value 4 1:3 0.5 0.5 0.0 key space-group source-value Fm-3m key cohesive-potential-energy source-value 0.0865055084950546 source-unit eV +#=== kim property =========================================== + +# Dump the results in a file +kim property dump "results.edn" +#=== kim property =========================================== +Total wall time: 0:00:00 diff --git a/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 b/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 new file mode 100644 index 0000000000..c3dd234af2 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-pm-property.clang.4 @@ -0,0 +1,223 @@ +LAMMPS (10 Feb 2021) +# kim property example +# +# For detailed information of this example please refer to: +# `https://openkim.org/doc/evaluation/tutorial-lammps/` +# +# Description: +# +# This example is designed to calculate the cohesive energy corresponding to +# the equilibrium FCC lattice constant for +# `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` model for +# argon. The material properties computed in LAMMPS are represented as a +# standard KIM property instance format. (See +# `https://openkim.org/doc/schema/properties-framework/` and +# `https://lammps.sandia.gov/doc/kim_commands.html` for further details). +# Then the created property instance is written to a file named `results.edn` +# using the `kim property dump` command. +# +# Requirement: +# +# This example requires LAMMPS built with the Python 3.6 or later package +# installed. See the `https://lammps.sandia.gov/doc/python.html` doc page for +# more info on building LAMMPS with the version of Python on your system. +# After successfully building LAMMPS with Python, you need to install the +# kim-property Python package, See the +# `https://lammps.sandia.gov/doc/Build_extras.html#kim` doc page for +# further details. +# +# This example requires that the KIM Portable Model (PM) +# `LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004` +# is installed. This can be done with the command +# kim-api-collections-management install user LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. +# + +# Initialize interatomic potential (KIM model) and units +atom_style atomic + +# Set the OpenKIM model that will be used +kim init LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 metal +#=== BEGIN kim init ========================================== +units metal +neighbor 2.0 bin # Angstroms +timestep 1.0e-3 # picoseconds + +This model has 3 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | cutoff | "Double" | 1 + 2 | epsilon | "Double" | 1 + 3 | sigma | "Double" | 1 +#=== END kim init ============================================ + + +# the equilibrium lattice constant for the fcc structure +variable lattice_constant equal 5.248509056866169 + +# Periodic boundary conditions along all three dimensions +boundary p p p + +# Create an FCC lattice with the lattice spacing +# using a single conventional (orthogonal) unit cell +lattice fcc ${lattice_constant} +lattice fcc 5.24850905686617 +Lattice spacing in x,y,z = 5.2485091 5.2485091 5.2485091 +region box block 0 1 0 1 0 1 units lattice +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (5.2485091 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 +mass 1 39.948 + +# Specify the KIM interactions +kim interactions Ar +#=== BEGIN kim interactions ================================== +pair_style kim LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004 +pair_coeff * * Ar +#=== END kim interactions ==================================== + + +# Compute energy +run 0 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_126566794224_004a} is archived in OpenKIM~\cite{MO_126566794224_004, MD_498634107543_004, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_126566794224_004.bib} +\end{document} +} + +@Misc{MO_126566794224_004, + author = {Ellad Tadmor}, + title = {{L}ennard-{J}ones model (shifted) for {A}r with parameters from {B}ernardes (1958) (medium precision cutoff) v004}, + doi = {10.25950/9f98b989}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/9f98b989}}, + keywords = {OpenKIM, Model, MO_126566794224_004}, + publisher = {OpenKIM}, + year = 2020, +} + +@Misc{MD_498634107543_004, + author = {Ellad Tadmor}, + title = {{D}river for the {L}ennard-{J}ones model uniformly shifted to have zero energy at the cutoff radius v004}, + doi = {10.25950/bdffd6a6}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/9f98b989}}, + keywords = {OpenKIM, Model Driver, MD_498634107543_004}, + publisher = {OpenKIM}, + year = 2020, +} + +@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_126566794224_004a, + author = {Newton Bernardes}, + doi = {10.1103/PhysRev.112.1534}, + issue = {5}, + journal = {Physical Review}, + pages = {1534--1539}, + publisher = {American Physical Society}, + title = {Theory of Solid {N}e, {A}, {K}r, and {X}e at 0{K}}, + volume = {112}, + year = {1958}, +} +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 15.5 + ghost atom cutoff = 15.5 + binsize = 7.75, bins = 1 1 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 15.5 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.165 | 3.165 | 3.165 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -0.34602203 0 -0.34602203 0.00061471244 +Loop time of 1.5e-06 on 4 procs for 0 steps with 4 atoms + +100.0% 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 | 0 | 0 | 0.0 | 0.00 +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 | | 1.5e-06 | | |100.00 + +Nlocal: 1.00000 ave 1 max 1 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 935.000 ave 935 max 935 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 428.000 ave 428 max 428 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1712 +Ave neighs/atom = 428.00000 +Neighbor list builds = 0 +Dangerous builds = 0 + +# Get cohesive energy +variable natoms equal "count(all)" +variable ecohesive equal "-pe/v_natoms" + +# Create a property instance +kim property create 1 cohesive-potential-energy-cubic-crystal +#=== kim property =========================================== + +# Set all the key-value pairs for this property instance +kim property modify 1 key short-name source-value 1 fcc key species source-value 1 Ar key a source-value ${lattice_constant} source-unit angstrom key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 source-value 2 1:3 0.0 0.5 0.5 source-value 3 1:3 0.5 0.0 0.5 source-value 4 1:3 0.5 0.5 0.0 key space-group source-value Fm-3m key cohesive-potential-energy source-value ${ecohesive} source-unit eV +kim property modify 1 key short-name source-value 1 fcc key species source-value 1 Ar key a source-value 5.24850905686617 source-unit angstrom key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 source-value 2 1:3 0.0 0.5 0.5 source-value 3 1:3 0.5 0.0 0.5 source-value 4 1:3 0.5 0.5 0.0 key space-group source-value Fm-3m key cohesive-potential-energy source-value ${ecohesive} source-unit eV +kim property modify 1 key short-name source-value 1 fcc key species source-value 1 Ar key a source-value 5.24850905686617 source-unit angstrom key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 source-value 2 1:3 0.0 0.5 0.5 source-value 3 1:3 0.5 0.0 0.5 source-value 4 1:3 0.5 0.5 0.0 key space-group source-value Fm-3m key cohesive-potential-energy source-value 0.0865055084950538 source-unit eV +#=== kim property =========================================== + +# Dump the results in a file +kim property dump "results.edn" +#=== kim property =========================================== +Total wall time: 0:00:00 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 new file mode 100644 index 0000000000..be12cda3da --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.1 @@ -0,0 +1,210 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the KIM Portable Model (PM) +# `SW_StillingerWeber_1985_Si__MO_405512056662_005` +# is installed. This can be done with the command +# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real +#=== BEGIN kim init ========================================== +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds + +This model has 9 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | A | "Double" | 1 + 2 | B | "Double" | 1 + 3 | p | "Double" | 1 + 4 | q | "Double" | 1 + 5 | sigma | "Double" | 1 + 6 | gamma | "Double" | 1 + 7 | cutoff | "Double" | 1 + 8 | lambda | "Double" | 1 + 9 | costheta0 | "Double" | 1 +#=== END kim init ============================================ + +kim query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Si"] units=["angstrom"] +#=== BEGIN kim-query ========================================= +variable a0 string "4.146581932902336" +#=== END kim-query =========================================== + + +lattice fcc ${a0} +lattice fcc 4.146581932902336 +Lattice spacing in x,y,z = 4.1465819 4.1465819 4.1465819 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (82.931639 82.931639 82.931639) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.004 seconds + +kim interactions Si +#=== BEGIN kim interactions ================================== +pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 +pair_coeff * * Si +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +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: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_405512056662_005a, MO_405512056662_005b} is archived in OpenKIM~\cite{MO_405512056662_005, MD_335816936951_004, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_405512056662_005.bib} +\end{document} +} + +@Misc{MO_405512056662_005, + author = {Amit K Singh}, + title = {{S}tillinger-{W}eber potential for {S}i due to {S}tillinger and {W}eber (1985) v005}, + doi = {10.25950/c74b293f}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model, MO_405512056662_005}, + publisher = {OpenKIM}, + year = 2018, +} + +@Misc{MD_335816936951_004, + author = {Mingjian Wen}, + title = {{S}tillinger-{W}eber ({SW}) {M}odel {D}river v004}, + doi = {10.25950/f3abd2d6}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model Driver, MD_335816936951_004}, + 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_405512056662_005a, + author = {Stillinger, Frank H. and Weber, Thomas A.}, + doi = {10.1103/PhysRevB.31.5262}, + issue = {8}, + journal = {Physical Review B}, + month = {Apr}, + pages = {5262--5271}, + publisher = {American Physical Society}, + title = {Computer simulation of local order in condensed phases of silicon}, + volume = {31}, + year = {1985}, +} + +@Book{MO_405512056662_005b, + author = {Tadmor, Ellad B. and Miller, Ronald E.}, + doi = {10.1017/CBO9781139003582}, + publisher = {Cambridge University Press}, + title = {Modeling Materials: {C}ontinuum, Atomistic and Multiscale Techniques}, + year = {2011}, +} +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 + master list distance cutoff = 4.07118 + ghost atom cutoff = 4.07118 + binsize = 2.03559, bins = 41 41 41 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 4.07118 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +Performance: 0.472 ns/day, 50.802 hours/ns, 5.468 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 + +Nlocal: 32000.0 ave 32000 max 32000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 9667.00 ave 9667 max 9667 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 450192.0 ave 450192 max 450192 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 450192 +Ave neighs/atom = 14.068500 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:21 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 new file mode 100644 index 0000000000..f982e79425 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-pm-query.melt.clang.4 @@ -0,0 +1,210 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the KIM Portable Model (PM) +# `SW_StillingerWeber_1985_Si__MO_405512056662_005` +# is installed. This can be done with the command +# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real +#=== BEGIN kim init ========================================== +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds + +This model has 9 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | A | "Double" | 1 + 2 | B | "Double" | 1 + 3 | p | "Double" | 1 + 4 | q | "Double" | 1 + 5 | sigma | "Double" | 1 + 6 | gamma | "Double" | 1 + 7 | cutoff | "Double" | 1 + 8 | lambda | "Double" | 1 + 9 | costheta0 | "Double" | 1 +#=== END kim init ============================================ + +kim query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Si"] units=["angstrom"] +#=== BEGIN kim-query ========================================= +variable a0 string "4.146581932902336" +#=== END kim-query =========================================== + + +lattice fcc ${a0} +lattice fcc 4.146581932902336 +Lattice spacing in x,y,z = 4.1465819 4.1465819 4.1465819 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (82.931639 82.931639 82.931639) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.001 seconds + +kim interactions Si +#=== BEGIN kim interactions ================================== +pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 +pair_coeff * * Si +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +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: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_405512056662_005a, MO_405512056662_005b} is archived in OpenKIM~\cite{MO_405512056662_005, MD_335816936951_004, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_405512056662_005.bib} +\end{document} +} + +@Misc{MO_405512056662_005, + author = {Amit K Singh}, + title = {{S}tillinger-{W}eber potential for {S}i due to {S}tillinger and {W}eber (1985) v005}, + doi = {10.25950/c74b293f}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model, MO_405512056662_005}, + publisher = {OpenKIM}, + year = 2018, +} + +@Misc{MD_335816936951_004, + author = {Mingjian Wen}, + title = {{S}tillinger-{W}eber ({SW}) {M}odel {D}river v004}, + doi = {10.25950/f3abd2d6}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model Driver, MD_335816936951_004}, + 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_405512056662_005a, + author = {Stillinger, Frank H. and Weber, Thomas A.}, + doi = {10.1103/PhysRevB.31.5262}, + issue = {8}, + journal = {Physical Review B}, + month = {Apr}, + pages = {5262--5271}, + publisher = {American Physical Society}, + title = {Computer simulation of local order in condensed phases of silicon}, + volume = {31}, + year = {1985}, +} + +@Book{MO_405512056662_005b, + author = {Tadmor, Ellad B. and Miller, Ronald E.}, + doi = {10.1017/CBO9781139003582}, + publisher = {Cambridge University Press}, + title = {Modeling Materials: {C}ontinuum, Atomistic and Multiscale Techniques}, + year = {2011}, +} +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 + master list distance cutoff = 4.07118 + ghost atom cutoff = 4.07118 + binsize = 2.03559, bins = 41 41 41 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 4.07118 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +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 + +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 + +Nlocal: 8000.00 ave 8029 max 7968 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Nghost: 4259.00 ave 4303 max 4202 min +Histogram: 1 0 0 0 0 0 2 0 0 1 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 112548.0 ave 113091 max 111995 min +Histogram: 1 0 0 1 0 0 0 1 0 1 + +Total # of neighbors = 450192 +Ave neighs/atom = 14.068500 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:07 diff --git a/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 new file mode 100644 index 0000000000..f27f8e6d83 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.1 @@ -0,0 +1,204 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the KIM Portable Model (PM) +# `SW_StillingerWeber_1985_Si__MO_405512056662_005` +# is installed. This can be done with the command +# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real +#=== BEGIN kim init ========================================== +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds + +This model has 9 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | A | "Double" | 1 + 2 | B | "Double" | 1 + 3 | p | "Double" | 1 + 4 | q | "Double" | 1 + 5 | sigma | "Double" | 1 + 6 | gamma | "Double" | 1 + 7 | cutoff | "Double" | 1 + 8 | lambda | "Double" | 1 + 9 | costheta0 | "Double" | 1 +#=== END kim init ============================================ + + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 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 + +kim interactions Si +#=== BEGIN kim interactions ================================== +pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 +pair_coeff * * Si +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +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: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_405512056662_005a, MO_405512056662_005b} is archived in OpenKIM~\cite{MO_405512056662_005, MD_335816936951_004, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_405512056662_005.bib} +\end{document} +} + +@Misc{MO_405512056662_005, + author = {Amit K Singh}, + title = {{S}tillinger-{W}eber potential for {S}i due to {S}tillinger and {W}eber (1985) v005}, + doi = {10.25950/c74b293f}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model, MO_405512056662_005}, + publisher = {OpenKIM}, + year = 2018, +} + +@Misc{MD_335816936951_004, + author = {Mingjian Wen}, + title = {{S}tillinger-{W}eber ({SW}) {M}odel {D}river v004}, + doi = {10.25950/f3abd2d6}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model Driver, MD_335816936951_004}, + 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_405512056662_005a, + author = {Stillinger, Frank H. and Weber, Thomas A.}, + doi = {10.1103/PhysRevB.31.5262}, + issue = {8}, + journal = {Physical Review B}, + month = {Apr}, + pages = {5262--5271}, + publisher = {American Physical Society}, + title = {Computer simulation of local order in condensed phases of silicon}, + volume = {31}, + year = {1985}, +} + +@Book{MO_405512056662_005b, + author = {Tadmor, Ellad B. and Miller, Ronald E.}, + doi = {10.1017/CBO9781139003582}, + publisher = {Cambridge University Press}, + title = {Modeling Materials: {C}ontinuum, Atomistic and Multiscale Techniques}, + year = {2011}, +} +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 + master list distance cutoff = 4.07118 + ghost atom cutoff = 4.07118 + binsize = 2.03559, bins = 44 44 44 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 4.07118 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +Performance: 0.487 ns/day, 49.291 hours/ns, 5.635 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 + +Nlocal: 32000.0 ave 32000 max 32000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 7760.00 ave 7760 max 7760 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 402352.0 ave 402352 max 402352 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 402352 +Ave neighs/atom = 12.573500 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:17 diff --git a/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 new file mode 100644 index 0000000000..2107e3f876 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-pm.melt.clang.4 @@ -0,0 +1,204 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the KIM Portable Model (PM) +# `SW_StillingerWeber_1985_Si__MO_405512056662_005` +# is installed. This can be done with the command +# kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see `https://openkim.org/doc/obtaining-models` for alternative options. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real +#=== BEGIN kim init ========================================== +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds + +This model has 9 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | A | "Double" | 1 + 2 | B | "Double" | 1 + 3 | p | "Double" | 1 + 4 | q | "Double" | 1 + 5 | sigma | "Double" | 1 + 6 | gamma | "Double" | 1 + 7 | cutoff | "Double" | 1 + 8 | lambda | "Double" | 1 + 9 | costheta0 | "Double" | 1 +#=== END kim init ============================================ + + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 88.600000) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.001 seconds + +kim interactions Si +#=== BEGIN kim interactions ================================== +pair_style kim SW_StillingerWeber_1985_Si__MO_405512056662_005 +pair_coeff * * Si +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +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: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_405512056662_005a, MO_405512056662_005b} is archived in OpenKIM~\cite{MO_405512056662_005, MD_335816936951_004, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_405512056662_005.bib} +\end{document} +} + +@Misc{MO_405512056662_005, + author = {Amit K Singh}, + title = {{S}tillinger-{W}eber potential for {S}i due to {S}tillinger and {W}eber (1985) v005}, + doi = {10.25950/c74b293f}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model, MO_405512056662_005}, + publisher = {OpenKIM}, + year = 2018, +} + +@Misc{MD_335816936951_004, + author = {Mingjian Wen}, + title = {{S}tillinger-{W}eber ({SW}) {M}odel {D}river v004}, + doi = {10.25950/f3abd2d6}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/c74b293f}}, + keywords = {OpenKIM, Model Driver, MD_335816936951_004}, + 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_405512056662_005a, + author = {Stillinger, Frank H. and Weber, Thomas A.}, + doi = {10.1103/PhysRevB.31.5262}, + issue = {8}, + journal = {Physical Review B}, + month = {Apr}, + pages = {5262--5271}, + publisher = {American Physical Society}, + title = {Computer simulation of local order in condensed phases of silicon}, + volume = {31}, + year = {1985}, +} + +@Book{MO_405512056662_005b, + author = {Tadmor, Ellad B. and Miller, Ronald E.}, + doi = {10.1017/CBO9781139003582}, + publisher = {Cambridge University Press}, + title = {Modeling Materials: {C}ontinuum, Atomistic and Multiscale Techniques}, + year = {2011}, +} +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 + master list distance cutoff = 4.07118 + ghost atom cutoff = 4.07118 + binsize = 2.03559, bins = 44 44 44 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair kim, perpetual + attributes: full, newton off, cut 4.07118 + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +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 + +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 + +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 + +Nlocal: 8000.00 ave 8014 max 7988 min +Histogram: 1 1 0 0 0 0 1 0 0 1 +Nghost: 3374.75 ave 3389 max 3361 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 100588.0 ave 100856 max 100392 min +Histogram: 1 0 1 0 1 0 0 0 0 1 + +Total # of neighbors = 402352 +Ave neighs/atom = 12.573500 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:04 diff --git a/examples/kim/log.10Feb21.in.kim-query.clang.1 b/examples/kim/log.10Feb21.in.kim-query.clang.1 new file mode 100644 index 0000000000..01fc8cd7dd --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-query.clang.1 @@ -0,0 +1,655 @@ +LAMMPS (10 Feb 2021) +# kim query example +# +# Requirement: +# +# This example requires LAMMPS is built with KIM package. A requirement for +# the KIM package, is the KIM API library that must be downloaded from the +# OpenKIM website and installed before LAMMPS is compiled. The 'kim query' +# command requires the libcurl library to be installed. See the +# `https://lammps.sandia.gov/doc/Build_extras.html#kim` doc page for further +# details +# +# This example requires that the KIM Models +# `EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005` +# and +# `EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000` +# are installed. +# +# This can be done with the commands +# `kim-api-collections-management install user `EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005` +# `kim-api-collections-management install user `EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000` +# +# If these commands do not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# Or, see https://openkim.org/doc/obtaining-models for alternative options. +# + +# ----------------------------------------------- +# Get an equilibrium fcc crystal lattice constant +# ----------------------------------------------- +kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal +#=== BEGIN kim init ========================================== +units metal +neighbor 2.0 bin # Angstroms +timestep 1.0e-3 # picoseconds + +This model has 6 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | cutoff | "Double" | 1 + 2 | deltaRho | "Double" | 1 + 3 | deltaR | "Double" | 1 + 4 | embeddingData | "Double" | 500 + 5 | rPhiData | "Double" | 500 + 6 | densityData | "Double" | 500 +#=== END kim init ============================================ + +kim query latconst_1 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] +#=== BEGIN kim-query ========================================= +variable latconst_1 string "4.032082033157349" +#=== END kim-query =========================================== + +print "FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = ${latconst_1}" +FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = 4.032082033157349 +# Get the lattice contant from a different model +kim query latconst_2 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005] +#=== BEGIN kim-query ========================================= +variable latconst_2 string "4.024845376610756" +#=== END kim-query =========================================== + +print "FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = ${latconst_2}" +FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = 4.024845376610756 +clear + + +# ----------------------------------------------- +# Get an equilibrium fcc crystal lattice constant +# ----------------------------------------------- +kim query latconst_1 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005] +#=== BEGIN kim-query ========================================= +variable latconst_1 string "4.032082033157349" +#=== END kim-query =========================================== + +kim query latconst_2 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005] +#=== BEGIN kim-query ========================================= +variable latconst_2 string "4.024845376610756" +#=== END kim-query =========================================== + +print "FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = ${latconst_1}" +FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = 4.032082033157349 +print "FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = ${latconst_2}" +FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = 4.024845376610756 +clear + + +# ----------------------------------------------- +# Get an equilibrium hcp crystal lattice constant +# ----------------------------------------------- +kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal +#=== BEGIN kim init ========================================== +units metal +neighbor 2.0 bin # Angstroms +timestep 1.0e-3 # picoseconds + +This model has 6 mutable parameters. + No. | Parameter name | data type | extent +----------------------------------------------------- + 1 | cutoff | "Double" | 1 + 2 | deltaRho | "Double" | 1 + 3 | deltaR | "Double" | 1 + 4 | embeddingData | "Double" | 10000 + 5 | rPhiData | "Double" | 10000 + 6 | densityData | "Double" | 10000 +#=== END kim init ============================================ + +kim query latconst split get_lattice_constant_hexagonal crystal=["hcp"] species=["Zr"] units=["angstrom"] +#=== BEGIN kim-query ========================================= +variable latconst_1 string 3.234055244384789 +variable latconst_2 string 5.167650199630013 +#=== END kim-query =========================================== + +print "HCP lattice constants = ${latconst_1}, ${latconst_2}" +HCP lattice constants = 3.234055244384789, 5.167650199630013 +clear + + +# ----------------------------------------------- +# Query for KIM models from openkim.org +# Get all the EAM models that support Al +# ----------------------------------------------- +kim query model index get_available_models species=[Al] potential_type=[eam] +#=== BEGIN kim-query ========================================= +variable model index "EAM_CubicNaturalSpline_ErcolessiAdams_1994_Al__MO_800509458712_002" "EAM_Dynamo_AngeloMoodyBaskes_1995_NiAlH__MO_418978237058_005" "EAM_Dynamo_CaiYe_1996_AlCu__MO_942551040047_005" "EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005" "EAM_Dynamo_FarkasJones_1996_NbTiAl__MO_042691367780_000" "EAM_Dynamo_JacobsenNorskovPuska_1987_Al__MO_411692133366_000" "EAM_Dynamo_LandaWynblattSiegel_2000_AlPb__MO_699137396381_005" "EAM_Dynamo_LiuAdams_1998_AlMg__MO_019873715786_000" "EAM_Dynamo_LiuErcolessiAdams_2004_Al__MO_051157671505_000" "EAM_Dynamo_LiuLiuBorucki_1999_AlCu__MO_020851069572_000" "EAM_Dynamo_LiuOhotnickyAdams_1997_AlMg__MO_559870613549_000" "EAM_Dynamo_MendelevAstaRahman_2009_AlMg__MO_658278549784_005" "EAM_Dynamo_MendelevFangYe_2015_AlSm__MO_338600200739_000" "EAM_Dynamo_MendelevKramerBecker_2008_Al__MO_106969701023_005" "EAM_Dynamo_MendelevSrolovitzAckland_2005_AlFe__MO_577453891941_005" "EAM_Dynamo_MishinFarkasMehl_1999_Al__MO_651801486679_005" "EAM_Dynamo_MishinMehlPapaconstantopoulos_2002_NiAl__MO_109933561507_005" "EAM_Dynamo_Mishin_2004_NiAl__MO_101214310689_005" "EAM_Dynamo_PunMishin_2009_NiAl__MO_751354403791_005" "EAM_Dynamo_PunYamakovMishin_2013_AlCo__MO_678952612413_000" "EAM_Dynamo_PunYamakovMishin_2013_NiAlCo__MO_826591359508_000" "EAM_Dynamo_SchopfBrommerFrigan_2012_AlMnPd__MO_137572817842_000" "EAM_Dynamo_SturgeonLaird_2000_Al__MO_120808805541_005" "EAM_Dynamo_VailheFarkas_1997_CoAl__MO_284963179498_005" "EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005" "EAM_Dynamo_Zhakhovsky_2009_Al__MO_519613893196_000" "EAM_Dynamo_ZhouJohnsonWadley_2004NISTretabulation_Al__MO_060567868558_000" "EAM_Dynamo_ZhouJohnsonWadley_2004_Al__MO_131650261510_005" "EAM_Dynamo_ZhouWadleyJohnson_2001_Al__MO_049243498555_000" "EAM_Dynamo_ZopeMishin_2003_Al__MO_664470114311_005" "EAM_Dynamo_ZopeMishin_2003_TiAl__MO_117656786760_005" "EAM_ErcolessiAdams_1994_Al__MO_324507536345_003" "EAM_IMD_BrommerGaehler_2006A_AlNiCo__MO_122703700223_003" "EAM_IMD_BrommerGaehler_2006B_AlNiCo__MO_128037485276_003" "EAM_IMD_SchopfBrommerFrigan_2012_AlMnPd__MO_878712978062_003" "EAM_QuinticClampedSpline_ErcolessiAdams_1994_Al__MO_450093727396_002" "EAM_QuinticHermiteSpline_ErcolessiAdams_1994_Al__MO_781138671863_002" "EMT_Asap_Standard_JacobsenStoltzeNorskov_1996_AlAgAuCuNiPdPt__MO_115316750986_001" "EMT_Asap_Standard_JacobsenStoltzeNorskov_1996_Al__MO_623376124862_001" +#=== END kim-query =========================================== + +label model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_CubicNaturalSpline_ErcolessiAdams_1994_Al__MO_800509458712_002] +#=== BEGIN kim-query ========================================= +variable latconst string "4.032082748413087" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_CubicNaturalSpline_ErcolessiAdams_1994_Al__MO_800509458712_002) = 4.032082748413087 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_AngeloMoodyBaskes_1995_NiAlH__MO_418978237058_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050000071525574" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_AngeloMoodyBaskes_1995_NiAlH__MO_418978237058_005) = 4.050000071525574 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_CaiYe_1996_AlCu__MO_942551040047_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.049763545393944" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_CaiYe_1996_AlCu__MO_942551040047_005) = 4.049763545393944 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.032082033157349" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005) = 4.032082033157349 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_FarkasJones_1996_NbTiAl__MO_042691367780_000] +#=== BEGIN kim-query ========================================= +variable latconst string "3.869337007403374" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_FarkasJones_1996_NbTiAl__MO_042691367780_000) = 3.869337007403374 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_JacobsenNorskovPuska_1987_Al__MO_411692133366_000] +#=== BEGIN kim-query ========================================= +variable latconst string "3.987558534741402" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_JacobsenNorskovPuska_1987_Al__MO_411692133366_000) = 3.987558534741402 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_LandaWynblattSiegel_2000_AlPb__MO_699137396381_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.031036108732224" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_LandaWynblattSiegel_2000_AlPb__MO_699137396381_005) = 4.031036108732224 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_LiuAdams_1998_AlMg__MO_019873715786_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.03203821182251" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_LiuAdams_1998_AlMg__MO_019873715786_000) = 4.03203821182251 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_LiuErcolessiAdams_2004_Al__MO_051157671505_000] +#=== BEGIN kim-query ========================================= +variable latconst string "9.5" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_LiuErcolessiAdams_2004_Al__MO_051157671505_000) = 9.5 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_LiuLiuBorucki_1999_AlCu__MO_020851069572_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.032073378562927" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_LiuLiuBorucki_1999_AlCu__MO_020851069572_000) = 4.032073378562927 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_LiuOhotnickyAdams_1997_AlMg__MO_559870613549_000] +#=== BEGIN kim-query ========================================= +variable latconst string "8.5" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_LiuOhotnickyAdams_1997_AlMg__MO_559870613549_000) = 8.5 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_MendelevAstaRahman_2009_AlMg__MO_658278549784_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.045270472764969" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_MendelevAstaRahman_2009_AlMg__MO_658278549784_005) = 4.045270472764969 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_MendelevFangYe_2015_AlSm__MO_338600200739_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.040926471352577" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_MendelevFangYe_2015_AlSm__MO_338600200739_000) = 4.040926471352577 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_MendelevKramerBecker_2008_Al__MO_106969701023_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.045259781181811" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_MendelevKramerBecker_2008_Al__MO_106969701023_005) = 4.045259781181811 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_MendelevSrolovitzAckland_2005_AlFe__MO_577453891941_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.03330184519291" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_MendelevSrolovitzAckland_2005_AlFe__MO_577453891941_005) = 4.03330184519291 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_MishinFarkasMehl_1999_Al__MO_651801486679_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050004702806472" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_MishinFarkasMehl_1999_Al__MO_651801486679_005) = 4.050004702806472 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_MishinMehlPapaconstantopoulos_2002_NiAl__MO_109933561507_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.051526293158533" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_MishinMehlPapaconstantopoulos_2002_NiAl__MO_109933561507_005) = 4.051526293158533 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_Mishin_2004_NiAl__MO_101214310689_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.049999862909317" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_Mishin_2004_NiAl__MO_101214310689_005) = 4.049999862909317 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_PunMishin_2009_NiAl__MO_751354403791_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050000071525574" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_PunMishin_2009_NiAl__MO_751354403791_005) = 4.050000071525574 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_PunYamakovMishin_2013_AlCo__MO_678952612413_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.05000014603138" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_PunYamakovMishin_2013_AlCo__MO_678952612413_000) = 4.05000014603138 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_PunYamakovMishin_2013_NiAlCo__MO_826591359508_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.05000014603138" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_PunYamakovMishin_2013_NiAlCo__MO_826591359508_000) = 4.05000014603138 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_SchopfBrommerFrigan_2012_AlMnPd__MO_137572817842_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.210718545317654" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_SchopfBrommerFrigan_2012_AlMnPd__MO_137572817842_000) = 4.210718545317654 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_SturgeonLaird_2000_Al__MO_120808805541_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050010219216347" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_SturgeonLaird_2000_Al__MO_120808805541_005) = 4.050010219216347 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_VailheFarkas_1997_CoAl__MO_284963179498_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.049696564674378" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_VailheFarkas_1997_CoAl__MO_284963179498_005) = 4.049696564674378 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.024845376610756" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_WineyKubotaGupta_2010_Al__MO_149316865608_005) = 4.024845376610756 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_Zhakhovsky_2009_Al__MO_519613893196_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.031999975442885" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_Zhakhovsky_2009_Al__MO_519613893196_000) = 4.031999975442885 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ZhouJohnsonWadley_2004NISTretabulation_Al__MO_060567868558_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050199627876282" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_ZhouJohnsonWadley_2004NISTretabulation_Al__MO_060567868558_000) = 4.050199627876282 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ZhouJohnsonWadley_2004_Al__MO_131650261510_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050180745124819" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_ZhouJohnsonWadley_2004_Al__MO_131650261510_005) = 4.050180745124819 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ZhouWadleyJohnson_2001_Al__MO_049243498555_000] +#=== BEGIN kim-query ========================================= +variable latconst string "4.081654928624631" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_ZhouWadleyJohnson_2001_Al__MO_049243498555_000) = 4.081654928624631 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ZopeMishin_2003_Al__MO_664470114311_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.050000011920929" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_ZopeMishin_2003_Al__MO_664470114311_005) = 4.050000011920929 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ZopeMishin_2003_TiAl__MO_117656786760_005] +#=== BEGIN kim-query ========================================= +variable latconst string "4.049999445676804" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_Dynamo_ZopeMishin_2003_TiAl__MO_117656786760_005) = 4.049999445676804 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_ErcolessiAdams_1994_Al__MO_324507536345_003] +#=== BEGIN kim-query ========================================= +variable latconst string "4.032082714140415" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_ErcolessiAdams_1994_Al__MO_324507536345_003) = 4.032082714140415 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_IMD_BrommerGaehler_2006A_AlNiCo__MO_122703700223_003] +#=== BEGIN kim-query ========================================= +variable latconst string "4.128871455788613" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_IMD_BrommerGaehler_2006A_AlNiCo__MO_122703700223_003) = 4.128871455788613 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_IMD_BrommerGaehler_2006B_AlNiCo__MO_128037485276_003] +#=== BEGIN kim-query ========================================= +variable latconst string "4.073718130588532" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_IMD_BrommerGaehler_2006B_AlNiCo__MO_128037485276_003) = 4.073718130588532 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_IMD_SchopfBrommerFrigan_2012_AlMnPd__MO_878712978062_003] +#=== BEGIN kim-query ========================================= +variable latconst string "4.210700303316115" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_IMD_SchopfBrommerFrigan_2012_AlMnPd__MO_878712978062_003) = 4.210700303316115 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_QuinticClampedSpline_ErcolessiAdams_1994_Al__MO_450093727396_002] +#=== BEGIN kim-query ========================================= +variable latconst string "4.032082897424699" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_QuinticClampedSpline_ErcolessiAdams_1994_Al__MO_450093727396_002) = 4.032082897424699 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_QuinticHermiteSpline_ErcolessiAdams_1994_Al__MO_781138671863_002] +#=== BEGIN kim-query ========================================= +variable latconst string "4.03208246231079" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EAM_QuinticHermiteSpline_ErcolessiAdams_1994_Al__MO_781138671863_002) = 4.03208246231079 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EMT_Asap_Standard_JacobsenStoltzeNorskov_1996_AlAgAuCuNiPdPt__MO_115316750986_001] +#=== BEGIN kim-query ========================================= +variable latconst string "3.994616635143757" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EMT_Asap_Standard_JacobsenStoltzeNorskov_1996_AlAgAuCuNiPdPt__MO_115316750986_001) = 3.994616635143757 +next model +jump SELF model_loop +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] +kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EMT_Asap_Standard_JacobsenStoltzeNorskov_1996_Al__MO_623376124862_001] +#=== BEGIN kim-query ========================================= +variable latconst string "3.994608342647553" +#=== END kim-query =========================================== + +print "FCC lattice constant (${model}) = ${latconst}" +FCC lattice constant (EMT_Asap_Standard_JacobsenStoltzeNorskov_1996_Al__MO_623376124862_001) = 3.994608342647553 +next model +jump SELF model_loop +clear + + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Model originally published in \cite{MO_123629422045_005a} is archived in OpenKIM~\cite{MO_123629422045_005, MD_120291908751_005, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-MO_123629422045_005.bib} +\end{document} +} + +@Misc{MO_123629422045_005, + author = {Ryan S. Elliott}, + title = {{EAM} potential ({LAMMPS} cubic hermite tabulation) for {A}l developed by {E}rcolessi and {A}dams (1994) v005}, + doi = {10.25950/7cd2a6ab}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/7cd2a6ab}}, + keywords = {OpenKIM, Model, MO_123629422045_005}, + 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/7cd2a6ab}}, + 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_123629422045_005a, + author = {F. Ercolessi and J. B. Adams}, + doi = {10.1209/0295-5075/26/8/005}, + journal = {Europhysics Letters}, + number = {8}, + pages = {583}, + title = {Interatomic Potentials from First-Principles Calculations: {T}he Force-Matching Method}, + 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} +} + +@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 diff --git a/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 new file mode 100644 index 0000000000..bb00b7fec4 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.1 @@ -0,0 +1,208 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the KIM Simulator Model (PM) +# `Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000` +# is installed. This can be done with the command +# kim-api-collections-management install user Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# See `https://openkim.org/doc/obtaining-models` for alternative options. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real +#=== BEGIN kim init ========================================== +# Using KIM Simulator Model : Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 +# For Simulator : LAMMPS 28 Feb 2019 +# Running on : LAMMPS 10 Feb 2021 +# +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds +atom_style charge +neigh_modify one 4000 +#=== END kim init ============================================ + + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 88.600000) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.003 seconds + +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 +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +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: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Simulator Model originally published in \cite{SM_107643900657_000a} is archived in OpenKIM~\cite{SM_107643900657_000, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-SM_107643900657_000.bib} +\end{document} +} + +@Misc{SM_107643900657_000, + author = {Ellad Tadmor}, + title = {{LAMMPS} {R}eax{FF} potential for {RDX} ({C}-{H}-{N}-{O}) systems developed by {S}trachan et al. (2003) v000}, + doi = {10.25950/acd3fc89}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/acd3fc89}}, + keywords = {OpenKIM, Simulator Model, SM_107643900657_000}, + publisher = {OpenKIM}, + year = 2019, +} + +@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{SM_107643900657_000a, + author = {Strachan, Alejandro and van Duin, Adri C. T. and Chakraborty, Debashis and Dasgupta, Siddharth and Goddard, William A.}, + doi = {10.1103/PhysRevLett.91.098301}, + issue = {9}, + journal = {Physical Review Letters}, + month = {Aug}, + numpages = {4}, + pages = {098301}, + publisher = {American Physical Society}, + title = {Shock Waves in High-Energy Materials: {T}he Initial Chemical Events in Nitramine {RDX}}, + volume = {91}, + year = {2003}, +} +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +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: 4000, page size: 100000 + master list distance cutoff = 10.3 + ghost atom cutoff = 10.3 + binsize = 5.15, bins = 18 18 18 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +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 + +Performance: 0.215 ns/day, 111.818 hours/ns, 2.484 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 + +Nlocal: 32000.0 ave 32000 max 32000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 26825.0 ave 26825 max 26825 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3.73924e+06 ave 3.73924e+06 max 3.73924e+06 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 3739236 +Ave neighs/atom = 116.85112 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:41 diff --git a/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 new file mode 100644 index 0000000000..90c8adc6b0 --- /dev/null +++ b/examples/kim/log.10Feb21.in.kim-sm.melt.clang.4 @@ -0,0 +1,208 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt +# +# This example requires that the KIM Simulator Model (PM) +# `Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000` +# is installed. This can be done with the command +# kim-api-collections-management install user Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 +# If this command does not work, you may need to setup your PATH to find the utility. +# If you installed the kim-api using the LAMMPS CMake build, you can do the following +# (where the current working directory is assumed to be the LAMMPS build directory) +# source ./kim_build-prefix/bin/kim-api-activate +# If you installed the kim-api using the LAMMPS Make build, you can do the following +# (where the current working directory is assumed to be the LAMMPS src directory) +# source ../lib/kim/installed-kim-api-X.Y.Z/bin/kim-api-activate +# (where you should relplace X.Y.Z with the appropriate kim-api version number). +# +# See `https://openkim.org/doc/obtaining-models` for alternative options. +# + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +kim init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real +#=== BEGIN kim init ========================================== +# Using KIM Simulator Model : Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 +# For Simulator : LAMMPS 28 Feb 2019 +# Running on : LAMMPS 10 Feb 2021 +# +units real +neighbor 2.0 bin # Angstroms +timestep 1.0 # femtoseconds +atom_style charge +neigh_modify one 4000 +#=== END kim init ============================================ + + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 88.600000) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.001 seconds + +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 +#=== END kim interactions ==================================== + + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +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: + +- @Comment +{ +\documentclass{article} +\usepackage{url} +\begin{document} +This Simulator Model originally published in \cite{SM_107643900657_000a} is archived in OpenKIM~\cite{SM_107643900657_000, tadmor:elliott:2011, elliott:tadmor:2011}. +\bibliographystyle{vancouver} +\bibliography{kimcite-SM_107643900657_000.bib} +\end{document} +} + +@Misc{SM_107643900657_000, + author = {Ellad Tadmor}, + title = {{LAMMPS} {R}eax{FF} potential for {RDX} ({C}-{H}-{N}-{O}) systems developed by {S}trachan et al. (2003) v000}, + doi = {10.25950/acd3fc89}, + howpublished = {OpenKIM, \url{https://doi.org/10.25950/acd3fc89}}, + keywords = {OpenKIM, Simulator Model, SM_107643900657_000}, + publisher = {OpenKIM}, + year = 2019, +} + +@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{SM_107643900657_000a, + author = {Strachan, Alejandro and van Duin, Adri C. T. and Chakraborty, Debashis and Dasgupta, Siddharth and Goddard, William A.}, + doi = {10.1103/PhysRevLett.91.098301}, + issue = {9}, + journal = {Physical Review Letters}, + month = {Aug}, + numpages = {4}, + pages = {098301}, + publisher = {American Physical Society}, + title = {Shock Waves in High-Energy Materials: {T}he Initial Chemical Events in Nitramine {RDX}}, + volume = {91}, + year = {2003}, +} +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +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: 4000, page size: 100000 + master list distance cutoff = 10.3 + ghost atom cutoff = 10.3 + binsize = 5.15, bins = 18 18 18 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +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 + +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 + +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 + +Nlocal: 8000.00 ave 8010 max 7993 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Nghost: 12605.0 ave 12612 max 12595 min +Histogram: 1 0 0 0 1 0 0 0 0 2 +Neighs: 1.00097e+06 ave 1.00187e+06 max 1.0006e+06 min +Histogram: 2 1 0 0 0 0 0 0 0 1 + +Total # of neighbors = 4003876 +Ave neighs/atom = 125.12113 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:15 diff --git a/examples/kim/log.10Feb21.in.lammps.melt.clang.1 b/examples/kim/log.10Feb21.in.lammps.melt.clang.1 new file mode 100644 index 0000000000..eb2922f413 --- /dev/null +++ b/examples/kim/log.10Feb21.in.lammps.melt.clang.1 @@ -0,0 +1,88 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +units real + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 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 + +pair_style lj/cut 8.1500 +pair_coeff 1 1 0.0104 3.4000 + +#pair_style kim LennardJones_Ar +#pair_coeff * * Ar + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 + +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.45 + ghost atom cutoff = 8.45 + binsize = 4.225, bins = 21 21 21 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +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 + +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 + +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 + +Nlocal: 32000.0 ave 32000 max 32000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 19911.0 ave 19911 max 19911 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1.96027e+06 ave 1.96027e+06 max 1.96027e+06 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1960266 +Ave neighs/atom = 61.258313 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:01 diff --git a/examples/kim/log.10Feb21.in.lammps.melt.clang.4 b/examples/kim/log.10Feb21.in.lammps.melt.clang.4 new file mode 100644 index 0000000000..b8751c4e41 --- /dev/null +++ b/examples/kim/log.10Feb21.in.lammps.melt.clang.4 @@ -0,0 +1,88 @@ +LAMMPS (10 Feb 2021) +# 3d Lennard-Jones melt + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable xx equal 20*1 +variable yy equal 20*$y +variable yy equal 20*1 +variable zz equal 20*$z +variable zz equal 20*1 + +units real + +lattice fcc 4.4300 +Lattice spacing in x,y,z = 4.4300000 4.4300000 4.4300000 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +region box block 0 20 0 ${yy} 0 ${zz} +region box block 0 20 0 20 0 ${zz} +region box block 0 20 0 20 0 20 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (88.600000 88.600000 88.600000) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 32000 atoms + create_atoms CPU = 0.001 seconds + +pair_style lj/cut 8.1500 +pair_coeff 1 1 0.0104 3.4000 + +#pair_style kim LennardJones_Ar +#pair_coeff * * Ar + +mass 1 39.95 +velocity all create 200.0 232345 loop geom + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +fix 1 all nve +#fix 1 all npt temp 1.0 1.0 1.0 iso 1.0 1.0 3.0 + +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.45 + ghost atom cutoff = 8.45 + binsize = 4.225, bins = 21 21 21 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +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 + +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 + +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 + +Nlocal: 8000.00 ave 8012 max 7989 min +Histogram: 1 0 0 0 2 0 0 0 0 1 +Nghost: 9131.00 ave 9142 max 9119 min +Histogram: 1 0 0 0 0 2 0 0 0 1 +Neighs: 490066.0 ave 491443 max 489273 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 1960266 +Ave neighs/atom = 61.258313 +Neighbor list builds = 3 +Dangerous builds = 0 +Total wall time: 0:00:00 From a73f6f58ad75b9d68b1c13863ace10aef7d5bc71 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Mon, 15 Feb 2021 13:12:40 -0600 Subject: [PATCH 52/89] Extra check to prevent illegal neighbor request esp, in unit conversion mode --- src/KIM/pair_kim.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 2f1fb9da3e..5fa93b09d0 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -601,6 +601,8 @@ void PairKIM::init_style() // set cutoff neighbor->requests[irequest]->cut = 1; + if (kim_cutoff_values[i] <= neighbor->skin) + error->all(FLERR,"Illegal neighbor request (force cutoff <= skin)"); neighbor->requests[irequest]->cutoff = kim_cutoff_values[i] + neighbor->skin; } From 21a60235eb4c604a1645562b588b956b5ada543f Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 16 Feb 2021 13:57:55 -0600 Subject: [PATCH 53/89] Fix a wrong indexing for optional explicit argument --- src/KIM/kim_param.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 1ebbed62f6..161e8c9fc2 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -367,7 +367,7 @@ void KimParam::command(int narg, char **arg) varsname.resize(1); varsname[0] = varname; // Default explicit (optional) formatarg - } else if (i - 1 + nvars < narg) { + } else if (i - 1 + nvars - 1 < narg) { varsname.resize(nvars); --i; for (int j = 0; j < nvars; ++j, ++i) varsname[j] = arg[i]; From c139adf95be4866be30a571d99b61082ee3ecc5a Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 16 Feb 2021 15:12:56 -0600 Subject: [PATCH 54/89] Fix the index for get argument and correct the string variable format --- src/KIM/kim_param.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 161e8c9fc2..04e2bdceca 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -346,6 +346,8 @@ 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") + error->all(FLERR, "Illegal variable name in 'kim param get'"); } else { std::string msg("Wrong number of arguments in 'kim param get' "); msg += "command.\nThe LAMMPS variable name is mandatory"; @@ -362,15 +364,22 @@ void KimParam::command(int narg, char **arg) for (int j = 0, k = nlbound; j < nvars; ++j, ++k) { varsname[j] = fmt::format("{}_{}", varname, k); } + ++i; } else if (strcmp(arg[i], "list") == 0) { list_requested = true; varsname.resize(1); varsname[0] = varname; + ++i; // Default explicit (optional) formatarg } else if (i - 1 + nvars - 1 < narg) { varsname.resize(nvars); --i; - for (int j = 0; j < nvars; ++j, ++i) varsname[j] = arg[i]; + for (int j = 0; j < nvars; ++j, ++i) { + varsname[j] = 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; } @@ -396,8 +405,7 @@ void KimParam::command(int narg, char **arg) ++i; } else { if ((strcmp(arg[i], "list") == 0) || - (strcmp(arg[i], "explicit") == 0)) - ++i; + (strcmp(arg[i], "explicit") == 0)) ++i; varsname[0] = varname; } @@ -427,7 +435,7 @@ void KimParam::command(int narg, char **arg) str += fmt::format(" {}", V); } - auto setcmd = fmt::format("{} string {}", varsname[0], str); + auto setcmd = fmt::format("{} string \"{}\"", varsname[0], str); input->variable->set(setcmd); input->write_echo(fmt::format("variable {}\n", setcmd)); @@ -465,7 +473,7 @@ void KimParam::command(int narg, char **arg) str += fmt::format(" {}", V); } - auto setcmd = fmt::format("{} string {}", varsname[0], str); + auto setcmd = fmt::format("{} string \"{}\"", varsname[0], str); input->variable->set(setcmd); input->write_echo(fmt::format("variable {}\n", setcmd)); From 29926c4f71ae1c72e066c71809299b262c74fe7b Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 16 Feb 2021 16:44:12 -0600 Subject: [PATCH 55/89] update kim command unittests with extra test cases for kim param command --- unittest/commands/test_kim_commands.cpp | 65 +++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 9d02cdb74c..3934e5de6f 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -347,6 +347,71 @@ TEST_F(KimCommandsTest, kim_param) if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "2"); + + TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + lmp->input->one("kim param get cutoffs 1:3 list");); + TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 list");); + TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + lmp->input->one("kim param get cutoffs 1:3 split");); + TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 split");); + TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + lmp->input->one("kim param get cutoffs 1:3 explicit");); + TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 explicit");); + TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param get' " + "command.\nThe LAMMPS '3' variable names or 'cutoffs " + "split/list' is mandatory.*", + lmp->input->one("kim param get cutoffs 1:3 cutoffs");); + TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param get' " + "command.\nThe LAMMPS '3' variable names or 'cutoffs_1 " + "split' is mandatory.*", + lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2");); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_1")) == "2.20943"); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_2")) == "2.10252"); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_3")) == "5.666115"); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3 explicit"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_1")) == "2.20943"); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_2")) == "2.10252"); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_3")) == "5.666115"); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("kim param get cutoffs 1:3 cutoffs split"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_1")) == "2.20943"); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_2")) == "2.10252"); + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_3")) == "5.666115"); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("kim param get cutoffs 1:3 cutoffs list"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs")) == "2.20943 2.10252 5.666115"); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("kim param set cutoffs 1 2.21 cutoffs 2 2.11"); + lmp->input->one("kim param get cutoffs 1:2 cutoffs list"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs")) == "2.21 2.11"); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("kim param set cutoffs 1:3 2.3 2.2 5.7"); + lmp->input->one("kim param get cutoffs 1:3 cutoffs list"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs")) == "2.3 2.2 5.7"); } TEST_F(KimCommandsTest, kim_property) From 3b9cbe4361fabd25dccf5fc43b294af80912ac01 Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 16 Feb 2021 16:44:58 -0600 Subject: [PATCH 56/89] Update the kim command doc Update the document with the latest interface changes. Replace the discontinued models in the examples with the correct models. Test all provided examples and fix the mistakes in them. --- doc/src/kim_commands.rst | 1299 ++++++++++++++++++++------------------ 1 file changed, 694 insertions(+), 605 deletions(-) diff --git a/doc/src/kim_commands.rst b/doc/src/kim_commands.rst index e9afa48fd5..47b8d3e790 100644 --- a/doc/src/kim_commands.rst +++ b/doc/src/kim_commands.rst @@ -1,106 +1,136 @@ -.. index:: kim_init, kim_interactions, kim_query, kim_param, kim_property +.. index:: kim_commands -:ref:`kim_init` command -========================================= - -:ref:`kim_interactions` command -========================================================= - -:ref:`kim_query` command -=========================================== - -:ref:`kim_param` command -=========================================== - -:ref:`kim_property` command -================================================= +kim command +=========== Syntax """""" .. code-block:: LAMMPS - kim_init model user_units unitarg - kim_interactions typeargs - kim_query variable formatarg query_function queryargs - kim_param get param_name index_range variables formatarg - kim_param set param_name index_range values - kim_property create instance_id property_id - kim_property modify instance_id key key_name key_name_key key_name_value - kim_property remove instance_id key key_name - kim_property destroy instance_id - kim_property dump file + kim sub-command -.. _formatarg_options: - -* model = name of the KIM interatomic model (the KIM ID for models archived in OpenKIM) -* user_units = the LAMMPS :doc:`units ` style assumed in the LAMMPS input script -* unitarg = *unit_conversion_mode* (optional) -* typeargs = atom type to species mapping (one entry per atom type) or *fixed_types* for models with a preset fixed mapping -* variable(s) = single name or list of names of (string style) LAMMPS variable(s) where a query result or parameter get result is stored. Variables that do not exist will be created by the command. -* formatarg = *list, split, or explicit* (optional): - - .. parsed-literal:: - - *list* = returns a single string with a list of space separated values - (e.g. "1.0 2.0 3.0"), which is placed in a LAMMPS variable as - defined by the *variable* argument. [default for *kim_query*] - *split* = returns the values separately in new variables with names based - on the prefix specified in *variable* and a number appended to - indicate which element in the list of values is in the variable. - *explicit* = returns the values separately in one more more variable names - provided as arguments that precede *formatarg*\ . [default for *kim_param*] - -* query_function = name of the OpenKIM web API query function to be used -* queryargs = a series of *keyword=value* pairs that represent the web query; supported keywords depend on the query function -* param_name = name of a KIM portable model parameter -* index_range = KIM portable model parameter index range (an integer for a single element, or pair of integers separated by a colon for a range of elements) -* values = new value(s) to replace the current value(s) of a KIM portable model parameter -* instance_id = a positive integer identifying the KIM property instance -* property_id = identifier of a `KIM Property Definition `_, which can be (1) a property short name, (2) the full unique ID of the property (including the contributor and date), (3) a file name corresponding to a local property definition file -* key_name = one of the keys belonging to the specified KIM property definition -* key_name_key = a key belonging to a key-value pair (standardized in the `KIM Properties Framework `__) -* key_name_value = value to be associated with a key_name_key in a key-value pair -* file = name of a file to write the currently defined set of KIM property instances to +* sub-command = :ref:`init ` or :ref:`interactions ` or + :ref:`query ` or :ref:`param ` or :ref:`property ` Examples """""""" .. code-block:: LAMMPS - kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal - kim_interactions Si - kim_init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real - kim_init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 metal unit_conversion_mode - kim_interactions C H O - kim_init Sim_LAMMPS_IFF_PCFF_HeinzMishraLinEmami_2015Ver1v5_FccmetalsMineralsSolventsPolymers__SM_039297821658_000 real - kim_interactions fixed_types - kim_query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Al"] units=["angstrom"] - kim_param get gamma 1 varGamma - kim_param set gamma 1 3.0 - kim_property create 1 atomic-mass - kim_property modify 1 key mass source-value 26.98154 - kim_property modify 1 key species source-value Al - kim_property remove 1 key species - kim_property destroy 1 - kim_property dump results.edn - + kim init ... + kim interactions ... + kim query ... + kim param ... + kim property ... .. _kim_description: Description """"""""""" -The set of *kim_commands* provide a high-level wrapper around the +*kim command* provides a set of high-level wrapper around the `Open Knowledgebase of Interatomic Models (OpenKIM) `_ repository of interatomic models (IMs) (potentials and force fields), -so that they can be used by LAMMPS scripts. These commands do not implement -any computations directly, but rather generate LAMMPS input commands based -on the information retrieved from the OpenKIM repository to initialize and -activate OpenKIM IMs and query their predictions for use in the LAMMPS script. -All LAMMPS input commands generated and executed by *kim_commands* are +so that they can be used by LAMMPS scripts. This command is followed by a +a set of sub-coammnds. The kim command does not implement any computations +directly, but rather generates LAMMPS input commands based on the information +retrieved from the OpenKIM repository to initialize and activate OpenKIM IMs +and query their predictions for use in the LAMMPS script. +All LAMMPS input commands generated and executed by *kim command* are echoed to the LAMMPS log file. +Full syntax +""""""""""" + +.. code-block:: LAMMPS + + kim init model user_units unitarg + kim interactions typeargs + kim query variable formatarg query_function queryargs + kim param get param_name index_range variables formatarg + kim param set param_name index_range values + kim property create instance_id property_id + kim property modify instance_id key key_name key_name_key key_name_value + kim property remove instance_id key key_name + kim property destroy instance_id + kim property dump file + +.. _formatarg_options: + +* model = name of the KIM interatomic model (the KIM ID for models archived in + OpenKIM) +* user_units = the LAMMPS :doc:`units ` style assumed in the LAMMPS + input script +* unitarg = *unit_conversion_mode* (optional) +* typeargs = atom type to species mapping (one entry per atom type) or + *fixed_types* for models with a preset fixed mapping +* variable(s) = single name or list of names of (string style) LAMMPS + variable(s) where a query result or parameter get result is stored. Variables + that do not exist will be created by the command +* formatarg = *list, split, index, or explicit* (optional): + + .. parsed-literal:: + + *list* = returns a single string with a list of space separated values + (e.g. "1.0 2.0 3.0"), which is placed in a LAMMPS variable as + defined by the *variable* argument. [default for *query* + sub-command] + *split* = returns the values separately in new variables with names based + on the prefix specified in *variable* and a number appended to + indicate which element in the list of values is in the variable + *index* = returns a variable style index that can be incremented via the + next command. This enables the construction of simple loops + *explicit* = returns the values separately in one more more variable names + provided as arguments that precede *formatarg*\ . [default for + *kim_param*] + +* query_function = name of the OpenKIM web API query function to be used +* queryargs = a series of *keyword=value* pairs that represent the web query; + supported keywords depend on the query function +* param_name = name of a KIM portable model parameter +* index_range = KIM portable model parameter index range (an integer for a + single element, or pair of integers separated by a colon for a range of + elements) +* values = new value(s) to replace the current value(s) of a KIM portable model + parameter +* instance_id = a positive integer identifying the KIM property instance +* property_id = identifier of a + `KIM Property Definition `_, which can be (1) + a property short name, (2) the full unique ID of the property (including the + contributor and date), (3) a file name corresponding to a local property + definition file +* key_name = one of the keys belonging to the specified KIM property definition +* key_name_key = a key belonging to a key-value pair (standardized in the + `KIM Properties Framework `__) +* key_name_value = value to be associated with a key_name_key in a key-value + pair +* file = name of a file to write the currently defined set of KIM property + instances to + +Full syntax examples +"""""""""""""""""""" + +.. code-block:: LAMMPS + + kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal + kim interactions Si + kim init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_001 real + kim init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_001 metal unit_conversion_mode + kim interactions C H O + kim init Sim_LAMMPS_IFF_PCFF_HeinzMishraLinEmami_2015Ver1v5_FccmetalsMineralsSolventsPolymers__SM_039297821658_000 real + kim interactions fixed_types + kim query a0 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] + kim query model index get_available_models species=[Al] potential_type=[eam] + kim param get gamma 1 varGamma + kim param set gamma 1 3.0 + kim property create 1 atomic-mass + kim property modify 1 key mass source-value 26.98154 + kim property modify 1 key species source-value Al + kim property remove 1 key species + kim property destroy 1 + kim property dump results.edn + Benefits of Using OpenKIM IMs ----------------------------- @@ -109,22 +139,49 @@ Employing OpenKIM IMs provides LAMMPS users with multiple benefits: Reliability ^^^^^^^^^^^ -* All content archived in OpenKIM is reviewed by the `KIM Editor `_ for quality. -* IMs in OpenKIM are archived with full provenance control. Each is associated with a maintainer responsible for the integrity of the content. All changes are tracked and recorded. -* IMs in OpenKIM are exhaustively tested using `KIM Tests `_ that compute a host of material properties, and `KIM Verification Checks `_ that provide the user with information on various aspects of the IM behavior and coding correctness. This information is displayed on the IM's page accessible through the `OpenKIM browse interface `_. +* All content archived in OpenKIM is reviewed by the + `KIM Editor `_ for quality. +* IMs in OpenKIM are archived with full provenance control. Each is associated + with a maintainer responsible for the integrity of the content. All changes + are tracked and recorded. +* IMs in OpenKIM are exhaustively tested using + `KIM Tests `_ that compute a + host of material properties, and + `KIM Verification Checks `_ + that provide the user with information on various aspects of the IM behavior + and coding correctness. This information is displayed on the IM's page + accessible through the + `OpenKIM browse interface `_. Reproducibility ^^^^^^^^^^^^^^^ -* Each IM in OpenKIM is issued a unique identifier (`KIM ID `_), which includes a version number (last three digits). Any changes that can result in different numerical values lead to a version increment in the KIM ID. This makes it possible to reproduce simulations since the specific version of a specific IM used can be retrieved using its KIM ID. -* OpenKIM is a member organization of `DataCite `_ and issues digital object identifiers (DOIs) to all IMs archived in OpenKIM. This makes it possible to cite the IM code used in a simulation in a publications to give credit to the developers and further facilitate reproducibility. +* Each IM in OpenKIM is issued a unique identifier + (`KIM ID `_), which includes a + version number (last three digits). Any changes that can result in different + numerical values lead to a version increment in the KIM ID. This makes it + possible to reproduce simulations since the specific version of a specific IM + used can be retrieved using its KIM ID. +* OpenKIM is a member organization of `DataCite `_ and + issues digital object identifiers (DOIs) to all IMs archived in OpenKIM. This + makes it possible to cite the IM code used in a simulation in a publications + to give credit to the developers and further facilitate reproducibility. Convenience ^^^^^^^^^^^ -* IMs in OpenKIM are distributed in binary form along with LAMMPS and can be used in a LAMMPS input script simply by providing their KIM ID in the *kim_init* command documented on this page. -* The *kim_query* web query tool provides the ability to use the predictions of IMs for supported material properties (computed via `KIM Tests `_) as part of a LAMMPS input script setup and analysis. -* Support is provided for unit conversion between the :doc:`unit style ` used in the LAMMPS input script and the units required by the OpenKIM IM. This makes it possible to use a single input script with IMs using different units without change and minimizes the likelihood of errors due to incompatible units. +* IMs in OpenKIM are distributed in binary form along with LAMMPS and can be + used in a LAMMPS input script simply by providing their KIM ID in the + *kim init* command documented on this page. +* The *kim_query* web query tool provides the ability to use the predictions of + IMs for supported material properties (computed via + `KIM Tests `_) as part of a + LAMMPS input script setup and analysis. +* Support is provided for unit conversion between the :doc:`unit style ` + used in the LAMMPS input script and the units required by the OpenKIM IM. + This makes it possible to use a single input script with IMs using different + units without change and minimizes the likelihood of errors due to + incompatible units. .. _IM_types: @@ -135,12 +192,23 @@ There are two types of IMs archived in OpenKIM: .. _PM_type: -1. The first type is called a *KIM Portable Model* (PM). A KIM PM is an independent computer implementation of an IM written in one of the languages supported by KIM (C, C++, Fortran) that conforms to the KIM Application Programming Interface (`KIM API `_) Portable Model Interface (PMI) standard. A KIM PM will work seamlessly with any simulation code that supports the KIM API/PMI standard (including LAMMPS; see `complete list of supported codes `_). -2. The second type is called a *KIM Simulator Model* (SM). A KIM SM is an IM that is implemented natively within a simulation code (\ *simulator*\ ) that supports the KIM API Simulator Model Interface (SMI); in this case LAMMPS. A separate SM package is archived in OpenKIM for each parameterization of the IM, which includes all of the necessary parameter files, LAMMPS commands, and metadata (supported species, units, etc.) needed to run the IM in LAMMPS. +1. The first type is called a *KIM Portable Model* (PM). A KIM PM is an + independent computer implementation of an IM written in one of the languages + supported by KIM (C, C++, Fortran) that conforms to the KIM Application + Programming Interface (`KIM API `_) Portable + Model Interface (PMI) standard. A KIM PM will work seamlessly with any + simulation code that supports the KIM API/PMI standard (including LAMMPS; see + `complete list of supported codes `_). +2. The second type is called a *KIM Simulator Model* (SM). A KIM SM is an IM + that is implemented natively within a simulation code (\ *simulator*\ ) that + supports the KIM API Simulator Model Interface (SMI); in this case LAMMPS. A + separate SM package is archived in OpenKIM for each parameterization of the + IM, which includes all of the necessary parameter files, LAMMPS commands, and + metadata (supported species, units, etc.) needed to run the IM in LAMMPS. -With these two IM types, OpenKIM can archive and test almost all IMs that -can be used by LAMMPS. (It is easy to contribute new IMs to OpenKIM, see -the `upload instructions `_.) +With these two IM types, OpenKIM can archive and test almost all IMs that can be +used by LAMMPS. (It is easy to contribute new IMs to OpenKIM, see the +`upload instructions `_.) OpenKIM IMs are uniquely identified by a `KIM ID `_. @@ -155,7 +223,7 @@ By convention SM prefixes begin with *Sim_* to readily identify them. .. parsed-literal:: SW_StillingerWeber_1985_Si__MO_405512056662_005 - Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 + Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_001 Each OpenKIM IM has a dedicated "Model Page" on `OpenKIM `_ providing all the information on the IM including a title, description, @@ -169,16 +237,17 @@ The URL for the Model Page is constructed from the https://openkim.org/id/extended_KIM_ID -For example, for the Stillinger--Weber potential -listed above the Model Page is located at: +For example, for the Stillinger--Weber potential listed above the Model Page is +located at: .. parsed-literal:: `https://openkim.org/id/SW_StillingerWeber_1985_Si__MO_405512056662_005 `_ -See the `current list of KIM PMs and SMs archived in OpenKIM `_. -This list is sorted by species and can be filtered to display only -IMs for certain species combinations. +See the +`current list of KIM PMs and SMs archived in OpenKIM `_. +This list is sorted by species and can be filtered to display only IMs for +certain species combinations. See `Obtaining KIM Models `_ to learn how to install a pre-built binary of the OpenKIM Repository of Models. @@ -190,91 +259,87 @@ learn how to install a pre-built binary of the OpenKIM Repository of Models. Using OpenKIM IMs with LAMMPS ----------------------------- -Two commands are employed when using OpenKIM IMs, one to select the -IM and perform necessary initialization (\ *kim_init*\ ), and the second +Two sub-commands are employed when using OpenKIM IMs, one to select the +IM and perform necessary initialization (\ *kim init*\ ), and the second to set up the IM for use by executing any necessary LAMMPS commands -(\ *kim_interactions*\ ). Both are required. +(\ *kim interactions*\ ). Both are required. See the *examples/kim* directory for example input scripts that use KIM PMs and KIM SMs. -.. _kim_init command: +.. _init: -OpenKIM IM Initialization (*kim_init*) +OpenKIM IM Initialization (*kim init*) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The *kim_init* mode command must be issued **before** -the simulation box is created (normally at the top of the file). -This command sets the OpenKIM IM that will be used and may issue -additional commands changing LAMMPS default settings that are required -for using the selected IM (such as :doc:`units ` or -:doc:`atom_style `). If needed, those settings can be overridden, -however, typically a script containing a *kim_init* command -would not include *units* and *atom_style* commands. +The *kim* command followed by *init* sub-command must be issued **before** +the simulation box is created (normally at the top of the file). This command +sets the OpenKIM IM that will be used and may issue additional commands changing +LAMMPS default settings that are required for using the selected IM (such as +:doc:`units ` or :doc:`atom_style `). If needed, those +settings can be overridden, however, typically a script containing a *kim init* +command would not include *units* and *atom_style* commands. -The required arguments of *kim_init* are the *model* name of the -IM to be used in the simulation (for an IM archived in OpenKIM this is -its `extended KIM ID `_, and -the *user_units*, which are the LAMMPS :doc:`units style ` used -in the input script. (Any dimensioned numerical values in the input -script and values read in from files are expected to be in the -*user_units* system.) +The required arguments of *kim init* are the *model* name of the IM to be used +in the simulation (for an IM archived in OpenKIM this is its +`extended KIM ID `_, and the +*user_units*, which are the LAMMPS :doc:`units style ` used in the input +script. (Any dimensioned numerical values in the input script and values read in +from files are expected to be in the *user_units* system.) -The selected IM can be either a :ref:`KIM PM or a KIM SM `. -For a KIM SM, the *kim_init* command verifies that the SM is designed -to work with LAMMPS (and not another simulation code). -In addition, the LAMMPS version used for defining -the SM and the LAMMPS version being currently run are -printed to help diagnose any incompatible changes to input script or -command syntax between the two LAMMPS versions. +The selected IM can be either a :ref:`KIM PM or a KIM SM `. For a KIM +SM, the *kim init* command verifies that the SM is designed to work with LAMMPS +(and not another simulation code). In addition, the LAMMPS version used for +defining the SM and the LAMMPS version being currently run are printed to help +diagnose any incompatible changes to input script or command syntax between the +two LAMMPS versions. -Based on the selected model *kim_init* may modify the -:doc:`atom_style `. -Some SMs have requirements for this setting. If this is the case, then -*atom_style* will be set to the required style. Otherwise, the value is left -unchanged (which in the absence of an *atom_style* command in the input script -is the :doc:`default atom_style value `). +Based on the selected model *kim init* may modify the +:doc:`atom_style `. Some SMs have requirements for this setting. +If this is the case, then *atom_style* will be set to the required style. +Otherwise, the value is left unchanged (which in the absence of an *atom_style* +command in the input script is the +:doc:`default atom_style value `). -Regarding units, the *kim_init* command behaves in different ways depending -on whether or not *unit conversion mode* is activated as indicated by the -optional *unitarg* argument. -If unit conversion mode is **not** active, then *user_units* must -either match the required units of the IM or the IM must be able -to adjust its units to match. (The latter is only possible with some KIM PMs; -SMs can never adjust their units.) If a match is possible, the LAMMPS -:doc:`units ` command is called to set the units to -*user_units*\ . If the match fails, the simulation is terminated with -an error. +Regarding units, the *kim init* behaves in different ways depending on whether +or not *unit conversion mode* is activated as indicated by the optional +*unitarg* argument. +If unit conversion mode is **not** active, then *user_units* must either match +the required units of the IM or the IM must be able to adjust its units to +match. (The latter is only possible with some KIM PMs; SMs can never adjust +their units.) If a match is possible, the LAMMPS :doc:`units ` command is +called to set the units to *user_units*\ . If the match fails, the simulation is +terminated with an error. -Here is an example of a LAMMPS script to compute the cohesive energy -of a face-centered cubic (fcc) lattice for the Ercolessi and Adams (1994) -potential for Al: +Here is an example of a LAMMPS script to compute the cohesive energy of a +face-centered cubic (fcc) lattice for the MEAM potential by Pascuet and +Fernandez (2015) for Al. .. code-block:: LAMMPS - kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal - boundary p p p - lattice fcc 4.032 - region simbox block 0 1 0 1 0 1 units lattice - create_box 1 simbox - create_atoms 1 box - mass 1 26.981539 - kim_interactions Al - run 0 - variable Ec equal (pe/count(all))/${_u_energy} - print "Cohesive Energy = ${EcJ} eV" + kim init Sim_LAMMPS_MEAM_PascuetFernandez_2015_Al__SM_811588957187_000 metal + boundary p p p + lattice fcc 4.049 + region simbox block 0 1 0 1 0 1 units lattice + create_box 1 simbox + create_atoms 1 box + mass 1 26.981539 + kim interactions Al + run 0 + variable Ec equal (pe/count(all)) + print "Cohesive Energy = ${Ec} eV" -The above script will end with an error in the *kim_init* line if the -IM is changed to another potential for Al that does not work with *metal* -units. To address this *kim_init* offers the *unit_conversion_mode* -as shown below. -If unit conversion mode *is* active, then *kim_init* calls the LAMMPS -:doc:`units ` command to set the units to the IM's required or -preferred units. Conversion factors between the IM's units and the *user_units* -are defined for all :doc:`physical quantities ` (mass, distance, etc.). +The above script will end with an error in the *kim init* line if the IM is +changed to another potential for Al that does not work with *metal* units. To +address this, *kim init* offers the *unit_conversion_mode* as shown below. + +If unit conversion mode *is* active, then *kim init* calls the LAMMPS +:doc:`units ` command to set the units to the IM's required or preferred +units. Conversion factors between the IM's units and the *user_units* are +defined for all :doc:`physical quantities ` (mass, distance, etc.). (Note that converting to or from the "lj" unit style is not supported.) -These factors are stored as :doc:`internal style variables ` with -the following standard names: +These factors are stored as :doc:`internal style variables ` with the +following standard names: .. parsed-literal:: @@ -297,127 +362,125 @@ If desired, the input script can be designed to work with these conversion factors so that the script will work without change with any OpenKIM IM. (This approach is used in the `OpenKIM Testing Framework `_.) -For example, the script given above for the cohesive energy of fcc Al -can be rewritten to work with any IM regardless of units. The following -script constructs an fcc lattice with a lattice parameter defined in -meters, computes the total energy, and prints the cohesive energy in -Joules regardless of the units of the IM. + +For example, the script given above for the cohesive energy of fcc Al can be +rewritten to work with any IM regardless of units. The following script +constructs an fcc lattice with a lattice parameter defined in meters, computes +the total energy, and prints the cohesive energy in Joules regardless of the +units of the IM. .. code-block:: LAMMPS - kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 si unit_conversion_mode - boundary p p p - lattice fcc 4.032e-10*${_u_distance} - region simbox block 0 1 0 1 0 1 units lattice - create_box 1 simbox - create_atoms 1 box - mass 1 4.480134e-26*${_u_mass} - kim_interactions Al - run 0 - variable Ec_in_J equal (pe/count(all))/${_u_energy} - print "Cohesive Energy = ${Ec_in_J} J" + kim init Sim_LAMMPS_MEAM_PascuetFernandez_2015_Al__SM_811588957187_000 si unit_conversion_mode + boundary p p p + lattice fcc $(4.049e-10*v__u_distance) + region simbox block 0 1 0 1 0 1 units lattice + create_box 1 simbox + create_atoms 1 box + mass 1 $(4.480134e-26*v__u_mass) + kim interactions Al + neighbor $(0.001e-10*v__u_distance) bin + run 0 + variable Ec_in_J equal (pe/count(all))/v__u_energy + print "Cohesive Energy = ${Ec_in_J} J" -Note the multiplication by ${_u_distance} and ${_u_mass} to convert -from SI units (specified in the *kim_init* command) to whatever units the -IM uses (metal in this case), and the division by ${_u_energy} -to convert from the IM's energy units to SI units (Joule). This script -will work correctly for any IM for Al (KIM PM or SM) selected by the -*kim_init* command. +Note the multiplication by `v__u_distance` and `v__u_mass` to convert from SI +units (specified in the *kim init* command) to whatever units the IM uses (metal +in this case), and the division by `v__u_energy` to convert from the IM's energy +units to SI units (Joule). This script will work correctly for any IM for Al +(KIM PM or SM) selected by the *kim init* command. Care must be taken to apply unit conversion to dimensional variables read in -from a file. For example, if a configuration of atoms is read in from a -dump file using the :doc:`read_dump ` command, the following can -be done to convert the box and all atomic positions to the correct units: +from a file. For example, if a configuration of atoms is read in from a dump +file using the :doc:`read_dump ` command, the following can be done +to convert the box and all atomic positions to the correct units: + .. code-block:: LAMMPS - variable xyfinal equal xy*${_u_distance} - variable xzfinal equal xz*${_u_distance} - variable yzfinal equal yz*${_u_distance} change_box all x scale ${_u_distance} & - y scale ${_u_distance} & - z scale ${_u_distance} & - xy final ${xyfinal} & - xz final ${xzfinal} & - yz final ${yzfinal} & - remap + y scale ${_u_distance} & + z scale ${_u_distance} & + xy final $(xy*v__u_distance) & + xz final $(xz*v__u_distance) & + yz final $(yz*v__u_distance) & + remap .. note:: - Unit conversion will only work if the conversion factors are placed in - all appropriate places in the input script. It is up to the user to do this + Unit conversion will only work if the conversion factors are placed in all + appropriate places in the input script. It is up to the user to do this correctly. -.. _kim_interactions command: +.. _interactions: -OpenKIM IM Execution (*kim_interactions*) +OpenKIM IM Execution (*kim interactions*) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The second and final step in using an OpenKIM IM is to execute the -*kim_interactions* command. This command must be preceded by a *kim_init* +*kim interactions* command. This command must be preceded by a *kim init* command and a command that defines the number of atom types *N* (such as :doc:`create_box `). -The *kim_interactions* command has one argument *typeargs*\ . This argument +The *kim interactions* command has one argument *typeargs*\ . This argument contains either a list of *N* chemical species, which defines a mapping between -atom types in LAMMPS to the available species in the OpenKIM IM, or the -keyword *fixed_types* for models that have a preset fixed mapping (i.e. -the mapping between LAMMPS atom types and chemical species is defined by -the model and cannot be changed). In the latter case, the user must consult -the model documentation to see how many atom types there are and how they -map to the chemical species. +atom types in LAMMPS to the available species in the OpenKIM IM, or the keyword +*fixed_types* for models that have a preset fixed mapping (i.e. the mapping +between LAMMPS atom types and chemical species is defined by the model and +cannot be changed). In the latter case, the user must consult the model +documentation to see how many atom types there are and how they map to the +chemical species. -For example, consider an OpenKIM IM that supports Si and C species. -If the LAMMPS simulation has four atom types, where the first three are Si, -and the fourth is C, the following *kim_interactions* command would be used: +For example, consider an OpenKIM IM that supports Si and C species. If the +LAMMPS simulation has four atom types, where the first three are Si, and the +fourth is C, the following *kim interactions* command would be used: .. code-block:: LAMMPS - kim_interactions Si Si Si C + kim interactions Si Si Si C Alternatively, for a model with a fixed mapping the command would be: .. code-block:: LAMMPS - kim_interactions fixed_types + kim interactions fixed_types -The *kim_interactions* command performs all the necessary steps to set up -the OpenKIM IM selected in the *kim_init* command. The specific actions depend -on whether the IM is a KIM PM or a KIM SM. For a KIM PM, -a :doc:`pair_style kim ` command is executed followed by -the appropriate *pair_coeff* command. For example, for the -Ercolessi and Adams (1994) KIM PM for Al set by the following commands: +The *kim interactions* command performs all the necessary steps to set up the +OpenKIM IM selected in the *kim_init* command. The specific actions depend on +whether the IM is a KIM PM or a KIM SM. For a KIM PM, a +:doc:`pair_style kim ` command is executed followed by the appropriate +*pair_coeff* command. For example, for the Ercolessi and Adams (1994) KIM PM for +Al set by the following commands: .. code-block:: LAMMPS - kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal + kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal ... ... box specification lines skipped ... - kim_interactions Al + kim interactions Al -the *kim_interactions* command executes the following LAMMPS input commands: +the *kim interactions* command executes the following LAMMPS input commands: .. code-block:: LAMMPS pair_style kim EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 pair_coeff * * Al -For a KIM SM, the generated input commands may be more complex -and require that LAMMPS is built with the required packages included -for the type of potential being used. The set of commands to be executed -is defined in the SM specification file, which is part of the SM package. -For example, for the Strachan et al. (2003) ReaxFF SM -set by the following commands: +For a KIM SM, the generated input commands may be more complex and require that +LAMMPS is built with the required packages included for the type of potential +being used. The set of commands to be executed is defined in the SM +specification file, which is part of the SM package. For example, for the +Strachan et al. (2003) ReaxFF SM set by the following commands: .. code-block:: LAMMPS - kim_init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real + kim init Sim_LAMMPS_ReaxFF_StrachanVanDuinChakraborty_2003_CHNO__SM_107643900657_000 real ... ... box specification lines skipped ... - kim_interactions C H N O + kim interactions C H N O -the *kim_interactions* command executes the following LAMMPS input commands: +the *kim interactions* command executes the following LAMMPS input commands: .. code-block:: LAMMPS @@ -427,325 +490,354 @@ the *kim_interactions* command executes the following LAMMPS input commands: .. note:: - The files *lmp_control*, *ffield.reax.rdx* and *param.qeq* - are specific to the Strachan et al. (2003) ReaxFF parameterization - and are archived as part of the SM package in OpenKIM. + The files *lmp_control*, *ffield.reax.rdx* and *param.qeq* are specific to + the Strachan et al. (2003) ReaxFF parameterization and are archived as part + of the SM package in OpenKIM. .. note:: - Parameters like cutoff radii and charge tolerances, - which have an effect on IM predictions, are also included in the - SM definition ensuring reproducibility. + Parameters like cutoff radii and charge tolerances, which have an effect on + IM predictions, are also included in the SM definition ensuring + reproducibility. .. note:: - When using *kim_init* and *kim_interactions* to select - and set up an OpenKIM IM, other LAMMPS commands - for the same functions (such as pair_style, pair_coeff, bond_style, - bond_coeff, fixes related to charge equilibration, etc.) should normally - not appear in the input script. + When using *kim init* and *kim interactions* to select and set up an OpenKIM + IM, other LAMMPS commands for the same functions (such as pair_style, + pair_coeff, bond_style, bond_coeff, fixes related to charge equilibration, + etc.) should normally not appear in the input script. -.. _kim_query command: +.. note:: -Using OpenKIM Web Queries in LAMMPS (*kim_query*) + Changing a periodic boundary to a non-periodic one, or in general using the + :doc:`change_box ` command after the interactions are set via + *kim interactions* or *pair_coeff* commands might affect some of the + settings. For example, SM models containing Coulombic terms in the + interactions require different settings if a periodic boundary changes to a + non-periodic one. In these cases, *kim interactions* must be called again + after the *change_box* command to provide the correct settings. + +.. _query: + +Using OpenKIM Web Queries in LAMMPS (*kim query*) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The *kim_query* command performs a web query to retrieve the predictions -of an IM set by *kim_init* for material properties archived in +The *kim query* command performs a web query to retrieve the predictions of an +IM set by *kim init* for material properties archived in `OpenKIM `_. -.. note:: - - The *kim_query* command must be preceded by a *kim_init* command. - -The syntax for the *kim_query* command is as follows: - +The syntax for the *kim query* command is as follows: .. code-block:: LAMMPS - kim_query variable formatarg query_function queryargs + kim query variable formatarg query_function queryargs The result of the query is stored in one or more -:doc:`string style variables ` as determined by the -optional *formatarg* argument :ref:`documented above `. -For the "list" setting of *formatarg* (or if *formatarg* is not -specified), the result is returned as a space-separated list of -values in *variable*\ . -The *formatarg* keyword "split" separates the result values into -individual variables of the form *prefix_I*, where *prefix* is set to the -*kim_query* *variable* argument and *I* ranges from 1 to the number of -returned values. The number and order of the returned values is determined -by the type of query performed. (Note that the "explicit" setting of -*formatarg* is not supported by *kim_query*\ .) +:doc:`string style variables ` as determined by the optional +*formatarg* argument :ref:`documented above `. For the "list" +setting of *formatarg* (or if *formatarg* is not specified), the result is +returned as a space-separated list of values in *variable*\ . The *formatarg* +keyword "split" separates the result values into individual variables of the +form *prefix_I*, where *prefix* is set to the *kim query* *variable* argument +and *I* ranges from 1 to the number of returned values. The number and order of +the returned values is determined by the type of query performed. The +*formatarg* keyword "index" returns a :doc:`variable style index ` +that can be incremented via the :doc:`next ` command. This enables the +construction of simple loops over the returned values by the type of query +performed. (Note that the "explicit" setting of *formatarg* is not supported by +*kim query*\ .) .. note:: - *kim_query* only supports queries that return a single result or - an array of values. More complex queries that return a JSON structure - are not currently supported. An attempt to use *kim_query* in such - cases will generate an error. + *kim query* only supports queries that return a single result or an array of + values. More complex queries that return a JSON structure are not currently + supported. An attempt to use *kim query* in such cases will generate an + error. -The second required argument *query_function* is the name of the -query function to be called (e.g. *get_lattice_constant_cubic*\ ). -All following :doc:`arguments ` are parameters handed over to -the web query in the format *keyword=value*\ , where *value* is always -an array of one or more comma-separated items in brackets. -The list of supported keywords and the type and format of their values -depend on the query function used. The current list of query functions -is available on the OpenKIM webpage at +The second required argument *query_function* is the name of the query function +to be called (e.g. *get_lattice_constant_cubic*\ ). All following +:doc:`arguments ` are parameters handed over to the web query in +the format *keyword=value*\ , where *value* is always an array of one or more +comma-separated items in brackets. The list of supported keywords and the type +and format of their values depend on the query function used. The current list +of query functions is available on the OpenKIM webpage at `https://openkim.org/doc/usage/kim-query `_. .. note:: - All query functions require the *model* keyword, which identifies - the IM whose predictions are being queried. This keyword is automatically - generated by *kim_query* based on the IM set in *kim_init* and must not - be specified as an argument to *kim_query*\ . + All query functions, except *get_available_models* function, require the + *model* keyword, which identifies the IM whose predictions are being queried. + *kim query* automatically generates the *model* keyword based on the IM set + in by *kim init*, and it can be overwritten if specified as an argument to + the *kim query*\ . Where *Kim init* is not specified, the *model* keyword + must be provided as an argument to the *kim query*\ . .. note:: - Each *query_function* is associated with a default method (implemented - as a `KIM Test `_) - used to compute this property. In cases where there are multiple - methods in OpenKIM for computing a property, a *method* keyword can - be provided to select the method of choice. See the - `query documentation `_ - to see which methods are available for a given *query_function*\ . + Each *query_function* is associated with a default method (implemented as a + `KIM Test `_) used to compute + this property. In cases where there are multiple methods in OpenKIM for + computing a property, a *method* keyword can be provided to select the method + of choice. See the + `query documentation `_ to see which + methods are available for a given *query_function*\ . -*kim_query* Usage Examples and Further Clarifications +*kim query* Usage Examples and Further Clarifications ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The data obtained by *kim_query* commands can be used as part of the setup -or analysis phases of LAMMPS simulations. Some examples are given below. +The data obtained by *kim query* commands can be used as part of the setup or +analysis phases of LAMMPS simulations. Some examples are given below. **Define an equilibrium fcc crystal** .. code-block:: LAMMPS - kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal - boundary p p p - kim_query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Al"] units=["angstrom"] - lattice fcc ${a0} + kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal + boundary p p p + kim query a0 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] + lattice fcc ${a0} ... -The *kim_query* command retrieves from `OpenKIM `_ -the equilibrium lattice constant predicted by the Ercolessi and Adams (1994) -potential for the fcc structure and places it in -variable *a0*\ . This variable is then used on the next line to set up the -crystal. By using *kim_query*, the user is saved the trouble and possible -error of tracking this value down, or of having to perform an energy -minimization to find the equilibrium lattice constant. +.. code-block:: LAMMPS + + units metal + kim query a0 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005] + lattice fcc ${a0} + ... + +The *kim query* command retrieves from `OpenKIM `_ the +equilibrium lattice constant predicted by the Ercolessi and Adams (1994) +potential for the fcc structure and places it in variable *a0*\ . This variable +is then used on the next line to set up the crystal. By using *kim query*, the +user is saved the trouble and possible error of tracking this value down, or of +having to perform an energy minimization to find the equilibrium lattice +constant. .. note:: - In *unit_conversion_mode* the results obtained from a - *kim_query* would need to be converted to the appropriate units system. - For example, in the above script, the lattice command would need to be - changed to: "lattice fcc ${a0}*${_u_distance}". + In *unit_conversion_mode* the results obtained from a *kim query* would need + to be converted to the appropriate units system. For example, in the above + script, the lattice command would need to be changed to: + "lattice fcc $(v_a0*v__u_distance)". **Define an equilibrium hcp crystal** .. code-block:: LAMMPS - kim_init EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000 metal - boundary p p p - kim_query latconst split get_lattice_constant_hexagonal crystal=["hcp"] species=["Zr"] units=["angstrom"] - variable a0 equal latconst_1 - variable c0 equal latconst_2 - variable c_to_a equal ${c0}/${a0} - lattice custom ${a0} a1 0.5 -0.866025 0 a2 0.5 0.866025 0 a3 0 0 ${c_to_a} & - basis 0.333333 0.666666 0.25 basis 0.666666 0.333333 0.75 + kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal + boundary p p p + kim query latconst split get_lattice_constant_hexagonal crystal=[hcp] species=[Zr] units=[angstrom] + lattice custom ${latconst_1} a1 0.5 -0.866025 0 a2 0.5 0.866025 0 a3 0 0 $(latconst_2/latconst_1) & + basis 0.333333 0.666666 0.25 basis 0.666666 0.333333 0.75 ... -In this case the *kim_query* returns two arguments (since the hexagonal -close packed (hcp) structure has two independent lattice constants). -The *formatarg* keyword "split" places the two values into -the variables *latconst_1* and *latconst_2*\ . (These variables are -created if they do not already exist.) For convenience the variables -*a0* and *c0* are created in order to make the remainder of the -input script more readable. +In this case the *kim query* returns two arguments (since the hexagonal close +packed (hcp) structure has two independent lattice constants). The *formatarg* +keyword "split" places the two values into the variables *latconst_1* and +*latconst_2*\ . (These variables are created if they do not already exist.) **Define a crystal at finite temperature accounting for thermal expansion** .. code-block:: LAMMPS - kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal - boundary p p p - kim_query a0 get_lattice_constant_cubic crystal=["fcc"] species=["Al"] units=["angstrom"] - kim_query alpha get_linear_thermal_expansion_coefficient_cubic crystal=["fcc"] species=["Al"] units=["1/K"] temperature=[293.15] temperature_units=["K"] - variable DeltaT equal 300 - lattice fcc ${a0}*${alpha}*${DeltaT} + kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal + boundary p p p + kim query a0 get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] + kim query alpha get_linear_thermal_expansion_coefficient_cubic crystal=[fcc] species=[Al] units=[1/K] temperature=[293.15] temperature_units=[K] + variable DeltaT equal 300 + lattice fcc $(v_a0*v_alpha*v_DeltaT) ... -As in the previous example, the equilibrium lattice constant is obtained -for the Ercolessi and Adams (1994) potential. However, in this case the -crystal is scaled to the appropriate lattice constant at room temperature -(293.15 K) by using the linear thermal expansion constant predicted by the -potential. +As in the previous example, the equilibrium lattice constant is obtained for the +Ercolessi and Adams (1994) potential. However, in this case the crystal is +scaled to the appropriate lattice constant at room temperature (293.15 K) by +using the linear thermal expansion constant predicted by the potential. .. note:: - When passing numerical values as arguments (as in the case - of the temperature in the above example) it is also possible to pass a - tolerance indicating how close to the value is considered a match. - If no tolerance is passed a default value is used. If multiple results - are returned (indicating that the tolerance is too large), *kim_query* - will return an error. See the - `query documentation `_ - to see which numerical arguments and tolerances are available for a - given *query_function*\ . + When passing numerical values as arguments (as in the case of the temperature + in the above example) it is also possible to pass a tolerance indicating how + close to the value is considered a match. If no tolerance is passed a default + value is used. If multiple results are returned (indicating that the + tolerance is too large), *kim query* will return an error. See the + `query documentation `_ to see which + numerical arguments and tolerances are available for a given + *query_function*\ . **Compute defect formation energy** .. code-block:: LAMMPS - kim_init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal + kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal ... ... Build fcc crystal containing some defect and compute the total energy ... which is stored in the variable *Etot* ... - kim_query Ec get_cohesive_energy_cubic crystal=["fcc"] species=["Al"] units=["eV"] - variable Eform equal ${Etot} - count(all)*${Ec} + kim query Ec get_cohesive_energy_cubic crystal=[fcc] species=[Al] units=[eV] + variable Eform equal ${Etot} - count(all)*${Ec} ... -The defect formation energy *Eform* is computed by subtracting from *Etot* the -ideal fcc cohesive energy of the atoms in the system obtained from +The defect formation energy *Eform* is computed by subtracting the ideal fcc +cohesive energy of the atoms in the system from *Etot*\ . The ideal fcc +cohesive energy of the atoms is obtained from `OpenKIM `_ for the Ercolessi and Adams (1994) potential. +**Retrieve equilibrium fcc crystal of all EAM potentials that support a specific species** + +.. code-block:: LAMMPS + + kim query model index get_available_models species=[Al] potential_type=[eam] + label model_loop + kim query latconst get_lattice_constant_cubic crystal=[fcc] species=[Al] units=[angstrom] model=[${model}] + print "FCC lattice constant (${model} potential) = ${latconst}" + ... + ... do something with current value of latconst + ... + next model + jump SELF model_loop + +In this example, the *index* mode of *formatarg* is used. The first *kim query* +returns the list of all available EAM potentials that support the *Al* species +and archived in `OpenKIM `_. The result of the query +operation is stored in the LAMMPS variable *model* as an index *variable*\ . +This variable is used later to access the values one at a time within a loop as +shown in the example. The second *kim query* command retrieves from +`OpenKIM `_ the equilibrium lattice constant predicted by +each potential for the fcc structure and places it in variable *latconst*\ . + .. note:: - *kim_query* commands return results archived in - `OpenKIM `_. These results are obtained - using programs for computing material properties - (KIM Tests and KIM Test Drivers) that were contributed to OpenKIM. - In order to give credit to Test developers, the number of times results - from these programs are queried is tracked. No other information about - the nature of the query or its source is recorded. + *kim query* commands return results archived in + `OpenKIM `_. These results are obtained using programs + for computing material properties (KIM Tests and KIM Test Drivers) that were + contributed to OpenKIM. In order to give credit to Test developers, the + number of times results from these programs are queried is tracked. No other + information about the nature of the query or its source is recorded. -.. _kim_param command: -Accessing KIM Model Parameters from LAMMPS (*kim_param*) +.. _param: + +Accessing KIM Model Parameters from LAMMPS (*kim param*) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -All IMs are functional forms containing a set of -parameters. The values of these parameters are typically -selected to best reproduce a training set of quantum mechanical -calculations or available experimental data. For example, a -Lennard-Jones potential intended to model argon might have the values of -its two parameters, epsilon and sigma, fit to the -dimer dissociation energy or thermodynamic properties at a critical point -of the phase diagram. +All IMs are functional forms containing a set of parameters. These parameters' +values are typically selected to best reproduce a training set of quantum +mechanical calculations or available experimental data. For example, a +Lennard-Jones potential intended to model argon might have the values of its two +parameters, epsilon, and sigma, fit to the dimer dissociation energy or +thermodynamic properties at a critical point of the phase diagram. -Normally a user employing an IM should not modify its parameters since, -as noted above, these are selected to reproduce material properties. -However, there are cases where accessing and modifying IM parameters -is desired, such as for assessing uncertainty, fitting an IM, -or working with an ensemble of IMs. As explained :ref:`above `, -IMs archived in OpenKIM are either Portable Models (PMs) or -Simulator Models (SMs). KIM PMs are complete independent implementations -of an IM, whereas KIM SMs are wrappers to an IM implemented within LAMMPS. -Two different mechanisms are provided for accessing IM parameters in these -two cases: +Normally a user employing an IM should not modify its parameters since, as noted +above, these are selected to reproduce material properties. However, there are +cases where accessing and modifying IM parameters is desired, such as for +assessing uncertainty, fitting an IM, or working with an ensemble of IMs. As +explained :ref:`above `, IMs archived in OpenKIM are either Portable +Models (PMs) or Simulator Models (SMs). KIM PMs are complete independent +implementations of an IM, whereas KIM SMs are wrappers to an IM implemented +within LAMMPS. Two different mechanisms are provided for accessing IM parameters +in these two cases: -* For a KIM PM, the *kim_param* command can be used to *get* and *set* the values of the PM's parameters as explained below. -* For a KIM SM, the user should consult the documentation page for the specific IM and follow instructions there for how to modify its parameters (if possible). +* For a KIM PM, the *kim param* command can be used to *get* and *set* the + values of the PM's parameters as explained below. +* For a KIM SM, the user should consult the documentation page for the specific + IM and follow instructions there for how to modify its parameters (if + possible). -The *kim_param get* and *kim_param set* commands provide an interface -to access and change the parameters of a KIM PM that "publishes" its -parameters and makes them publicly available (see the +The *kim param get* and *kim param set* commands provide an interface to access +and change the parameters of a KIM PM that "publishes" its parameters and makes +them publicly available (see the `KIM API documentation `_ for details). .. note:: - The *kim_param get/set* commands must be preceded by *kim_init*\ . - The *kim_param set* command must additionally be preceded by a - *kim_interactions* command (or alternatively by a *pair_style kim* - and *pair_coeff* commands). The *kim_param set* command may be used wherever a *pair_coeff* command may occur. + The *kim param get/set* commands must be preceded by *kim init*\ . + The *kim param set* command must additionally be preceded by a + *kim_interactions* command (or alternatively by a *pair_style kim* and + *pair_coeff* commands). The *kim param set* command may be used wherever a + *pair_coeff* command may occur. -The syntax for the *kim_param* command is as follows: +The syntax for the *kim param* command is as follows: .. code-block:: LAMMPS - kim_param get param_name index_range variable formatarg - kim_param set param_name index_range values + kim param get param_name index_range variable formatarg + kim param set param_name index_range values -Here, *param_name* is the name of a KIM PM parameter (which is published -by the PM and available for access). The specific string used to identify -a parameter is defined by the PM. For example, for the +Here, *param_name* is the name of a KIM PM parameter (which is published by the +PM and available for access). The specific string used to identify a parameter +is defined by the PM. For example, for the `Stillinger--Weber (SW) potential in OpenKIM `_, the parameter names are *A, B, p, q, sigma, gamma, cutoff, lambda, costheta0*\ . .. note:: The list of all the parameters that a PM exposes for access/mutation are - automatically written to the lammps log file when *kim_init* is called. + automatically written to the lammps log file when *kim init* is called. -Each published parameter of a KIM PM takes the form of an array of -numerical values. The array can contain one element for a single-valued -parameter, or a set of values. For example, the +Each published parameter of a KIM PM takes the form of an array of numerical +values. The array can contain one element for a single-valued parameter, or a +set of values. For example, the `multispecies SW potential for the Zn-Cd-Hg-S-Se-Te system `_ has the same parameter names as the `single-species SW potential `_, but each parameter array contains 21 entries that correspond to the parameter values used for each pairwise combination of the model's six supported species -(this model does not have parameters specific to individual ternary -combinations of its supported species). +(this model does not have parameters specific to individual ternary combinations +of its supported species). -The *index_range* argument may either be an integer referring to -a specific element within the array associated with the parameter -specified by *param_name*, or a pair of integers separated by a colon -that refer to a slice of this array. In both cases, one-based indexing is -used to refer to the entries of the array. +The *index_range* argument may either be an integer referring to a specific +element within the array associated with the parameter specified by +*param_name*, or a pair of integers separated by a colon that refer to a slice +of this array. In both cases, one-based indexing is used to refer to the +entries of the array. The result of a *get* operation for a specific *index_range* is stored in -one or more :doc:`LAMMPS string style variables ` as determined -by the optional *formatarg* argument :ref:`documented above. ` -If not specified, the default for *formatarg* is "explicit" for the -*kim_param* command. +one or more :doc:`LAMMPS string style variables ` as determined by the +optional *formatarg* argument :ref:`documented above. ` If +not specified, the default for *formatarg* is "explicit" for the *kim param* +command. -For the case where the result is an array with multiple values -(i.e. *index_range* contains a range), the optional "split" or "explicit" -*formatarg* keywords can be used to separate the results into multiple -variables; see the examples below. -Multiple parameters can be retrieved with a single call to *kim_param get* -by repeating the argument list following *get*\ . +For the case where the result is an array with multiple values (i.e. +*index_range* contains a range), the optional "split" or "explicit" *formatarg* +keywords can be used to separate the results into multiple variables; see the +examples below. Multiple parameters can be retrieved with a single call to +*kim param get* by repeating the argument list following *get*\ . -For a *set* operation, the *values* argument contains the new value(s) -for the element(s) of the parameter specified by *index_range*\ . For the case -where multiple values are being set, *values* contains a set of values -separated by spaces. Multiple parameters can be set with a single call to -*kim_param set* by repeating the argument list following *set*\ . +For a *set* operation, the *values* argument contains the new value(s) for the +element(s) of the parameter specified by *index_range*\ . For the case where +multiple values are being set, *values* contains a set of values separated by +spaces. Multiple parameters can be set with a single call to *kim param set* by +repeating the argument list following *set*\ . -*kim_param* Usage Examples and Further Clarifications +*kim param* Usage Examples and Further Clarifications ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Examples of getting and setting KIM PM parameters with further -clarifications are provided below. +Examples of getting and setting KIM PM parameters with further clarifications +are provided below. **Getting a scalar parameter** .. code-block:: LAMMPS - kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal + kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal ... - kim_param get A 1 VARA + kim param get A 1 VARA -In this case, the value of the SW *A* parameter is retrieved and placed -in the LAMMPS variable *VARA*\ . The variable *VARA* can be used -in the remainder of the input script in the same manner as any other -LAMMPS variable. +In this case, the value of the SW *A* parameter is retrieved and placed in the +LAMMPS variable *VARA*\ . The variable *VARA* can be used in the remainder of +the input script in the same manner as any other LAMMPS variable. **Getting multiple scalar parameters with a single call** .. code-block:: LAMMPS - kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal + kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal ... - kim_param get A 1 VARA B 1 VARB + kim param get A 1 VARA B 1 VARB -This retrieves the *A* and *B* parameters of the SW potential and stores -them in the LAMMPS variables *VARA* and *VARB*\ . +In this example, it is shown how to retrieve the *A* and *B* parameters of the +SW potential and store them in the LAMMPS variables *VARA* and *VARB*\ . **Getting a range of values from a parameter** @@ -754,9 +846,9 @@ determined by the *formatarg* argument. .. code-block:: LAMMPS - kim_init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal + kim init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal ... - kim_param get lambda 7:9 LAM_TeTe LAM_TeZn LAM_TeSe + kim param get lambda 7:9 LAM_TeTe LAM_TeZn LAM_TeSe In this case, *formatarg* is not specified and therefore the default "explicit" mode is used. (The behavior would be the same if the word @@ -766,166 +858,164 @@ lambda retrieved by the *get* operation are placed in the LAMMPS variables .. note:: - In the above example, elements 7--9 of the lambda parameter correspond - to Te-Te, Te-Zm and Te-Se interactions. This can be determined by visiting - the `model page for the specified potential `_ - and looking at its parameter file linked to at the bottom of the page - (file with .param ending) and consulting the README documentation - provided with the driver for the PM being used. A link to the driver - is provided at the top of the model page. + In the above example, elements 7--9 of the lambda parameter correspond to + Te-Te, Te-Zm and Te-Se interactions. This can be determined by visiting the + `model page for the specified potential `_ + and looking at its parameter file linked to at the bottom of the page (file + with .param ending) and consulting the README documentation provided with the + driver for the PM being used. A link to the driver is provided at the top of + the model page. .. code-block:: LAMMPS - kim_init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal + kim init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal ... - kim_param get lambda 15:17 LAMS list - variable LAM_VALUE index ${LAMS} - label loop_on_lambda + kim param get lambda 15:17 LAMS list + variable LAM_VALUE index ${LAMS} + label loop_on_lambda ... - ... do something with current value of lambda + ... do something with the current value of lambda ... - next LAM_VALUE - jump SELF loop_on_lambda + next LAM_VALUE + jump SELF loop_on_lambda -In this case, the "list" mode of *formatarg* is used. -The result of the *get* operation is stored in the LAMMPS variable -*LAMS* as a string containing the three retrieved values separated -by spaces, e.g "1.0 2.0 3.0". This can be used in LAMMPS with an -*index* variable to access the values one at a time within a loop -as shown in the example. At each iteration of the loop *LAM_VALUE* -contains the current value of lambda. +In this case, the "list" mode of *formatarg* is used. The result of the *get* +operation is stored in the LAMMPS variable *LAMS* as a string containing the +three retrieved values separated by spaces, e.g "1.0 2.0 3.0". This can be used +in LAMMPS with an *index* variable to access the values one at a time within a +loop as shown in the example. At each iteration of the loop *LAM_VALUE* contains +the current value of lambda. .. code-block:: LAMMPS - kim_init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal + kim init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal ... - kim_param get lambda 15:17 LAM split + kim param get lambda 15:17 LAM split -In this case, the "split" mode of *formatarg* is used. -The three values retrieved by the *get* operation are stored in -the three LAMMPS variables *LAM_15*, *LAM_16* and *LAM_17*\ . -The provided name "LAM" is used as prefix and the location in -the lambda array is appended to create the variable names. +In this case, the "split" mode of *formatarg* is used. The three values +retrieved by the *get* operation are stored in the three LAMMPS variables +*LAM_15*, *LAM_16* and *LAM_17*\ . The provided name "LAM" is used as prefix and +the location in the lambda array is appended to create the variable names. **Setting a scalar parameter** .. code-block:: LAMMPS - kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal + kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 metal ... - kim_interactions Si - kim_param set gamma 1 2.6 + kim interactions Si + kim param set gamma 1 2.6 Here, the SW potential's gamma parameter is set to 2.6. Note that the *get* -and *set* commands work together, so that a *get* following a *set* -operation will return the new value that was set. For example: +and *set* commands work together, so that a *get* following a *set* operation +will return the new value that was set. For example, .. code-block:: LAMMPS ... - kim_interactions Si - kim_param get gamma 1 ORIG_GAMMA - kim_param set gamma 1 2.6 - kim_param get gamma 1 NEW_GAMMA + kim interactions Si + kim param get gamma 1 ORIG_GAMMA + kim param set gamma 1 2.6 + kim param get gamma 1 NEW_GAMMA ... - print "original gamma = ${ORIG_GAMMA}, new gamma = ${NEW_GAMMA}" + print "original gamma = ${ORIG_GAMMA}, new gamma = ${NEW_GAMMA}" -Here, *ORIG_GAMMA* will contain the original gamma value for the SW -potential, while *NEW_GAMMA* will contain the value 2.6. +Here, *ORIG_GAMMA* will contain the original gamma value for the SW potential, +while *NEW_GAMMA* will contain the value 2.6. **Setting multiple scalar parameters with a single call** .. code-block:: LAMMPS - kim_init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal + kim init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal ... - kim_interactions Cd Te - variable VARG equal 2.6 - variable VARS equal 2.0951 - kim_param set gamma 1 ${VARG} sigma 3 ${VARS} + kim interactions Cd Te + variable VARG equal 2.6 + variable VARS equal 2.0951 + kim param set gamma 1 ${VARG} sigma 3 ${VARS} -In this case, the first element of the *gamma* parameter and -third element of the *sigma* parameter are set to 2.6 and 2.0951, -respectively. This example also shows how LAMMPS variables can -be used when setting parameters. +In this case, the first element of the *gamma* parameter and third element of +the *sigma* parameter are set to 2.6 and 2.0951, respectively. This example +also shows how LAMMPS variables can be used when setting parameters. **Setting a range of values of a parameter** .. code-block:: LAMMPS - kim_init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal + kim init SW_ZhouWardMartin_2013_CdTeZnSeHgS__MO_503261197030_002 metal ... - kim_interactions Cd Te Zn Se Hg S - kim_param set sigma 2:6 2.35214 2.23869 2.04516 2.43269 1.80415 + kim interactions Cd Te Zn Se Hg S + kim param set sigma 2:6 2.35214 2.23869 2.04516 2.43269 1.80415 -In this case, elements 2 through 6 of the parameter *sigma* -are set to the values 2.35214, 2.23869, 2.04516, 2.43269 and 1.80415 in -order. +In this case, elements 2 through 6 of the parameter *sigma* are set to the +values 2.35214, 2.23869, 2.04516, 2.43269 and 1.80415 in order. -.. _kim_property command: +.. _property: -Writing material properties computed in LAMMPS to standard KIM property instance format (*kim_property*) +Writing material properties computed in LAMMPS to standard KIM property instance format (*kim property*) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -As explained :ref:`above`, -The OpenKIM system includes a collection of Tests (material property calculation codes), -Models (interatomic potentials), Predictions, and Reference Data (DFT or experiments). -Specifically, a KIM Test is a computation that when coupled with a KIM Model generates -the prediction of that model for a specific material property rigorously defined -by a KIM Property Definition (see the +As explained :ref:`above`, the OpenKIM system includes a +collection of Tests (material property calculation codes), Models (interatomic +potentials), Predictions, and Reference Data (DFT or experiments). Specifically, +a KIM Test is a computation that when coupled with a KIM Model generates the +prediction of that model for a specific material property rigorously defined by +a KIM Property Definition (see the `KIM Properties Framework `__ -for further details). A prediction of a material property for a given model is a specific -numerical realization of a property definition, referred to as a "Property -Instance." The objective of the *kim_property* command is to make it easy to -output material properties in a standardized, machine readable, format that can be easily -ingested by other programs. -Additionally, it aims to make it as easy as possible to convert a LAMMPS script that computes a -material property into a KIM Test that can then be uploaded to `openkim.org `_ +for further details). A prediction of a material property for a given model is a +specific numerical realization of a property definition, referred to as a +"Property Instance." The objective of the *kim property* command is to make it +easy to output material properties in a standardized, machine readable, format +that can be easily ingested by other programs. Additionally, it aims to make it +as easy as possible to convert a LAMMPS script that computes a material property +into a KIM Test that can then be uploaded to +`openkim.org `_ -A developer interested in creating a KIM Test using a LAMMPS script should -first determine whether a property definition that applies to their calculation +A developer interested in creating a KIM Test using a LAMMPS script should first +determine whether a property definition that applies to their calculation already exists in OpenKIM by searching the `properties page `_. If none exists, it is possible to use a locally defined property definition contained in a file until it can be uploaded to the official repository (see below). Once one or more applicable -property definitions have been identified, the *kim_property create*, -*kim_property modify*, *kim_property remove*, and *kim_property destroy*, +property definitions have been identified, the *kim property create*, +*kim property modify*, *kim property remove*, and *kim property destroy*, commands provide an interface to create, set, modify, remove, and destroy -instances of them within a LAMMPS script. Their general syntax is as follows: +instances of them within a LAMMPS script. Their general syntax is as follows, .. code-block:: LAMMPS - kim_property create instance_id property_id - kim_property modify instance_id key key_name key_name_key key_name_value - kim_property remove instance_id key key_name - kim_property destroy instance_id - kim_property dump file + kim property create instance_id property_id + kim property modify instance_id key key_name key_name_key key_name_value + kim property remove instance_id key key_name + kim property destroy instance_id + kim property dump file Here, *instance_id* is a positive integer used to uniquely identify each property instance; (note that the results file can contain multiple property -instances). A property_id is an identifier of a +instances). A *property_id* is an identifier of a `KIM Property Definition `_, which can be (1) a property short name, (2) the full unique ID of the property (including the contributor and date), (3) a file name corresponding to a local -property definition file. Examples of each of these cases are shown below: +property definition file. Examples of each of these cases are shown below, .. code-block:: LAMMPS - kim_property create 1 atomic-mass - kim_property create 2 cohesive-energy-relation-cubic-crystal + kim property create 1 atomic-mass + kim property create 2 cohesive-energy-relation-cubic-crystal .. code-block:: LAMMPS - kim_property create 1 tag:brunnels@noreply.openkim.org,2016-05-11:property/atomic-mass - kim_property create 2 tag:staff@noreply.openkim.org,2014-04-15:property/cohesive-energy-relation-cubic-crystal + kim property create 1 tag:brunnels@noreply.openkim.org,2016-05-11:property/atomic-mass + kim property create 2 tag:staff@noreply.openkim.org,2014-04-15:property/cohesive-energy-relation-cubic-crystal .. code-block:: LAMMPS - kim_property create 1 new-property.edn - kim_property create 2 /home/mary/marys-kim-properties/dissociation-energy.edn + kim property create 1 new-property.edn + kim property create 2 /home/mary/marys-kim-properties/dissociation-energy.edn -In the last example, "new-property.edn" and "/home/mary/marys-kim-properties/dissociation-energy.edn" are the -names of files that contain user-defined (local) property definitions. +In the last example, "new-property.edn" and +"/home/mary/marys-kim-properties/dissociation-energy.edn" are the names of files +that contain user-defined (local) property definitions. A KIM property instance takes the form of a "map," i.e. a set of key-value pairs akin to Perl's hash, Python's dictionary, or Java's Hashtable. It @@ -944,13 +1034,13 @@ as stipulated in the property definition. Each map assigned to a *key_name* must contain the *key_name_key* "source-value" and an associated *key_name_value* of the appropriate type (as defined in the relevant KIM Property Definition). For keys that are - defined as having physical units, the - "source-unit" *key_name_key* must also be given a string value recognized - by `GNU units `_. + defined as having physical units, the "source-unit" *key_name_key* must also + be given a string value recognized by + `GNU units `_. -Once a *kim_property create* command has been given to instantiate a property +Once a *kim property create* command has been given to instantiate a property instance, maps associated with the property's keys can be edited using the -*kim_property modify* command. In using this command, the special keyword +*kim property modify* command. In using this command, the special keyword "key" should be given, followed by the property key name and the key-value pair in the map associated with the key that is to be set. For example, the `atomic-mass `_ @@ -959,37 +1049,37 @@ An instance of this property could be created like so: .. code-block:: LAMMPS - kim_property create 1 atomic-mass - kim_property modify 1 key species source-value Al - kim_property modify 1 key mass source-value 26.98154 - kim_property modify 1 key mass source-unit amu + kim property create 1 atomic-mass + kim property modify 1 key species source-value Al + kim property modify 1 key mass source-value 26.98154 + kim property modify 1 key mass source-unit amu or, equivalently, .. code-block:: LAMMPS - kim_property create 1 atomic-mass - kim_property modify 1 key species source-value Al & + kim property create 1 atomic-mass + kim property modify 1 key species source-value Al & key mass source-value 26.98154 & source-unit amu -*kim_property* Usage Examples and Further Clarifications +*kim property* Usage Examples and Further Clarifications ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **Create** .. code-block:: LAMMPS - kim_property create instance_id property_id + kim property create instance_id property_id -The *kim_property create* command takes as input a property instance ID and the +The *kim property create* command takes as input a property instance ID and the property definition name, and creates an initial empty property instance data structure. For example, .. code-block:: LAMMPS - kim_property create 1 atomic-mass - kim_property create 2 cohesive-energy-relation-cubic-crystal + kim property create 1 atomic-mass + kim property create 2 cohesive-energy-relation-cubic-crystal creates an empty property instance of the "atomic-mass" property definition with instance ID 1 and an empty instance of the @@ -1002,32 +1092,32 @@ path of a file containing a valid property definition. For example, .. code-block:: LAMMPS - kim_property create 1 new-property.edn + kim property create 1 new-property.edn where "new-property.edn" refers to a file name containing a new property definition that does not exist in OpenKIM. If the *property_id* given cannot be found in OpenKIM and no file of this name containing a valid property definition can be found, this command will produce -an error with an appropriate message. Calling *kim_property create* with the +an error with an appropriate message. Calling *kim property create* with the same instance ID multiple times will also produce an error. **Modify** .. code-block:: LAMMPS - kim_property modify instance_id key key_name key_name_key key_name_value + kim property modify instance_id key key_name key_name_key key_name_value -The *kim_property modify* command incrementally builds the property instance -by receiving property definition keys along with associated arguments. Each +The *kim property modify* command incrementally builds the property instance +by receiving property definition keys along with associated arguments. Each *key_name* is associated with a map containing one or more key-value pairs (in the form of *key_name_key*-*key_name_value* pairs). For example, .. code-block:: LAMMPS - kim_property modify 1 key species source-value Al - kim_property modify 1 key mass source-value 26.98154 - kim_property modify 1 key mass source-unit amu + kim property modify 1 key species source-value Al + kim property modify 1 key mass source-value 26.98154 + kim property modify 1 key mass source-unit amu where the special keyword "key" is followed by a *key_name* ("species" or "mass" in the above) and one or more key-value pairs. These key-value pairs @@ -1036,7 +1126,7 @@ command line is reached. Thus, the above could equivalently be written as .. code-block:: LAMMPS - kim_property modify 1 key species source-value Al & + kim property modify 1 key species source-value Al & key mass source-value 26.98154 & key mass source-unit amu @@ -1044,19 +1134,18 @@ As an example of modifying multiple key-value pairs belonging to the map of a single property key, the following command modifies the map of the "cohesive-potential-energy" property key to contain the key "source-unit" which is assigned a value of "eV" and the key "digits" which is assigned a value of -5: +5, .. code-block:: LAMMPS - kim_property modify 2 key cohesive-potential-energy source-unit eV digits 5 + kim property modify 2 key cohesive-potential-energy source-unit eV digits 5 .. note:: - The relevant data types of the values in the map are handled - automatically based on the specification of the key in the - KIM Property Definition. In the example above, - this means that the value "eV" will automatically be interpreted as a string - while the value 5 will be interpreted as an integer. + The relevant data types of the values in the map are handled automatically + based on the specification of the key in the KIM Property Definition. In + the example above, this means that the value "eV" will automatically be + interpreted as a string while the value 5 will be interpreted as an integer. The values contained in maps can either be scalars, as in all of the examples above, or arrays depending on which is stipulated in the corresponding Property @@ -1067,7 +1156,7 @@ dimensionality of the array. .. note:: - All array indexing used by *kim_property modify* is one-based, i.e. the + All array indexing used by *kim property modify* is one-based, i.e. the indices are enumerated 1, 2, 3, ... .. note:: @@ -1088,20 +1177,20 @@ of the "species" property key, we can do so by issuing: .. code-block:: LAMMPS - kim_property modify 2 key species source-value 1 Al - kim_property modify 2 key species source-value 2 Al - kim_property modify 2 key species source-value 3 Al - kim_property modify 2 key species source-value 4 Al + kim property modify 2 key species source-value 1 Al + kim property modify 2 key species source-value 2 Al + kim property modify 2 key species source-value 3 Al + kim property modify 2 key species source-value 4 Al .. note:: No declaration of the number of elements in this array was given; - *kim_property modify* will automatically handle memory management to allow + *kim property modify* will automatically handle memory management to allow an arbitrary number of elements to be added to the array. .. note:: - In the event that *kim_property modify* is used to set the value of an + In the event that *kim property modify* is used to set the value of an array index without having set the values of all lesser indices, they will be assigned default values based on the data type associated with the key in the map: @@ -1124,8 +1213,8 @@ of the "species" property key, we can do so by issuing: .. code-block:: LAMMPS - kim_property create 2 cohesive-energy-relation-cubic-crystal - kim_property modify 2 key species source-value 4 Al + kim property create 2 cohesive-energy-relation-cubic-crystal + kim property modify 2 key species source-value 4 Al will result in the "source-value" key in the map for the property key "species" being assigned the array ["", "", "", "Al"]. @@ -1137,12 +1226,12 @@ included). Thus, the snippet above could equivalently be written: .. code-block:: LAMMPS - kim_property modify 2 key species source-value 1:4 Al Al Al Al + kim property modify 2 key species source-value 1:4 Al Al Al Al Calling this command with a non-positive index, e.g. -``kim_property modify 2 key species source-value 0 Al``, or an incorrect +``kim property modify 2 key species source-value 0 Al``, or an incorrect number of input arguments, e.g. -``kim_property modify 2 key species source-value 1:4 Al Al``, will result in an +``kim property modify 2 key species source-value 1:4 Al Al``, will result in an error. As an example of modifying multidimensional arrays, consider the "basis-atoms" @@ -1165,36 +1254,36 @@ each row at a time using colon notation: .. code-block:: LAMMPS - kim_property modify 2 key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 - kim_property modify 2 key basis-atom-coordinates source-value 2 1:3 0.5 0.5 0.0 - kim_property modify 2 key basis-atom-coordinates source-value 3 1:3 0.5 0.0 0.5 - kim_property modify 2 key basis-atom-coordinates source-value 4 1:3 0.0 0.5 0.5 + kim property modify 2 key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 + kim property modify 2 key basis-atom-coordinates source-value 2 1:3 0.5 0.5 0.0 + kim property modify 2 key basis-atom-coordinates source-value 3 1:3 0.5 0.0 0.5 + kim property modify 2 key basis-atom-coordinates source-value 4 1:3 0.0 0.5 0.5 Where the first index given refers to a row and the second index refers to a column. We could, instead, choose to set each column at a time like so: .. code-block:: LAMMPS - kim_property modify 2 key basis-atom-coordinates source-value 1:4 1 0.0 0.5 0.5 0.0 & + kim property modify 2 key basis-atom-coordinates source-value 1:4 1 0.0 0.5 0.5 0.0 & key basis-atom-coordinates source-value 1:4 2 0.0 0.5 0.0 0.5 & key basis-atom-coordinates source-value 1:4 3 0.0 0.0 0.5 0.5 .. note:: - Multiple calls of *kim_property modify* made for the same instance ID + Multiple calls of *kim property modify* made for the same instance ID can be combined into a single invocation, meaning the following are both valid: .. code-block:: LAMMPS - kim_property modify 2 key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 & + kim property modify 2 key basis-atom-coordinates source-value 1 1:3 0.0 0.0 0.0 & key basis-atom-coordinates source-value 2 1:3 0.5 0.5 0.0 & key basis-atom-coordinates source-value 3 1:3 0.5 0.0 0.5 & key basis-atom-coordinates source-value 4 1:3 0.0 0.5 0.5 .. code-block:: LAMMPS - kim_property modify 2 key short-name source-value 1 fcc & + kim property modify 2 key short-name source-value 1 fcc & key species source-value 1:4 Al Al Al Al & key a source-value 1:5 3.9149 4.0000 4.032 4.0817 4.1602 & source-unit angstrom & @@ -1211,46 +1300,46 @@ column. We could, instead, choose to set each column at a time like so: .. code-block:: LAMMPS - kim_property modify 2 key basis-atom-coordinates 1 1:3 0.0 0.0 0.0 + kim property modify 2 key basis-atom-coordinates 1 1:3 0.0 0.0 0.0 is valid but .. code-block:: LAMMPS - kim_property modify 2 key basis-atom-coordinates 1:2 1:3 0.0 0.0 0.0 0.0 0.0 0.0 + kim property modify 2 key basis-atom-coordinates 1:2 1:3 0.0 0.0 0.0 0.0 0.0 0.0 is not. .. note:: - After one sets a value in a map with the *kim_property modify* command, + After one sets a value in a map with the *kim property modify* command, additional calls will overwrite the previous value. **Remove** .. code-block:: LAMMPS - kim_property remove instance_id key key_name + kim property remove instance_id key key_name -The *kim_property remove* command can be used to remove a property key from a +The *kim property remove* command can be used to remove a property key from a property instance. For example, .. code-block:: LAMMPS - kim_property remove 2 key basis-atom-coordinates + kim property remove 2 key basis-atom-coordinates **Destroy** .. code-block:: LAMMPS - kim_property destroy instance_id + kim property destroy instance_id -The *kim_property destroy* command deletes a previously created property +The *kim property destroy* command deletes a previously created property instance ID. For example, .. code-block:: LAMMPS - kim_property destroy 2 + kim property destroy 2 .. note:: @@ -1259,22 +1348,22 @@ instance ID. For example, **Dump** -The *kim_property dump* command can be used to write the content of all +The *kim property dump* command can be used to write the content of all currently defined property instances to a file: .. code-block:: LAMMPS - kim_property dump file + kim property dump file For example, .. code-block:: LAMMPS - kim_property dump results.edn + kim property dump results.edn .. note:: - Issuing the *kim_property dump* command clears all existing property + Issuing the *kim property dump* command clears all existing property instances from memory. Citation of OpenKIM IMs @@ -1283,32 +1372,32 @@ Citation of OpenKIM IMs When publishing results obtained using OpenKIM IMs researchers are requested to cite the OpenKIM project :ref:`(Tadmor) `, KIM API :ref:`(Elliott) `, and the specific IM codes used in the simulations, -in addition to the relevant scientific references for the IM. -The citation format for an IM is displayed on its page on -`OpenKIM `_ along with the corresponding BibTex file, -and is automatically added to the LAMMPS citation reminder. +in addition to the relevant scientific references for the IM. The citation +format for an IM is displayed on its page on +`OpenKIM `_ along with the corresponding BibTex file, and +is automatically added to the LAMMPS citation reminder. -Citing the IM software (KIM infrastructure and specific PM or SM codes) -used in the simulation gives credit to the researchers who developed them -and enables open source efforts like OpenKIM to function. +Citing the IM software (KIM infrastructure and specific PM or SM codes) used in +the simulation gives credit to the researchers who developed them and enables +open source efforts like OpenKIM to function. Restrictions """""""""""" -The set of *kim_commands* is part of the KIM package. It is only enabled if -LAMMPS is built with that package. A requirement for the KIM package, -is the KIM API library that must be downloaded from the -`OpenKIM website `_ and installed before -LAMMPS is compiled. When installing LAMMPS from binary, the kim-api package -is a dependency that is automatically downloaded and installed. The *kim_query* -command requires the *libcurl* library to be installed. The *kim_property* +The *kim* command is part of the KIM package. It is only enabled if LAMMPS is +built with that package. A requirement for the KIM package, is the KIM API +library that must be downloaded from the +`OpenKIM website `_ and installed before LAMMPS is +compiled. When installing LAMMPS from binary, the kim-api package is a +dependency that is automatically downloaded and installed. The *kim query* +command requires the *libcurl* library to be installed. The *kim property* command requires *Python* 3.6 or later and the *kim-property* python package to -be installed. See the KIM section of the :doc:`Packages details ` -for details. +be installed. See the KIM section of the +:doc:`Packages details ` for details. -Furthermore, when using *kim_commands* to run KIM SMs, any packages required -by the native potential being used or other commands or fixes that it invokes -must be installed. +Furthermore, when using *kim* command to run KIM SMs, any packages required by +the native potential being used or other commands or fixes that it invokes must +be installed. Related commands """""""""""""""" From 4cd42093a02fcb55ac61c6b5149a744acdd09d0e Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 16 Feb 2021 16:47:12 -0600 Subject: [PATCH 57/89] fixed the correct models for extra tests and update the command interface --- doc/src/Build_extras.rst | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 8f1154a167..60d5ad09af 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -258,18 +258,18 @@ To build with this package, the KIM library with API v2 must be downloaded and built on your system. It must include the KIM models that you want to use with LAMMPS. -If you would like to use the :doc:`kim_query ` +If you would like to use the :doc:`kim query ` command, you also need to have libcurl installed with the matching development headers and the curl-config tool. -If you would like to use the :doc:`kim_property ` +If you would like to use the :doc:`kim property ` command, you need to build LAMMPS with the PYTHON package installed and linked to Python 3.6 or later. See the :ref:`PYTHON package build info ` for more details on this. After successfully building LAMMPS with Python, you -also need to install the kim-property Python package, which can be easily done using -*pip* as ``pip install kim-property``, or from the *conda-forge* channel as -``conda install kim-property`` if LAMMPS is built in Conda. More detailed -information is available at: +also need to install the ``kim-property`` Python package, which can be easily +done using *pip* as ``pip install kim-property``, or from the *conda-forge* +channel as ``conda install kim-property`` if LAMMPS is built in Conda. More +detailed information is available at: `kim-property installation `_. In addition to installing the KIM API, it is also necessary to install the @@ -309,7 +309,7 @@ minutes to hours) to build. Of course you only need to do that once.) You can download and build the KIM library manually if you prefer; follow the instructions in ``lib/kim/README``. You can also do - this in one step from the lammps/src dir, using a command like + this in one step from the lammps/src directory, using a command like these, which simply invoke the ``lib/kim/Install.py`` script with the specified args. @@ -329,7 +329,7 @@ minutes to hours) to build. Of course you only need to do that once.) .. code-block:: make - LMP_INC = -DLMP_NO_SSL_CHECK + LMP_INC = -DLMP_NO_SSL_CHECK Debugging OpenKIM web queries in LAMMPS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -377,10 +377,11 @@ Enabling the extra unit tests have some requirements, Conda. More detailed information is available at: `kim-property installation `_. * It is also necessary to install - ``EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000``, and - ``EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005`` KIM models. + ``EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000``, + ``EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005``, and + ``LennardJones612_UniversalShifted__MO_959249795837_003`` KIM models. See `Obtaining KIM Models `_ - to learn how to install a pre-build binary of the OpenKIM Repository of + to learn how to install a pre-built binary of the OpenKIM Repository of Models or see `Installing KIM Models `_ to learn how to install the specific KIM models. From 0e465516325de08ffc6cca430ca4c294e94b36aa Mon Sep 17 00:00:00 2001 From: Yaser Afshar Date: Tue, 16 Feb 2021 16:47:57 -0600 Subject: [PATCH 58/89] Remove the old command interface and update the kim command as the only one --- doc/src/Commands_all.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index a38bd5f0db..132425948e 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -60,11 +60,7 @@ An alphabetic list of all general LAMMPS commands. * :doc:`include ` * :doc:`info ` * :doc:`jump ` - * :doc:`kim_init ` - * :doc:`kim_interactions ` - * :doc:`kim_param ` - * :doc:`kim_property ` - * :doc:`kim_query ` + * :doc:`kim ` * :doc:`kspace_modify ` * :doc:`kspace_style ` * :doc:`label